1
|
package eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator;
|
2
|
|
3
|
import java.util.HashMap;
|
4
|
import java.util.Map;
|
5
|
|
6
|
import eu.etaxonomy.cdm.model.agent.Person;
|
7
|
import eu.etaxonomy.cdm.model.agent.Team;
|
8
|
import eu.etaxonomy.cdm.model.name.Rank;
|
9
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
10
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
11
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
12
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
13
|
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
|
14
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
15
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
16
|
|
17
|
public class TaxonCreator implements IEntityCreator<TaxonBase>{
|
18
|
|
19
|
NameCreator nameCreator;
|
20
|
@Override
|
21
|
public TaxonBase createEntity(String text) {
|
22
|
// TODO Auto-generated method stub
|
23
|
return null;
|
24
|
}
|
25
|
|
26
|
@Override
|
27
|
public TaxonBase createEntity(Object key, String text) {
|
28
|
TaxonBase taxonBase = null;
|
29
|
if (nameCreator == null){
|
30
|
nameCreator = new NameCreator();
|
31
|
}
|
32
|
if (Synonym.class.equals(key)){
|
33
|
taxonBase = Synonym.NewInstance(nameCreator.createEntity(null, text), null);
|
34
|
} else{
|
35
|
taxonBase = Taxon.NewInstance(nameCreator.createEntity(null, text), null);
|
36
|
}
|
37
|
|
38
|
return taxonBase;
|
39
|
}
|
40
|
|
41
|
@Override
|
42
|
public Map<Object, String> getKeyLabelPairs() {
|
43
|
Map<Object, String> result = new HashMap<Object, String>();
|
44
|
result.put(Synonym.class, "Synonym");
|
45
|
result.put(Taxon.class, "Taxon");
|
46
|
return result;
|
47
|
}
|
48
|
|
49
|
@Override
|
50
|
public boolean savesEntity() {
|
51
|
// TODO Auto-generated method stub
|
52
|
return false;
|
53
|
}
|
54
|
|
55
|
}
|