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.taxon.Synonym;
|
7
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
8
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
9
|
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
|
10
|
|
11
|
public class TaxonCreator implements IEntityCreator<TaxonBase>{
|
12
|
|
13
|
NameCreator nameCreator;
|
14
|
@Override
|
15
|
public TaxonBase createEntity(String text) {
|
16
|
// TODO Auto-generated method stub
|
17
|
return null;
|
18
|
}
|
19
|
|
20
|
@Override
|
21
|
public TaxonBase createEntity(Object key, String text) {
|
22
|
TaxonBase taxonBase = null;
|
23
|
if (nameCreator == null){
|
24
|
nameCreator = new NameCreator();
|
25
|
}
|
26
|
if (Synonym.class.equals(key)){
|
27
|
taxonBase = Synonym.NewInstance(nameCreator.createEntity(null, text), null);
|
28
|
} else{
|
29
|
taxonBase = Taxon.NewInstance(nameCreator.createEntity(null, text), null);
|
30
|
}
|
31
|
|
32
|
return taxonBase;
|
33
|
}
|
34
|
|
35
|
@Override
|
36
|
public Map<Object, String> getKeyLabelPairs() {
|
37
|
Map<Object, String> result = new HashMap<>();
|
38
|
result.put(Synonym.class, "Synonym");
|
39
|
result.put(Taxon.class, "Taxon");
|
40
|
return result;
|
41
|
}
|
42
|
|
43
|
@Override
|
44
|
public boolean savesEntity() {
|
45
|
// TODO Auto-generated method stub
|
46
|
return false;
|
47
|
}
|
48
|
|
49
|
}
|