-// $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.
*/
import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;
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;
* @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)