From cec804823540f035172eabce620e636ea4f5e80d Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Wed, 31 Oct 2012 07:49:40 +0000 Subject: [PATCH] Make execution editor more robust git-svn-id: https://svn.argeo.org/slc/trunk@5682 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- plugins/org.argeo.slc.client.ui/plugin.xml | 180 ------------------ .../client/ui/editors/ProcessBuilderPage.java | 27 +-- .../slc/client/ui/editors/ProcessEditor.java | 25 +++ 3 files changed, 31 insertions(+), 201 deletions(-) diff --git a/plugins/org.argeo.slc.client.ui/plugin.xml b/plugins/org.argeo.slc.client.ui/plugin.xml index 7ee6be7aa..e77f45899 100644 --- a/plugins/org.argeo.slc.client.ui/plugin.xml +++ b/plugins/org.argeo.slc.client.ui/plugin.xml @@ -26,59 +26,6 @@ icon="icons/processes.gif" restorable="true"> - @@ -105,75 +52,6 @@ name="Refresh type"> - - - - - @@ -188,65 +66,7 @@ label="Update module" tooltip="Update module"> - - - diff --git a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessBuilderPage.java b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessBuilderPage.java index 31b5d30b8..5bd5aff31 100644 --- a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessBuilderPage.java +++ b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessBuilderPage.java @@ -517,22 +517,6 @@ public class ProcessBuilderPage extends FormPage implements SlcNames { .hasNext();) { Node flowNode = nit.nextNode(); children.add(flowNode); - try { - // make sure modules are started for all nodes - String flowDefPath = flowNode.getNode(SLC_ADDRESS) - .getProperty(Property.JCR_PATH).getString(); - Node executionModuleNode = flowNode.getSession() - .getNode(SlcJcrUtils.modulePath(flowDefPath)); - if (!executionModuleNode.getProperty(SLC_STARTED) - .getBoolean()) - ClientUiPlugin.startStopExecutionModule( - modulesManager, executionModuleNode); - } catch (Exception e) { - ErrorFeedback.show( - "Cannot start execution module related to " - + flowNode, e); - } - } return children.toArray(); } catch (RepositoryException e) { @@ -562,7 +546,6 @@ public class ProcessBuilderPage extends FormPage implements SlcNames { } static class FlowsLabelProvider extends ColumnLabelProvider { - @Override public String getText(Object element) { Node node = (Node) element; @@ -571,10 +554,12 @@ public class ProcessBuilderPage extends FormPage implements SlcNames { if (node.hasNode(SLC_ADDRESS)) { String path = node.getNode(SLC_ADDRESS) .getProperty(Property.JCR_PATH).getString(); - Node executionModuleNode = node.getSession().getNode( - SlcJcrUtils.modulePath(path)); - String executionModuleName = executionModuleNode - .getProperty(SLC_NAME).getString(); + String executionModuleName = SlcJcrUtils + .moduleName(path); + // Node executionModuleNode = node.getSession().getNode( + // SlcJcrUtils.modulePath(path)); + // String executionModuleName = executionModuleNode + // .getProperty(SLC_NAME).getString(); return executionModuleName + ":" + SlcJcrUtils.flowRelativePath(path); } diff --git a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessEditor.java b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessEditor.java index 71ca6b88d..87b7f8694 100644 --- a/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessEditor.java +++ b/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessEditor.java @@ -22,6 +22,7 @@ import java.util.UUID; import javax.jcr.Node; import javax.jcr.NodeIterator; +import javax.jcr.Property; import javax.jcr.RepositoryException; import javax.jcr.Session; @@ -122,8 +123,32 @@ public class ProcessEditor extends FormEditor implements } catch (RepositoryException e) { throw new SlcException("Cannot update status of " + processNode, e); } + + // save doSave(null); + try { + // make sure modules are started for all nodes + for (NodeIterator nit = processNode.getNode(SLC_FLOW).getNodes(); nit + .hasNext();) { + Node flowNode = nit.nextNode(); + try { + String flowDefPath = flowNode.getNode(SLC_ADDRESS) + .getProperty(Property.JCR_PATH).getString(); + Node executionModuleNode = flowNode.getSession().getNode( + SlcJcrUtils.modulePath(flowDefPath)); + if (!executionModuleNode.getProperty(SLC_STARTED) + .getBoolean()) + ClientUiPlugin.startStopExecutionModule(modulesManager, + executionModuleNode); + } catch (Exception e) { + ErrorFeedback.show( + "Cannot start execution module related to " + + flowNode, e); + } + } + + // Actually process ExecutionProcess process = processController.process(processNode); Map properties = new HashMap(); properties.put(ExecutionModulesManager.SLC_PROCESS_ID, -- 2.39.5