merge-update from trunk
authorPatric Plitzner <p.plitzner@bgbm.org>
Mon, 4 Aug 2014 10:08:37 +0000 (10:08 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Mon, 4 Aug 2014 10:08:37 +0000 (10:08 +0000)
14 files changed:
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientAgentService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientClassificationService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientDescriptionService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientNameService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientOccurenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientReferenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTaxonService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTermService.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/operation/DeleteOperation.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/DeleteTermBaseOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/SelectFeatureTreeWizardPage.java

index 95b1636ec84b555604ffd35a36af5310eb4e0fcf..8e4759ab69a7d1c47b9d1eaf80a4da5a729f9d85 100644 (file)
@@ -22,6 +22,7 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IAgentService;
 import eu.etaxonomy.cdm.api.service.IGroupService;
 import eu.etaxonomy.cdm.api.service.INameService;
@@ -85,7 +86,7 @@ public class DeleteHandler extends AbstractHandler {
                                for(Object object : structuredSelection.toList()){
                                        
                                        LineAnnotation annotation = (LineAnnotation) model.getAnnotation(object);
-                                       String result = "";     
+                                       DeleteResult result = new DeleteResult();       
                                        try {
                                                ICdmApplicationConfiguration controller;
                                                controller = (ICdmApplicationConfiguration) CdmStore.getCurrentApplicationConfiguration();
@@ -120,10 +121,8 @@ public class DeleteHandler extends AbstractHandler {
                                        } catch (Exception e){
                                                BulkEditorUtil.errorDialog("Could not delete", getClass(), e.getMessage(), null);
                                        }
-                                       try {
-                                               UUID uuid = UUID.fromString(result);
-                                       }catch (IllegalArgumentException e){
-                                               BulkEditorUtil.errorDialog("Could not delete", getClass(), result, null);
+                                       if (result.isError()){
+                                               BulkEditorUtil.errorDialog("Could not delete", getClass(), result.getExceptions().get(0).getMessage(), null);
                                        }
                                        ((BulkEditor) editor).removeAnnotatedLine(annotation);
                                        
index 8274cc91fea3725a6b30ad217c85331972c9ba37..8bbc1800583f625562baf3e5ff1682c5c7b09a16 100644 (file)
@@ -12,6 +12,7 @@ import org.eclipse.ui.IWorkbenchPage;
 \r
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;\r
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;\r
+import eu.etaxonomy.cdm.api.service.DeleteResult;\r
 import eu.etaxonomy.cdm.api.service.ITaxonService;\r
 import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;\r
 import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;\r
@@ -68,7 +69,7 @@ public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{
                                ITaxonService service = controller.getTaxonService();\r
                                \r
 \r
-                               String result = service.deleteTaxon(element, new TaxonDeletionConfigurator(), classification);\r
+                               DeleteResult result =   service.deleteTaxon(element, new TaxonDeletionConfigurator(), classification);\r
 \r
 \r
                                //closeObsoleteEditor(taxon);\r
index c22637fffb44ad60386c34035e3db19b5240734f..80e0d90e6f50d63ddee16cefbde1b55b775a3c72 100644 (file)
@@ -20,6 +20,7 @@ import org.hibernate.Session;
 import org.hibernate.criterion.Criterion;
 import org.hibernate.envers.query.criteria.AuditCriterion;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IAgentService;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
@@ -284,7 +285,7 @@ public class TransientAgentService implements IAgentService {
      * @see eu.etaxonomy.cdm.api.service.IService#delete(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public String delete(AgentBase persistentObject) {
+    public DeleteResult delete(AgentBase persistentObject) {
         return defaultAgentService.delete(persistentObject);
     }
 
index 4e7e44236b579d2e4674da2d3b119410f4674b80..7f907cdf397f7f946453f728d082cdcbad08350c 100644 (file)
@@ -20,6 +20,7 @@ import org.hibernate.Session;
 import org.hibernate.criterion.Criterion;
 import org.hibernate.envers.query.criteria.AuditCriterion;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
@@ -299,7 +300,7 @@ public class TransientClassificationService implements IClassificationService {
      * @see eu.etaxonomy.cdm.api.service.IService#delete(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public String delete(Classification persistentObject) {
+    public DeleteResult delete(Classification persistentObject) {
         return defaultClassificationService.delete(persistentObject);
     }
 
index e32f1d9972b9cd26924b2c9fd10e4a1010e8e7b9..2f46507ad575c24adc7ccde23b2e85edf4a40482 100644 (file)
@@ -20,6 +20,7 @@ import org.hibernate.Session;
 import org.hibernate.criterion.Criterion;
 import org.hibernate.envers.query.criteria.AuditCriterion;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.DistributionTree;
 import eu.etaxonomy.cdm.api.service.IDescriptionService;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
@@ -277,7 +278,7 @@ public class TransientDescriptionService implements IDescriptionService {
      * @see eu.etaxonomy.cdm.api.service.IService#delete(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public String delete(DescriptionBase persistentObject) {
+    public DeleteResult delete(DescriptionBase persistentObject) {
         return defaultDescriptionService.delete(persistentObject);
     }
 
index afaf72b65d69eb3ed01031915528c10c5063de3e..54c6911f367b1cf23601f69a41b24a7a4ecde54d 100644 (file)
@@ -23,6 +23,7 @@ import org.hibernate.Session;
 import org.hibernate.criterion.Criterion;
 import org.hibernate.envers.query.criteria.AuditCriterion;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.INameService;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
@@ -219,7 +220,7 @@ public class TransientNameService implements INameService {
      * @see eu.etaxonomy.cdm.api.service.INameService#delete(eu.etaxonomy.cdm.model.name.TaxonNameBase, eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator)
      */
     @Override
-    public String delete(TaxonNameBase name, NameDeletionConfigurator config)  {
+    public DeleteResult delete(TaxonNameBase name, NameDeletionConfigurator config)  {
         return defaultNameService.delete(name, config);
     }
 
@@ -256,7 +257,7 @@ public class TransientNameService implements INameService {
      * @see eu.etaxonomy.cdm.api.service.IService#delete(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public String delete(TaxonNameBase persistentObject) {
+    public DeleteResult delete(TaxonNameBase persistentObject) {
         return defaultNameService.delete(persistentObject);
     }
 
index f4ce443e403aec550768ea748cf13248902ab0e0..94900067a4b7a2f02bc001e9848e6f03dc63147d 100644 (file)
@@ -27,6 +27,7 @@ import org.hibernate.search.spatial.impl.Rectangle;
 
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
@@ -277,7 +278,7 @@ public class TransientOccurenceService implements IOccurrenceService {
      * @see eu.etaxonomy.cdm.api.service.IService#delete(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public String delete(SpecimenOrObservationBase persistentObject) {
+    public DeleteResult delete(SpecimenOrObservationBase persistentObject) {
         return defaultService.delete(persistentObject);
     }
 
index c70f5f06f4f45ba4606e30718837493be7a1f9e6..4aa2dabc68fdea0173650f19ace1e6cd01e9dbf9 100644 (file)
@@ -20,6 +20,7 @@ import org.hibernate.Session;
 import org.hibernate.criterion.Criterion;
 import org.hibernate.envers.query.criteria.AuditCriterion;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
@@ -273,7 +274,7 @@ public class TransientReferenceService implements IReferenceService {
      * @see eu.etaxonomy.cdm.api.service.IService#delete(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public String delete(Reference persistentObject) {
+    public DeleteResult delete(Reference persistentObject) {
         return defaultReferenceService.delete(persistentObject);
     }
 
index 96b5f6d45bc2f92017aff6dcc74cd937d2dd9652..9d00256fb3892cac1bbdff8a6a9d8e0b85c6df91 100644 (file)
@@ -24,6 +24,7 @@ import org.hibernate.Session;
 import org.hibernate.criterion.Criterion;
 import org.hibernate.envers.query.criteria.AuditCriterion;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.api.service.TaxaAndNamesSearchMode;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
@@ -257,7 +258,7 @@ public class TransientTaxonService implements ITaxonService {
      * @see eu.etaxonomy.cdm.api.service.IService#delete(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public String delete(TaxonBase persistentObject) {
+    public DeleteResult delete(TaxonBase persistentObject) {
         return defaultTaxonService.delete(persistentObject);
     }
 
@@ -1346,7 +1347,7 @@ public class TransientTaxonService implements ITaxonService {
      * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteSynonym(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator)
      */
     @Override
-    public String deleteSynonym(Synonym arg0, SynonymDeletionConfigurator arg1) {
+    public DeleteResult deleteSynonym(Synonym arg0, SynonymDeletionConfigurator arg1) {
         return defaultTaxonService.deleteSynonym(arg0, arg1);
     }
 
@@ -1354,7 +1355,7 @@ public class TransientTaxonService implements ITaxonService {
      * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteSynonym(eu.etaxonomy.cdm.model.taxon.Synonym, eu.etaxonomy.cdm.model.taxon.Taxon, eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator)
      */
     @Override
-    public String deleteSynonym(Synonym arg0, Taxon arg1, SynonymDeletionConfigurator arg2) {
+    public DeleteResult deleteSynonym(Synonym arg0, Taxon arg1, SynonymDeletionConfigurator arg2) {
         return defaultTaxonService.deleteSynonym(arg0, arg1, arg2);
     }
 
@@ -1362,7 +1363,7 @@ public class TransientTaxonService implements ITaxonService {
      * @see eu.etaxonomy.cdm.api.service.ITaxonService#deleteTaxon(eu.etaxonomy.cdm.model.taxon.Taxon, eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator, eu.etaxonomy.cdm.model.taxon.Classification)
      */
     @Override
-    public String deleteTaxon(Taxon arg0, TaxonDeletionConfigurator arg1, Classification arg2) {
+    public DeleteResult deleteTaxon(Taxon arg0, TaxonDeletionConfigurator arg1, Classification arg2) {
         return defaultTaxonService.deleteTaxon(arg0, arg1, arg2);
     }
 
index 533c4de908c517e624248245ae049a92f3922a5b..4264a12bb327fd47e57efeee5f9e0c861a776cc2 100644 (file)
@@ -331,7 +331,7 @@ public class TransientTermService implements ITermService {
      * @see eu.etaxonomy.cdm.api.service.IService#delete(eu.etaxonomy.cdm.model.common.ICdmBase)
      */
     @Override
-    public String delete(DefinedTermBase persistentObject) {
+    public DeleteResult delete(DefinedTermBase persistentObject) {
         return defaultTermService.delete(persistentObject);
     }
 
index abb15e3a4cf82f28788787c0a6963d64456d09e5..377bc61dacce8f56966c40dcdf2de98c80c12b84 100644 (file)
@@ -15,8 +15,10 @@ import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
 
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
 import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
 import eu.etaxonomy.cdm.model.description.PolytomousKey;
@@ -53,7 +55,13 @@ public class DeleteOperation extends AbstractPersistentPostOperation {
                        throws ExecutionException {
                bind();
                
-               String result = CdmStore.getService(IPolytomousKeyService.class).delete(key);
+               DeleteResult result = CdmStore.getService(IPolytomousKeyService.class).delete(key);
+               if (result.isError()){
+                       MessageDialog.openError(null, "Delete failed", result.getExceptions().get(0).getMessage());
+                       
+               }else if(!result.getExceptions().isEmpty()){
+                       //TODO:Warning!
+               }
                
                return postExecute(null);
        }
index 21629870e32e3e63ba7d6878e6034e8f805e8b3f..481b6d92848e1981f89ae8d8185f36dd76da7ef8 100644 (file)
@@ -19,9 +19,11 @@ import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
 
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
 import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
@@ -102,8 +104,12 @@ public class DeleteOperation extends AbstractPersistentPostOperation{
 
                                element = ((TaxonNode)taxonNode).getTaxon();
                                
-                               String result = service.deleteTaxonNode((TaxonNode)taxonNode, config);
-                               //TODO:if result is not a UUIDstring then pop up a message box
+                               DeleteResult result = service.deleteTaxonNode((TaxonNode)taxonNode, config);
+                               if (result.isError()){
+                                       //TODO:Error message!
+                                       MessageDialog.openError(null, "Delete failed", result.getExceptions().get(0).getMessage());
+                               }
+
 
                        }else if(taxonNode != null && taxonNode instanceof Classification){
                                Classification taxonomicTree = (Classification) taxonNode;
@@ -113,8 +119,11 @@ public class DeleteOperation extends AbstractPersistentPostOperation{
                                        }
                                }*/
                                
-                               String result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree);
-                               
+                               DeleteResult result = CdmStore.getService(IClassificationService.class).delete(taxonomicTree);
+                               if (result.isError()){
+                                       //TODO:Error message!
+                                       MessageDialog.openError(null, "Delete failed", result.getExceptions().get(0).getMessage());
+                               }
 
                                /*}else{
                                        try{
index c0d89719447f06971149075e4ef5892260f9376e..24865969ae937a3694ebfa64c496682567b410a4 100644 (file)
@@ -15,7 +15,9 @@ import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;\r
 import org.eclipse.core.runtime.IStatus;\r
 import org.eclipse.core.runtime.Status;\r
+import org.eclipse.jface.dialogs.MessageDialog;\r
 \r
+import eu.etaxonomy.cdm.api.service.DeleteResult;\r
 import eu.etaxonomy.cdm.api.service.ITermService;\r
 import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
 import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;\r
@@ -79,8 +81,10 @@ public class DeleteTermBaseOperation extends AbstractPostTaxonOperation {
 \r
                        definedEditorInput.getVocabularies().remove((TermVocabulary)termBase); \r
                        \r
-                       String result = CdmStore.getService(IVocabularyService.class).delete((TermVocabulary)termBase);\r
-                       \r
+                       DeleteResult result =   CdmStore.getService(IVocabularyService.class).delete((TermVocabulary)termBase);\r
+                       if (result.isError()){\r
+                               //TODO: Error message!\r
+                       }\r
                        \r
                } else if (termBase instanceof DefinedTermBase) {\r
                        \r
@@ -114,8 +118,11 @@ public class DeleteTermBaseOperation extends AbstractPostTaxonOperation {
                                vocabulary.removeTerm(definedTermBase);\r
                        }\r
                        \r
-                       String result = CdmStore.getService(ITermService.class).delete((DefinedTermBase)termBase);\r
+                       DeleteResult result =   CdmStore.getService(ITermService.class).delete((DefinedTermBase)termBase);\r
                        \r
+                       if (result.isError()){\r
+                               MessageDialog.openError(null, "Delete failed", result.getExceptions().get(0).getMessage());\r
+                       }\r
                }\r
                \r
                return postExecute(termBase);\r
index de74faa76b5b9cd4f6ae2390b91ba1b4d3998fba..9457d0969e75f394043336e778a4d343786473f0 100644 (file)
@@ -31,6 +31,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
 import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
@@ -162,8 +163,11 @@ public class SelectFeatureTreeWizardPage extends WizardPage implements ISelectio
                        for(Object element : selection.toArray()){
                                viewer.remove(element);
                                
-                               String result = CdmStore.getService(IFeatureTreeService.class).delete((FeatureTree) element);
+                               DeleteResult result =   CdmStore.getService(IFeatureTreeService.class).delete((FeatureTree) element);
                                
+                               if (result.isError()){
+                                       
+                               }
                                viewer.setSelection(new StructuredSelection(new Object[0]));
                        }
                }