1 |
3f8e87ed
|
Katja Luther
|
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 |
a856be7c
|
Katja Luther
|
taxonBase = Synonym.NewInstance(nameCreator.createEntity(null, text), null);
|
28 |
3f8e87ed
|
Katja Luther
|
} else{
|
29 |
a856be7c
|
Katja Luther
|
taxonBase = Taxon.NewInstance(nameCreator.createEntity(null, text), null);
|
30 |
3f8e87ed
|
Katja Luther
|
}
|
31 |
c8f12e19
|
Andreas Müller
|
|
32 |
3f8e87ed
|
Katja Luther
|
return taxonBase;
|
33 |
|
|
}
|
34 |
|
|
|
35 |
|
|
@Override
|
36 |
|
|
public Map<Object, String> getKeyLabelPairs() {
|
37 |
c8f12e19
|
Andreas Müller
|
Map<Object, String> result = new HashMap<>();
|
38 |
3f8e87ed
|
Katja Luther
|
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 |
|
|
}
|