Project

General

Profile

« Previous | Next » 

Revision 18ab877a

Added by Andreas Kohlbecker about 6 years ago

ref #7247, ref #7081 TypeDesignationSetManager: optional use of typeName or typeDesignation as base entity to allow for deduplication

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/util/converter/TypeDesignationSetManager.java
60 60
 */
61 61
public class TypeDesignationSetManager {
62 62

  
63
    enum NameTypeBaseEntityType{
64

  
65
        NAME_TYPE_DESIGNATION,
66
        TYPE_NAME;
67

  
68
    }
63 69

  
64 70
    private static final String TYPE_STATUS_SEPARATOR = "; ";
65 71

  
......
69 75

  
70 76
    private Collection<TypeDesignationBase> typeDesignations;
71 77

  
78
    private NameTypeBaseEntityType nameTypeBaseEntityType = NameTypeBaseEntityType.NAME_TYPE_DESIGNATION;
79

  
72 80
    /**
73 81
     * Groups the EntityReferences for each of the TypeDesignations by the according TypeDesignationStatus.
74 82
     * The TypeDesignationStatusBase keys are already ordered by the term order defined in the vocabulary.
......
178 186
                baseEntity = ((SpecimenTypeDesignation) td).getTypeSpecimen();
179 187
            }
180 188
        } else if(td instanceof NameTypeDesignation){
181
            baseEntity = ((NameTypeDesignation)td).getTypeName();
182
            baseEntity = td;
189
            if(nameTypeBaseEntityType == NameTypeBaseEntityType.NAME_TYPE_DESIGNATION){
190
                baseEntity = td;
191
            } else {
192
                // only other option is TaxonName
193
                baseEntity = ((NameTypeDesignation)td).getTypeName();
194
            }
183 195
        }
184 196
        if(baseEntity == null) {
185 197
            throw new DataIntegrityException("Incomplete TypeDesignation, no type missin in " + td.toString());
......
598 610
        return typifiedName;
599 611
    }
600 612

  
613
    public void setNameTypeBaseEntityType(NameTypeBaseEntityType nameTypeBaseEntityType){
614
        this.nameTypeBaseEntityType = nameTypeBaseEntityType;
615
    }
616

  
617
    public NameTypeBaseEntityType getNameTypeBaseEntityType(){
618
        return nameTypeBaseEntityType;
619
    }
620

  
601 621
    /**
602 622
     * TypeDesignations which refer to the same FieldUnit (SpecimenTypeDesignation) or TaxonName
603 623
     * (NameTypeDesignation) form a working set. The <code>TypeDesignationWorkingSet</code> internally

Also available in: Unified diff