- /** Opens a new editor with a copy of this process */
- protected void relaunch() {
- try {
- Node duplicatedNode = duplicateProcess();
- IWorkbenchPage activePage = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
- activePage.openEditor(
- new ProcessEditorInput(duplicatedNode.getPath()),
- ProcessEditor.ID);
- getEditor().close(false);
- } catch (Exception e1) {
- throw new SlcException("Cannot relaunch " + processNode, e1);
- }
- }
-
- /** Duplicates the process */
- protected Node duplicateProcess() {
- try {
- Session session = processNode.getSession();
- String uuid = UUID.randomUUID().toString();
- String destPath = SlcJcrUtils.createExecutionProcessPath(uuid);
- Node newNode = JcrUtils.mkdirs(session, destPath, SLC_PROCESS);
- JcrUtils.copy(processNode, newNode);
- // session.getWorkspace().copy(processNode.getPath(), destPath);
- // Node newNode = session.getNode(destPath);
- // make sure that we kept the mixins
- // newNode.addMixin(NodeType.MIX_CREATED);
- // newNode.addMixin(NodeType.MIX_LAST_MODIFIED);
- newNode.setProperty(SLC_UUID, uuid);
- newNode.setProperty(SLC_STATUS, ExecutionProcess.INITIALIZED);
- session.save();
- return newNode;
- } catch (RepositoryException e) {
- throw new SlcException("Cannot duplicate process", e);
- }
- }
-