return defaultService.delete(arg0);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
}
return defaultService.delete(arg0);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
}
return defaultService.delete(arg0);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(java.util.Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
}
return defaultService.moveTaxonDescriptions(sourceTaxonUuid, targetTaxonUuid);
}
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
}
return defaultService.delete(arg0);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
return defaultService.delete(uuid);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
}
return defaultService.delete(uuid);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
}
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
}
return defaultService.delete(uuid);
}
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.service.IService#delete(java.util.Collection)
+ */
+ @Override
+ public DeleteResult delete(Collection<UUID> arg0) {
+ return defaultService.delete(arg0);
+ }
+
}
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler;
import java.util.List;
+import java.util.UUID;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingPolytomousKeyDeleteOperation;
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.util.OperationsUtil;
/**
* @author cmathew
*/
public class RemotingPolytomousKeyDeleteHandler extends RemotingCdmHandler {
- List<PolytomousKey> keysToDelete;
+ List<UUID> keysToDelete;
/**
* @param label
*/
public IStatus allowOperations(ExecutionEvent event) {
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
- keysToDelete = selection.toList();
+ keysToDelete = OperationsUtil.convertToUuidList(selection.toList());
if(keysToDelete.isEmpty()){
return Status.CANCEL_STATUS;
package eu.etaxonomy.taxeditor.navigation.key.polytomous.operation;
import java.util.List;
+import java.util.UUID;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
import eu.etaxonomy.taxeditor.store.CdmStore;
private final static String LABEL = "Delete Polytomous Key operation";
- private final List<PolytomousKey> keysToDelete;
+ private final List<UUID> keysToDelete;
/**
* @param label
* @param action
*/
public RemotingPolytomousKeyDeleteOperation(Object source,
boolean async,
- List<PolytomousKey> keysToDelete) {
+ List<UUID> keysToDelete) {
super(LABEL, Action.Delete, source, async);
this.keysToDelete = keysToDelete;
}
*/
@Override
protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
- UpdateResult result = new UpdateResult();
- for(PolytomousKey key : keysToDelete) {
- UpdateResult updateResult = CdmStore.getService(IPolytomousKeyService.class).delete(key.getUuid());
- if(updateResult.isAbort()) {
- result.setStatus(updateResult.getStatus());
- result.addExceptions(updateResult.getExceptions());
- return result;
- }
- if(updateResult.isError()) {
- result.setStatus(updateResult.getStatus());
- result.addExceptions(updateResult.getExceptions());
- }
- }
- return result;
+ return CdmStore.getService(IPolytomousKeyService.class).delete(keysToDelete);
}
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.navigation.key.polytomous.operation;
+
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author cmathew
+ * @date 29 Jun 2015
+ *
+ */
+public class RemotingPolytomousKeyUpdateAllNodesOperation extends RemotingCdmUpdateOperation {
+
+ UUID polytomousKeyUuid;
+ /**
+ * @param label
+ * @param action
+ * @param source
+ * @param async
+ */
+ public RemotingPolytomousKeyUpdateAllNodesOperation(Object source,
+ boolean async,
+ UUID polytomousKeyUuid) {
+ super(LABEL, Action.Update, source, async);
+ this.polytomousKeyUuid = polytomousKeyUuid;
+
+ }
+
+ private final static String LABEL = "Update All Polytomous Key Nodes operation";
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+ return CdmStore.getService(IPolytomousKeyService.class).updateAllNodeNumberings(polytomousKeyUuid);
+ }
+
+}
eu.etaxonomy.taxeditor.ui.section.supplemental,
eu.etaxonomy.taxeditor.ui.section.taxon,
eu.etaxonomy.taxeditor.ui.selection,
+ eu.etaxonomy.taxeditor.util,
eu.etaxonomy.taxeditor.view,
eu.etaxonomy.taxeditor.view.datasource,
eu.etaxonomy.taxeditor.view.datasource.handler,
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 EDIT
+* 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.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+
+/**
+ * @author cmathew
+ * @date 29 Jun 2015
+ *
+ */
+public class OperationsUtil {
+
+ public static List<UUID> convertToUuidList(List<CdmBase> cdmBaseList) {
+ List<UUID> uuids = new ArrayList<UUID>();
+ for(CdmBase cdmBase : cdmBaseList) {
+ if(cdmBase == null) {
+ uuids.add(null);
+ } else {
+ uuids.add(cdmBase.getUuid());
+ }
+ }
+ return uuids;
+ }
+}
import org.eclipse.core.commands.ExecutionException;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import org.unitils.dbunit.annotation.DataSet;
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingPolytomousKeyDeleteOperation;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingPolytomousKeyUpdateAllNodesOperation;
import eu.etaxonomy.taxeditor.operations.BaseOperationTest;
/**
public class PolytomousKeyViewPartTest extends BaseOperationTest {
IPolytomousKeyService polytomousKeyService = getRemoteApplicationController().getPolytomousKeyService();
+ private static UUID pkey1Uuid = UUID.fromString("f82cef88-5a9e-4917-9938-d08bda40836f");
+ private static UUID pkey2Uuid = UUID.fromString("a00ca7ec-b660-433c-bd14-596826ab2243");
+ private static UUID pkey3Uuid = UUID.fromString("197bc542-bf5b-4a52-aa66-c65df32c196b");
+ @Ignore // waiting for #3998 to be fixed
@Test
public void testDeletePolytomousKey() throws ExecutionException {
List<PolytomousKey> pKeysBeforeDelete = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
int initialCount = pKeysBeforeDelete.size();
List<PolytomousKey> keysToDelete = new ArrayList<PolytomousKey>();
- keysToDelete.add(polytomousKeyService.load(UUID.fromString("f82cef88-5a9e-4917-9938-d08bda40836f")));
- keysToDelete.add(polytomousKeyService.load(UUID.fromString("a00ca7ec-b660-433c-bd14-596826ab2243")));
- keysToDelete.add(polytomousKeyService.load(UUID.fromString("197bc542-bf5b-4a52-aa66-c65df32c196b")));
+ keysToDelete.add(polytomousKeyService.load(pkey1Uuid));
+ keysToDelete.add(polytomousKeyService.load(pkey2Uuid));
+ keysToDelete.add(polytomousKeyService.load(pkey3Uuid));
+
+ List<UUID> uuids = new ArrayList<UUID>();
+ uuids.add(pkey1Uuid);
+ uuids.add(pkey2Uuid);
+ uuids.add(pkey3Uuid);
int keysToDeleteCount = keysToDelete.size();
operation = new RemotingPolytomousKeyDeleteOperation(sessionOwner,
false,
- keysToDelete);
+ uuids);
operation.execute(monitor, info);
List<PolytomousKey> pKeysAfterDelete = polytomousKeyService.list(PolytomousKey.class, null, null, null, null);
}
+ @Test
+ public void testUpdateAllNodes() throws ExecutionException {
+ operation = new RemotingPolytomousKeyUpdateAllNodesOperation(sessionOwner,
+ false,
+ pkey1Uuid);
+ operation.execute(monitor, info);
+ }
+
}
<?xml version="1.0" encoding="UTF-8"?><!--
- generated by Jailer 4.3, Thu Jun 25 16:36:00 CEST 2015 from cmathew@cmbgbm-t530
+ generated by Jailer 4.3, Mon Jun 29 14:15:44 CEST 2015 from cmathew@cmbgbm-t530
- Extraction Model: PolytomousKey where id = 90 or id = 111 or id = 112 or id = 113 or id = 114 or id = 115 or id = 116 (extractionmodel/by-example/SbE-PolytomousKey-16-34-36-489.csv)
+ Extraction Model: PolytomousKey where id = 90 or id = 111 or id = 112 or id = 113 or id = 114 or id = 115 or id = 116 (extractionmodel/by-example/SbE-PolytomousKey-14-15-18-725.csv)
Database URL: jdbc:mysql://127.0.0.1:3306/local-cyprus
Database User: root
- Exported Rows: 7
+ Exported Rows: 10
PolytomousKey 7
+ PolytomousKeyNode 3
--><dataset>
- <PolytomousKey id="90" created="2012-11-23 19:53:37.0" uuid="f82cef88-5a9e-4917-9938-d08bda40836f" protectedtitlecache="true" titleCache="Cleome" startNumber="1"/>
+ <PolytomousKeyNode id="100" created="2012-11-23 19:53:37.0" uuid="c8e296da-441d-403b-9647-d729c00b2aa4" updated="2014-01-24 13:21:03.0" nodenumber="1" key_id="90"/>
+ <PolytomousKeyNode id="101" created="2012-11-23 19:53:54.0" uuid="588754cd-6098-40d3-bb37-05d0a6676336" sortindex="0" key_id="90" parent_id="100"/>
+ <PolytomousKeyNode id="102" created="2012-11-23 19:54:42.0" uuid="52ea0b19-f29e-49fc-8326-02292fda4e43" sortindex="1" key_id="90" parent_id="100"/>
+
+ <PolytomousKey id="90" created="2012-11-23 19:53:37.0" uuid="f82cef88-5a9e-4917-9938-d08bda40836f" protectedtitlecache="true" titleCache="Cleome" root_id="100" startNumber="1"/>
<PolytomousKey id="111" created="2013-02-15 16:26:38.0" uuid="a00ca7ec-b660-433c-bd14-596826ab2243" protectedtitlecache="true" titleCache="Ammi" startNumber="1"/>
<PolytomousKey id="112" created="2013-02-15 16:31:54.0" uuid="197bc542-bf5b-4a52-aa66-c65df32c196b" protectedtitlecache="true" titleCache="Adonis" startNumber="1"/>
<PolytomousKey id="113" created="2013-02-15 16:50:59.0" uuid="2ebacbb0-13f4-4407-8579-d5968e09a905" protectedtitlecache="true" titleCache="Enarthrocarpus" startNumber="1"/>
- <PolytomousKey id="114" created="2013-02-15 16:54:31.0" uuid="0426418c-5b76-4c19-8177-6bebb4d37329" protectedtitlecache="true" titleCache="Glaucium" startNumber="1"/>
+ <PolytomousKey id="114" created="2013-02-15 16:54:31.0" uuid="0426418c-5b76-4c19-8177-6bebb4d37329" protectedtitlecache="true" titleCache="Glaucium" startNumber="1"/>
<PolytomousKey id="115" created="2013-02-15 17:05:42.0" uuid="6aa69b73-6242-4d3d-85c9-485aab9b1975" protectedtitlecache="true" titleCache="Sagina" startNumber="1"/>
<PolytomousKey id="116" created="2013-02-15 17:09:43.0" uuid="cfe7626d-49cc-4dac-acbc-601825deb44a" protectedtitlecache="true" titleCache="Dianthus" startNumber="1"/>