-// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
package eu.etaxonomy.taxeditor.newWizard;
import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;
-import eu.etaxonomy.cdm.api.service.IGroupService;
import eu.etaxonomy.cdm.model.common.GrantedAuthorityImpl;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailWizardPage;
-import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailWizardPage;
/**
* @author a.kohlbecker
* @created Sept 13 2012
*/
public class NewGrantedAuthorityWizard extends AbstractNewEntityWizard<GrantedAuthorityImpl> {
-
+
private GrantedAuthorityDetailWizardPage authorityPage;
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#addPages()
*/
*/
@Override
protected void saveEntity() {
- CdmStore.getService(IGrantedAuthorityService.class).saveOrUpdate(getEntity());
+ try{
+ CdmStore.getService(IGrantedAuthorityService.class).merge(getEntity(), true);
+ }catch (Exception e){
+ MessagingUtils.info(Messages.NewGrantedAuthority_AlreadyInDb);
+ }
+
}
/* (non-Javadoc)
*/
@Override
protected GrantedAuthorityImpl createNewEntity() {
- return GrantedAuthorityImpl.NewInstance();
+ return GrantedAuthorityImpl.NewInstance("");
}
/* (non-Javadoc)