Project

General

Profile

Download (1.47 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
	        if(CdmStore.getCurrentSessionManager().isRemoting()) {
35
	            CdmStore.getService(IPolytomousKeyService.class).merge(getEntity(), true);
36
	        } else {
37
	            CdmStore.getService(IPolytomousKeyService.class).save(getEntity());
38
	        }
39
	    }
40
	}
41

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

    
52
	@Override
53
	protected String getEntityName() {
54
		return "Polytomous Key";
55
	}
56

    
57
}
(15-15/23)