Project

General

Profile

Download (1.3 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 *
3
 */
4
package eu.etaxonomy.taxeditor.newWizard;
5

    
6
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
7
import eu.etaxonomy.cdm.model.description.PolytomousKey;
8
import eu.etaxonomy.taxeditor.store.CdmStore;
9

    
10
/**
11
 * @author n.hoffmann
12
 *
13
 */
14
public class NewPolytomousKeyWizard extends AbstractNewEntityWizard<PolytomousKey> {
15

    
16
    private PolytomousKeyWizardPage polytomousKeyPage;
17

    
18
	@Override
19
	public void addPages() {
20
		polytomousKeyPage = new PolytomousKeyWizardPage(formFactory, getConversationHolder(), getEntity());
21
		super.addPage(polytomousKeyPage);
22
	}
23

    
24
	public String getPolytomousKeyName() {
25
	    return polytomousKeyPage.getPolytomousKeyName();
26
	}
27

    
28
	/* (non-Javadoc)
29
	 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
30
	 */
31
	@Override
32
	protected void saveEntity() {
33
	    if(!polytomousKeyPage.getPolytomousKeyName().equals("")) {
34
	        CdmStore.getService(IPolytomousKeyService.class).merge(getEntity(), true);
35
	    }
36
	}
37

    
38
	/* (non-Javadoc)
39
	 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#createNewEntity()
40
	 */
41
	@Override
42
	protected PolytomousKey createNewEntity() {
43
	    PolytomousKey pkey = PolytomousKey.NewInstance();
44
	    pkey.setTitleCache("");
45
		return pkey;
46
	}
47

    
48
	@Override
49
	protected String getEntityName() {
50
		return "Polytomous Key";
51
	}
52

    
53
}
(15-15/23)