Project

General

Profile

Revision 0405e234

ID0405e23492e57fe076781a248c301e3bc85efe06
Parent 370ab182
Child d847eb88

Added by Katja Luther about 2 years ago

ref #7700: use TypedesignationSetManager for creating TypeDesignationString for homotypic group in cdm light export

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/cdmLight/CdmLightClassificationExport.java
20 20
import org.apache.commons.lang3.StringUtils;
21 21
import org.springframework.stereotype.Component;
22 22

  
23
import eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager;
23 24
import eu.etaxonomy.cdm.common.CdmUtils;
24 25
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
25 26
import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
......
59 60
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
60 61
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
61 62
import eu.etaxonomy.cdm.model.name.HomotypicalGroupNameComparator;
62
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
63 63
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
64 64
import eu.etaxonomy.cdm.model.name.Rank;
65 65
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
......
78 78
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
79 79
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
80 80
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
81
import eu.etaxonomy.cdm.strategy.cache.TagEnum;
82
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
83
import eu.etaxonomy.cdm.strategy.cache.reference.DefaultReferenceCacheStrategy;
81 84
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
82 85

  
83 86
/**
......
1276 1279
     */
1277 1280
    private void handleHomotypicalGroup(CdmLightExportState state, HomotypicalGroup group) {
1278 1281
        try {
1279
            state.addHomotypicalGroupToStore(group);
1282
           state.addHomotypicalGroupToStore(group);
1280 1283
            CdmLightExportTable table = CdmLightExportTable.HOMOTYPIC_GROUP;
1281 1284
            String[] csvLine = new String[table.getSize()];
1282 1285

  
......
1298 1301
            }else{
1299 1302
                csvLine[table.getIndex(CdmLightExportTable.HOMOTYPIC_GROUP_STRING)] = "";
1300 1303
            }
1301
            Set<TypeDesignationBase> typeDesigantions = group.getTypeDesignations();
1304
            Set<TypeDesignationBase> typeDesigantionSet = group.getTypeDesignations();
1302 1305
            List<TypeDesignationBase> designationList = new ArrayList<>();
1303
            designationList.addAll(typeDesigantions);
1306
            designationList.addAll(typeDesigantionSet);
1304 1307
            Collections.sort(designationList, new TypeComparator());
1305 1308
            StringBuffer typeDesignationString = new StringBuffer();
1306
            for (TypeDesignationBase typeDesignation: designationList){
1309
            List<TaggedText> list = new ArrayList<TaggedText>();
1310
            if (!designationList.isEmpty()){
1311
                TypeDesignationSetManager manager = new TypeDesignationSetManager(group);
1307 1312

  
1313
                list.addAll( manager.toTaggedTextWithCitation());
1314
                System.err.println(list.toString());
1315
            }
1316
            StringBuffer homotypicalGroupTypeDesignationString = new StringBuffer();
1317

  
1318
            for (TaggedText text:list){
1319
                if (text != null && text.getText() != null && (text.getText().equals("Type:") || text.getText().equals("NameType:"))){
1320
                  //do nothing
1321
                } else if (text.getType().equals(TagEnum.reference)){
1322
                    homotypicalGroupTypeDesignationString.append(" [fide "+ text.getText() + "]");
1323
                }else if (text.getType().equals(TagEnum.typeDesignation)){
1324
                    homotypicalGroupTypeDesignationString.append(text.getText().replace(").", "").replace("(", "").replace(")", "") );
1325
                } else{
1326
                    homotypicalGroupTypeDesignationString.append(text.getText());
1327
                }
1328
            }
1329

  
1330

  
1331
            String typeDesignations= homotypicalGroupTypeDesignationString.toString();
1332
            typeDesignations = typeDesignations.trim();
1333

  
1334
            typeDesignations += ".";
1335
            typeDesignations = typeDesignations.replace("..", ".");
1336
            typeDesignations = typeDesignations.replace(". .", ".");
1337
            if (typeDesignations.equals(".")){
1338
                typeDesignations = null;
1339
            }
1340
            System.err.println(typeDesignations);
1341
       /*     for (TypeDesignationBase typeDesignation: designationList){
1308 1342
                //[Vorschlag Soll:]
1309 1343
               // Sumatra Utara, Kab. Karo, around Sidikalang areas, 1000─1500 m, Dec 11, 2003, Nepenthes Team (Hernawati, P. Akhriadi & I. Petra), NP 354 (‘ANDA’–Holo, BO–Iso) [fide Akhriadi & al. 2004]
1310 1344
                if (typeDesignation != null && typeDesignation.getTypeStatus() != null){
1311
                    typeDesignationString.append(typeDesignation.getTypeStatus().getTitleCache() + ": ");
1345
                    typeDesignationString.append(typeDesignation.getTypeStatus().getTitleCache() + ":");
1312 1346
                }
1313 1347
                if (typeDesignation instanceof SpecimenTypeDesignation){
1314 1348
                    if (((SpecimenTypeDesignation)typeDesignation).getTypeSpecimen() != null){
1315
                        typeDesignationString.append(((SpecimenTypeDesignation)typeDesignation).getTypeSpecimen().getTitleCache());
1349
                        typeDesignationString.append(" "+((SpecimenTypeDesignation)typeDesignation).getTypeSpecimen().getTitleCache());
1350
                        if (typeDesignationString.lastIndexOf(".") == typeDesignationString.length()){
1351
                            typeDesignationString.deleteCharAt(typeDesignationString.lastIndexOf("."));
1352
                        }
1316 1353
                        handleSpecimen(state, ((SpecimenTypeDesignation)typeDesignation).getTypeSpecimen());
1317 1354
                    }
1318 1355
                }else{
......
1321 1358
                    }
1322 1359
                }
1323 1360
                if(typeDesignation.getCitation() != null ){
1324
                    typeDesignationString.append("[fide " + createShortCitation(typeDesignation.getCitation()) +"]");
1361
                    typeDesignationString.append(" [fide " + ((DefaultReferenceCacheStrategy)typeDesignation.getCitation().getCacheStrategy()).createShortCitation(typeDesignation.getCitation()) +"]");
1325 1362
                }
1326 1363
                //TODO...
1327 1364
                /*
......
1334 1371
                Aufbau der Typusinformationen:
1335 1372
                Land: Lokalität mit Höhe und Koordinaten; Datum; Sammler Nummer (Herbar/Barcode, Typusart; Herbar/Barcode, Typusart …)
1336 1373

  
1337
                 */
1338
            }
1339
            String typeDesignations = typeDesignationString.toString();
1374

  
1375
            }*/
1376
           // typeDesignations = typeDesignationString.toString();
1340 1377
            if (typeDesignations != null){
1378
                if (!typeDesignations.endsWith(".") ){
1379
                    typeDesignations =typeDesignations + ".";
1380
                }
1341 1381
                csvLine[table.getIndex(CdmLightExportTable.TYPE_STRING)] = typeDesignations;
1382

  
1342 1383
            }else{
1343 1384
                csvLine[table.getIndex(CdmLightExportTable.TYPE_STRING)] = "";
1344 1385
            }
1345 1386
            state.getProcessor().put(table, String.valueOf(group.getId()), csvLine);
1346 1387
        } catch (Exception e) {
1388
            e.printStackTrace();
1347 1389
            state.getResult().addException(e, "An unexpected error occurred when handling homotypic group " +
1348 1390
                    cdmBaseStr(group) + ": " + e.getMessage());
1349 1391
        }
......
1501 1543
            String[] csvLine = new String[table.getSize()];
1502 1544
            csvLine[table.getIndex(CdmLightExportTable.REFERENCE_ID)] = getId(state, reference);
1503 1545
            //TODO short citations correctly
1504
            String shortCitation = createShortCitation(reference);  //Should be Author(year) like in Taxon.sec
1546
            String shortCitation = ((DefaultReferenceCacheStrategy)reference.getCacheStrategy()).createShortCitation(reference);  //Should be Author(year) like in Taxon.sec
1505 1547
            csvLine[table.getIndex(CdmLightExportTable.BIBLIO_SHORT_CITATION)] = shortCitation;
1506 1548
            //TODO get preferred title
1507 1549
            csvLine[table.getIndex(CdmLightExportTable.REF_TITLE)] = reference.getTitle();
......
1545 1587
    }
1546 1588

  
1547 1589

  
1548
    /**
1549
     * @param reference
1550
     * @return
1551
     */
1552
    private String createShortCitation(Reference reference) {
1553
        TeamOrPersonBase<?> authorship = reference.getAuthorship();
1554
        String shortCitation = "";
1555
        if (authorship == null) {
1556
            return null;
1557
        }
1558
        authorship = HibernateProxyHelper.deproxy(authorship);
1559
        if (authorship instanceof Person){
1560
            shortCitation = ((Person)authorship).getFamilyName();
1561
            if (StringUtils.isBlank(shortCitation) ){
1562
                shortCitation = ((Person)authorship).getTitleCache();
1563
            }
1564
        }
1565
        else if (authorship instanceof Team){
1566

  
1567
            Team authorTeam = HibernateProxyHelper.deproxy(authorship, Team.class);
1568
            int index = 0;
1569

  
1570
            for (Person teamMember : authorTeam.getTeamMembers()){
1571
                index++;
1572
                if (index == 3){
1573
                    shortCitation += " & al.";
1574
                    break;
1575
                }
1576
                String concat = concatString(authorTeam, authorTeam.getTeamMembers(), index);
1577
                if (teamMember.getFamilyName() != null){
1578
                    shortCitation += concat + teamMember.getFamilyName();
1579
                }else{
1580
                    shortCitation += concat + teamMember.getTitleCache();
1581
                }
1582

  
1583
            }
1584
            if (StringUtils.isBlank(shortCitation)){
1585
                shortCitation = authorTeam.getTitleCache();
1586
            }
1587

  
1588
        }
1589
        if (reference.getDatePublished() != null) {
1590
            if (!StringUtils.isBlank(reference.getDatePublished().getFreeText())){
1591
                shortCitation = shortCitation + " (" + reference.getDatePublished().getFreeText() + ")";
1592
            }else if (!StringUtils.isBlank(reference.getYear()) ){
1593
                shortCitation = shortCitation + " (" + reference.getYear() + ")";
1594
            }
1595
        }
1596 1590

  
1597
        return shortCitation;
1598
    }
1599 1591

  
1600 1592
    /**
1601 1593
     * @param reference
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/name/TypeDesignationSetManager.java
9 9
package eu.etaxonomy.cdm.api.service.name;
10 10

  
11 11
import java.util.ArrayList;
12
import java.util.Arrays;
13 12
import java.util.Collection;
14 13
import java.util.Collections;
15 14
import java.util.Comparator;
......
20 19
import java.util.Map;
21 20
import java.util.Optional;
22 21
import java.util.Set;
22
import java.util.UUID;
23 23

  
24 24
import org.apache.commons.lang3.StringUtils;
25 25
import org.hibernate.search.hcore.util.impl.HibernateHelper;
......
31 31
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
32 32
import eu.etaxonomy.cdm.model.common.TermVocabulary;
33 33
import eu.etaxonomy.cdm.model.common.VersionableEntity;
34
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
34 35
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
35 36
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
36 37
import eu.etaxonomy.cdm.model.name.TaxonName;
......
40 41
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
41 42
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
42 43
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
44
import eu.etaxonomy.cdm.model.reference.Reference;
43 45
import eu.etaxonomy.cdm.ref.EntityReference;
44 46
import eu.etaxonomy.cdm.ref.TypedEntityReference;
45 47
import eu.etaxonomy.cdm.strategy.cache.TagEnum;
46 48
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
47 49
import eu.etaxonomy.cdm.strategy.cache.TaggedTextBuilder;
50
import eu.etaxonomy.cdm.strategy.cache.reference.DefaultReferenceCacheStrategy;
48 51
/**
49 52
 * Manages a collection of {@link TypeDesignationBase TypeDesignations} for the same typified name.
50 53
 *
......
78 81
    private static final String TYPE_SEPARATOR = "; ";
79 82

  
80 83
    private static final String TYPE_DESIGNATION_SEPARATOR = ", ";
81

  
82
    private Collection<TypeDesignationBase> typeDesignations;
84
    private static final String TYPE_STATUS_SEPARATOR_WITHCITATION = ": ";
85
    private static final String TYPE_STATUS_PARENTHESIS_LEFT = " (";
86
    private static final String TYPE_STATUS_PARENTHESIS_RIGHT = ")";
87
    private static final String REFERENCE_PARENTHESIS_RIGHT = "]";
88
    private static final String REFERENCE_PARENTHESIS_LEFT = " [fide ";
89
    private Map<UUID,TypeDesignationBase> typeDesignations;
83 90

  
84 91
    private NameTypeBaseEntityType nameTypeBaseEntityType = NameTypeBaseEntityType.NAME_TYPE_DESIGNATION;
85 92

  
......
100 107
    private List<String> problems = new ArrayList<>();
101 108

  
102 109
    private boolean printCitation = false;
110
    private boolean useShortCitation = false;
103 111

  
104 112
    private List<TaggedText> taggedText;
105 113

  
......
110 118
     *
111 119
     */
112 120
    public TypeDesignationSetManager(Collection<TypeDesignationBase> typeDesignations) throws RegistrationValidationException {
113
        this.typeDesignations = typeDesignations;
121
        if (this.typeDesignations == null){
122
            this.typeDesignations = new HashMap();
123
        }
124
        for (TypeDesignationBase typeDes:typeDesignations){
125
            this.typeDesignations.put(typeDes.getUuid(), typeDes);
126
        }
114 127
        findTypifiedName();
115 128
        mapAndSort();
116 129
    }
117 130

  
118 131
    /**
132
     * @param containgEntity
133
     * @param taxonName
134
     * @throws RegistrationValidationException
135
     *
136
     */
137
    public TypeDesignationSetManager(HomotypicalGroup group) throws RegistrationValidationException {
138
        if (this.typeDesignations == null){
139
            this.typeDesignations = new HashMap();
140
        }
141
        for (TypeDesignationBase typeDes:group.getTypeDesignations()){
142
            this.typeDesignations.put(typeDes.getUuid(), typeDes);
143
        }
144
        //findTypifiedName();
145
        mapAndSort();
146
    }
147

  
148
    /**
119 149
     * @param typifiedName2
120 150
     */
121 151
    public TypeDesignationSetManager(TaxonName typifiedName) {
122
        this.typeDesignations = new ArrayList<>();
152
        this.typeDesignations = new HashMap<>();
123 153
        this.typifiedNameRef = new EntityReference(typifiedName.getUuid(), typifiedName.getTitleCache());
124 154
    }
125 155

  
......
131 161
     * @param typeDesignations
132 162
     */
133 163
    public void addTypeDesigations(CdmBase containgEntity, TypeDesignationBase ... typeDesignations){
134
       this.typeDesignations.addAll(Arrays.asList(typeDesignations));
164
        for (TypeDesignationBase typeDes: typeDesignations){
165
            this.typeDesignations.put(typeDes.getUuid(), typeDes);
166
        }
135 167
       mapAndSort();
136 168
    }
137 169

  
......
143 175
    protected void mapAndSort() {
144 176
        finalString = null;
145 177
        Map<TypedEntityReference, TypeDesignationWorkingSet> byBaseEntityByTypeStatus = new HashMap<>();
146
        this.typeDesignations.forEach(td -> mapTypeDesignation(byBaseEntityByTypeStatus, td));
178

  
179
        this.typeDesignations.forEach((uuid, td) -> mapTypeDesignation(byBaseEntityByTypeStatus, td));
147 180
        orderedByTypesByBaseEntity = orderByTypeByBaseEntity(byBaseEntityByTypeStatus);
148 181
    }
149 182

  
......
311 344
                        workingsetBuilder.add(TagEnum.separator, TYPE_SEPARATOR);
312 345
                    }
313 346
                    boolean isNameTypeDesignation = false;
314
                    if(SpecimenOrObservationBase.class.isAssignableFrom(baseEntityRef.getType())){
347
                    if(SpecimenOrObservationBase.class.isAssignableFrom(baseEntityRef.getType()) ){
315 348
                        workingsetBuilder.add(TagEnum.label, "Type:");
316
                    } else {
317
                        workingsetBuilder.add(TagEnum.label, "NameType:");
318
                        isNameTypeDesignation = true;
319 349
                    }
320 350
                    if(!baseEntityRef.getLabel().isEmpty()){
321 351
                        workingsetBuilder.add(TagEnum.specimenOrObservation, baseEntityRef.getLabel(), baseEntityRef);
......
325 355
                    for(TypeDesignationStatusBase<?> typeStatus : typeDesignationWorkingSet.keySet()) {
326 356
                        if(typeStatusCount++  > 0){
327 357
                            workingsetBuilder.add(TagEnum.separator, TYPE_STATUS_SEPARATOR);
358

  
328 359
                        }
329 360
                        boolean isPlural = typeDesignationWorkingSet.get(typeStatus).size() > 1;
330 361
                        if(!typeStatus.equals(NULL_STATUS)) {
331
                            workingsetBuilder.add(TagEnum.label, typeStatus.getLabel() + (isPlural ? "s:" : ","));
362

  
363
                            workingsetBuilder.add(TagEnum.label, typeStatus.getLabel() + (isPlural ? "s:" : ":"));
364
                         }
365

  
366

  
367
                        int typeDesignationCount = 0;
368

  
369

  
370
                        for(TypedEntityReference typeDesignationEntityReference : typeDesignationWorkingSet.get(typeStatus)) {
371

  
372
                            if(typeDesignationCount++  > 0){
373
                               workingsetBuilder.add(TagEnum.separator, TYPE_DESIGNATION_SEPARATOR);
374
                            }
375

  
376
                            workingsetBuilder.add(TagEnum.typeDesignation, typeDesignationEntityReference.getLabel(), typeDesignationEntityReference);
377

  
332 378
                        }
379

  
380
                    }
381
                    typeDesignationWorkingSet.setRepresentation(workingsetBuilder.toString());
382
                    finalString += typeDesignationWorkingSet.getRepresentation();
383
                    finalBuilder.addAll(workingsetBuilder);
384
                }
385
            }
386
            finalString = finalString.trim();
387
            taggedText = finalBuilder.getTaggedText();
388
        }
389
    }
390

  
391
    public void buildStringWithCitation(){
392

  
393
        if(finalString == null){
394

  
395
            TaggedTextBuilder finalBuilder = new TaggedTextBuilder();
396
            finalString = "";
397

  
398
            if(getTypifiedNameCache() != null){
399
                finalString += getTypifiedNameCache() + " ";
400
                finalBuilder.add(TagEnum.name, getTypifiedNameCache(), new TypedEntityReference<>(TaxonName.class, getTypifiedNameRef().getUuid()));
401
            }
402

  
403
            int typeCount = 0;
404
            if(orderedByTypesByBaseEntity != null){
405
                for(TypedEntityReference baseEntityRef : orderedByTypesByBaseEntity.keySet()) {
406

  
407
                    TaggedTextBuilder workingsetBuilder = new TaggedTextBuilder();
408
                    if(typeCount++ > 0){
409
                        workingsetBuilder.add(TagEnum.separator, TYPE_SEPARATOR);
410
                    }
411
                    boolean isNameTypeDesignation = false;
412

  
413
                    if(!baseEntityRef.getLabel().isEmpty()){
414
                        workingsetBuilder.add(TagEnum.specimenOrObservation, baseEntityRef.getLabel(), baseEntityRef);
415
                    }
416
                    TypeDesignationWorkingSet typeDesignationWorkingSet = orderedByTypesByBaseEntity.get(baseEntityRef);
417
                    int typeStatusCount = 0;
418
                    for(TypeDesignationStatusBase<?> typeStatus : typeDesignationWorkingSet.keySet()) {
419
                        if(typeStatusCount++  > 0){
420
                            workingsetBuilder.add(TagEnum.separator, TYPE_STATUS_SEPARATOR);
421

  
422
                        }
423
                        boolean isPlural = typeDesignationWorkingSet.get(typeStatus).size() > 1;
424
                        if(!typeStatus.equals(NULL_STATUS)) {
425
                            workingsetBuilder.add(TagEnum.separator, TYPE_STATUS_PARENTHESIS_LEFT);
426
                            workingsetBuilder.add(TagEnum.label, typeStatus.getLabel() + (isPlural ? "s:" : ":"));
427
                         }
333 428
                        int typeDesignationCount = 0;
429

  
430

  
334 431
                        for(TypedEntityReference typeDesignationEntityReference : typeDesignationWorkingSet.get(typeStatus)) {
432

  
335 433
                            if(typeDesignationCount++  > 0){
336
                                workingsetBuilder.add(TagEnum.separator, TYPE_DESIGNATION_SEPARATOR);
434
                               workingsetBuilder.add(TagEnum.separator, TYPE_DESIGNATION_SEPARATOR);
337 435
                            }
436

  
338 437
                            workingsetBuilder.add(TagEnum.typeDesignation, typeDesignationEntityReference.getLabel(), typeDesignationEntityReference);
438

  
439
                            TypeDesignationBase typeDes =  typeDesignations.get(typeDesignationEntityReference.getUuid());
440
                            if (typeDes.getCitation() != null){
441
                                workingsetBuilder.add(TagEnum.separator, REFERENCE_PARENTHESIS_LEFT);
442
                                String shortCitation = ((DefaultReferenceCacheStrategy)typeDes.getCitation().getCacheStrategy()).createShortCitation(typeDes.getCitation());
443
                                workingsetBuilder.add(TagEnum.reference, shortCitation, typeDesignationEntityReference);
444
                                workingsetBuilder.add(TagEnum.separator, REFERENCE_PARENTHESIS_RIGHT);
445
                            }
446

  
447
                            if ((!typeStatus.equals(NULL_STATUS)) &&(typeDesignationCount ==  typeDesignationWorkingSet.get(typeStatus).size())){
448
                                workingsetBuilder.add(TagEnum.separator, TYPE_STATUS_PARENTHESIS_RIGHT);
449
                            }
339 450
                        }
451

  
340 452
                    }
341 453
                    typeDesignationWorkingSet.setRepresentation(workingsetBuilder.toString());
342 454
                    finalString += typeDesignationWorkingSet.getRepresentation();
......
348 460
        }
349 461
    }
350 462

  
463

  
351 464
    /**
352 465
     * FIXME use the validation framework validators to store the validation problems!!!
353 466
     *
......
360 473

  
361 474
        TaxonName typifiedName = null;
362 475

  
363
        for(TypeDesignationBase<?> typeDesignation : typeDesignations){
476
        for(TypeDesignationBase<?> typeDesignation : typeDesignations.values()){
364 477
            typeDesignation.getTypifiedNames();
365 478
            if(typeDesignation.getTypifiedNames().isEmpty()){
366 479

  
......
421 534
    /**
422 535
     * @return
423 536
     */
424
    public Collection<TypeDesignationBase> getTypeDesignations() {
537
    public Map<UUID,TypeDesignationBase> getTypeDesignations() {
425 538
        return typeDesignations;
426 539
    }
427 540

  
......
430 543
     * @return
431 544
     */
432 545
    public TypeDesignationBase findTypeDesignation(EntityReference typeDesignationRef) {
433
        for(TypeDesignationBase td : typeDesignations){
434
            if(td.getUuid().equals(typeDesignationRef.getUuid())){
435
                return td;
436
            }
437
        }
438
        // TODO Auto-generated method stub
439
        return null;
546
        return this.typeDesignations.get(typeDesignationRef.getUuid());
440 547
    }
441 548

  
442 549

  
......
530 637
                    } else {
531 638
                        DerivedUnitFacadeCacheStrategy cacheStrategy = new DerivedUnitFacadeCacheStrategy();
532 639
                        typeSpecimenTitle += cacheStrategy.getTitleCache(du, true);
640

  
533 641
                    }
534 642

  
535 643
                    result += (isMediaSpecimen ? "[icon] " : "") + typeSpecimenTitle.trim();
......
538 646
        }
539 647

  
540 648
        if(isPrintCitation() && td.getCitation() != null){
541
            if(td.getCitation().getAbbrevTitle() != null){
542
                result += " " + td.getCitation().getAbbrevTitle();
649
            Reference citation = HibernateProxyHelper.deproxy(td.getCitation(), Reference.class);
650
            if(citation.getAbbrevTitle() != null){
651

  
652
                result += " " + citation.getAbbrevTitle();
543 653
            } else {
544
                result += " " + td.getCitation().getTitleCache();
654
                result += " " + citation.getTitleCache();
545 655
            }
546 656
            if(td.getCitationMicroReference() != null){
547 657
                result += " :" + td.getCitationMicroReference();
......
603 713
        return taggedText;
604 714
    }
605 715

  
716
    public List<TaggedText> toTaggedTextWithCitation() {
717
        buildStringWithCitation();
718
        return taggedText;
719
    }
720

  
721

  
606 722
    /**
607 723
     * @return the printCitation
608 724
     */
......
632 748
        return nameTypeBaseEntityType;
633 749
    }
634 750

  
751
    public boolean isUseShortCitation() {
752
        return useShortCitation;
753
    }
754

  
755
    public void setUseShortCitation(boolean useShortCitation) {
756
        this.useShortCitation = useShortCitation;
757
    }
758

  
635 759
    /**
636 760
     * TypeDesignations which refer to the same FieldUnit (SpecimenTypeDesignation) or TaxonName
637 761
     * (NameTypeDesignation) form a working set. The <code>TypeDesignationWorkingSet</code> internally

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)