3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.entitycreator
;
13 import java
.util
.HashMap
;
16 import org
.apache
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.model
.molecular
.DnaSample
;
19 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
20 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldObservation
;
21 import eu
.etaxonomy
.cdm
.model
.occurrence
.Fossil
;
22 import eu
.etaxonomy
.cdm
.model
.occurrence
.LivingBeing
;
23 import eu
.etaxonomy
.cdm
.model
.occurrence
.Observation
;
24 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
25 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
26 import eu
.etaxonomy
.taxeditor
.annotatedlineeditor
.IEntityCreator
;
30 * OccurrenceCreator class.
34 * @created Jun 16, 2010
37 public class OccurrenceCreator
implements
38 IEntityCreator
<SpecimenOrObservationBase
> {
39 private static final Logger logger
= Logger
40 .getLogger(OccurrenceCreator
.class);
44 public SpecimenOrObservationBase
createEntity(String text
) {
45 return createEntity(Specimen
.class, text
);
50 public SpecimenOrObservationBase
createEntity(Object key
, String text
) {
51 SpecimenOrObservationBase specimenOrObservation
= null;
53 if (FieldObservation
.class.equals((key
))) {
54 specimenOrObservation
= FieldObservation
.NewInstance();
55 } else if (DerivedUnit
.class.equals((key
))) {
56 specimenOrObservation
= DerivedUnit
.NewInstance();
57 } else if (LivingBeing
.class.equals((key
))) {
58 specimenOrObservation
= LivingBeing
.NewInstance();
59 } else if (Observation
.class.equals((key
))) {
60 specimenOrObservation
= Observation
.NewInstance();
61 } else if (Specimen
.class.equals((key
))) {
62 specimenOrObservation
= Specimen
.NewInstance();
63 } else if (DnaSample
.class.equals((key
))) {
64 specimenOrObservation
= DnaSample
.NewInstance();
65 } else if (Fossil
.class.equals((key
))) {
66 specimenOrObservation
= Fossil
.NewInstance();
69 if (specimenOrObservation
!= null) {
70 specimenOrObservation
.setTitleCache(text
);
72 return specimenOrObservation
;
80 * @return a {@link java.util.Map} object.
83 public Map
<Object
, String
> getKeyLabelPairs() {
84 Map
<Object
, String
> result
= new HashMap
<Object
, String
>();
86 result
.put(Specimen
.class, "Specimen");
87 result
.put(Observation
.class, "Observation");
88 result
.put(LivingBeing
.class, "Living Being");
89 result
.put(Fossil
.class, "Fossil");
90 result
.put(DerivedUnit
.class, "Derived Unit");
92 // Omitted at the moment see #2266
93 // result.put(DnaSample.class, "Dna Sample");
96 // result.put(FieldObservation.class, "Field Observation");
97 // result.put(Observation.class, "Observation");