Project

General

Profile

Revision b0412410

IDb0412410c4f965c82ffffbe5321f96c25e72a977
Parent 4855bbd5
Child 592f88ca

Added by Katja Luther over 3 years ago

move getFieldUnits to findFieldUnits

View differences:

cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/specimen/abcd206/in/AbcdGgbnImportTest.java
498 498
	    assertEquals("Wrong number of originals", 1, dnaSample.getDerivedFrom().getOriginals().size());
499 499

  
500 500
	    FieldUnit specimenFieldUnit = (FieldUnit) occurrenceService.load(fieldUnit1Uuid);
501
	    Collection<FieldUnit> fieldUnits = occurrenceService.getFieldUnits(dnaSample.getUuid(), null);
501
	    Collection<FieldUnit> fieldUnits = occurrenceService.findFieldUnits(dnaSample.getUuid(), null);
502 502
	    assertEquals(1, fieldUnits.size());
503 503
	    FieldUnit dnaSampleFieldUnit = fieldUnits.iterator().next();
504 504
        assertEquals(specimenFieldUnit, dnaSampleFieldUnit);
......
558 558

  
559 559
	    assertEquals("Wrong number of originals", 1, dnaSample.getDerivedFrom().getOriginals().size());
560 560
        FieldUnit specimenFieldUnit = (FieldUnit) occurrenceService.load(fieldUnit1Uuid);
561
        Collection<FieldUnit> fieldUnits = occurrenceService.getFieldUnits(dnaSample.getUuid(), null);
561
        Collection<FieldUnit> fieldUnits = occurrenceService.findFieldUnits(dnaSample.getUuid(), null);
562 562
        assertEquals(1, fieldUnits.size());
563 563
        FieldUnit dnaSampleFieldUnit = fieldUnits.iterator().next();
564 564
        assertEquals(specimenFieldUnit, dnaSampleFieldUnit);
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IOccurrenceService.java
16 16
import java.util.Set;
17 17
import java.util.UUID;
18 18

  
19
import org.apache.lucene.index.CorruptIndexException;
19 20
import org.hibernate.search.spatial.impl.Rectangle;
20 21
import org.springframework.transaction.annotation.Transactional;
21 22

  
......
34 35
import eu.etaxonomy.cdm.model.description.DescriptionBase;
35 36
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
36 37
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
38
import eu.etaxonomy.cdm.model.description.TaxonDescription;
37 39
import eu.etaxonomy.cdm.model.location.Country;
38 40
import eu.etaxonomy.cdm.model.media.Media;
39 41
import eu.etaxonomy.cdm.model.molecular.DnaSample;
40 42
import eu.etaxonomy.cdm.model.molecular.Sequence;
43
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
41 44
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
42 45
import eu.etaxonomy.cdm.model.name.TaxonName;
43 46
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
44 47
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
45 48
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
46 49
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
50
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
51
import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
47 52
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
53
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
48 54
import eu.etaxonomy.cdm.model.taxon.Taxon;
49 55
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
56
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
57
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
58
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
50 59
import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
51 60
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
52 61
import eu.etaxonomy.cdm.persistence.query.OrderHint;
......
336 345
     * @return either a collection of FieldUnits this specimen was derived from, the FieldUnit itself
337 346
     * if this was a FieldUnit or an empty collection if no FieldUnits were found
338 347
     */
339
    public Collection<FieldUnit> getFieldUnits(UUID specimenUuid, List<String> propertyPaths);
348
    public Collection<FieldUnit> findFieldUnits(UUID specimenUuid, List<String> propertyPaths);
340 349

  
341 350
    /**
342 351
     * @param clazz
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceImpl.java
379 379
        Set<UUID> fieldUnitUuids = new HashSet<>();
380 380
        List<SpecimenOrObservationBase> records = listByAssociatedTaxon(null, includeRelationships, associatedTaxon, maxDepth, null, null, orderHints, propertyPaths);
381 381
        for (SpecimenOrObservationBase<?> specimen : records) {
382
            for (FieldUnit fieldUnit : getFieldUnits(specimen.getUuid(), null)) {
382
            for (FieldUnit fieldUnit : findFieldUnits(specimen.getUuid(), null)) {
383 383
                fieldUnitUuids.add(fieldUnit.getUuid());
384 384
            }
385 385
        }
......
863 863

  
864 864

  
865 865
    @Override
866
    public Collection<FieldUnit> getFieldUnits(UUID derivedUnitUuid, List<String> propertyPaths) {
866
    public Collection<FieldUnit> findFieldUnits(UUID derivedUnitUuid, List<String> propertyPaths) {
867 867
        //It will search recursively over all {@link DerivationEvent}s and get the "originals" ({@link SpecimenOrObservationBase})
868 868
        //from which this DerivedUnit was derived until all FieldUnits are found.
869 869

  
......
1513 1513
    @Override
1514 1514
    public List<SpecimenOrObservationBase<?>> getAllHierarchyDerivatives(SpecimenOrObservationBase<?> specimen){
1515 1515
        List<SpecimenOrObservationBase<?>> allHierarchyDerivatives = new ArrayList<>();
1516
        Collection<FieldUnit> fieldUnits = getFieldUnits(specimen.getUuid(), null);
1516
        Collection<FieldUnit> fieldUnits = findFieldUnits(specimen.getUuid(), null);
1517 1517
        if(fieldUnits.isEmpty()){
1518 1518
            allHierarchyDerivatives.add(specimen);
1519 1519
            allHierarchyDerivatives.addAll(getAllChildDerivatives(specimen));

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)