Revision a9527b12
Added by Andreas Kohlbecker over 3 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceImpl.java | ||
---|---|---|
399 | 399 |
return derivedUnitDTO; |
400 | 400 |
} |
401 | 401 |
|
402 |
private Set<SpecimenOrObservationBaseDTO> getDerivedUnitDTOsFor(SpecimenOrObservationBaseDTO specimenDto, DerivedUnit specimen, HashMap<UUID, SpecimenOrObservationBaseDTO> alreadyCollectedSpecimen) {
|
|
403 |
Set<SpecimenOrObservationBaseDTO> derivedUnits = new HashSet<>();
|
|
404 |
// load |
|
402 |
private Set<DerivedUnitDTO> getDerivedUnitDTOsFor(SpecimenOrObservationBaseDTO specimenDto, DerivedUnit specimen, HashMap<UUID, SpecimenOrObservationBaseDTO> alreadyCollectedSpecimen) {
|
|
403 |
Set<DerivedUnitDTO> derivedUnits = new HashSet<>();
|
|
404 |
|
|
405 | 405 |
for (DerivationEvent derivationEvent : specimen.getDerivationEvents()) { |
406 | 406 |
for (DerivedUnit derivative : derivationEvent.getDerivatives()) { |
407 | 407 |
if (!alreadyCollectedSpecimen.containsKey(specimenDto.getUuid())){ |
... | ... | |
517 | 517 |
for (SpecimenOrObservationBase<?> o : perTaxonOccurrences) { |
518 | 518 |
if (o.isInstanceOf(DerivedUnit.class)){ |
519 | 519 |
DerivedUnit derivedUnit; |
520 |
SpecimenOrObservationBaseDTO derivedUnitDTO;
|
|
520 |
DerivedUnitDTO derivedUnitDTO;
|
|
521 | 521 |
if (o.isInstanceOf(DnaSample.class)) { |
522 | 522 |
derivedUnit = HibernateProxyHelper.deproxy(o, DnaSample.class); |
523 | 523 |
derivedUnitDTO = new DNASampleDTO(derivedUnit); |
... | ... | |
548 | 548 |
List<String> propertyPaths) { |
549 | 549 |
|
550 | 550 |
DnaSample dnaSample = dao.findByGeneticAccessionNumber(accessionNumberString, propertyPaths); |
551 |
SpecimenOrObservationBaseDTO derivedUnitDTO;
|
|
551 |
DerivedUnitDTO derivedUnitDTO;
|
|
552 | 552 |
HashMap<UUID, SpecimenOrObservationBaseDTO> alreadyCollectedSpecimen = new HashMap<>(); |
553 | 553 |
List<FieldUnitDTO> fieldUnitDTOs = new ArrayList<>(); |
554 | 554 |
if (dnaSample != null){ |
... | ... | |
659 | 659 |
|
660 | 660 |
@Override |
661 | 661 |
@Transactional(readOnly=true) |
662 |
public FieldUnitDTO findFieldUnitDTO(SpecimenOrObservationBaseDTO derivedUnitDTO, Collection<FieldUnitDTO> fieldUnits,
|
|
662 |
public FieldUnitDTO findFieldUnitDTO(DerivedUnitDTO derivedUnitDTO, Collection<FieldUnitDTO> fieldUnits,
|
|
663 | 663 |
HashMap<UUID, SpecimenOrObservationBaseDTO> alreadyCollectedSpecimen) { |
664 | 664 |
//It will search recursively over all {@link DerivationEvent}s and get the "originals" ({@link SpecimenOrObservationBase}) |
665 | 665 |
//from which this DerivedUnit was derived until all FieldUnits are found. |
... | ... | |
695 | 695 |
fieldUnitDto.addDerivate(derivedUnitDTO); |
696 | 696 |
fieldUnits.add(fieldUnitDto); |
697 | 697 |
}else{ |
698 |
SpecimenOrObservationBaseDTO originalDTO;
|
|
698 |
DerivedUnitDTO originalDTO;
|
|
699 | 699 |
if (specimen instanceof DnaSample){ |
700 | 700 |
originalDTO = new DNASampleDTO((DnaSample)specimen); |
701 | 701 |
} else { |
... | ... | |
721 | 721 |
public FieldUnitDTO loadFieldUnitDTO(UUID derivedUnitUuid) { |
722 | 722 |
|
723 | 723 |
FieldUnitDTO fieldUnitDTO = null; |
724 |
SpecimenOrObservationBaseDTO derivedUnitDTO = null;
|
|
724 |
DerivedUnitDTO derivedUnitDTO = null;
|
|
725 | 725 |
|
726 | 726 |
Map<UUID, SpecimenOrObservationBaseDTO> cycleDetectionMap = new HashMap<>(); |
727 | 727 |
SpecimenOrObservationBase derivative = dao.load(derivedUnitUuid); |
... | ... | |
776 | 776 |
} |
777 | 777 |
break; |
778 | 778 |
}else{ |
779 |
// So this must be a DerivedUnitDTO |
|
779 | 780 |
if (derivedUnitDTO == null){ |
780 |
derivedUnitDTO = originalDTO; |
|
781 |
derivedUnitDTO = (DerivedUnitDTO)originalDTO;
|
|
781 | 782 |
} else { |
782 | 783 |
originalDTO.addDerivate(derivedUnitDTO); |
783 |
derivedUnitDTO = originalDTO; |
|
784 |
derivedUnitDTO = (DerivedUnitDTO)originalDTO;
|
|
784 | 785 |
} |
785 | 786 |
} |
786 | 787 |
} |
Also available in: Unified diff
ref #9252 determinig hasTypes from actual data and fixing type probelms in methods