Make execution editor more robust
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 31 Oct 2012 07:49:40 +0000 (07:49 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 31 Oct 2012 07:49:40 +0000 (07:49 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@5682 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

plugins/org.argeo.slc.client.ui/plugin.xml
plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessBuilderPage.java
plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessEditor.java

index 7ee6be7aa41855ae264997c78cf51521d998c786..e77f45899a0aec2f70bd19090d18b10d213a77c8 100644 (file)
                 icon="icons/processes.gif"
                 restorable="true">
           </view>
-          <!--
-          <view
-                id="org.argeo.slc.client.ui.executionModulesView"
-                class="org.argeo.eclipse.spring.SpringExtensionFactory"
-                icon="icons/execution_module.gif"
-                name="Execution Modules"
-                restorable="true">
-          </view>
-          <view
-                class="org.argeo.eclipse.spring.SpringExtensionFactory"
-                icon="icons/results.gif"
-                id="org.argeo.slc.client.ui.resultListView"
-                name="Results"
-                restorable="true">
-          </view>
-          <view
-                allowMultiple="true"
-                class="org.argeo.eclipse.spring.SpringExtensionFactory"
-                icon="icons/result_details.gif"
-                id="org.argeo.slc.client.ui.resultDetailView"
-                name="Result details"
-                restorable="true">
-          </view>
-          <view
-                id="org.argeo.slc.client.ui.processListView"
-                class="org.argeo.eclipse.spring.SpringExtensionFactory"
-                name="Processes"
-                icon="icons/processes.gif"
-                restorable="true">
-          </view>
-          <view
-                allowMultiple="true"
-                class="org.argeo.eclipse.spring.SpringExtensionFactory"
-                icon="icons/process_details.gif"
-                id="org.argeo.slc.client.ui.processDetailView"
-                name="Process details"
-                restorable="true">
-          </view>
-          <view
-                class="org.argeo.eclipse.spring.SpringExtensionFactory"
-                icon="icons/edit_parameters.gif"
-                id="org.argeo.slc.client.ui.processParametersView"
-                name="Process Parameters"
-                restorable="true">
-          </view>
-          <view
-                class="org.argeo.eclipse.spring.SpringExtensionFactory"
-                icon="icons/batch.gif"
-                id="org.argeo.slc.client.ui.processBuilderView"
-                name="Batch"
-                restorable="true">
-          </view>
-          -->
    </extension>
        
        <!-- Commands definitions --> 
                        name="Refresh type">
                        </commandParameter>
            </command>
-           <!--
-               <command
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.runSlc/Flow"
-               name="org.argeo.slc.demo.minimal:hello">
-           </command>
-           -->
-           <!-- Result List
-               <command
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.refreshResultList"
-               name="Refresh Result List">
-           </command>
-               <command
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.removeSelectedResultFromResultList"
-               name="Remove selected results from list">
-           </command>
-               <command 
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.displayResultDetails"
-               name="Display Result Details">
-               </command>
-        -->
-           <!-- Execution Modules
-           <command
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.refreshExecutionModulesView"
-               name="Refresh Execution Modules View">
-               </command>
-                -->
-           <!-- Batch
-           <command
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.launchBatch"
-               name="Launch Batch">
-           </command>
-           <command
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.removeSelectedFromBatch"
-               name="Remove Selected From Batch">
-               </command>
-           <command
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.clearBatch"
-               name="Clear Batch">
-               </command>
-                -->
-           <!-- Process List
-           <command
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.refreshProcessList"
-               name="Refresh Process List ">
-               </command>
-               <command 
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.displayProcessDetails"
-               name="DisplayProcessDetails">
-                       <commandParameter
-                       id="org.argeo.slc.client.commands.processUuid"
-                       name="Process UUID">
-                       </commandParameter>
-               </command>
-               <command 
-               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-               id="org.argeo.slc.client.ui.manageBundles"
-               name="Manage Bundles">
-               </command>
-                -->
     </extension>
    
        <!-- Menu definitions -->
                                label="Update module"
                                tooltip="Update module">
                        </command>
-                       <!--
-                       <command
-                               commandId="org.argeo.slc.client.ui.runSlc/Flow"
-                               icon="icons/launch.gif"
-                               label="Run SLC Flow"
-                               tooltip="Run SLC Flow">
-                       </command>
-                       -->
-               </menuContribution>   
-        <!--
-               <menuContribution
-               locationURI="menu:fileMenu">
-               </menuContribution>
-               <menuContribution
-                       locationURI="toolbar:org.argeo.slc.client.ui.resultListView">
-            <command
-               commandId="org.argeo.slc.client.ui.refreshResultList"
-                icon="icons/refresh.png"
-                label="Refresh result list"
-                tooltip="Refresh the result list">
-            </command>
-            <command
-               commandId="org.argeo.slc.client.ui.removeSelectedResultFromResultList"
-                icon="icons/removeAll.png"
-                label="Remove selected"
-                tooltip="Remove selected items from the result list (Also on server side, cannot be undone)">
-            </command>
-               </menuContribution>
-               <menuContribution
-               locationURI="toolbar:org.argeo.slc.client.ui.executionModulesView">
-                       <command
-                               commandId="org.argeo.slc.client.ui.refreshExecutionModulesView"
-                               icon="icons/refresh.png"
-                               label="Refresh execution modules"
-                               tooltip="Refresh the execution modules view.">
-                       </command>
                </menuContribution>   
-               <menuContribution
-                       locationURI="toolbar:org.argeo.slc.client.ui.processBuilderView">
-                       <command
-                               commandId="org.argeo.slc.client.ui.launchBatch"
-                               icon="icons/launch.gif"
-                               label="Launch Batch"
-                               tooltip="Launch the batch built in the process builder view.">
-                       </command>
-                       <command
-                               commandId="org.argeo.slc.client.ui.clearBatch"
-                               label="Clear Batch"
-                               icon="icons/clear_batch.gif"
-                               tooltip="Clear the batch built in the process builder view.">
-                       </command>
-                       <command
-                               commandId="org.argeo.slc.client.ui.removeSelectedFromBatch"
-                               icon="icons/remove_one.gif"
-                               label="Remove Selected From Batch"
-                               tooltip="Remove selected process from process builder view.">
-                       </command>
-               </menuContribution>
-               -->
        </extension>
    <extension
          point="org.eclipse.ui.perspectives">
index 31b5d30b8eb0d961ace4c7348c5c7459c0f3ca1d..5bd5aff31094a37e27f18059534018406d02ff21 100644 (file)
@@ -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);
                                        }
index 71ca6b88d43416442a618a815652841018ebf8d9..87b7f86940db8f72a35d06f81cbf1f1f5848d08d 100644 (file)
@@ -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<String, String> properties = new HashMap<String, String>();
                        properties.put(ExecutionModulesManager.SLC_PROCESS_ID,