Project

General

Profile

« Previous | Next » 

Revision 8bdc4275

Added by Patrick Plitzner over 8 years ago

Refactoring type designation gathering according to model change

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientOccurenceService.java
1101 1101
        return defaultService.listTypeDesignations(arg0, arg1, arg2, arg3, arg4);
1102 1102
    }
1103 1103

  
1104
    @Override
1105
    public List<DerivedUnit> getAllChildDerivatives(UUID arg0) {
1106
        return defaultService.getAllChildDerivatives(arg0);
1107
    }
1108

  
1104 1109

  
1105 1110
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
238 238
                derivates = CdmStore.getService(IOccurrenceService.class).load(new ArrayList(derivativeUuids), SPECIMEN_INIT_STRATEGY);
239 239
            }
240 240
            updateRootEntities(derivates);
241
            labelProvider.initCache(derivates);
242 241
            previousCdmEntitySession.bind();
243 242
        }
244 243
    }
......
268 267
                    rootElements.add(specimen);
269 268
                }
270 269
            }
270
            //FIXME: only init cache when elements have changed
271
            labelProvider.initCache(rootElements);
271 272
            viewer.setInput(rootElements);
272 273

  
273 274
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java
354 354

  
355 355
                boolean isType = false;
356 356
                //type designation extension
357
                if(typeDesignations.get(derivedUnit)!=null){
357
                if(typeDesignations.get(derivedUnit)!=null && !typeDesignations.get(derivedUnit).isEmpty()){
358 358
                    isType = true;
359 359
                }
360 360
                if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.FieldUnit){
......
434 434
        return multiLinkSingleReads;
435 435
    }
436 436

  
437
    public void initCache(List<SpecimenOrObservationBase> derivates) {
437
    public void initCache(Collection<SpecimenOrObservationBase<?>> rootElements) {
438 438
        DerivateLabelProvider.multiLinkSingleReads = new HashSet<SingleRead>();
439 439
        DerivateLabelProvider.typeDesignations = new HashMap<DerivedUnit, Collection<SpecimenTypeDesignation>>();
440 440
        for(Entry<SingleRead, Collection<Sequence>> entry:CdmStore.getService(ISequenceService.class).getSingleReadSequencesMap().entrySet()){
......
442 442
                multiLinkSingleReads.add(entry.getKey());
443 443
            }
444 444
        }
445
        Collection<DerivedUnit> derivedUnits = new ArrayList<DerivedUnit>();
446
        for (SpecimenOrObservationBase specimenOrObservationBase : derivates) {
447
            if(specimenOrObservationBase.isInstanceOf(DerivedUnit.class)){
448
                derivedUnits.add(HibernateProxyHelper.deproxy(specimenOrObservationBase, DerivedUnit.class));
445
        if(rootElements!=null){
446
            Collection<DerivedUnit> derivedUnits = new ArrayList<DerivedUnit>();
447
            for (SpecimenOrObservationBase specimenOrObservationBase : rootElements) {
448
                derivedUnits.addAll(CdmStore.getService(IOccurrenceService.class).getAllChildDerivatives(specimenOrObservationBase.getUuid()));
449
                if(specimenOrObservationBase.isInstanceOf(DerivedUnit.class)){
450
                    derivedUnits.add(HibernateProxyHelper.deproxy(specimenOrObservationBase, DerivedUnit.class));
451
                }
449 452
            }
453
            typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(derivedUnits, null, null, null, null);
450 454
        }
451
        typeDesignations = CdmStore.getService(IOccurrenceService.class).listTypeDesignations(derivedUnits, null, null, null, null);
452 455
    }
453 456

  
454 457
}

Also available in: Unified diff