Revision aa52b6f0
Added by Andreas Kohlbecker over 2 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/DerivedUnitDTO.java | ||
---|---|---|
88 | 88 |
// return newInstance; |
89 | 89 |
// } |
90 | 90 |
|
91 |
/** |
|
92 |
* Constructs a new DerivedUnitDTO. All derivatives of the passed <code>DerivedUnit entity</code> will be collected and |
|
93 |
* added as DerivedUnitDTO to the {@link SpecimenOrObservationBaseDTO#getDerivates() derivative DTOs}. |
|
94 |
* |
|
95 |
* @param entity |
|
96 |
* The entity to create the dto for |
|
97 |
* |
|
98 |
* @return <code>null</code> or the new DerivedUnitDTO |
|
99 |
*/ |
|
91 | 100 |
public static DerivedUnitDTO fromEntity(DerivedUnit entity){ |
92 | 101 |
return fromEntity(entity, null); |
93 | 102 |
} |
94 | 103 |
/** |
95 |
|
|
96 | 104 |
* @param entity |
97 | 105 |
* The entity to create the dto for |
98 | 106 |
* @param individualsAssociations |
... | ... | |
100 | 108 |
* action, since individualsAssociations are not accessible from the DerivedUnit side. A service level method call is needed to |
101 | 109 |
* retrieve them, so it would be required to access the OccurrenceServiceImpl from inside of this DTO factory method, which is |
102 | 110 |
* bad OO design. The other option is implemented here, requires all calling Objects to pass the IndividualsAssociations as parameter. |
103 |
* @return |
|
104 |
* |
|
111 |
* @return <code>null</code> or the new DerivedUnitDTO |
|
105 | 112 |
* @deprecated see comment on the parameter <code>individualsAssociations</code> |
106 | 113 |
*/ |
107 | 114 |
@Deprecated |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/FieldUnitDTO.java | ||
---|---|---|
114 | 114 |
// List of accession numbers for citation |
115 | 115 |
List<String> preservedSpecimenAccessionNumbers = new ArrayList<>(); |
116 | 116 |
|
117 |
// assemble preserved specimen DTOs |
|
117 |
// NOTE! |
|
118 |
// the derivation graph seems to be walked two time in here |
|
119 |
// 1. below in the for |
|
120 |
// assemble DerivedUnitDTOs |
|
118 | 121 |
Set<DerivationEvent> derivationEvents = fieldUnit.getDerivationEvents(); |
119 | 122 |
for (DerivationEvent derivationEvent : derivationEvents) { |
120 | 123 |
Set<DerivedUnit> derivatives = derivationEvent.getDerivatives(); |
... | ... | |
142 | 145 |
collectionToCountMap.put(collection, herbariumCount + 1); |
143 | 146 |
} |
144 | 147 |
if (specimenOrObservationTypeFilter.contains(derivedUnit.getRecordBasis())) { |
148 |
// FIXME should'nt the specimenOrObservationTypeFilter be also passed |
|
149 |
// to the DerivedUnitDTO factory method? |
|
145 | 150 |
DerivedUnitDTO derivedUnitDTO = DerivedUnitDTO.fromEntity(derivedUnit, null); |
146 | 151 |
addDerivate(derivedUnitDTO); |
147 | 152 |
setHasCharacterData(isHasCharacterData() || derivedUnitDTO.isHasCharacterData()); |
Also available in: Unified diff
ref #9257 comments including questions on missing filtering in the DrivedUnitDTO construction