2 * Copyright (C) 2013 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.view
.derivateSearch
;
11 import java
.util
.ArrayList
;
12 import java
.util
.Collection
;
13 import java
.util
.HashMap
;
14 import java
.util
.HashSet
;
15 import java
.util
.List
;
17 import java
.util
.Map
.Entry
;
19 import java
.util
.UUID
;
21 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
22 import org
.eclipse
.jface
.viewers
.TreeNode
;
23 import org
.eclipse
.swt
.graphics
.Image
;
24 import org
.hibernate
.LazyInitializationException
;
26 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
27 import eu
.etaxonomy
.cdm
.api
.service
.IOccurrenceService
;
28 import eu
.etaxonomy
.cdm
.api
.service
.molecular
.ISequenceService
;
29 import eu
.etaxonomy
.cdm
.common
.CdmUtils
;
30 import eu
.etaxonomy
.cdm
.format
.CdmFormatterFactory
;
31 import eu
.etaxonomy
.cdm
.format
.ICdmFormatter
.FormatKey
;
32 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
33 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
34 import eu
.etaxonomy
.cdm
.model
.common
.DefinedTerm
;
35 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
36 import eu
.etaxonomy
.cdm
.model
.common
.Identifier
;
37 import eu
.etaxonomy
.cdm
.model
.molecular
.DnaSample
;
38 import eu
.etaxonomy
.cdm
.model
.molecular
.Sequence
;
39 import eu
.etaxonomy
.cdm
.model
.molecular
.SingleRead
;
40 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
41 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
42 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldUnit
;
43 import eu
.etaxonomy
.cdm
.model
.occurrence
.GatheringEvent
;
44 import eu
.etaxonomy
.cdm
.model
.occurrence
.MediaSpecimen
;
45 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
46 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationType
;
47 import eu
.etaxonomy
.cdm
.strategy
.cache
.common
.IdentifiableEntityDefaultCacheStrategy
;
48 import eu
.etaxonomy
.taxeditor
.model
.ImageResources
;
49 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
52 * Label provider for the views to show {@link SpecimenOrObservationBase}s.<br>
54 * <b>Note:</b> If you use this label provider you need to assure that you
55 * created a {@link ConversationHolder} resp. have an open session because
56 * the labels are generated from various fields of the derivate hierarchy which
57 * are lazy loaded and could therefore throw a {@link LazyInitializationException}.<br>
58 * Use <b>{@link #setConversation(ConversationHolder)}</b> to assign the session to this provider.
60 public class DerivateLabelProvider
extends ColumnLabelProvider
{
62 private static final String NO_SAMPLE_DESIGNATION
= "[no sample designation]";
64 private static Set
<SingleRead
> multiLinkSingleReads
;
66 private static Map
<DerivedUnit
, Collection
<SpecimenTypeDesignation
>> typeDesignations
;
68 private ConversationHolder conversation
;
70 private static DefinedTerm photoTerm
= null;
71 private static DefinedTerm drawingTerm
= null;
72 private static DefinedTerm specimenScanTerm
= null;
73 private static DefinedTerm detailImageTerm
= null;
74 private static DefinedTerm sampleDesignationTerm
= null;
76 //FIXME: move static term getters to new singleton utility class
77 private static void initializeTerms() {
78 List
<DefinedTerm
> preferredTerms
= CdmStore
.getTermManager().getPreferredTerms(DefinedTerm
.class);
79 for (DefinedTerm definedTerm
: preferredTerms
) {
80 if(definedTerm
.getUuid().equals(UUID
.fromString("c5c59c42-f254-471e-96c6-09f459f7c903"))){
81 photoTerm
= definedTerm
;
83 else if(definedTerm
.getUuid().equals(UUID
.fromString("669b0409-4aa4-4695-aae4-a95ed27bad4c"))){
84 drawingTerm
= definedTerm
;
86 else if(definedTerm
.getUuid().equals(UUID
.fromString("acda15be-c0e2-4ea8-8783-b9b0c4ad7f03"))){
87 specimenScanTerm
= definedTerm
;
89 else if(definedTerm
.getUuid().equals(UUID
.fromString("31eb8d02-bf5d-437c-bcc6-87a626445f34"))){
90 detailImageTerm
= definedTerm
;
92 else if(definedTerm
.getUuid().equals(UUID
.fromString("fadeba12-1be3-4bc7-9ff5-361b088d86fc"))){
93 sampleDesignationTerm
= definedTerm
;
98 public static DefinedTerm
getLivingPlantPhotoTerm(){
105 public static DefinedTerm
getArtworkTerm(){
106 if(drawingTerm
==null){
112 public static DefinedTerm
getSpecimenScanTerm(){
113 if(specimenScanTerm
==null){
116 return specimenScanTerm
;
119 public static DefinedTerm
getDetailImageTerm(){
120 if(detailImageTerm
==null){
123 return detailImageTerm
;
126 public static DefinedTerm
getSampleDesignationTerm(){
127 if(sampleDesignationTerm
==null){
130 return sampleDesignationTerm
;
136 public String
getText(Object element
) {
137 if(element
instanceof TreeNode
){
138 element
= ((TreeNode
) element
).getValue();
142 //check if collection code does not exist -> use collection name then
143 FormatKey collectionKey
= FormatKey
.COLLECTION_CODE
;
144 text
= CdmFormatterFactory
.format(element
,new FormatKey
[]{FormatKey
.COLLECTION_CODE
});
145 if(CdmUtils
.isBlank(text
)){
146 collectionKey
= FormatKey
.COLLECTION_NAME
;
149 //Use titlecache for FieldUnits
150 if(element
instanceof FieldUnit
){
151 return ((FieldUnit
) element
).getTitleCache();
154 else if(element
instanceof MediaSpecimen
){
155 text
= CdmFormatterFactory
.format(element
,
157 FormatKey
.MEDIA_TITLE_CACHE
, FormatKey
.SPACE
,
158 collectionKey
, FormatKey
.SPACE
,
159 FormatKey
.MOST_SIGNIFICANT_IDENTIFIER
, FormatKey
.SPACE
,
160 FormatKey
.MEDIA_TITLE
, FormatKey
.SPACE
,
161 FormatKey
.MEDIA_ARTIST
, FormatKey
.SPACE
,
164 else if (element
instanceof DnaSample
) {
165 text
= CdmFormatterFactory
.format(element
,
167 collectionKey
, FormatKey
.SPACE
,
168 FormatKey
.MOST_SIGNIFICANT_IDENTIFIER
, FormatKey
.SPACE
,
169 FormatKey
.SAMPLE_DESIGNATION
, FormatKey
.SPACE
172 else if (element
instanceof DerivedUnit
) {
173 text
= CdmFormatterFactory
.format(element
,
175 collectionKey
, FormatKey
.SPACE
,
176 FormatKey
.MOST_SIGNIFICANT_IDENTIFIER
, FormatKey
.SPACE
179 else if (element
instanceof Sequence
) {
180 text
= CdmFormatterFactory
.format(element
,
182 FormatKey
.SEQUENCE_DNA_MARKER
, FormatKey
.SPACE
185 else if (element
instanceof SingleRead
) {
186 text
= CdmFormatterFactory
.format(element
,
188 FormatKey
.SINGLE_READ_PHEROGRAM_TITLE_CACHE
, FormatKey
.SPACE
,
189 FormatKey
.AMPLIFICATION_LABEL
, FormatKey
.SPACE
,
192 else if(element
instanceof IdentifiableEntity
){
194 IdentifiableEntity identifiableEntity
= (IdentifiableEntity
) element
;
195 if(identifiableEntity
.isProtectedTitleCache()){
196 text
= identifiableEntity
.getTitleCache();
199 if(CdmUtils
.isBlank(text
) || text
.equals(IdentifiableEntityDefaultCacheStrategy
.TITLE_CACHE_GENERATION_NOT_IMPLEMENTED
)){
200 if(element
instanceof CdmBase
){
201 text
= ((CdmBase
) element
).getUuid().toString();
204 text
= element
.toString();
212 public String
getToolTipText(Object element
) {
213 return getDerivateText(element
);
217 * @param conversation the conversation to set
219 public void setConversation(ConversationHolder conversation
) {
220 this.conversation
= conversation
;
223 public String
getDerivateText(Object element
){
224 return getDerivateText(element
, conversation
);
227 public static String
getDerivateText(Object element
, ConversationHolder conversation
){
228 //TODO: use list of strings to assemble labels to avoid adding the separator every time and to allow null values
229 TreeNode parentNode
= null;
230 TreeNode node
= null;
231 Object derivate
= element
;
232 if(element
instanceof TreeNode
){
233 node
= (TreeNode
) element
;
234 parentNode
= node
.getParent();
235 //unwrap specimen from TreeNode
236 derivate
= node
.getValue();
239 if(conversation
!=null){
243 final String emptyString
= "";
244 final String separator
= " ";
246 String label
= emptyString
;
249 if(derivate
instanceof FieldUnit
){
250 FieldUnit fieldUnit
= (FieldUnit
)derivate
;
251 if(fieldUnit
.getGatheringEvent()!=null){
252 GatheringEvent gatheringEvent
= fieldUnit
.getGatheringEvent();
253 label
+= gatheringEvent
.getCountry()!=null?gatheringEvent
.getCountry().getLabel()+separator
:emptyString
;
254 label
+= gatheringEvent
.getLocality()!=null?gatheringEvent
.getLocality().getText()+separator
:emptyString
;
255 label
+= gatheringEvent
.getGatheringDate()!=null?gatheringEvent
.getGatheringDate()+separator
:emptyString
;
256 label
+= gatheringEvent
.getCollector()!=null?gatheringEvent
.getCollector()+separator
:emptyString
;
258 label
+= fieldUnit
.getFieldNumber()!=null?fieldUnit
.getFieldNumber():emptyString
;
261 else if(derivate
instanceof MediaSpecimen
){
262 MediaSpecimen mediaSpecimen
= (MediaSpecimen
)derivate
;
263 if(mediaSpecimen
.getMediaSpecimen()!=null){
264 label
+= mediaSpecimen
.getMediaSpecimen().getTitle()!=null?mediaSpecimen
.getMediaSpecimen().getTitle().getText()+separator
:"[no motif]";
265 label
+= mediaSpecimen
.getMediaSpecimen().getArtist()!=null?mediaSpecimen
.getMediaSpecimen().getArtist()+separator
:emptyString
;
267 eu
.etaxonomy
.cdm
.model
.occurrence
.Collection collection
= mediaSpecimen
.getCollection();
268 if(collection
!=null){
269 label
+= collection
.getName()!=null?collection
.getName()+" ":emptyString
;
270 label
+= collection
.getCode()!=null?
"("+collection
.getCode()+")"+separator
:emptyString
;
272 label
+= mediaSpecimen
.getAccessionNumber()!=null?mediaSpecimen
.getAccessionNumber()+separator
:emptyString
;
273 label
+= mediaSpecimen
.getBarcode()!=null?mediaSpecimen
.getBarcode()+separator
:emptyString
;
275 //TissueSample + DnaSample
276 else if(derivate
instanceof DnaSample
){
277 DnaSample dnaSample
= (DnaSample
)derivate
;
278 if(((DnaSample
) derivate
).getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
279 Identifier
<DnaSample
> currentSampleDesignation
= getCurrentSampleDesignation(dnaSample
);
280 if(currentSampleDesignation
!=null && currentSampleDesignation
.getIdentifier()!=null){
281 label
+= currentSampleDesignation
.getIdentifier()+separator
;
284 label
+= NO_SAMPLE_DESIGNATION
+separator
;
287 else if(((DnaSample
) derivate
).getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
288 if(dnaSample
.getKindOfUnit()!=null){
289 label
+= dnaSample
.getKindOfUnit()+separator
;
291 Identifier
<DnaSample
> currentSampleDesignation
= getCurrentSampleDesignation(dnaSample
);
292 if(currentSampleDesignation
!=null && currentSampleDesignation
.getIdentifier()!=null){
293 label
+= currentSampleDesignation
.getIdentifier()+separator
;
296 label
+= NO_SAMPLE_DESIGNATION
+separator
;
301 //DerivedUnit + TissueSample
302 else if(derivate
instanceof DerivedUnit
){
303 DerivedUnit derivedUnit
= (DerivedUnit
)derivate
;
304 if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.PreservedSpecimen
){
305 //check for type designation
306 if(typeDesignations
.get(derivedUnit
)==null){
307 for (SpecimenTypeDesignation specimenTypeDesignation
: derivedUnit
.getSpecimenTypeDesignations()) {
308 addTypeDesignation(derivedUnit
, specimenTypeDesignation
);
311 //java.util.Collection<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class).getFieldUnits(derivedUnit.getUuid());
312 //TODO : This is not generic anymore for performance reasons
313 Set
<SpecimenOrObservationBase
> originals
= derivedUnit
.getOriginals();
314 if(originals
!=null && originals
.size() ==1) {
315 SpecimenOrObservationBase specimen
= originals
.iterator().next();
316 if(specimen
instanceof FieldUnit
) {
317 FieldUnit fieldUnit
= (FieldUnit
)specimen
;
318 GatheringEvent gatheringEvent
= fieldUnit
.getGatheringEvent();
319 if(gatheringEvent
!=null){
320 label
+= gatheringEvent
.getCollector()!=null?gatheringEvent
.getCollector()+separator
:emptyString
;
322 label
+= fieldUnit
.getFieldNumber()!=null?fieldUnit
.getFieldNumber()+separator
:emptyString
;
326 eu
.etaxonomy
.cdm
.model
.occurrence
.Collection collection
= derivedUnit
.getCollection();
327 if(collection
!=null){
328 label
+= collection
.getCode()!=null?
"("+collection
.getCode()+")"+separator
:emptyString
;
330 String mostSignificantIdentifier
= derivedUnit
.getMostSignificantIdentifier();
331 label
+= mostSignificantIdentifier
!=null?mostSignificantIdentifier
+separator
:emptyString
;
333 else if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
334 //TissueSample should only be created by using it's own class
335 //in future using only one class with different SpecimenOrObservationTypes is desired
336 // label += derivedUnit.getKindOfUnit() + NO_SAMPLE_DESIGNATION;
340 else if(derivate
instanceof Sequence
){
341 Sequence sequence
= (Sequence
)derivate
;
342 Identifier
<DnaSample
> currentSampleDesignation
= getCurrentSampleDesignation(sequence
);
343 if(currentSampleDesignation
!=null && currentSampleDesignation
.getIdentifier()!=null){
344 label
+= currentSampleDesignation
.getIdentifier()+separator
;
347 label
+= NO_SAMPLE_DESIGNATION
+separator
;
349 label
+= sequence
.getDnaMarker()!=null?sequence
.getDnaMarker():emptyString
;
352 else if(derivate
instanceof SingleRead
){
353 SingleRead singleRead
= (SingleRead
)derivate
;
354 if(parentNode
!=null && parentNode
.getValue() instanceof Sequence
){
355 Sequence sequence
= (Sequence
) parentNode
.getValue();
356 Identifier
<DnaSample
> currentSampleDesignation
= getCurrentSampleDesignation(sequence
);
357 if(currentSampleDesignation
!=null && currentSampleDesignation
.getIdentifier()!=null){
358 label
= currentSampleDesignation
.getIdentifier()+separator
;
361 label
+= NO_SAMPLE_DESIGNATION
+separator
;
363 label
+= singleRead
.getPrimer()!=null?singleRead
.getPrimer().getLabel()+separator
:emptyString
;
364 if(sequence
!=null && sequence
.getDnaMarker()!=null){
365 label
+= sequence
.getDnaMarker()+separator
;
367 if(singleRead
.getAmplificationResult()!=null && singleRead
.getAmplificationResult().getAmplification()!=null){
368 label
+= singleRead
.getAmplificationResult().getAmplification().getLabelCache()+separator
;
373 else if(derivate
instanceof SpecimenOrObservationBase
){
374 SpecimenOrObservationBase
<?
> specimen
= (SpecimenOrObservationBase
<?
>) derivate
;
375 SpecimenOrObservationType type
= specimen
.getRecordBasis();
376 return specimen
.getTitleCache() + (type
!=null?
" ["+type
.toString()+"]":emptyString
);
379 label
= derivate
.toString();
382 else if(label
.endsWith(separator
)){
383 label
= label
.substring(0, label
.length()-separator
.length());
389 public Image
getImage(Object element
) {
390 if(element
instanceof TreeNode
){
391 element
= ((TreeNode
) element
).getValue();
393 if(element
instanceof CdmBase
){
394 CdmBase cdmBase
= (CdmBase
)element
;
395 boolean hasCharacterData
= false;
396 if(cdmBase
.isInstanceOf(SpecimenOrObservationBase
.class)){
397 SpecimenOrObservationBase
<?
> specimen
= HibernateProxyHelper
.deproxy(cdmBase
, SpecimenOrObservationBase
.class);
398 if(specimen
.hasCharacterData()){
399 hasCharacterData
= true;
402 if(cdmBase
.isInstanceOf(FieldUnit
.class)){
403 return hasCharacterData?ImageResources
.getImage(ImageResources
.FIELD_UNIT_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.FIELD_UNIT
);
405 else if(cdmBase
.isInstanceOf(DerivedUnit
.class)){
406 DerivedUnit derivedUnit
= HibernateProxyHelper
.deproxy(element
, DerivedUnit
.class);
408 if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.FieldUnit
){
409 return hasCharacterData?ImageResources
.getImage(ImageResources
.FIELD_UNIT_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.FIELD_UNIT
);
411 else if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
412 return hasCharacterData?ImageResources
.getImage(ImageResources
.DNA_SAMPLE_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.DNA_SAMPLE_DERIVATE
);
414 else if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
415 return hasCharacterData?ImageResources
.getImage(ImageResources
.TISSUE_SAMPLE_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.TISSUE_SAMPLE_DERIVATE
);
417 else if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.PreservedSpecimen
){
418 if(typeDesignations
.get(derivedUnit
)!=null && !typeDesignations
.get(derivedUnit
).isEmpty()){
419 return ImageResources
.getImage(ImageResources
.SPECIMEN_DERIVATE_TYPE
);
421 return hasCharacterData?ImageResources
.getImage(ImageResources
.SPECIMEN_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.SPECIMEN_DERIVATE
);
423 else if(derivedUnit
.getRecordBasis().isMedia()
424 || derivedUnit
.getRecordBasis().isKindOf(SpecimenOrObservationType
.Media
)){
425 if(derivedUnit
.getKindOfUnit()!=null){
426 if(derivedUnit
.getKindOfUnit().equals(getArtworkTerm())){
427 return hasCharacterData?ImageResources
.getImage(ImageResources
.ARTWORK_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.ARTWORK_DERIVATE
);
429 else if(derivedUnit
.getKindOfUnit().equals(getLivingPlantPhotoTerm())){
430 return hasCharacterData?ImageResources
.getImage(ImageResources
.LIVING_PLANT_PHOTO_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.LIVING_PLANT_PHOTO_DERIVATE
);
432 else if(derivedUnit
.getKindOfUnit().equals(getSpecimenScanTerm())){
433 return hasCharacterData?ImageResources
.getImage(ImageResources
.SPECIMEN_SCAN_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.SPECIMEN_SCAN_DERIVATE
);
435 else if(derivedUnit
.getKindOfUnit().equals(getDetailImageTerm())){
436 return hasCharacterData?ImageResources
.getImage(ImageResources
.DETAIL_IMAGE_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.DETAIL_IMAGE_DERIVATE
);
441 else if(cdmBase
.isInstanceOf(Sequence
.class)){
442 return ImageResources
.getImage(ImageResources
.SEQUENCE_DERIVATE
);
445 else if(cdmBase
.isInstanceOf(SingleRead
.class)){
446 if(multiLinkSingleReads
!=null && multiLinkSingleReads
.contains(element
)){
447 return ImageResources
.getImage(ImageResources
.SINGLE_READ_DERIVATE_MULTILINK
);
450 return ImageResources
.getImage(ImageResources
.SINGLE_READ_DERIVATE
);
454 return ImageResources
.getImage(ImageResources
.DEFAULT_DERIVATIVE
);
457 public static Identifier
<DnaSample
> getCurrentSampleDesignation(CdmBase entity
) {
458 if(entity
.isInstanceOf(DnaSample
.class)){
459 DnaSample dnaSample
= HibernateProxyHelper
.deproxy(entity
, DnaSample
.class);
460 for (Identifier
<DnaSample
> identifier
: dnaSample
.getIdentifiers()) {
461 if(identifier
.getType()!=null && identifier
.getType().equals(DerivateLabelProvider
.getSampleDesignationTerm())){
462 //first sample designation is the current
467 else if(entity
.isInstanceOf(Sequence
.class)){
468 Sequence sequence
= HibernateProxyHelper
.deproxy(entity
, Sequence
.class);
469 if(sequence
.getDnaSample()!=null){
470 return getCurrentSampleDesignation(sequence
.getDnaSample());
476 private static void addTypeDesignation(DerivedUnit derivedUnit
, SpecimenTypeDesignation typeDesignation
){
477 Collection
<SpecimenTypeDesignation
> list
= typeDesignations
.get(derivedUnit
);
479 list
= new ArrayList
<SpecimenTypeDesignation
>();
481 list
.add(typeDesignation
);
482 typeDesignations
.put(derivedUnit
, list
);
485 public static Set
<SingleRead
> getMultiLinkSingleReads() {
486 return multiLinkSingleReads
;
489 public void updateLabelCache(Collection
<SpecimenOrObservationBase
<?
>> rootElements
) {
490 multiLinkSingleReads
= new HashSet
<SingleRead
>();
491 typeDesignations
= new HashMap
<DerivedUnit
, Collection
<SpecimenTypeDesignation
>>();
492 for(Entry
<SingleRead
, Collection
<Sequence
>> entry
:CdmStore
.getService(ISequenceService
.class).getSingleReadSequencesMap().entrySet()){
493 if(entry
.getValue().size()>1){
494 multiLinkSingleReads
.add(entry
.getKey());
497 if(rootElements
!=null){
498 Collection
<DerivedUnit
> derivedUnits
= new ArrayList
<DerivedUnit
>();
499 for (SpecimenOrObservationBase specimenOrObservationBase
: rootElements
) {
500 List
<DerivedUnit
> childUnits
= CdmStore
.getService(IOccurrenceService
.class).getAllChildDerivatives(specimenOrObservationBase
.getUuid());
501 if (childUnits
!= null){
502 derivedUnits
.addAll(childUnits
);
504 if(specimenOrObservationBase
.isInstanceOf(DerivedUnit
.class)){
505 specimenOrObservationBase
= CdmStore
.getService(IOccurrenceService
.class).load(specimenOrObservationBase
.getUuid());
506 if (specimenOrObservationBase
!= null){
507 derivedUnits
.add(HibernateProxyHelper
.deproxy(specimenOrObservationBase
, DerivedUnit
.class));
511 for (DerivedUnit derivedUnit
: derivedUnits
) {
512 if(!derivedUnit
.getSpecimenTypeDesignations().isEmpty()){
513 typeDesignations
.put(derivedUnit
, derivedUnit
.getSpecimenTypeDesignations());