Project

General

Profile

Download (1.98 KB) Statistics
| Branch: | Tag: | Revision:
1 3be6ef3e n.hoffmann
// $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 db5e366d n.hoffmann
package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator;
12 3be6ef3e n.hoffmann
13
import java.util.HashMap;
14
import java.util.Map;
15
16
import eu.etaxonomy.cdm.model.name.Rank;
17
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
18
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
19 f211dd28 n.hoffmann
import eu.etaxonomy.taxeditor.parser.ParseHandler;
20 3be6ef3e n.hoffmann
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
21 ea781c57 n.hoffmann
import eu.etaxonomy.taxeditor.store.CdmStore;
22 3be6ef3e n.hoffmann
23
/**
24
 * <p>NameCreator class.</p>
25
 *
26
 * @author p.ciardelli
27
 * @created 07.07.2009
28
 * @version 1.0
29
 */
30
public class NameCreator implements IEntityCreator<TaxonNameBase> {
31
32
	/* (non-Javadoc)
33
	 * @see eu.etaxonomy.taxeditor.bulkeditor.IEntityCreator#createEntity(java.lang.String)
34
	 */
35
	/** {@inheritDoc} */
36
	public TaxonNameBase createEntity(String text) {
37
		TaxonNameBase name = PreferencesUtil.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null);
38
		name.setTitleCache(text);
39
		return name;
40
	}
41
42
	/* (non-Javadoc)
43
	 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Class, java.lang.String)
44
	 */
45
	/** {@inheritDoc} */
46
	public TaxonNameBase createEntity(Object key, String text) {
47 f211dd28 n.hoffmann
		return ParseHandler.parseName(text, (Rank) key);
48 3be6ef3e n.hoffmann
	}
49
50
	/* (non-Javadoc)
51
	 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getClassLabelPairs()
52
	 */
53
	/**
54
	 * <p>getKeyLabelPairs</p>
55
	 *
56
	 * @return a {@link java.util.Map} object.
57
	 */
58
	public Map<Object, String> getKeyLabelPairs() {
59
		Map<Object, String> result = new HashMap<Object, String>();
60 b9a0d300 l.morris
		for (Rank rank : CdmStore.getTermManager().getPreferredTerms(Rank.class)) {
61 3be6ef3e n.hoffmann
			result.put(rank, rank.getLabel());
62
		}
63
		return result;
64
	}
65 c0692f1e Cherian Mathew
66
	@Override
67
	public boolean savesEntity() {
68
		// TODO Auto-generated method stub
69
		return false;
70
	}
71 3be6ef3e n.hoffmann
}