Project

General

Profile

« Previous | Next » 

Revision 2bbade98

Added by Andreas Müller over 2 years ago

cleanup

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/name/TypeDesignationDTO.java
25 25

  
26 26
    private UUID typeUuid;
27 27

  
28
    /**
29
     * @param type the typeDesignations subclass
30
     * @param uuid the typeDesignations uuid
31
     * @param taggedText
32
     * @param typeUuid the uuid of the type (may it be specimen or name)
33
     */
28 34
    public TypeDesignationDTO(Class<T> type, UUID uuid, List<TaggedText> taggedText, UUID typeUuid) {
29 35
        super(type, uuid, taggedText);
30 36
        this.typeUuid = typeUuid;
......
33 39
    public UUID getTypeUuid() {
34 40
        return typeUuid;
35 41
    }
42

  
36 43
}
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/name/TypeDesignationWorkingSet.java
45 45

  
46 46
    private String label = null;
47 47

  
48
    //maybe remove in future as redundant with baseEntity
48
    //maybe removed in future as redundant with baseEntity
49 49
    private TypedEntityReference<? extends VersionableEntity> baseEntityReference;
50 50

  
51 51
    private VersionableEntity baseEntity;
......
68 68
        return baseEntity;
69 69
    }
70 70

  
71
//    @Override
72
//    public Collection<TypedEntityReference<TypeDesignationBase>> put(TypeDesignationStatusBase<?> key, Collection<TypedEntityReference<TypeDesignationBase>> collection) {
73
//        return super.put(key, collection);
74
//        //return internalMap.put(key, collection);
75
//    }
76

  
77 71
    public List<TypeDesignationDTO> getTypeDesignations() {
78 72
        List<TypeDesignationDTO> typeDesignations = new ArrayList<>();
79 73
        this.values().forEach(typeDesignationReferences -> typeDesignationReferences.forEach(td -> typeDesignations.add(td)));
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/name/TypeDesignationSetManagerTest.java
55 55
 */
56 56
public class TypeDesignationSetManagerTest extends TermTestBase{
57 57

  
58
        private static final boolean WITH_CITATION = true;
59
        private static final boolean WITH_NAME_IF_AVAILABLE_CITATION = true;
60
        private static final boolean WITH_TYPE_LABEL = true;
61

  
62

  
63

  
58 64
        private NameTypeDesignation ntd;
59 65
        private NameTypeDesignation ntd_LT;
60 66
        private SpecimenTypeDesignation std_IT;
......
198 204
            typifiedName.addTypeDesignation(std_IT_3, false);
199 205

  
200 206
            TypeDesignationSetManager typeDesignationManager = new TypeDesignationSetManager(tds);
201
            String result = typeDesignationManager.print(true, true, true);
207
            String result = typeDesignationManager.print(WITH_CITATION, WITH_TYPE_LABEL, true);
202 208

  
203 209
//            Logger.getLogger(this.getClass()).debug(result);
204 210
            assertNotNull(result);
......
226 232
            typifiedName.setTitleCache("Prionus L.", true);
227 233

  
228 234
            TypeDesignationSetManager typeDesignationManager = new TypeDesignationSetManager(typifiedName);
229
            String result = typeDesignationManager.print(true, true, true);
235
            String result = typeDesignationManager.print(WITH_CITATION, WITH_TYPE_LABEL, true);
230 236
            assertEquals(
231 237
                    "Prionus L."
232 238
                    , result
......
237 243

  
238 244
            assertEquals(
239 245
                    "Prionus L.\u202F\u2013\u202FNametype: Prionus coriatius L."
240
                    , typeDesignationManager.print(true, true, true)
246
                    , typeDesignationManager.print(WITH_CITATION, WITH_TYPE_LABEL, true)
241 247
                    );
242 248

  
243 249
            typifiedName.addTypeDesignation(std_HT, false);
......
275 281
            inRef.setAuthorship(Team.NewTitledInstance("Miller", "Mill."));
276 282
            std_LT.addPrimaryTaxonomicSource(inRef, "55");
277 283
            assertEquals("Prionus coriatius L.\u202F\u2013\u202FTestland, near Bughausen, A.Kohlbecker 81989, 2017 (lectotype: LEC designated by Decandolle & al. 1962 [fide Miller 1989: 55])",
278
                    typeDesignationManager.print(true, false, true));
284
                    typeDesignationManager.print(WITH_CITATION, !WITH_TYPE_LABEL, true));
279 285
            assertEquals("Prionus coriatius L.\u202F\u2013\u202FTestland, near Bughausen, A.Kohlbecker 81989, 2017 (lectotype: LEC)",
280
                    typeDesignationManager.print(false, false, true));
286
                    typeDesignationManager.print(!WITH_CITATION,!WITH_TYPE_LABEL, true));
281 287
            assertEquals("Testland, near Bughausen, A.Kohlbecker 81989, 2017 (lectotype: LEC)",
282
                    typeDesignationManager.print(false, false, false));
288
                    typeDesignationManager.print(!WITH_CITATION, !WITH_TYPE_LABEL, false));
283 289

  
284 290
            //name types
285 291
            typifiedName = TaxonNameFactory.NewBacterialInstance(Rank.GENUS());
......
288 294
            typeDesignationManager.addTypeDesigations(ntd_LT);
289 295
            ntd_LT.addPrimaryTaxonomicSource(inRef, "66");
290 296
            assertEquals("Prionus L.\u202F\u2013\u202FLectotype: Prionus arealus L. designated by Decandolle & al. 1962 [fide Miller 1989: 66]",
291
                    typeDesignationManager.print(true, false, true));
297
                    typeDesignationManager.print(WITH_CITATION, !WITH_TYPE_LABEL, true));
292 298
            assertEquals("Prionus L.\u202F\u2013\u202FLectotype: Prionus arealus L.",
293
                    typeDesignationManager.print(false, false, true));
299
                    typeDesignationManager.print(!WITH_CITATION, !WITH_TYPE_LABEL, true));
294 300

  
295 301
        }
296 302

  
......
311 317

  
312 318
                assertEquals("failed after repeating " + i + " times",
313 319
                        "Prionus coriatius L.\u202F\u2013\u202FTypes: Testland, near Bughausen, A.Kohlbecker 81989, 2017 (holotype: [icon] in Kohlbecker & Kusber 2008: 33; isotype: [icon] B Slide A565656)"
314
                        , typeDesignationManager.print(true, true, true)
320
                        , typeDesignationManager.print(WITH_CITATION, WITH_TYPE_LABEL, true)
315 321
                        );
316 322

  
317 323
                Media media = ((MediaSpecimen)mtd_HT_published.getTypeSpecimen()).getMediaSpecimen();
......
320 326
                ref2.setAuthorship(Person.NewInstance(null, "Mueller", "A.", null));
321 327
                IdentifiableSource newSource = IdentifiableSource.NewPrimaryMediaSourceInstance(ref2, "tab. 4");
322 328
                media.addSource(newSource);
323
                String with2Sources = typeDesignationManager.print(true, true, true);
329
                String with2Sources = typeDesignationManager.print(WITH_CITATION, WITH_TYPE_LABEL, true);
324 330
                Assert.assertTrue("failed after repeating " + i + " times",
325 331
                        //the order of the sources is currently not yet defined (rare case), therefore 2 possibilities
326 332
                        with2Sources.equals("Prionus coriatius L.\u202F\u2013\u202FTypes: Testland, near Bughausen, A.Kohlbecker 81989, 2017 (holotype: [icon] in Mueller 2009: tab. 4, Kohlbecker & Kusber 2008: 33; isotype: [icon] B Slide A565656)")

Also available in: Unified diff