OPEN_BRACKET,
CLOSE_BRACKET,
SPACE,
- /*occurrences*/
- LOCALITY_TEXT,
- ACCESSION_NUMBER
+ /*identifiable entity*/
+ SAMPLE_DESIGNATION,
+ /*specimenOrObservationBase*/
+ RECORD_BASIS,
+ KIND_OF_UNIT,
+ /*field unit*/
+ FIELD_NUMBER,
+ /*gathering event*/
+ GATHERING_COUNTRY,
+ GATHERING_LOCALITY_TEXT,
+ GATHERING_DATE,
+ GATHERING_COLLECTOR,
+ /*derived unit*/
+ COLLECTION_CODE,
+ COLLECTION_NAME,
+ MOST_SIGNIFICANT_IDENTIFIER,
+ ACCESSION_NUMBER,
+ BARCODE,
+ CATALOG_NUMBER,
+ /*media specimen*/
+ MEDIA_TITLE,
+ MEDIA_ARTIST,
+ /*sequence*/
+ SEQUENCE_DNA_MARKER,
+ /*single read*/
+ SINGLE_READ_PRIMER,
+ AMPLIFICATION_LABEL,
}
public String format(Object object, FormatKey... formatKeys);
* @date Nov 30, 2015
*
*/
-public class DerivedUnitFormatter extends AbstractCdmFormatter{
+public class DerivedUnitFormatter extends SpecimenOrObservationBaseFormatter{
public DerivedUnitFormatter(Object object, FormatKey[] formatKeys) {
super(object, formatKeys);
case ACCESSION_NUMBER:
formatKeyMap.put(FormatKey.ACCESSION_NUMBER, derivedUnit.getAccessionNumber());
break;
+ case BARCODE:
+ formatKeyMap.put(FormatKey.BARCODE, derivedUnit.getBarcode());
+ break;
+ case CATALOG_NUMBER:
+ formatKeyMap.put(FormatKey.CATALOG_NUMBER, derivedUnit.getCatalogNumber());
+ break;
+ case MOST_SIGNIFICANT_IDENTIFIER:
+ formatKeyMap.put(FormatKey.MOST_SIGNIFICANT_IDENTIFIER, derivedUnit.getMostSignificantIdentifier());
+ break;
+ case COLLECTION_CODE:
+ if(derivedUnit.getCollection()!=null){
+ formatKeyMap.put(FormatKey.COLLECTION_CODE, derivedUnit.getCollection().getCode());
+ }
+ break;
+ case COLLECTION_NAME:
+ if(derivedUnit.getCollection()!=null){
+ formatKeyMap.put(FormatKey.COLLECTION_NAME, derivedUnit.getCollection().getName());
+ }
+ break;
default:
break;
* @date Nov 30, 2015
*
*/
-public class FieldUnitFormatter extends AbstractCdmFormatter {
+public class FieldUnitFormatter extends SpecimenOrObservationBaseFormatter {
public FieldUnitFormatter(Object object, FormatKey[] formatKeys) {
super(object, formatKeys);
super.initFormatKeys(object);
FieldUnit fieldUnit = (FieldUnit)object;
if(fieldUnit.getGatheringEvent()!=null){
- formatKeyMap.put(FormatKey.LOCALITY_TEXT, fieldUnit.getGatheringEvent().getLocality().getText());
+ formatKeyMap.put(FormatKey.GATHERING_LOCALITY_TEXT, fieldUnit.getGatheringEvent().getLocality().getText());
+ formatKeyMap.put(FormatKey.GATHERING_COLLECTOR, fieldUnit.getGatheringEvent().getCollector().toString());
+ formatKeyMap.put(FormatKey.GATHERING_COUNTRY, fieldUnit.getGatheringEvent().getCountry().getLabel());
+ formatKeyMap.put(FormatKey.GATHERING_DATE, fieldUnit.getGatheringEvent().getGatheringDate().toString());
}
+ formatKeyMap.put(FormatKey.FIELD_NUMBER, fieldUnit.getFieldNumber());
}
}
--- /dev/null
+// $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.format.occurrences;
+
+
+/**
+ * @author pplitzner
+ * @date Nov 30, 2015
+ *
+ */
+public class IdentifiableEntityFormatter extends AbstractCdmFormatter {
+
+ public IdentifiableEntityFormatter(Object object, FormatKey[] formatKeys) {
+ super(object, formatKeys);
+ }
+
+ @Override
+ protected void initFormatKeys(Object object, FormatKey... formatKeys) {
+ super.initFormatKeys(object);
+// IdentifiableEntity identifiableEntity = (IdentifiableEntity)object;
+// List<Identifier> identifiers = identifiableEntity.getIdentifiers();
+// String identifierString = null;
+// for (Identifier identifier : identifiers) {
+// if(identifier.getType()!=null && identifier.getType().equals(DerivateLabelProvider.getSampleDesignationTerm())){
+// //first sample designation is the current
+// identifierString = identifier.toString();
+// }
+// }
+// if(identifierString!=null){
+// formatKeyMap.put(FormatKey.FIELD_NUMBER, identifierString);
+// }
+ }
+
+}
--- /dev/null
+// $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.format.occurrences;
+
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
+
+/**
+ * @author pplitzner
+ * @date Nov 30, 2015
+ *
+ */
+public class MediaSpecimenFormatter extends DerivedUnitFormatter {
+
+ public MediaSpecimenFormatter(Object object, FormatKey[] formatKeys) {
+ super(object, formatKeys);
+ }
+
+ @Override
+ protected void initFormatKeys(Object object, FormatKey... formatKeys) {
+ super.initFormatKeys(object);
+ MediaSpecimen mediaSpecimen = (MediaSpecimen)object;
+ Media media = mediaSpecimen.getMediaSpecimen();
+ if(media!=null){
+ if(media.getArtist()!=null){
+ formatKeyMap.put(FormatKey.MEDIA_ARTIST, media.getArtist().toString());
+ }
+ if(media.getTitle()!=null){
+ formatKeyMap.put(FormatKey.MEDIA_TITLE, media.getTitle().getText());
+ }
+ }
+ }
+
+}
--- /dev/null
+// $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.format.occurrences;
+
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+
+/**
+ * @author pplitzner
+ * @date Nov 30, 2015
+ *
+ */
+public class SequenceFormatter extends AbstractCdmFormatter {
+
+ public SequenceFormatter(Object object, FormatKey[] formatKeys) {
+ super(object, formatKeys);
+ }
+
+ @Override
+ protected void initFormatKeys(Object object, FormatKey... formatKeys) {
+ super.initFormatKeys(object);
+ Sequence sequence = (Sequence)object;
+ if(sequence.getDnaMarker()!=null){
+ formatKeyMap.put(FormatKey.SEQUENCE_DNA_MARKER, sequence.getDnaMarker().getLabel());
+ }
+ }
+
+}
--- /dev/null
+// $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.format.occurrences;
+
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+
+/**
+ * @author pplitzner
+ * @date Nov 30, 2015
+ *
+ */
+public class SingleReadFormatter extends AbstractCdmFormatter {
+
+ public SingleReadFormatter(Object object, FormatKey[] formatKeys) {
+ super(object, formatKeys);
+ }
+
+ @Override
+ protected void initFormatKeys(Object object, FormatKey... formatKeys) {
+ super.initFormatKeys(object);
+ SingleRead singleRead = (SingleRead)object;
+ if(singleRead.getPrimer()!=null){
+ formatKeyMap.put(FormatKey.SINGLE_READ_PRIMER, singleRead.getPrimer().getLabel());
+ }
+ if(singleRead.getAmplificationResult()!=null &&
+ singleRead.getAmplificationResult().getAmplification()!=null){
+ formatKeyMap.put(FormatKey.AMPLIFICATION_LABEL, singleRead.getAmplificationResult().getAmplification().getLabelCache());
+ }
+ }
+
+}
--- /dev/null
+// $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.format.occurrences;
+
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+
+/**
+ * @author pplitzner
+ * @date Nov 30, 2015
+ *
+ */
+public class SpecimenOrObservationBaseFormatter extends IdentifiableEntityFormatter {
+
+ public SpecimenOrObservationBaseFormatter(Object object, FormatKey[] formatKeys) {
+ super(object, formatKeys);
+ }
+
+ @Override
+ protected void initFormatKeys(Object object, FormatKey... formatKeys) {
+ super.initFormatKeys(object);
+ SpecimenOrObservationBase specimenOrObservationBase = (SpecimenOrObservationBase)object;
+ formatKeyMap.put(FormatKey.RECORD_BASIS, specimenOrObservationBase.getRecordBasis().toString());
+ formatKeyMap.put(FormatKey.KIND_OF_UNIT, specimenOrObservationBase.getKindOfUnit().toString());
+ }
+
+}