Search in sources :

Example 6 with ValidationException

use of com.centurylink.mdw.designer.utils.ValidationException in project mdw-designer by CenturyLinkCloud.

the class ImportTaskTemplatesWizard method performImportExport.

void performImportExport(ProgressMonitor progressMonitor) throws IOException, XmlException, DataAccessException, ValidationException, ActionCancelledException {
    Importer importer = new Importer(getProject().getDataAccess(), getShell());
    progressMonitor.progress(10);
    progressMonitor.subTask("Reading XML file");
    byte[] bytes = readFile(getPage().getFilePath());
    if (progressMonitor.isCanceled())
        throw new ActionCancelledException();
    progressMonitor.subTask("Performing Import");
    WorkflowPackage pkg = getPackage();
    if (pkg == null)
        throw new ValidationException("No package found.");
    importer.importTaskTemplates(pkg, new String(bytes), progressMonitor);
    progressMonitor.progress(30);
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ValidationException(com.centurylink.mdw.designer.utils.ValidationException) ActionCancelledException(com.centurylink.mdw.common.utilities.timer.ActionCancelledException) Importer(com.centurylink.mdw.plugin.designer.Importer)

Example 7 with ValidationException

use of com.centurylink.mdw.designer.utils.ValidationException 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 8 with ValidationException

use of com.centurylink.mdw.designer.utils.ValidationException 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 9 with ValidationException

use of com.centurylink.mdw.designer.utils.ValidationException in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method saveProcessWithProgress.

public void saveProcessWithProgress(final WorkflowProcess process, final FlowchartPage flowchartPage, final PersistType persistType, final int version, final boolean validate, final boolean keepLocked) {
    String progressMsg = SAVING + process.getName() + "'";
    String errorMsg = "Save Process";
    designerRunner = new DesignerRunner(progressMsg, errorMsg, project) {

        public void perform() throws ValidationException, DataAccessException, RemoteException {
            WorkflowProcess oldProcess = null;
            if (persistType == PersistType.NEW_VERSION) {
                RuleSetVO existing = null;
                if (process.isInRuleSet())
                    existing = dataAccess.getDesignerDataAccess().getRuleSet(process.getName(), RuleSetVO.PROCESS, version);
                if (existing != null)
                    throw new DataAccessException("\n" + process.getLabel() + ALREADY_EXISTS);
                process.getProcessVO().setProcessId(-1L);
                // preserve the old version for the process tree
                ProcessVO oldProcessVoStub = new ProcessVO();
                oldProcessVoStub.setProcessId(process.getId());
                oldProcessVoStub.setProcessName(process.getName());
                oldProcessVoStub.setVersion(process.getProcessVO().getVersion());
                oldProcess = new WorkflowProcess(process.getProject(), oldProcessVoStub);
                oldProcess.setPackage(process.getPackage());
                oldProcess.setTopLevelVersion(process.getTopLevelVersion());
                if (// temp attribute to avoid API
                project.isFilePersist())
                    // change
                    process.setAttribute("previousProcessVersion", oldProcess.getVersionString());
            }
            saveProcess(process, flowchartPage, persistType, version, validate, keepLocked);
            if (process.getTopLevelVersion() != null)
                process.getTopLevelVersion().setProcessVO(process.getProcessVO());
            if (persistType == PersistType.NEW_VERSION && process.isInRuleSet()) {
                RuleSetVO procRs = dataAccess.getRuleSet(process.getId());
                if (procRs == null)
                    dataAccess.getAllRuleSets(false).add(process.getProcessVO());
            }
        }
    };
    designerRunner.run();
}
Also used : ValidationException(com.centurylink.mdw.designer.utils.ValidationException) 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) RuleSetVO(com.centurylink.mdw.model.value.attribute.RuleSetVO)

Example 10 with ValidationException

use of com.centurylink.mdw.designer.utils.ValidationException in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method forceUpdateProcess.

/**
 * Relies on classic designer page to update the processVO with the reloaded
 * data.
 */
public void forceUpdateProcess(WorkflowProcess processVersion, FlowchartPage flowchartPage, boolean validate, boolean lock) throws ValidationException, DataAccessException, RemoteException {
    CodeTimer timer = new CodeTimer("forceUpdateProcess()");
    Graph graph = flowchartPage.getProcess();
    graph.save_temp_vars();
    if (validate)
        new ProcessValidator(processVersion.getProcessVO()).validate(getNodeMetaInfo());
    if (!processVersion.getProject().checkRequiredVersion(5, 5))
        flowchartPage.setProcessVersions(flowchartPage.getProcess(), // not
        !processVersion.getProject().checkRequiredVersion(5, 2));
    // sure
    // why
    // this
    // was
    // ever
    // needed
    Graph reloaded = null;
    try {
        reloaded = flowchartPage.saveProcess(graph, mainFrame, PersistType.UPDATE, 0, lock);
    } catch (ValidationException ex) {
        if (ex.getMessage() != null && ex.getMessage().contains(ORA_02292))
            throw new ValidationException(INCOMPATIBLE_INSTANCES);
        else
            throw ex;
    }
    flowchartPage.setProcess(reloaded);
    processVersion.setProcessVO(reloaded.getProcessVO());
    cacheRefresh.fireRefresh(reloaded.getProcessVO().hasDynamicJavaActivity());
    timer.stopAndLog();
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) ValidationException(com.centurylink.mdw.designer.utils.ValidationException) CodeTimer(com.centurylink.mdw.plugin.CodeTimer) ProcessValidator(com.centurylink.mdw.designer.utils.ProcessValidator)

Aggregations

ValidationException (com.centurylink.mdw.designer.utils.ValidationException)16 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)10 RemoteException (java.rmi.RemoteException)9 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)7 Graph (com.centurylink.mdw.designer.display.Graph)5 SubGraph (com.centurylink.mdw.designer.display.SubGraph)5 ProcessWorker (com.centurylink.mdw.designer.utils.ProcessWorker)5 CodeTimer (com.centurylink.mdw.plugin.CodeTimer)4 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)4 FlowchartPage (com.centurylink.mdw.designer.pages.FlowchartPage)3 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)3 ProcessValidator (com.centurylink.mdw.designer.utils.ProcessValidator)2 XmlException (org.apache.xmlbeans.XmlException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 Shell (org.eclipse.swt.widgets.Shell)2 MDWStatusMessageDocument (com.centurylink.mdw.bpm.MDWStatusMessageDocument)1 MDWStatusMessage (com.centurylink.mdw.bpm.MDWStatusMessageDocument.MDWStatusMessage)1 StatusMessage (com.centurylink.mdw.common.service.types.StatusMessage)1 ActionCancelledException (com.centurylink.mdw.common.utilities.timer.ActionCancelledException)1 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)1