Search in sources :

Example 1 with FlowchartPage

use of com.centurylink.mdw.designer.pages.FlowchartPage in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method saveProcessAs.

public void saveProcessAs(final WorkflowProcess processVersion, final WorkflowPackage targetPackage, final String newName) {
    String progressMsg = SAVING + newName + "'";
    String errorMsg = "Save Process";
    designerRunner = new DesignerRunner(progressMsg, errorMsg, project) {

        public void perform() throws ValidationException, DataAccessException, RemoteException {
            ProcessVO origProcVO = processVersion.getProcessVO();
            ProcessVO newProcVO = new ProcessVO(-1L, newName, origProcVO.getProcessDescription(), null);
            newProcVO.set(origProcVO.getAttributes(), origProcVO.getVariables(), origProcVO.getTransitions(), origProcVO.getSubProcesses(), origProcVO.getActivities());
            newProcVO.setVersion(1);
            newProcVO.setInRuleSet(origProcVO.isInRuleSet());
            WorkflowProcess newProcess = new WorkflowProcess(targetPackage.getProject(), newProcVO);
            newProcess.setPackage(targetPackage);
            Graph process = new Graph(newProcVO, dataAccess.getDesignerDataModel().getNodeMetaInfo(), getIconFactory());
            process.dirtyLevel = Graph.NEW;
            FlowchartPage flowchartPage = FlowchartPage.newPage(mainFrame);
            flowchartPage.setProcess(process);
            saveProcess(newProcess, flowchartPage, PersistType.CREATE, 0, false, false);
            toggleProcessLock(newProcess, true);
            // why?
            newProcess.getProcessVO().setVersion(1);
            dataAccess.getProcesses(false).add(newProcess.getProcessVO());
            targetPackage.addProcess(newProcess);
            newProcess.setPackage(targetPackage);
            if (!newProcess.isInDefaultPackage())
                savePackage(newProcess.getPackage());
        }
    };
    designerRunner.run();
}
Also used : ValidationException(com.centurylink.mdw.designer.utils.ValidationException) Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) RemoteException(java.rmi.RemoteException) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) FlowchartPage(com.centurylink.mdw.designer.pages.FlowchartPage)

Example 2 with FlowchartPage

use of com.centurylink.mdw.designer.pages.FlowchartPage in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method copyProcess.

public void copyProcess(final String originalName, final String originalVersion, final String newName, final WorkflowPackage targetPackage) {
    String progressMsg = "Creating process '" + newName + "'\nin package '" + targetPackage.getName() + "'";
    String errorMsg = "Create Process";
    designerRunner = new DesignerRunner(progressMsg, errorMsg, project) {

        public void perform() throws ValidationException, DataAccessException, RemoteException {
            int dotIdx = originalVersion.indexOf('.');
            int major = Integer.parseInt(originalVersion.substring(0, dotIdx));
            int minor = Integer.parseInt(originalVersion.substring(dotIdx + 1));
            ProcessVO origProcVO = dataAccess.getDesignerDataAccess().getProcessDefinition(originalName, major * 1000 + minor);
            origProcVO = dataAccess.getDesignerDataAccess().getProcess(origProcVO.getProcessId(), origProcVO);
            new ProcessWorker().convert_to_designer(origProcVO);
            ProcessVO newProcVO = new ProcessVO(-1L, newName, origProcVO.getProcessDescription(), null);
            newProcVO.set(origProcVO.getAttributes(), origProcVO.getVariables(), origProcVO.getTransitions(), origProcVO.getSubProcesses(), origProcVO.getActivities());
            newProcVO.setVersion(1);
            newProcVO.setInRuleSet(origProcVO.isInRuleSet());
            WorkflowProcess newProcess = new WorkflowProcess(targetPackage.getProject(), newProcVO);
            newProcess.setPackage(targetPackage);
            Graph process = new Graph(newProcVO, dataAccess.getDesignerDataModel().getNodeMetaInfo(), getIconFactory());
            process.dirtyLevel = Graph.NEW;
            FlowchartPage flowchartPage = FlowchartPage.newPage(mainFrame);
            flowchartPage.setProcess(process);
            saveProcess(newProcess, flowchartPage, PersistType.CREATE, 0, false, false);
            toggleProcessLock(newProcess, true);
            // why?
            newProcess.getProcessVO().setVersion(1);
            dataAccess.getProcesses(false).add(newProcess.getProcessVO());
            targetPackage.addProcess(newProcess);
            newProcess.setPackage(targetPackage);
            if (!newProcess.isInDefaultPackage())
                savePackage(newProcess.getPackage());
        }
    };
    designerRunner.run();
}
Also used : ValidationException(com.centurylink.mdw.designer.utils.ValidationException) Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) ProcessWorker(com.centurylink.mdw.designer.utils.ProcessWorker) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) RemoteException(java.rmi.RemoteException) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) FlowchartPage(com.centurylink.mdw.designer.pages.FlowchartPage)

Example 3 with FlowchartPage

use of com.centurylink.mdw.designer.pages.FlowchartPage in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method createNewProcess.

public void createNewProcess(final WorkflowProcess processVersion) {
    String progressMsg = "Creating '" + processVersion.getName() + "'";
    String errorMsg = "Create Process";
    designerRunner = new DesignerRunner(progressMsg, errorMsg, project) {

        public void perform() throws ValidationException, DataAccessException, RemoteException {
            if (dataAccess.getDesignerDataModel().getNodeMetaInfo().getStartActivity() == null)
                throw new ValidationException("Please import the MDW Baseline Package corresponding to your MDW framework version.");
            Graph process = new Graph(processVersion.getName(), ProcessVisibilityConstant.PUBLIC, dataAccess.getDesignerDataModel().getNodeMetaInfo(), getIconFactory());
            process.setDescription(processVersion.getDescription());
            process.getProcessVO().setInRuleSet(processVersion.isInRuleSet());
            if (project.isFilePersist())
                process.getProcessVO().setRawFile(new File(project.getAssetDir() + "/" + processVersion.getPackage().getName() + "/" + processVersion.getName() + ".proc"));
            if (!processVersion.isInDefaultPackage())
                process.getProcessVO().setPackageName(processVersion.getPackage().getName());
            final FlowchartPage flowchartPage = FlowchartPage.newPage(mainFrame);
            flowchartPage.setProcess(process);
            saveProcess(processVersion, flowchartPage, PersistType.CREATE, 0, false, false);
            toggleProcessLock(processVersion, true);
            if (processVersion.isInRuleSet())
                dataAccess.getAllRuleSets(false).add(processVersion.getProcessVO());
            // update the process tree
            if (!processVersion.isInDefaultPackage()) {
                processVersion.getPackage().addProcess(processVersion);
                savePackage(processVersion.getPackage());
            } else {
                processVersion.getProject().getDefaultPackage().addProcess(processVersion);
            }
            // add to the mainFrame process list
            dataAccess.getDesignerDataModel().addProcess(processVersion.getProcessVO());
        }
    };
    designerRunner.run();
}
Also used : ValidationException(com.centurylink.mdw.designer.utils.ValidationException) Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) RemoteException(java.rmi.RemoteException) IFile(org.eclipse.core.resources.IFile) File(java.io.File) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) FlowchartPage(com.centurylink.mdw.designer.pages.FlowchartPage)

Aggregations

DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)3 Graph (com.centurylink.mdw.designer.display.Graph)3 SubGraph (com.centurylink.mdw.designer.display.SubGraph)3 FlowchartPage (com.centurylink.mdw.designer.pages.FlowchartPage)3 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)3 RemoteException (java.rmi.RemoteException)3 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)2 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)2 ProcessWorker (com.centurylink.mdw.designer.utils.ProcessWorker)1 File (java.io.File)1 IFile (org.eclipse.core.resources.IFile)1