2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.entitycreator
;
12 import java
.util
.Collections
;
13 import java
.util
.List
;
15 import java
.util
.TreeMap
;
17 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
18 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
19 import eu
.etaxonomy
.taxeditor
.annotatedlineeditor
.IEntityCreator
;
20 import eu
.etaxonomy
.taxeditor
.parser
.ParseHandler
;
21 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
25 * <p>NameCreator class.</p>
31 public class NameCreator
implements IEntityCreator
<TaxonNameBase
> {
34 * @see eu.etaxonomy.taxeditor.bulkeditor.IEntityCreator#createEntity(java.lang.String)
38 public TaxonNameBase
createEntity(String text
) {
39 TaxonNameBase name
= PreferencesUtil
.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null);
40 name
.setTitleCache(text
, true);
41 //name.setTitleCache(text);
46 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Class, java.lang.String)
50 public TaxonNameBase
createEntity(Object key
, String text
) {
51 return ParseHandler
.parseName(text
, (Rank
) key
);
55 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getClassLabelPairs()
58 * <p>getKeyLabelPairs</p>
60 * @return a {@link java.util.Map} object.
63 public Map
<Object
, String
> getKeyLabelPairs() {
64 Map
<Object
, String
> result
= new TreeMap
<Object
, String
>();
65 List
<Rank
> ranks
= CdmStore
.getTermManager().getPreferredTerms(Rank
.class);
66 Collections
.reverse(ranks
);
67 for (Rank rank
: ranks
) {
68 result
.put(rank
, rank
.getLabel());
74 public boolean savesEntity() {
75 // TODO Auto-generated method stub