import java.util.ArrayList;\r
import java.util.Arrays;\r
import java.util.Collection;\r
+import java.util.Collections;\r
import java.util.HashMap;\r
import java.util.HashSet;\r
import java.util.List;\r
import org.hibernate.search.spatial.impl.Rectangle;\r
import org.joda.time.Partial;\r
import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.dao.DataRetrievalFailureException;\r
import org.springframework.stereotype.Service;\r
import org.springframework.transaction.annotation.Transactional;\r
\r
import eu.etaxonomy.cdm.api.service.UpdateResult.Status;\r
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;\r
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;\r
-import eu.etaxonomy.cdm.api.service.dto.DerivateHierarchyDTO;\r
-import eu.etaxonomy.cdm.api.service.dto.DerivateHierarchyDTO.ContigFile;\r
-import eu.etaxonomy.cdm.api.service.dto.DerivateHierarchyDTO.MolecularData;\r
+import eu.etaxonomy.cdm.api.service.dto.DerivateDTO;\r
+import eu.etaxonomy.cdm.api.service.dto.DerivateDataDTO;\r
+import eu.etaxonomy.cdm.api.service.dto.DerivateDataDTO.ContigFile;\r
+import eu.etaxonomy.cdm.api.service.dto.DerivateDataDTO.MolecularData;\r
+import eu.etaxonomy.cdm.api.service.dto.FieldUnitDTO;\r
+import eu.etaxonomy.cdm.api.service.dto.PreservedSpecimenDTO;\r
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;\r
import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;\r
import eu.etaxonomy.cdm.api.service.pager.Pager;\r
import eu.etaxonomy.cdm.model.common.ICdmBase;\r
import eu.etaxonomy.cdm.model.common.Language;\r
import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;\r
+import eu.etaxonomy.cdm.model.description.CategoricalData;\r
import eu.etaxonomy.cdm.model.description.DescriptionBase;\r
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;\r
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;\r
+import eu.etaxonomy.cdm.model.description.QuantitativeData;\r
import eu.etaxonomy.cdm.model.description.SpecimenDescription;\r
import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
import eu.etaxonomy.cdm.model.location.Country;\r
import eu.etaxonomy.cdm.model.molecular.SingleRead;\r
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;\r
import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
-import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;\r
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;\r
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;\r
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;\r
}\r
\r
@Override\r
- public DerivateHierarchyDTO assembleDerivateHierarchyDTO(FieldUnit fieldUnit, UUID associatedTaxonUuid){\r
+ public FieldUnitDTO assembleFieldUnitDTO(FieldUnit fieldUnit, UUID associatedTaxonUuid){\r
\r
if(!getSession().contains(fieldUnit)){\r
fieldUnit = (FieldUnit) load(fieldUnit.getUuid());\r
}\r
TaxonBase associatedTaxon = taxonService.load(associatedTaxonUuid);\r
\r
- DerivateHierarchyDTO dto = new DerivateHierarchyDTO();\r
- Map<UUID, TypeDesignationStatusBase> typeSpecimenUUIDtoTypeDesignationStatus = new HashMap<UUID, TypeDesignationStatusBase>();\r
-\r
- //gather types for this taxon name\r
- TaxonNameBase<?,?> name = associatedTaxon.getName();\r
- Set<?> typeDesignations = name.getSpecimenTypeDesignations();\r
- for (Object object : typeDesignations) {\r
- if(object instanceof CdmBase && ((CdmBase)object).isInstanceOf(SpecimenTypeDesignation.class)){\r
- SpecimenTypeDesignation specimenTypeDesignation = HibernateProxyHelper.deproxy(object, SpecimenTypeDesignation.class);\r
- DerivedUnit typeSpecimen = specimenTypeDesignation.getTypeSpecimen();\r
- final TypeDesignationStatusBase typeStatus = specimenTypeDesignation.getTypeStatus();\r
- typeSpecimenUUIDtoTypeDesignationStatus.put(typeSpecimen.getUuid(), typeStatus);\r
- }\r
- }\r
+ FieldUnitDTO fieldUnitDTO = new FieldUnitDTO();\r
\r
if(fieldUnit.getGatheringEvent()!=null){\r
GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();\r
//Country\r
final NamedArea country = gatheringEvent.getCountry();\r
- dto.setCountry(country!=null?country.getDescription():"");\r
+ fieldUnitDTO.setCountry(country!=null?country.getDescription():"");\r
//Collection\r
final AgentBase collector = gatheringEvent.getCollector();\r
final String fieldNumber = fieldUnit.getFieldNumber();\r
- dto.setCollection(((collector!=null?collector:"") + " " + (fieldNumber!=null?fieldNumber:"")).trim());\r
+ fieldUnitDTO.setCollection(((collector!=null?collector:"") + " " + (fieldNumber!=null?fieldNumber:"")).trim());\r
//Date\r
final Partial gatheringDate = gatheringEvent.getGatheringDate();\r
- dto.setDate(gatheringDate!=null?gatheringDate.toString():"");\r
+ fieldUnitDTO.setDate(gatheringDate!=null?gatheringDate.toString():"");\r
}\r
\r
//Taxon Name\r
- dto.setTaxonName(associatedTaxon.getName().getFullTitleCache());\r
+ fieldUnitDTO.setTaxonName(associatedTaxon.getName().getFullTitleCache());\r
\r
\r
- Collection<DerivedUnit> derivedUnits = new ArrayList<DerivedUnit>();\r
- getDerivedUnitsFor(fieldUnit, derivedUnits);\r
-\r
//Herbaria map\r
Map<eu.etaxonomy.cdm.model.occurrence.Collection, Integer> collectionToCountMap = new HashMap<eu.etaxonomy.cdm.model.occurrence.Collection, Integer>();\r
//List of accession numbers for citation\r
List<String> preservedSpecimenAccessionNumbers = new ArrayList<String>();\r
\r
- //iterate over sub derivates\r
- for (DerivedUnit derivedUnit : derivedUnits) {\r
+ //assemble preserved specimen DTOs\r
+ Set<DerivationEvent> derivationEvents = fieldUnit.getDerivationEvents();\r
+ for (DerivationEvent derivationEvent : derivationEvents) {\r
+ Set<DerivedUnit> derivatives = derivationEvent.getDerivatives();\r
+ for (DerivedUnit derivedUnit : derivatives) {\r
+ if(derivedUnit.getRecordBasis().equals(SpecimenOrObservationType.PreservedSpecimen)){\r
+ PreservedSpecimenDTO preservedSpecimenDTO = assemblePreservedSpecimenDTO(derivedUnit, fieldUnitDTO);\r
+ fieldUnitDTO.addPreservedSpecimenDTO(preservedSpecimenDTO);\r
+ fieldUnitDTO.setHasCharacterData(preservedSpecimenDTO.isHasCharacterData());\r
+ fieldUnitDTO.setHasDetailImage(preservedSpecimenDTO.isHasDetailImage());\r
+ fieldUnitDTO.setHasDna(preservedSpecimenDTO.isHasDna());\r
+ fieldUnitDTO.setHasSpecimenScan(preservedSpecimenDTO.isHasSpecimenScan());\r
+ }\r
+ }\r
+ }\r
+ //assemble derivate data DTO\r
+ assembleDerivateDataDTO(fieldUnitDTO, fieldUnit);\r
+\r
+ final String separator = ", ";\r
+ //assemble citation\r
+ String citation = "";\r
+ citation += !fieldUnitDTO.getCountry().isEmpty()?fieldUnitDTO.getCountry()+separator:"";\r
+ if(fieldUnit.getGatheringEvent()!=null){\r
+ if(fieldUnit.getGatheringEvent().getLocality()!=null){\r
+ citation += fieldUnit.getGatheringEvent().getLocality().getText();\r
+ citation += separator;\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;\r
+ citation += fieldUnit.getGatheringEvent().getExactLocation().getLongitude().toString();\r
+ citation += separator;\r
+ }\r
+ }\r
+ citation += !fieldUnitDTO.getCollection().isEmpty()?fieldUnitDTO.getCollection():"";\r
+ if(!preservedSpecimenAccessionNumbers.isEmpty()){\r
+ citation += " (";\r
+ for(String accessionNumber:preservedSpecimenAccessionNumbers){\r
+ if(!accessionNumber.isEmpty()){\r
+ citation += accessionNumber+separator;\r
+ }\r
+ }\r
+ citation = removeTail(citation, separator);\r
+ citation += ")";\r
+ }\r
+ citation = removeTail(citation, separator);\r
+ fieldUnitDTO.setCitation(citation);\r
+\r
+ //assemble herbaria string\r
+ String herbariaString = "";\r
+ for(Entry<eu.etaxonomy.cdm.model.occurrence.Collection, Integer> e:collectionToCountMap.entrySet()){\r
+ eu.etaxonomy.cdm.model.occurrence.Collection collection = e.getKey();\r
+ if(collection.getCode()!=null){\r
+ herbariaString += collection.getCode();\r
+ }\r
+ if(e.getValue()>1){\r
+ herbariaString += "("+e.getValue()+")";\r
+ }\r
+ herbariaString += separator;\r
+ }\r
+ herbariaString = removeTail(herbariaString, separator);\r
+ fieldUnitDTO.setHerbarium(herbariaString);\r
+\r
+ return fieldUnitDTO;\r
+ }\r
+\r
+\r
+ @Override\r
+ public PreservedSpecimenDTO assemblePreservedSpecimenDTO(DerivedUnit derivedUnit){\r
+ return assemblePreservedSpecimenDTO(derivedUnit, null);\r
+ }\r
+\r
+ public PreservedSpecimenDTO assemblePreservedSpecimenDTO(DerivedUnit derivedUnit, FieldUnitDTO hierarchyDTO){\r
+ PreservedSpecimenDTO preservedSpecimenDTO = new PreservedSpecimenDTO();\r
+ preservedSpecimenDTO.setAccessionNumber(derivedUnit.getAccessionNumber());\r
+\r
+ //character state data\r
+ Collection<DescriptionElementBase> characterDataForSpecimen = getCharacterDataForSpecimen(derivedUnit);\r
+ if(!characterDataForSpecimen.isEmpty()){\r
+ if(hierarchyDTO!=null){\r
+ hierarchyDTO.setHasCharacterData(true);\r
+ }\r
+ }\r
+ for (DescriptionElementBase descriptionElementBase : characterDataForSpecimen) {\r
+ String character = descriptionElementBase.getFeature().getLabel();\r
+ ArrayList<Language> languages = new ArrayList<Language>(Collections.singleton(Language.DEFAULT()));\r
+ if(descriptionElementBase instanceof QuantitativeData){\r
+ QuantitativeData quantitativeData = (QuantitativeData)descriptionElementBase;\r
+ DefaultQuantitativeDescriptionBuilder builder = new DefaultQuantitativeDescriptionBuilder();\r
+ String state = builder.build(quantitativeData, languages).getText(Language.DEFAULT());\r
+ preservedSpecimenDTO.addCharacterData(character, state);\r
+ }\r
+ else if(descriptionElementBase instanceof CategoricalData){\r
+ CategoricalData categoricalData = (CategoricalData)descriptionElementBase;\r
+ DefaultCategoricalDescriptionBuilder builder = new DefaultCategoricalDescriptionBuilder();\r
+ String state = builder.build(categoricalData, languages).getText(Language.DEFAULT());\r
+ preservedSpecimenDTO.addCharacterData(character, state);\r
+ }\r
+ }\r
+ //check if derived unit is a type\r
+ Collection<SpecimenTypeDesignation> specimenTypeDesignations = listTypeDesignations(derivedUnit, null, null, null, null);\r
+ for (SpecimenTypeDesignation specimenTypeDesignation : specimenTypeDesignations) {\r
+ if(hierarchyDTO!=null){\r
+ hierarchyDTO.setHasType(true);\r
+ }\r
+ preservedSpecimenDTO.addType(specimenTypeDesignation.getTypeStatus().getLabel());\r
+ }\r
+ //assemble sub derivates\r
+ preservedSpecimenDTO.setDerivateDataDTO(assembleDerivateDataDTO(preservedSpecimenDTO, derivedUnit));\r
+ return preservedSpecimenDTO;\r
+ }\r
+\r
+ /**\r
+ * @param derivedUnit\r
+ * @param derivateDataDTO\r
+ * @return\r
+ */\r
+ private DerivateDataDTO assembleDerivateDataDTO(DerivateDTO derivateDTO, SpecimenOrObservationBase<?> specimenOrObservation) {\r
+ DerivateDataDTO derivateDataDTO = new DerivateDataDTO();\r
+ Collection<DerivedUnit> childDerivates = getDerivedUnitsFor(specimenOrObservation);\r
+ for (DerivedUnit childDerivate : childDerivates) {\r
//current accession number\r
- String currentAccessionNumber = derivedUnit.getAccessionNumber()!=null?derivedUnit.getAccessionNumber():"";\r
+ String currentAccessionNumber = childDerivate.getAccessionNumber()!=null?childDerivate.getAccessionNumber():"";\r
//current herbarium\r
String currentHerbarium = "";\r
- eu.etaxonomy.cdm.model.occurrence.Collection collection = derivedUnit.getCollection();\r
+ eu.etaxonomy.cdm.model.occurrence.Collection collection = childDerivate.getCollection();\r
if(collection!=null){\r
currentHerbarium = collection.getCode()!=null?collection.getCode():"";\r
- //count herbaria\r
- Integer count = collectionToCountMap.get(collection);\r
- if(count==null){\r
- count = 1;\r
- }\r
- else{\r
- count++;\r
- }\r
- collectionToCountMap.put(collection, count);\r
- }\r
- //check if derived unit is a type\r
- if(typeSpecimenUUIDtoTypeDesignationStatus.keySet().contains(derivedUnit.getUuid())){\r
- dto.setHasType(true);\r
- TypeDesignationStatusBase typeDesignationStatus = typeSpecimenUUIDtoTypeDesignationStatus.get(derivedUnit.getUuid());\r
- String typeStatus = typeDesignationStatus.getLabel();\r
- dto.addTypes(typeStatus, currentAccessionNumber);\r
}\r
//assemble molecular data\r
//pattern: DNAMarker [contig1, primer1_1, primer1_2, ...][contig2, primer2_1, ...]...\r
- if(derivedUnit.isInstanceOf(DnaSample.class)){\r
- if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.TissueSample){\r
+ if(childDerivate.isInstanceOf(DnaSample.class)){\r
+ if(childDerivate.getRecordBasis()==SpecimenOrObservationType.TissueSample){\r
//TODO implement TissueSample assembly for web service\r
}\r
- if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.DnaSample){\r
+ if(childDerivate.getRecordBasis()==SpecimenOrObservationType.DnaSample){\r
\r
- DnaSample dna = HibernateProxyHelper.deproxy(derivedUnit, DnaSample.class);\r
+ DnaSample dna = HibernateProxyHelper.deproxy(childDerivate, DnaSample.class);\r
if(!dna.getSequences().isEmpty()){\r
- dto.setHasDna(true);\r
+ derivateDTO.setHasDna(true);\r
}\r
for(Sequence sequence:dna.getSequences()){\r
URI boldUri = null;\r
logger.error("Could not create BOLD URI", e1);\r
}\r
final DefinedTerm dnaMarker = sequence.getDnaMarker();\r
- MolecularData molecularData = dto.addProviderLink(boldUri!=null?boldUri:null,dnaMarker!=null?dnaMarker.getLabel():"[no marker]");\r
+ MolecularData molecularData = derivateDataDTO.addProviderLink(boldUri!=null?boldUri:null,dnaMarker!=null?dnaMarker.getLabel():"[no marker]");\r
\r
//contig file FIXME show primer although contig not present?\r
if(sequence.getContigFile()!=null){\r
}\r
}\r
//assemble media data\r
- else if(derivedUnit.isInstanceOf(MediaSpecimen.class)){\r
+ else if(childDerivate.isInstanceOf(MediaSpecimen.class)){\r
\r
- MediaSpecimen media = HibernateProxyHelper.deproxy(derivedUnit, MediaSpecimen.class);\r
+ MediaSpecimen media = HibernateProxyHelper.deproxy(childDerivate, MediaSpecimen.class);\r
String mediaUriString = getMediaUriString(media);\r
if(media.getKindOfUnit()!=null){\r
//specimen scan\r
if(media.getKindOfUnit().getUuid().equals(UUID.fromString("acda15be-c0e2-4ea8-8783-b9b0c4ad7f03"))){\r
- dto.setHasSpecimenScan(true);\r
- final String imageLinkText = currentHerbarium+" "+currentAccessionNumber;\r
- dto.addSpecimenScan(mediaUriString==null?"":mediaUriString, !imageLinkText.equals(" ")?imageLinkText:"[no accession]");\r
+ derivateDTO.setHasSpecimenScan(true);\r
+ final String imageLinkText = currentHerbarium+" "+currentAccessionNumber;\r
+ derivateDataDTO.addSpecimenScan(mediaUriString==null?"":mediaUriString, !imageLinkText.equals(" ")?imageLinkText:"[no accession]");\r
}\r
//detail image\r
else if(media.getKindOfUnit().getUuid().equals(UUID.fromString("31eb8d02-bf5d-437c-bcc6-87a626445f34"))){\r
- dto.setHasDetailImage(true);\r
+ derivateDTO.setHasDetailImage(true);\r
String motif = "";\r
if(media.getMediaSpecimen()!=null && media.getMediaSpecimen().getTitle()!=null){\r
motif = media.getMediaSpecimen().getTitle().getText();\r
}\r
- dto.addDetailImage(mediaUriString==null?"":mediaUriString, motif!=null?motif:"[no motif]");\r
+ derivateDataDTO.addDetailImage(mediaUriString==null?"":mediaUriString, motif!=null?motif:"[no motif]");\r
}\r
}\r
}\r
- //assemble preserved specimen data\r
- else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){\r
- if(!currentAccessionNumber.isEmpty()){\r
- preservedSpecimenAccessionNumbers.add(currentAccessionNumber);\r
- }\r
- }\r
- }\r
-\r
- final String separator = ", ";\r
- //assemble citation\r
- String citation = "";\r
- citation += !dto.getCountry().isEmpty()?dto.getCountry()+separator:"";\r
- if(fieldUnit.getGatheringEvent()!=null){\r
- if(fieldUnit.getGatheringEvent().getLocality()!=null){\r
- citation += fieldUnit.getGatheringEvent().getLocality().getText();\r
- citation += separator;\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;\r
- citation += fieldUnit.getGatheringEvent().getExactLocation().getLongitude().toString();\r
- citation += separator;\r
- }\r
- }\r
- citation += !dto.getCollection().isEmpty()?dto.getCollection():"";\r
- if(!preservedSpecimenAccessionNumbers.isEmpty()){\r
- citation += " (";\r
- for(String accessionNumber:preservedSpecimenAccessionNumbers){\r
- if(!accessionNumber.isEmpty()){\r
- citation += accessionNumber+separator;\r
- }\r
- }\r
- citation = removeTail(citation, separator);\r
- citation += ")";\r
}\r
- citation = removeTail(citation, separator);\r
- dto.setCitation(citation);\r
-\r
- //assemble herbaria string\r
- String herbariaString = "";\r
- for(Entry<eu.etaxonomy.cdm.model.occurrence.Collection, Integer> e:collectionToCountMap.entrySet()){\r
- eu.etaxonomy.cdm.model.occurrence.Collection collection = e.getKey();\r
- if(collection.getCode()!=null){\r
- herbariaString += collection.getCode();\r
- }\r
- if(e.getValue()>1){\r
- herbariaString += "("+e.getValue()+")";\r
- }\r
- herbariaString += separator;\r
- }\r
- herbariaString = removeTail(herbariaString, separator);\r
- dto.setHerbarium(herbariaString);\r
-\r
- return dto;\r
+ return derivateDataDTO;\r
}\r
\r
\r
return mediaUri;\r
}\r
\r
- private void getDerivedUnitsFor(SpecimenOrObservationBase<?> specimen, Collection<DerivedUnit> derivedUnits){\r
+ private Collection<DerivedUnit> getDerivedUnitsFor(SpecimenOrObservationBase<?> specimen){\r
+ Collection<DerivedUnit> derivedUnits = new ArrayList<DerivedUnit>();\r
for(DerivationEvent derivationEvent:specimen.getDerivationEvents()){\r
for(DerivedUnit derivative:derivationEvent.getDerivatives()){\r
derivedUnits.add(derivative);\r
- getDerivedUnitsFor(derivative, derivedUnits);\r
+ derivedUnits.addAll(getDerivedUnitsFor(derivative));\r
}\r
}\r
+ return derivedUnits;\r
}\r
\r
\r
return dao.listDescriptionsWithDescriptionSpecimen(specimen, limit, start, orderHints, propertyPaths);\r
}\r
\r
+ /* (non-Javadoc)\r
+ * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getStatesForSpecimen(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase)\r
+ */\r
+ @Override\r
+ public Collection<DescriptionElementBase> getCharacterDataForSpecimen(SpecimenOrObservationBase<?> specimen) {\r
+ Collection<DescriptionElementBase> states = new ArrayList<DescriptionElementBase>();\r
+ if(specimen!=null){\r
+ Set<DescriptionBase> descriptions = specimen.getDescriptions();\r
+ for (DescriptionBase<?> descriptionBase : descriptions) {\r
+ if(descriptionBase.isInstanceOf(SpecimenDescription.class)){\r
+ SpecimenDescription specimenDescription = HibernateProxyHelper.deproxy(descriptionBase, SpecimenDescription.class);\r
+ Set<DescriptionElementBase> elements = specimenDescription.getElements();\r
+ for (DescriptionElementBase descriptionElementBase : elements) {\r
+ if(descriptionElementBase.getFeature().isSupportsCategoricalData()\r
+ ||descriptionElementBase.getFeature().isSupportsQuantitativeData()){\r
+ states.add(descriptionElementBase);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return states;\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getStatesForSpecimen(java.util.UUID)\r
+ */\r
+ @Override\r
+ public Collection<DescriptionElementBase> getCharacterDataForSpecimen(UUID specimenUuid) {\r
+ SpecimenOrObservationBase<?> specimen = load(specimenUuid);\r
+ if(specimen!=null){\r
+ return getCharacterDataForSpecimen(specimen);\r
+ }\r
+ else{\r
+ throw new DataRetrievalFailureException("Specimen with the given uuid not found in the data base");\r
+ }\r
+ }\r
+\r
}\r
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
package eu.etaxonomy.cdm.api.service.dto;
import java.net.URI;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.hibernate.envers.tools.Pair;
-public class DerivateHierarchyDTO {
+/**
+ * @author pplitzner
+ * @date Mar 26, 2015
+ *
+ */
+public class DerivateDataDTO {
- //Filter Flags
- private boolean hasDna;
- private boolean hasDetailImage;
+ private List<Pair<String, String>> specimenScans;
+ private List<MolecularData> molecularDataList;
+ private List<Pair<String, String>> detailImages;
- //Row Attributes
- private String country;
- private String collection;
- private String date;
- private String herbarium;
- private boolean hasType;
- private boolean hasSpecimenScan;
-
- //Detail pop-down
- private String taxonName;
- private String protologue;
- private String citation;
- private Map<String, List<String>> types;
- private List<Pair<String, String>> specimenScans;
- private List<MolecularData> molecularDataList;
- private List<Pair<String, String>> detailImages;
-
- /**
+ /**
* @return the molecularData
*/
public List<MolecularData> getMolecularDataList() {
public MolecularData addProviderLink(URI uri, String linkText) {
if(this.molecularDataList==null){
- molecularDataList = new ArrayList<DerivateHierarchyDTO.MolecularData>();
+ molecularDataList = new ArrayList<MolecularData>();
}
MolecularData molecularData = new MolecularData(new Link(uri, linkText));
this.molecularDataList.add(molecularData);
return molecularData;
}
- /**
- * @return the hasDna
- */
- public boolean isHasDna() {
- return hasDna;
- }
- /**
- * @param hasDna the hasDna to set
- */
- public void setHasDna(boolean hasDna) {
- this.hasDna = hasDna;
- }
- /**
- * @return the hasDetailImage
- */
- public boolean isHasDetailImage() {
- return hasDetailImage;
- }
- /**
- * @param hasDetailImage the hasDetailImage to set
- */
- public void setHasDetailImage(boolean hasDetailImage) {
- this.hasDetailImage = hasDetailImage;
- }
- /**
- * @return the country
- */
- public String getCountry() {
- return country;
- }
- /**
- * @param country the country to set
- */
- public void setCountry(String country) {
- this.country = country;
- }
- /**
- * @return the collection
- */
- public String getCollection() {
- return collection;
- }
- /**
- * @param collection the collection to set
- */
- public void setCollection(String collection) {
- this.collection = collection;
- }
- /**
- * @return the date
- */
- public String getDate() {
- return date;
- }
- /**
- * @param date the date to set
- */
- public void setDate(String date) {
- this.date = date;
- }
- /**
- * @return the herbarium
- */
- public String getHerbarium() {
- return herbarium;
- }
- /**
- * @param herbarium the herbarium to set
- */
- public void setHerbarium(String herbarium) {
- this.herbarium = herbarium;
- }
- /**
- * @return the hasType
- */
- public boolean isHasType() {
- return hasType;
- }
- /**
- * @param hasType the hasType to set
- */
- public void setHasType(boolean hasType) {
- this.hasType = hasType;
- }
- /**
- * @return the hasSpecimenScan
- */
- public boolean isHasSpecimenScan() {
- return hasSpecimenScan;
- }
- /**
- * @param hasSpecimenScan the hasSpecimenScan to set
- */
- public void setHasSpecimenScan(boolean hasSpecimenScan) {
- this.hasSpecimenScan = hasSpecimenScan;
- }
- /**
- * @return the taxonName
- */
- public String getTaxonName() {
- return taxonName;
- }
- /**
- * @param taxonName the taxonName to set
- */
- public void setTaxonName(String taxonName) {
- this.taxonName = taxonName;
- }
- /**
- * @return the protologue
- */
- public String getProtologue() {
- return protologue;
- }
- /**
- * @param protologue the protologue to set
- */
- public void setProtologue(String protologue) {
- this.protologue = protologue;
- }
- /**
- * @return the citation
- */
- public String getCitation() {
- return citation;
- }
- /**
- * @param citation the citation to set
- */
- public void setCitation(String citation) {
- this.citation = citation;
- }
-
- /**
- * @param types the types to set
- */
- public void setTypes(Map<String, List<String>> types) {
- this.types = types;
- }
- /**
- * @return the types
- */
- public Map<String, List<String>> getTypes() {
- return types;
- }
- public void addTypes(String typeStatus, String accessionNumber){
- if(types==null){
- types = new HashMap<String, List<String>>();
- }
- List<String> list = types.get(typeStatus);
- if(list==null){
- list = new ArrayList<String>();
- }
- list.add(accessionNumber);
- types.put(typeStatus, list);
- }
-
- /**
- * @param specimenScans the specimenScans to set
- */
- public void setSpecimenScans(List<Pair<String, String>> specimenScans) {
- this.specimenScans = specimenScans;
- }
/**
* @return the specimenScans
*/
public List<Pair<String, String>> getDetailImages() {
return detailImages;
}
- /**
- * @param detailImages the detailImages to set
- */
- public void setDetailImages(List<Pair<String, String>> detailImages) {
- this.detailImages = detailImages;
- }
public void addDetailImage(String uri, String motif){
if(detailImages==null){
public ContigFile addContigFile(URI uri, String linkText){
if(contigFiles==null){
- contigFiles = new ArrayList<DerivateHierarchyDTO.ContigFile>();
+ contigFiles = new ArrayList<ContigFile>();
}
ContigFile contigFile = new ContigFile(new Link(uri, linkText));
contigFiles.add(contigFile);
public void addPrimerLink(URI uri, String linkText){
if(primerLinks==null){
- primerLinks = new ArrayList<DerivateHierarchyDTO.Link>();
+ primerLinks = new ArrayList<Link>();
}
primerLinks.add(new Link(uri, linkText));
}
}
}
+
}