1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.newWizard;
|
11
|
|
12
|
import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;
|
13
|
import eu.etaxonomy.cdm.model.permission.GrantedAuthorityImpl;
|
14
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
15
|
import eu.etaxonomy.taxeditor.model.MessagingUtils;
|
16
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
17
|
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailWizardPage;
|
18
|
|
19
|
/**
|
20
|
* @author a.kohlbecker
|
21
|
* @created Sept 13 2012
|
22
|
*/
|
23
|
public class NewGrantedAuthorityWizard extends AbstractNewEntityWizard<GrantedAuthorityImpl> {
|
24
|
|
25
|
private GrantedAuthorityDetailWizardPage authorityPage;
|
26
|
|
27
|
@Override
|
28
|
public void addPages() {
|
29
|
authorityPage = new GrantedAuthorityDetailWizardPage(formFactory, getConversationHolder(), getEntity());
|
30
|
super.addPage(authorityPage);
|
31
|
}
|
32
|
|
33
|
@Override
|
34
|
protected void saveEntity() {
|
35
|
try{
|
36
|
CdmStore.getService(IGrantedAuthorityService.class).merge(getEntity(), true);
|
37
|
}catch (Exception e){
|
38
|
MessagingUtils.informationDialog(Messages.NewGrantedAuthority_AlreadyInDb, Messages.NewGrantedAuthority_AlreadyInDb);
|
39
|
}
|
40
|
|
41
|
}
|
42
|
|
43
|
@Override
|
44
|
protected GrantedAuthorityImpl createNewEntity() {
|
45
|
return GrantedAuthorityImpl.NewInstance("");
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
protected String getEntityName() {
|
50
|
return "Granted Authority";
|
51
|
}
|
52
|
}
|