derivates = CdmStore.getService(IOccurrenceService.class).load(new ArrayList(derivativeUuids), SPECIMEN_INIT_STRATEGY);
}
updateRootEntities(derivates);
- labelProvider.initCache(derivates);
previousCdmEntitySession.bind();
}
}
rootElements.add(specimen);
}
}
+ //FIXME: only init cache when elements have changed
+ labelProvider.initCache(rootElements);
viewer.setInput(rootElements);
}
boolean isType = false;
//type designation extension
- if(typeDesignations.get(derivedUnit)!=null){
+ if(typeDesignations.get(derivedUnit)!=null && !typeDesignations.get(derivedUnit).isEmpty()){
isType = true;
}
if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.FieldUnit){
return multiLinkSingleReads;
}
- public void initCache(List<SpecimenOrObservationBase> derivates) {
+ public void initCache(Collection<SpecimenOrObservationBase<?>> rootElements) {
DerivateLabelProvider.multiLinkSingleReads = new HashSet<SingleRead>();
DerivateLabelProvider.typeDesignations = new HashMap<DerivedUnit, Collection<SpecimenTypeDesignation>>();
for(Entry<SingleRead, Collection<Sequence>> entry:CdmStore.getService(ISequenceService.class).getSingleReadSequencesMap().entrySet()){
multiLinkSingleReads.add(entry.getKey());
}
}
- Collection<DerivedUnit> derivedUnits = new ArrayList<DerivedUnit>();
- for (SpecimenOrObservationBase specimenOrObservationBase : derivates) {
- if(specimenOrObservationBase.isInstanceOf(DerivedUnit.class)){
- derivedUnits.add(HibernateProxyHelper.deproxy(specimenOrObservationBase, DerivedUnit.class));
+ if(rootElements!=null){
+ Collection<DerivedUnit> derivedUnits = new ArrayList<DerivedUnit>();
+ for (SpecimenOrObservationBase specimenOrObservationBase : rootElements) {
+ derivedUnits.addAll(CdmStore.getService(IOccurrenceService.class).getAllChildDerivatives(specimenOrObservationBase.getUuid()));
+ if(specimenOrObservationBase.isInstanceOf(DerivedUnit.class)){
+ derivedUnits.add(HibernateProxyHelper.deproxy(specimenOrObservationBase, DerivedUnit.class));
+ }
}
+ typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(derivedUnits, null, null, null, null);
}
- typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(derivedUnits, null, null, null, null);
}
}