From: Patric Plitzner
Date: Tue, 5 Aug 2014 14:14:15 +0000 (+0000)
Subject: - enhanced DerivateHierarchyDTO data
X-Git-Tag: cdmlib-parent-3.4.0~127^2~84
X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/commitdiff_plain/7cf1fb235297a5c51ca2e1a78a7296031cb4b333
- enhanced DerivateHierarchyDTO data
---
diff --git a/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceImpl.java b/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceImpl.java
index 4c6a037b51..202715a323 100644
--- a/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceImpl.java
+++ b/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceImpl.java
@@ -64,6 +64,8 @@ import eu.etaxonomy.cdm.model.media.MediaRepresentation;
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
+import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
@@ -326,12 +328,21 @@ public class OccurrenceServiceImpl extends IdentifiableServiceBase typeSpecimenUUIDtoTypeDesignation = new HashMap();
//types
- TaxonNameBase name = associatedTaxon.getName();
- dto.setHasType(!name.getTypeDesignations().isEmpty());
+ TaxonNameBase,?> name = associatedTaxon.getName();
+ Set> typeDesignations = name.getSpecimenTypeDesignations();
+ for (Object object : typeDesignations) {
+ if(object instanceof SpecimenTypeDesignation){
+ SpecimenTypeDesignation specimenTypeDesignation = (SpecimenTypeDesignation)object;
+ DerivedUnit typeSpecimen = specimenTypeDesignation.getTypeSpecimen();
+ typeSpecimenUUIDtoTypeDesignation.put(typeSpecimen.getUuid(), specimenTypeDesignation);
+ }
+ }
if(fieldUnit.getGatheringEvent()!=null){
GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
@@ -351,6 +362,8 @@ public class OccurrenceServiceImpl extends IdentifiableServiceBase collectionToCountMap = new HashMap();
+ //Type map
+ Map> typeStatusToAccessionNumber = new HashMap>();
//iterate over sub derivates
for (DerivedUnit derivedUnit : derivedUnits) {
@@ -371,6 +384,14 @@ public class OccurrenceServiceImpl extends IdentifiableServiceBase e:collectionToCountMap.entrySet()){
eu.etaxonomy.cdm.model.occurrence.Collection collection = e.getKey();
if(collection.getCode()!=null){
@@ -437,13 +464,12 @@ public class OccurrenceServiceImpl extends IdentifiableServiceBase1){
herbariaString += "("+e.getValue()+")";
}
- herbariaString += herbariaSeparator;
+ herbariaString += separator;
}
- if(herbariaString.endsWith(herbariaSeparator)){
- herbariaString = herbariaString.substring(0, herbariaString.length()-herbariaSeparator.length());
+ if(herbariaString.endsWith(separator)){
+ herbariaString = herbariaString.substring(0, herbariaString.length()-separator.length());
}
dto.setHerbarium(herbariaString);
- dto.setCitation(citation);
return dto;
}
diff --git a/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/DerivateHierarchyDTO.java b/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/DerivateHierarchyDTO.java
index 3f80245bbf..e94879b69f 100644
--- a/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/DerivateHierarchyDTO.java
+++ b/cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/DerivateHierarchyDTO.java
@@ -23,7 +23,7 @@ public class DerivateHierarchyDTO {
private String taxonName;
private String protologue;
private String citation;
- private List types;
+ private Map> types;
private Map specimenScans;
private Map molecularData;
private Map detailImages;
@@ -159,24 +159,28 @@ public class DerivateHierarchyDTO {
public void setCitation(String citation) {
this.citation = citation;
}
+
/**
- * @return the types
+ * @param types the types to set
*/
- public List getTypes() {
- return types;
+ public void setTypes(Map> types) {
+ this.types = types;
}
/**
- * @param types the types to set
+ * @return the types
*/
- public void setTypes(List types) {
- this.types = types;
+ public Map> getTypes() {
+ return types;
}
-
- public void addTypes(String uri){
+ public void addTypes(String typeStatus, String accessionNumber){
if(types==null){
- types = new ArrayList();
+ types = new HashMap>();
+ }
+ List list = types.get(typeStatus);
+ if(list==null){
+ list = new ArrayList();
}
- types.add(uri);
+ list.add(accessionNumber);
}
/**
* @return the specimenScans