1
|
/**
|
2
|
*
|
3
|
*/
|
4
|
package eu.etaxonomy.taxeditor.newWizard;
|
5
|
|
6
|
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
|
7
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
8
|
import eu.etaxonomy.cdm.model.description.PolytomousKey;
|
9
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
10
|
|
11
|
/**
|
12
|
* @author n.hoffmann
|
13
|
*
|
14
|
*/
|
15
|
public class NewPolytomousKeyWizard extends AbstractNewEntityWizard<PolytomousKey> {
|
16
|
|
17
|
private PolytomousKeyWizardPage polytomousKeyPage;
|
18
|
|
19
|
@Override
|
20
|
public void addPages() {
|
21
|
polytomousKeyPage = new PolytomousKeyWizardPage(formFactory, getConversationHolder(), getEntity());
|
22
|
super.addPage(polytomousKeyPage);
|
23
|
}
|
24
|
|
25
|
public String getPolytomousKeyName() {
|
26
|
return polytomousKeyPage.getPolytomousKeyName();
|
27
|
}
|
28
|
|
29
|
/* (non-Javadoc)
|
30
|
* @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
|
31
|
*/
|
32
|
@Override
|
33
|
protected void saveEntity() {
|
34
|
if(CdmUtils.isNotBlank(polytomousKeyPage.getPolytomousKeyName())) {
|
35
|
CdmStore.getService(IPolytomousKeyService.class).merge(getEntity(), true);
|
36
|
}
|
37
|
}
|
38
|
|
39
|
/* (non-Javadoc)
|
40
|
* @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#createNewEntity()
|
41
|
*/
|
42
|
@Override
|
43
|
protected PolytomousKey createNewEntity() {
|
44
|
PolytomousKey pkey = PolytomousKey.NewInstance();
|
45
|
pkey.setTitleCache("");
|
46
|
return pkey;
|
47
|
}
|
48
|
|
49
|
@Override
|
50
|
protected String getEntityName() {
|
51
|
return "Polytomous Key";
|
52
|
}
|
53
|
|
54
|
@Override
|
55
|
public boolean canFinish() {
|
56
|
if(CdmUtils.isBlank(polytomousKeyPage.getPolytomousKeyName())) {
|
57
|
return false;
|
58
|
}
|
59
|
return super.canFinish();
|
60
|
}
|
61
|
|
62
|
}
|