1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.taxeditor.newWizard;
|
12
|
|
13
|
import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;
|
14
|
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
|
15
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
16
|
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailWizardPage;
|
17
|
|
18
|
/**
|
19
|
* @author a.kohlbecker
|
20
|
* @created Sept 13 2012
|
21
|
*/
|
22
|
public class NewGrantedAuthorityWizard extends AbstractNewEntityWizard<GrantedAuthorityImpl> {
|
23
|
|
24
|
private GrantedAuthorityDetailWizardPage authorityPage;
|
25
|
|
26
|
/* (non-Javadoc)
|
27
|
* @see org.eclipse.jface.wizard.Wizard#addPages()
|
28
|
*/
|
29
|
@Override
|
30
|
public void addPages() {
|
31
|
authorityPage = new GrantedAuthorityDetailWizardPage(formFactory, getConversationHolder(), getEntity());
|
32
|
super.addPage(authorityPage);
|
33
|
}
|
34
|
|
35
|
|
36
|
/* (non-Javadoc)
|
37
|
* @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#saveEntity()
|
38
|
*/
|
39
|
@Override
|
40
|
protected void saveEntity() {
|
41
|
if(CdmStore.getCurrentSessionManager().isRemoting()) {
|
42
|
CdmStore.getService(IGrantedAuthorityService.class).merge(getEntity(), true);
|
43
|
} else {
|
44
|
CdmStore.getService(IGrantedAuthorityService.class).save(getEntity());
|
45
|
}
|
46
|
}
|
47
|
|
48
|
/* (non-Javadoc)
|
49
|
* @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#createNewEntity()
|
50
|
*/
|
51
|
@Override
|
52
|
protected GrantedAuthorityImpl createNewEntity() {
|
53
|
return GrantedAuthorityImpl.NewInstance();
|
54
|
}
|
55
|
|
56
|
/* (non-Javadoc)
|
57
|
* @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#getEntityName()
|
58
|
*/
|
59
|
@Override
|
60
|
protected String getEntityName() {
|
61
|
return "GrantedAuthority";
|
62
|
}
|
63
|
}
|