Project

General

Profile

Download (2.82 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
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
 */
10

    
11
package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator;
12

    
13
import java.util.HashMap;
14
import java.util.Map;
15

    
16
import org.apache.log4j.Logger;
17

    
18
import eu.etaxonomy.cdm.model.molecular.DnaSample;
19
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
20
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
21
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
22
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
23

    
24
/**
25
 * <p>
26
 * OccurrenceCreator class.
27
 * </p>
28
 * 
29
 * @author n.hoffmann
30
 * @created Jun 16, 2010
31
 * @version 1.0
32
 */
33
public class OccurrenceCreator implements
34
		IEntityCreator<SpecimenOrObservationBase> {
35
	private static final Logger logger = Logger
36
			.getLogger(OccurrenceCreator.class);
37

    
38
	/** {@inheritDoc} */
39
	@Override
40
	public SpecimenOrObservationBase createEntity(String text) {
41
		return createEntity(DerivedUnit.class, text);
42
	}
43

    
44
	/** {@inheritDoc} */
45
	@Override
46
	public SpecimenOrObservationBase createEntity(Object key, String text) {
47
		SpecimenOrObservationBase specimenOrObservation = null;
48
		//FIXME:3.3MC
49
		if (FieldUnit.class.equals((key))) {
50
			specimenOrObservation = FieldUnit.NewInstance();
51
		} else if (DerivedUnit.class.equals((key))) {
52
			specimenOrObservation = DerivedUnit.NewInstance();
53
		} else if (DerivedUnit.class.equals((key))) {
54
			specimenOrObservation = DerivedUnit.NewInstance();
55
		} else if (DerivedUnit.class.equals((key))) {
56
			specimenOrObservation = DerivedUnit.NewInstance();
57
		} else if (DerivedUnit.class.equals((key))) {
58
			specimenOrObservation = DerivedUnit.NewInstance();
59
		} else if (DnaSample.class.equals((key))) {
60
			specimenOrObservation = DnaSample.NewInstance();
61
		} else if (DerivedUnit.class.equals((key))) {
62
			specimenOrObservation = DerivedUnit.NewInstance();
63
		}
64

    
65
		if (specimenOrObservation != null) {
66
			specimenOrObservation.setTitleCache(text, true);
67
		}
68
		return specimenOrObservation;
69
	}
70

    
71
	/**
72
	 * <p>
73
	 * getKeyLabelPairs
74
	 * </p>
75
	 * 
76
	 * @return a {@link java.util.Map} object.
77
	 */
78
	@Override
79
	public Map<Object, String> getKeyLabelPairs() {
80
		Map<Object, String> result = new HashMap<Object, String>();
81

    
82
		//FIXME:3.3MC
83
		result.put(DerivedUnit.class, "Specimen");
84
		result.put(DerivedUnit.class, "Observation");
85
		result.put(DerivedUnit.class, "Living Being");
86
		result.put(DerivedUnit.class, "Fossil");
87
		result.put(DerivedUnit.class, "Derived Unit");
88

    
89
		// Omitted at the moment see #2266
90
		// result.put(DnaSample.class, "Dna Sample");
91

    
92
		// Omitted see #2266
93
		// result.put(FieldObservation.class, "Field Observation");
94
		// result.put(Observation.class, "Observation");
95

    
96
		return result;
97
	}
98
}
(4-4/6)