public Collection<SpecimenNodeWrapper> loadSpecimens(DescriptiveDataSet descriptiveDataSet){
List<UUID> filteredNodes = findFilteredTaxonNodes(descriptiveDataSet);
if(filteredNodes.isEmpty()){
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
Collection<SpecimenNodeWrapper> result = occurrenceService.listUuidAndTitleCacheByAssociatedTaxon(filteredNodes, null, null);
SpecimenOrObservationBase specimen = description.getDescribedSpecimenOrObservation();
//get taxon node
+ @SuppressWarnings("unchecked")
Set<IndividualsAssociation> associations = (Set<IndividualsAssociation>)descriptiveDataSet.getDescriptions()
.stream()
.flatMap(desc->desc.getElements().stream())// put all description element in one stream
specimenDescription = SpecimenDescription.NewInstance(specimen);
specimenDescription.setUuid(specimenDescriptionUuid);
List<DescriptionElementDto> elementDtos = descriptionDto.getElements();
- List<DescriptionElementBase> elements = new ArrayList<>();
+
for (DescriptionElementDto elementDto: elementDtos){
if (elementDto instanceof CategoricalDataDto){
eu.etaxonomy.cdm.model.description.Character feature = DefinedTermBase.getTermByClassAndUUID(eu.etaxonomy.cdm.model.description.Character.class, elementDto.getFeatureUuid());
}
}
- if(wrapper==null){
- result.addException(new IllegalArgumentException("Could not create wrapper for "+wrapper.getDescription()));
- continue;
- }
+
//add specimen description to data set
specimenDescription.addDescriptiveDataSet(dataSet);
return null;
}
else{
- if (fieldUnits != null && fieldUnits.size()>0){
+ if (fieldUnits.size()>0){
fieldUnit = fieldUnits.iterator().next();
}
}
boolean success = dataSet.removeDescription(description);
result.addDeletedObject(description);// remove taxon description with IndividualsAssociation from data set
if(description instanceof SpecimenDescription){
- @SuppressWarnings("cast")
+ @SuppressWarnings("unchecked")
Set<IndividualsAssociation> associations = (Set<IndividualsAssociation>)dataSet.getDescriptions()
.stream()
.flatMap(desc->desc.getElements().stream())// put all description element in one stream
.filter(element->element instanceof IndividualsAssociation)
.map(ia->(IndividualsAssociation)ia)
.collect(Collectors.toSet());
- Classification classification = dataSet.getTaxonSubtreeFilter().iterator().next().getClassification();
+
for (IndividualsAssociation individualsAssociation : associations) {
if(individualsAssociation.getAssociatedSpecimenOrObservation().equals(description.getDescribedSpecimenOrObservation())){
dataSet.removeDescription(individualsAssociation.getInDescription());
}
}
if (description instanceof TaxonDescription){
- UUID taxonUuid = ((TaxonDescription)description).getTaxon().getUuid();
DeleteResult isDeletable = descriptionService.isDeletable(description.getUuid());
for (CdmBase relatedCdmBase: isDeletable.getRelatedObjects()){
if (relatedCdmBase instanceof CdmLinkSource){
}
- UUID uuid = dao.delete(dataSet);
+ dao.delete(dataSet);
monitor.worked(1);
monitor.done();
result.includeResult(descriptionResult);