Revision baadcf2d
Added by Niels Hoffmann almost 12 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/OccurrenceCreator.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 |
* Copyright (C) 2007 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
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. |
|
9 |
*/ |
|
3 |
* Copyright (C) 2007 EDIT
|
|
4 |
* European Distributed Institute of Taxonomy
|
|
5 |
* http://www.e-taxonomy.eu
|
|
6 |
*
|
|
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.
|
|
9 |
*/
|
|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator; |
12 | 12 |
|
... | ... | |
26 | 26 |
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator; |
27 | 27 |
|
28 | 28 |
/** |
29 |
* <p>OccurrenceCreator class.</p> |
|
30 |
* |
|
29 |
* <p> |
|
30 |
* OccurrenceCreator class. |
|
31 |
* </p> |
|
32 |
* |
|
31 | 33 |
* @author n.hoffmann |
32 | 34 |
* @created Jun 16, 2010 |
33 | 35 |
* @version 1.0 |
34 | 36 |
*/ |
35 |
public class OccurrenceCreator implements IEntityCreator<SpecimenOrObservationBase> { |
|
37 |
public class OccurrenceCreator implements |
|
38 |
IEntityCreator<SpecimenOrObservationBase> { |
|
36 | 39 |
private static final Logger logger = Logger |
37 | 40 |
.getLogger(OccurrenceCreator.class); |
38 | 41 |
|
39 | 42 |
/** {@inheritDoc} */ |
43 |
@Override |
|
40 | 44 |
public SpecimenOrObservationBase createEntity(String text) { |
41 | 45 |
return createEntity(Specimen.class, text); |
42 | 46 |
} |
43 | 47 |
|
44 | 48 |
/** {@inheritDoc} */ |
49 |
@Override |
|
45 | 50 |
public SpecimenOrObservationBase createEntity(Object key, String text) { |
46 | 51 |
SpecimenOrObservationBase specimenOrObservation = null; |
47 |
|
|
48 |
if (FieldObservation.class.equals(((Class) key))) {
|
|
52 |
|
|
53 |
if (FieldObservation.class.equals((key))) { |
|
49 | 54 |
specimenOrObservation = FieldObservation.NewInstance(); |
50 |
} |
|
51 |
else if (DerivedUnit.class.equals(((Class) key))) { |
|
55 |
} else if (DerivedUnit.class.equals((key))) { |
|
52 | 56 |
specimenOrObservation = DerivedUnit.NewInstance(); |
53 |
} |
|
54 |
else if (LivingBeing.class.equals(((Class) key))) { |
|
57 |
} else if (LivingBeing.class.equals((key))) { |
|
55 | 58 |
specimenOrObservation = LivingBeing.NewInstance(); |
56 |
} |
|
57 |
else if (Observation.class.equals(((Class) key))) { |
|
59 |
} else if (Observation.class.equals((key))) { |
|
58 | 60 |
specimenOrObservation = Observation.NewInstance(); |
59 |
} |
|
60 |
else if (Specimen.class.equals(((Class) key))) { |
|
61 |
} else if (Specimen.class.equals((key))) { |
|
61 | 62 |
specimenOrObservation = Specimen.NewInstance(); |
62 |
} |
|
63 |
else if (DnaSample.class.equals(((Class) key))) { |
|
63 |
} else if (DnaSample.class.equals((key))) { |
|
64 | 64 |
specimenOrObservation = DnaSample.NewInstance(); |
65 |
} |
|
66 |
else if (Fossil.class.equals(((Class) key))) { |
|
65 |
} else if (Fossil.class.equals((key))) { |
|
67 | 66 |
specimenOrObservation = Fossil.NewInstance(); |
68 | 67 |
} |
69 |
|
|
68 |
|
|
70 | 69 |
if (specimenOrObservation != null) { |
71 | 70 |
specimenOrObservation.setTitleCache(text); |
72 | 71 |
} |
... | ... | |
74 | 73 |
} |
75 | 74 |
|
76 | 75 |
/** |
77 |
* <p>getKeyLabelPairs</p> |
|
78 |
* |
|
76 |
* <p> |
|
77 |
* getKeyLabelPairs |
|
78 |
* </p> |
|
79 |
* |
|
79 | 80 |
* @return a {@link java.util.Map} object. |
80 | 81 |
*/ |
82 |
@Override |
|
81 | 83 |
public Map<Object, String> getKeyLabelPairs() { |
82 | 84 |
Map<Object, String> result = new HashMap<Object, String>(); |
83 |
result.put(FieldObservation.class, "Field Observation"); |
|
84 |
result.put(DerivedUnit.class, "Derived Unit"); |
|
85 |
result.put(LivingBeing.class, "Living Being"); |
|
86 |
result.put(Observation.class, "Observation"); |
|
85 |
|
|
87 | 86 |
result.put(Specimen.class, "Specimen"); |
88 |
result.put(DnaSample.class, "Dna Sample"); |
|
87 |
result.put(Observation.class, "Observation"); |
|
88 |
result.put(LivingBeing.class, "Living Being"); |
|
89 | 89 |
result.put(Fossil.class, "Fossil"); |
90 |
result.put(DerivedUnit.class, "Derived Unit"); |
|
91 |
|
|
92 |
// Omitted at the moment see #2266 |
|
93 |
// result.put(DnaSample.class, "Dna Sample"); |
|
94 |
|
|
95 |
// Omitted see #2266 |
|
96 |
// result.put(FieldObservation.class, "Field Observation"); |
|
97 |
// result.put(Observation.class, "Observation"); |
|
98 |
|
|
90 | 99 |
return result; |
91 | 100 |
} |
92 | 101 |
} |
Also available in: Unified diff
minor