import javax.jcr.Node;
import javax.jcr.NodeIterator;
+import javax.jcr.Property;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
private ProcessController processController;
private ProcessBuilderPage builderPage;
- //private ProcessLogPage logPage;
private ExecutionModulesManager modulesManager;
- //private Boolean switchToLog = false;
-
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
protected Node newProcessNode(ProcessEditorInput pei)
throws RepositoryException {
String uuid = UUID.randomUUID().toString();
- String processPath = SlcJcrUtils.createExecutionProcessPath(uuid);
+ String processPath = SlcJcrUtils.createExecutionProcessPath(session,
+ uuid);
Node processNode = JcrUtils.mkdirs(session, processPath, SLC_PROCESS);
processNode.setProperty(SLC_UUID, uuid);
processNode.setProperty(SLC_STATUS, ExecutionProcess.NEW);
} catch (RepositoryException e) {
throw new SlcException("Cannot update status of " + processNode, e);
}
+
+ // save
doSave(null);
+
try {
- // show log
-// if (switchToLog)
-// setActivePage(logPage.getId());
+ // 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,
try {
Session session = processNode.getSession();
String uuid = UUID.randomUUID().toString();
- String destPath = SlcJcrUtils.createExecutionProcessPath(uuid);
+ String destPath = SlcJcrUtils.createExecutionProcessPath(session,
+ uuid);
Node newNode = JcrUtils.mkdirs(session, destPath,
SlcTypes.SLC_PROCESS);
@Override
protected void addPages() {
try {
- builderPage = new ProcessBuilderPage(this, processNode);
+ builderPage = new ProcessBuilderPage(this, processNode,
+ modulesManager);
addPage(builderPage);
firePropertyChange(PROP_DIRTY);
-// logPage = new ProcessLogPage(this, processNode);
-// addPage(logPage);
} catch (PartInitException e) {
throw new SlcException("Cannot add pages", e);
}
}
public void addSteps(ExecutionProcess process, List<ExecutionStep> steps) {
- // logPage.addSteps(steps);
}
/** Expects one session per editor. */