Project

General

Profile

« Previous | Next » 

Revision d6353c79

Added by Andreas Müller almost 2 years ago

cleanup

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/name/TypeDesignationSet.java
21 21
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
22 22

  
23 23
/**
24
 * TypeDesignations which refer to the same base entity (e.g. FieldUnit for SpecimenTypeDesignations
25
 * or TaxonName/NameTypeDesignation for NameTypeDesignation form a type designation set.
26
 * The <code>TypeDesignationSet</code> internally stores the entity base
24
 * Type designations which refer to the same base entity (e.g. FieldUnit for SpecimenTypeDesignations
25
 * or TaxonName/NameTypeDesignation for NameTypeDesignation form a {@link TypeDesignationSet}.
26
 * The <code>TypeDesignationSet</code> internally stores the base entity
27 27
 * and an ordered map that maps type status (TypeDesignationStatusBase) to the type designations
28 28
 * in the <code>TypeDesignationSet</code>.
29 29
 *
......
39 39

  
40 40
    public static final NullTypeDesignationStatus NULL_STATUS = NullTypeDesignationStatus.SINGLETON();
41 41

  
42
    //TODO needed?
42
    //TODO needed? => currently used as cache for toString()
43 43
    private String label = null;
44 44

  
45 45
    private VersionableEntity baseEntity;
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/name/TypeDesignationSetFormatter.java
128 128
                orderedByTypesByBaseEntity = manager.getOrderedTypeDesignationSets();
129 129
        TypeDesignationSet typeDesignationSet = orderedByTypesByBaseEntity.get(baseEntity);
130 130

  
131
        TaggedTextBuilder workingsetBuilder = new TaggedTextBuilder();
131
        TaggedTextBuilder taggedTextBuilder = new TaggedTextBuilder();
132 132
        if(typeSetCount > 0){
133
            workingsetBuilder.add(TagEnum.separator, TYPE_SEPARATOR);
133
            taggedTextBuilder.add(TagEnum.separator, TYPE_SEPARATOR);
134 134
        }else if (withStartingTypeLabel){
135 135
            //TODO this is not really exact as we may want to handle specimen types and
136 136
            //name types separately, but this is such a rare case (if at all) and
137 137
            //increases complexity so it is not yet implemented
138 138
            boolean isPlural = hasMultipleTypes(orderedByTypesByBaseEntity);
139 139
            if(typeDesignationSet.getWorkingsetType().isSpecimenType()){
140
                workingsetBuilder.add(TagEnum.label, (isPlural? "Types:": "Type:"));
140
                taggedTextBuilder.add(TagEnum.label, (isPlural? "Types:": "Type:"));
141 141
            } else if (typeDesignationSet.getWorkingsetType().isNameType()){
142
                workingsetBuilder.add(TagEnum.label, (isPlural? "Nametypes:": "Nametype:"));
142
                taggedTextBuilder.add(TagEnum.label, (isPlural? "Nametypes:": "Nametype:"));
143 143
            } else {
144 144
                //do nothing for now
145 145
            }
......
147 147

  
148 148
        boolean hasExplicitBaseEntity = hasExplicitBaseEntity(baseEntity, typeDesignationSet);
149 149
        if(hasExplicitBaseEntity && !entityLabel(baseEntity).isEmpty()){
150
            workingsetBuilder.add(TagEnum.specimenOrObservation, entityLabel(baseEntity), baseEntity);
150
            taggedTextBuilder.add(TagEnum.specimenOrObservation, entityLabel(baseEntity), baseEntity);
151 151
        }
152 152
        int typeStatusCount = 0;
153 153
        if (withBrackets && hasExplicitBaseEntity){
154
            workingsetBuilder.add(TagEnum.separator, TYPE_STATUS_PARENTHESIS_LEFT);
154
            taggedTextBuilder.add(TagEnum.separator, TYPE_STATUS_PARENTHESIS_LEFT);
155 155
        }
156 156
        for(TypeDesignationStatusBase<?> typeStatus : typeDesignationSet.keySet()) {
157
            typeStatusCount = buildTaggedTextForSingleTypeStatus(manager, workingsetBuilder,
157
            typeStatusCount = buildTaggedTextForSingleTypeStatus(manager, taggedTextBuilder,
158 158
                    typeDesignationSet, typeStatusCount, typeStatus,
159 159
                    lastWsType, typeSetCount);
160 160
        }
161 161
        if (withBrackets && hasExplicitBaseEntity){
162
            workingsetBuilder.add(TagEnum.separator, TYPE_STATUS_PARENTHESIS_RIGHT);
162
            taggedTextBuilder.add(TagEnum.separator, TYPE_STATUS_PARENTHESIS_RIGHT);
163 163
        }
164
        typeDesignationSet.setRepresentation(workingsetBuilder.toString());
165
        finalBuilder.addAll(workingsetBuilder);
164
        typeDesignationSet.setRepresentation(taggedTextBuilder.toString());
165
        finalBuilder.addAll(taggedTextBuilder);
166 166
        return;
167 167
    }
168 168

  

Also available in: Unified diff