8cb943b83e54437cd233063ba04b74b9f4d8216a
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
.HashMap
;
15 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
16 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
17 import eu
.etaxonomy
.taxeditor
.annotatedlineeditor
.IEntityCreator
;
18 import eu
.etaxonomy
.taxeditor
.parser
.ParseHandler
;
19 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
20 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
23 * <p>NameCreator class.</p>
29 public class NameCreator
implements IEntityCreator
<TaxonNameBase
> {
32 * @see eu.etaxonomy.taxeditor.bulkeditor.IEntityCreator#createEntity(java.lang.String)
35 public TaxonNameBase
createEntity(String text
) {
36 TaxonNameBase name
= PreferencesUtil
.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null);
37 name
.setTitleCache(text
, true);
38 //name.setTitleCache(text);
43 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#createEntity(java.lang.Class, java.lang.String)
46 public TaxonNameBase
createEntity(Object key
, String text
) {
47 return ParseHandler
.parseName(text
, (Rank
) key
);
51 * @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator#getClassLabelPairs()
54 * <p>getKeyLabelPairs</p>
56 * @return a {@link java.util.Map} object.
58 public Map
<Object
, String
> getKeyLabelPairs() {
59 Map
<Object
, String
> result
= new HashMap
<Object
, String
>();
60 for (Rank rank
: CdmStore
.getTermManager().getPreferredTerms(Rank
.class)) {
61 result
.put(rank
, rank
.getLabel());
67 public boolean savesEntity() {
68 // TODO Auto-generated method stub