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 text
= ((FieldUnit
) element
).getTitleCache();
153 else if(element
instanceof MediaSpecimen
){
154 text
= CdmFormatterFactory
.format(element
,
156 FormatKey
.MEDIA_TITLE_CACHE
, FormatKey
.SPACE
,
157 collectionKey
, FormatKey
.SPACE
,
158 FormatKey
.MOST_SIGNIFICANT_IDENTIFIER
, FormatKey
.SPACE
,
159 FormatKey
.MEDIA_TITLE
, FormatKey
.SPACE
,
160 FormatKey
.MEDIA_ARTIST
, FormatKey
.SPACE
,
163 else if (element
instanceof DnaSample
) {
164 text
= CdmFormatterFactory
.format(element
,
166 collectionKey
, FormatKey
.SPACE
,
167 FormatKey
.MOST_SIGNIFICANT_IDENTIFIER
, FormatKey
.SPACE
,
168 FormatKey
.SAMPLE_DESIGNATION
, FormatKey
.SPACE
171 else if (element
instanceof DerivedUnit
) {
172 text
= CdmFormatterFactory
.format(element
,
174 collectionKey
, FormatKey
.SPACE
,
175 FormatKey
.MOST_SIGNIFICANT_IDENTIFIER
, FormatKey
.SPACE
178 else if (element
instanceof Sequence
) {
179 text
= CdmFormatterFactory
.format(element
,
181 FormatKey
.SEQUENCE_DNA_MARKER
, FormatKey
.SPACE
184 else if (element
instanceof SingleRead
) {
185 text
= CdmFormatterFactory
.format(element
,
187 FormatKey
.SINGLE_READ_PHEROGRAM_TITLE_CACHE
, FormatKey
.SPACE
,
188 FormatKey
.AMPLIFICATION_LABEL
, FormatKey
.SPACE
,
191 else if(element
instanceof IdentifiableEntity
){
193 IdentifiableEntity identifiableEntity
= (IdentifiableEntity
) element
;
194 if(identifiableEntity
.isProtectedTitleCache()){
195 text
= identifiableEntity
.getTitleCache();
198 if(CdmUtils
.isBlank(text
) || text
.equals(IdentifiableEntityDefaultCacheStrategy
.TITLE_CACHE_GENERATION_NOT_IMPLEMENTED
)){
199 if(element
instanceof CdmBase
){
200 text
= ((CdmBase
) element
).getUuid().toString();
203 text
= element
.toString();
206 //remove dot at the end
207 if(text
.endsWith(".")){
208 text
= text
.substring(0, text
.length()-1);
215 public String
getToolTipText(Object element
) {
216 return getDerivateText(element
);
220 * @param conversation the conversation to set
222 public void setConversation(ConversationHolder conversation
) {
223 this.conversation
= conversation
;
226 public String
getDerivateText(Object element
){
227 return getDerivateText(element
, conversation
);
230 public static String
getDerivateText(Object element
, ConversationHolder conversation
){
231 //TODO: use list of strings to assemble labels to avoid adding the separator every time and to allow null values
232 TreeNode parentNode
= null;
233 TreeNode node
= null;
234 Object derivate
= element
;
235 if(element
instanceof TreeNode
){
236 node
= (TreeNode
) element
;
237 parentNode
= node
.getParent();
238 //unwrap specimen from TreeNode
239 derivate
= node
.getValue();
242 if(conversation
!=null){
246 final String emptyString
= "";
247 final String separator
= " ";
249 String label
= emptyString
;
252 if(derivate
instanceof FieldUnit
){
253 FieldUnit fieldUnit
= (FieldUnit
)derivate
;
254 if(fieldUnit
.getGatheringEvent()!=null){
255 GatheringEvent gatheringEvent
= fieldUnit
.getGatheringEvent();
256 label
+= gatheringEvent
.getCountry()!=null?gatheringEvent
.getCountry().getLabel()+separator
:emptyString
;
257 label
+= gatheringEvent
.getLocality()!=null?gatheringEvent
.getLocality().getText()+separator
:emptyString
;
258 label
+= gatheringEvent
.getGatheringDate()!=null?gatheringEvent
.getGatheringDate()+separator
:emptyString
;
259 label
+= gatheringEvent
.getCollector()!=null?gatheringEvent
.getCollector()+separator
:emptyString
;
261 label
+= fieldUnit
.getFieldNumber()!=null?fieldUnit
.getFieldNumber():emptyString
;
264 else if(derivate
instanceof MediaSpecimen
){
265 MediaSpecimen mediaSpecimen
= (MediaSpecimen
)derivate
;
266 if(mediaSpecimen
.getMediaSpecimen()!=null){
267 label
+= mediaSpecimen
.getMediaSpecimen().getTitle()!=null?mediaSpecimen
.getMediaSpecimen().getTitle().getText()+separator
:"[no motif]";
268 label
+= mediaSpecimen
.getMediaSpecimen().getArtist()!=null?mediaSpecimen
.getMediaSpecimen().getArtist()+separator
:emptyString
;
270 eu
.etaxonomy
.cdm
.model
.occurrence
.Collection collection
= mediaSpecimen
.getCollection();
271 if(collection
!=null){
272 label
+= collection
.getName()!=null?collection
.getName()+" ":emptyString
;
273 label
+= collection
.getCode()!=null?
"("+collection
.getCode()+")"+separator
:emptyString
;
275 label
+= mediaSpecimen
.getAccessionNumber()!=null?mediaSpecimen
.getAccessionNumber()+separator
:emptyString
;
276 label
+= mediaSpecimen
.getBarcode()!=null?mediaSpecimen
.getBarcode()+separator
:emptyString
;
278 //TissueSample + DnaSample
279 else if(derivate
instanceof DnaSample
){
280 DnaSample dnaSample
= (DnaSample
)derivate
;
281 if(((DnaSample
) derivate
).getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
282 Identifier
<DnaSample
> currentSampleDesignation
= getCurrentSampleDesignation(dnaSample
);
283 if(currentSampleDesignation
!=null && currentSampleDesignation
.getIdentifier()!=null){
284 label
+= currentSampleDesignation
.getIdentifier()+separator
;
287 label
+= NO_SAMPLE_DESIGNATION
+separator
;
290 else if(((DnaSample
) derivate
).getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
291 if(dnaSample
.getKindOfUnit()!=null){
292 label
+= dnaSample
.getKindOfUnit()+separator
;
294 Identifier
<DnaSample
> currentSampleDesignation
= getCurrentSampleDesignation(dnaSample
);
295 if(currentSampleDesignation
!=null && currentSampleDesignation
.getIdentifier()!=null){
296 label
+= currentSampleDesignation
.getIdentifier()+separator
;
299 label
+= NO_SAMPLE_DESIGNATION
+separator
;
304 //DerivedUnit + TissueSample
305 else if(derivate
instanceof DerivedUnit
){
306 DerivedUnit derivedUnit
= (DerivedUnit
)derivate
;
307 if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.PreservedSpecimen
){
308 //check for type designation
309 if(typeDesignations
.get(derivedUnit
)==null){
310 for (SpecimenTypeDesignation specimenTypeDesignation
: derivedUnit
.getSpecimenTypeDesignations()) {
311 addTypeDesignation(derivedUnit
, specimenTypeDesignation
);
314 //java.util.Collection<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class).getFieldUnits(derivedUnit.getUuid());
315 //TODO : This is not generic anymore for performance reasons
316 Set
<SpecimenOrObservationBase
> originals
= derivedUnit
.getOriginals();
317 if(originals
!=null && originals
.size() ==1) {
318 SpecimenOrObservationBase specimen
= originals
.iterator().next();
319 if(specimen
instanceof FieldUnit
) {
320 FieldUnit fieldUnit
= (FieldUnit
)specimen
;
321 GatheringEvent gatheringEvent
= fieldUnit
.getGatheringEvent();
322 if(gatheringEvent
!=null){
323 label
+= gatheringEvent
.getCollector()!=null?gatheringEvent
.getCollector()+separator
:emptyString
;
325 label
+= fieldUnit
.getFieldNumber()!=null?fieldUnit
.getFieldNumber()+separator
:emptyString
;
329 eu
.etaxonomy
.cdm
.model
.occurrence
.Collection collection
= derivedUnit
.getCollection();
330 if(collection
!=null){
331 label
+= collection
.getCode()!=null?
"("+collection
.getCode()+")"+separator
:emptyString
;
333 String mostSignificantIdentifier
= derivedUnit
.getMostSignificantIdentifier();
334 label
+= mostSignificantIdentifier
!=null?mostSignificantIdentifier
+separator
:emptyString
;
336 else if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
337 //TissueSample should only be created by using it's own class
338 //in future using only one class with different SpecimenOrObservationTypes is desired
339 // label += derivedUnit.getKindOfUnit() + NO_SAMPLE_DESIGNATION;
343 else if(derivate
instanceof Sequence
){
344 Sequence sequence
= (Sequence
)derivate
;
345 Identifier
<DnaSample
> currentSampleDesignation
= getCurrentSampleDesignation(sequence
);
346 if(currentSampleDesignation
!=null && currentSampleDesignation
.getIdentifier()!=null){
347 label
+= currentSampleDesignation
.getIdentifier()+separator
;
350 label
+= NO_SAMPLE_DESIGNATION
+separator
;
352 label
+= sequence
.getDnaMarker()!=null?sequence
.getDnaMarker():emptyString
;
355 else if(derivate
instanceof SingleRead
){
356 SingleRead singleRead
= (SingleRead
)derivate
;
357 if(parentNode
!=null && parentNode
.getValue() instanceof Sequence
){
358 Sequence sequence
= (Sequence
) parentNode
.getValue();
359 Identifier
<DnaSample
> currentSampleDesignation
= getCurrentSampleDesignation(sequence
);
360 if(currentSampleDesignation
!=null && currentSampleDesignation
.getIdentifier()!=null){
361 label
= currentSampleDesignation
.getIdentifier()+separator
;
364 label
+= NO_SAMPLE_DESIGNATION
+separator
;
366 label
+= singleRead
.getPrimer()!=null?singleRead
.getPrimer().getLabel()+separator
:emptyString
;
367 if(sequence
!=null && sequence
.getDnaMarker()!=null){
368 label
+= sequence
.getDnaMarker()+separator
;
370 if(singleRead
.getAmplificationResult()!=null && singleRead
.getAmplificationResult().getAmplification()!=null){
371 label
+= singleRead
.getAmplificationResult().getAmplification().getLabelCache()+separator
;
376 else if(derivate
instanceof SpecimenOrObservationBase
){
377 SpecimenOrObservationBase
<?
> specimen
= (SpecimenOrObservationBase
<?
>) derivate
;
378 SpecimenOrObservationType type
= specimen
.getRecordBasis();
379 return specimen
.getTitleCache() + (type
!=null?
" ["+type
.toString()+"]":emptyString
);
382 label
= derivate
.toString();
385 else if(label
.endsWith(separator
)){
386 label
= label
.substring(0, label
.length()-separator
.length());
392 public Image
getImage(Object element
) {
393 if(element
instanceof TreeNode
){
394 element
= ((TreeNode
) element
).getValue();
396 if(element
instanceof CdmBase
){
397 CdmBase cdmBase
= (CdmBase
)element
;
398 boolean hasCharacterData
= false;
399 if(cdmBase
.isInstanceOf(SpecimenOrObservationBase
.class)){
400 SpecimenOrObservationBase
<?
> specimen
= HibernateProxyHelper
.deproxy(cdmBase
, SpecimenOrObservationBase
.class);
401 if(specimen
.hasCharacterData()){
402 hasCharacterData
= true;
405 if(cdmBase
.isInstanceOf(FieldUnit
.class)){
406 return hasCharacterData?ImageResources
.getImage(ImageResources
.FIELD_UNIT_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.FIELD_UNIT
);
408 else if(cdmBase
.isInstanceOf(DerivedUnit
.class)){
409 DerivedUnit derivedUnit
= HibernateProxyHelper
.deproxy(element
, DerivedUnit
.class);
411 if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.FieldUnit
){
412 return hasCharacterData?ImageResources
.getImage(ImageResources
.FIELD_UNIT_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.FIELD_UNIT
);
414 else if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.DnaSample
){
415 return hasCharacterData?ImageResources
.getImage(ImageResources
.DNA_SAMPLE_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.DNA_SAMPLE_DERIVATE
);
417 else if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.TissueSample
){
418 return hasCharacterData?ImageResources
.getImage(ImageResources
.TISSUE_SAMPLE_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.TISSUE_SAMPLE_DERIVATE
);
420 else if(derivedUnit
.getRecordBasis()==SpecimenOrObservationType
.PreservedSpecimen
){
421 if(typeDesignations
.get(derivedUnit
)!=null && !typeDesignations
.get(derivedUnit
).isEmpty()){
422 return ImageResources
.getImage(ImageResources
.SPECIMEN_DERIVATE_TYPE
);
424 return hasCharacterData?ImageResources
.getImage(ImageResources
.SPECIMEN_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.SPECIMEN_DERIVATE
);
426 else if(derivedUnit
.getRecordBasis().isMedia()
427 || derivedUnit
.getRecordBasis().isKindOf(SpecimenOrObservationType
.Media
)){
428 if(derivedUnit
.getKindOfUnit()!=null){
429 if(derivedUnit
.getKindOfUnit().equals(getArtworkTerm())){
430 return hasCharacterData?ImageResources
.getImage(ImageResources
.ARTWORK_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.ARTWORK_DERIVATE
);
432 else if(derivedUnit
.getKindOfUnit().equals(getLivingPlantPhotoTerm())){
433 return hasCharacterData?ImageResources
.getImage(ImageResources
.LIVING_PLANT_PHOTO_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.LIVING_PLANT_PHOTO_DERIVATE
);
435 else if(derivedUnit
.getKindOfUnit().equals(getSpecimenScanTerm())){
436 return hasCharacterData?ImageResources
.getImage(ImageResources
.SPECIMEN_SCAN_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.SPECIMEN_SCAN_DERIVATE
);
438 else if(derivedUnit
.getKindOfUnit().equals(getDetailImageTerm())){
439 return hasCharacterData?ImageResources
.getImage(ImageResources
.DETAIL_IMAGE_DERIVATE_CHARACTER_DATA
):ImageResources
.getImage(ImageResources
.DETAIL_IMAGE_DERIVATE
);
444 else if(cdmBase
.isInstanceOf(Sequence
.class)){
445 return ImageResources
.getImage(ImageResources
.SEQUENCE_DERIVATE
);
448 else if(cdmBase
.isInstanceOf(SingleRead
.class)){
449 if(multiLinkSingleReads
!=null && multiLinkSingleReads
.contains(element
)){
450 return ImageResources
.getImage(ImageResources
.SINGLE_READ_DERIVATE_MULTILINK
);
453 return ImageResources
.getImage(ImageResources
.SINGLE_READ_DERIVATE
);
457 return ImageResources
.getImage(ImageResources
.DEFAULT_DERIVATIVE
);
460 public static Identifier
<DnaSample
> getCurrentSampleDesignation(CdmBase entity
) {
461 if(entity
.isInstanceOf(DnaSample
.class)){
462 DnaSample dnaSample
= HibernateProxyHelper
.deproxy(entity
, DnaSample
.class);
463 for (Identifier
<DnaSample
> identifier
: dnaSample
.getIdentifiers()) {
464 if(identifier
.getType()!=null && identifier
.getType().equals(DerivateLabelProvider
.getSampleDesignationTerm())){
465 //first sample designation is the current
470 else if(entity
.isInstanceOf(Sequence
.class)){
471 Sequence sequence
= HibernateProxyHelper
.deproxy(entity
, Sequence
.class);
472 if(sequence
.getDnaSample()!=null){
473 return getCurrentSampleDesignation(sequence
.getDnaSample());
479 private static void addTypeDesignation(DerivedUnit derivedUnit
, SpecimenTypeDesignation typeDesignation
){
480 Collection
<SpecimenTypeDesignation
> list
= typeDesignations
.get(derivedUnit
);
482 list
= new ArrayList
<SpecimenTypeDesignation
>();
484 list
.add(typeDesignation
);
485 typeDesignations
.put(derivedUnit
, list
);
488 public static Set
<SingleRead
> getMultiLinkSingleReads() {
489 return multiLinkSingleReads
;
492 public void updateLabelCache(Collection
<SpecimenOrObservationBase
<?
>> rootElements
) {
493 multiLinkSingleReads
= new HashSet
<SingleRead
>();
494 typeDesignations
= new HashMap
<DerivedUnit
, Collection
<SpecimenTypeDesignation
>>();
495 for(Entry
<SingleRead
, Collection
<Sequence
>> entry
:CdmStore
.getService(ISequenceService
.class).getSingleReadSequencesMap().entrySet()){
496 if(entry
.getValue().size()>1){
497 multiLinkSingleReads
.add(entry
.getKey());
500 if(rootElements
!=null){
501 Collection
<DerivedUnit
> derivedUnits
= new ArrayList
<DerivedUnit
>();
502 for (SpecimenOrObservationBase specimenOrObservationBase
: rootElements
) {
503 List
<DerivedUnit
> childUnits
= CdmStore
.getService(IOccurrenceService
.class).getAllChildDerivatives(specimenOrObservationBase
.getUuid());
504 if (childUnits
!= null){
505 derivedUnits
.addAll(childUnits
);
507 if(specimenOrObservationBase
.isInstanceOf(DerivedUnit
.class)){
508 specimenOrObservationBase
= CdmStore
.getService(IOccurrenceService
.class).load(specimenOrObservationBase
.getUuid());
509 if (specimenOrObservationBase
!= null){
510 derivedUnits
.add(HibernateProxyHelper
.deproxy(specimenOrObservationBase
, DerivedUnit
.class));
514 for (DerivedUnit derivedUnit
: derivedUnits
) {
515 if(!derivedUnit
.getSpecimenTypeDesignations().isEmpty()){
516 typeDesignations
.put(derivedUnit
, derivedUnit
.getSpecimenTypeDesignations());