- fixed citation string and specimen determination string in portal assembly
authorPatric Plitzner <p.plitzner@bgbm.org>
Wed, 8 Apr 2015 13:06:30 +0000 (13:06 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Wed, 8 Apr 2015 13:06:30 +0000 (13:06 +0000)
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceImpl.java

index 50a8568d3111f632badf3dd80a6625eea03b4fd9..20350108205f86a92b875d8f9732bfda689dee03 100644 (file)
@@ -426,7 +426,7 @@ public class OccurrenceServiceImpl extends IdentifiableServiceBase<SpecimenOrObs
         assembleDerivateDataDTO(fieldUnitDTO, fieldUnit);\r
 \r
         //assemble citation\r
-        String citation = assembleCitation(fieldUnit);\r
+        String citation = fieldUnit.getTitleCache();\r
         if(!preservedSpecimenAccessionNumbers.isEmpty()){\r
             citation += " (";\r
             for(String accessionNumber:preservedSpecimenAccessionNumbers){\r
@@ -458,53 +458,6 @@ public class OccurrenceServiceImpl extends IdentifiableServiceBase<SpecimenOrObs
     }\r
 \r
 \r
-    /**\r
-     * @param fieldUnit\r
-     * @param fieldUnitDTO\r
-     * @param preservedSpecimenAccessionNumbers\r
-     * @param SEPARATOR_STRING\r
-     * @return\r
-     */\r
-    private String assembleCitation(FieldUnit fieldUnit) {\r
-        String citation = "";\r
-        if(fieldUnit.getGatheringEvent()!=null){\r
-            //Country\r
-            GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();\r
-            NamedArea country = gatheringEvent.getCountry();\r
-            String countryString = country!=null?country.getDescription():null;\r
-            citation += countryString+SEPARATOR_STRING;\r
-\r
-            //Collection\r
-            AgentBase collector = gatheringEvent.getCollector();\r
-            String fieldNumber = fieldUnit.getFieldNumber();\r
-            String collectionString = "";\r
-            if(collector!=null || fieldNumber!=null){\r
-                collectionString += collector!=null?collector:"";\r
-                if(!collectionString.isEmpty()){\r
-                    collectionString += " ";\r
-                }\r
-                collectionString += (fieldNumber!=null?fieldNumber:"");\r
-                collectionString.trim();\r
-            }\r
-            citation += collectionString;\r
-            if(fieldUnit.getGatheringEvent().getLocality()!=null){\r
-                citation += fieldUnit.getGatheringEvent().getLocality().getText();\r
-                citation += SEPARATOR_STRING;\r
-            }\r
-            if(fieldUnit.getGatheringEvent().getExactLocation()!=null\r
-                    && fieldUnit.getGatheringEvent().getExactLocation().getLatitude()!=null\r
-                    && fieldUnit.getGatheringEvent().getExactLocation().getLongitude()!=null){\r
-                citation += fieldUnit.getGatheringEvent().getExactLocation().getLatitude().toString();\r
-                citation += SEPARATOR_STRING;\r
-                citation += fieldUnit.getGatheringEvent().getExactLocation().getLongitude().toString();\r
-                citation += SEPARATOR_STRING;\r
-            }\r
-        }\r
-        citation = removeTail(citation, SEPARATOR_STRING);\r
-        return citation;\r
-    }\r
-\r
-\r
     @Override\r
     public PreservedSpecimenDTO assemblePreservedSpecimenDTO(DerivedUnit derivedUnit){\r
         return assemblePreservedSpecimenDTO(derivedUnit, null);\r
@@ -545,7 +498,7 @@ public class OccurrenceServiceImpl extends IdentifiableServiceBase<SpecimenOrObs
         //citation\r
         Collection<FieldUnit> fieldUnits = getFieldUnits(derivedUnit);\r
         if(fieldUnits.size()==1){\r
-            preservedSpecimenDTO.setCitation(assembleCitation(fieldUnits.iterator().next()));\r
+            preservedSpecimenDTO.setCitation(fieldUnits.iterator().next().getTitleCache());\r
         }\r
         else{\r
             preservedSpecimenDTO.setCitation("No Citation available. This specimen either has no or multiple field units.");\r
@@ -600,7 +553,7 @@ public class OccurrenceServiceImpl extends IdentifiableServiceBase<SpecimenOrObs
                     TaxonDescription taxonDescription = HibernateProxyHelper.deproxy(individualsAssociation.getInDescription(), TaxonDescription.class);\r
                     Taxon taxon = taxonDescription.getTaxon();\r
                     if(taxon!=null && taxon.getName()!=null){\r
-                        preservedSpecimenDTO.addAssociatedTaxon(taxon.getName().getFullTitleCache());\r
+                        preservedSpecimenDTO.addAssociatedTaxon(taxon.getName().getTitleCache());\r
                     }\r
                 }\r
             }\r