Search in sources :

Example 46 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createOpenInstanceAction.

private IAction createOpenInstanceAction() {
    IAction action = new Action() {

        @Override
        public void run() {
            if (openInstanceApplies(getSelection())) {
                WorkflowProject project = ((WorkflowElement) getSelection().getFirstElement()).getProject();
                try {
                    Long procInstId = null;
                    if (getSelection().getFirstElement() instanceof AutomatedTestResults) {
                        AutomatedTestResults expectedResults = (AutomatedTestResults) getSelection().getFirstElement();
                        procInstId = expectedResults.getActualProcessInstanceId();
                    } else if (getSelection().getFirstElement() instanceof LegacyExpectedResults) {
                        LegacyExpectedResults expectedResult = (LegacyExpectedResults) getSelection().getFirstElement();
                        java.io.File resultsFile = expectedResult.getActualResultFile();
                        TestFile testFile = new TestFile(null, resultsFile.getPath());
                        testFile.load();
                        TestFileLine line1 = testFile.getLines().get(0);
                        procInstId = new Long(line1.getWord(3));
                    }
                    if (procInstId == null) {
                        MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file.");
                        return;
                    }
                    ProcessInstanceVO procInst = project.getDataAccess().getProcessInstance(procInstId);
                    Long processId = procInst.getProcessId();
                    ProcessVO procVO = project.getProcess(processId).getProcessVO();
                    if (procVO == null)
                        PluginMessages.uiError("Unable to locate process: " + processId, OPEN_PROCESS_INSTANCE, project);
                    WorkflowProcess instance = new WorkflowProcess(project, procVO);
                    instance.setProcessInstance(procInst);
                    actionHandler.open(instance);
                } catch (Exception ex) {
                    PluginMessages.uiError(ex, OPEN_PROCESS_INSTANCE, project);
                }
            }
        }
    };
    action.setText(OPEN_PROCESS_INSTANCE);
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + OPEN_PROCESS_INSTANCE);
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor(ICON_PROCESS_GIF);
    action.setImageDescriptor(imageDesc);
    return action;
}
Also used : WebLaunchAction(com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction) IAction(org.eclipse.jface.action.IAction) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) TestFileLine(com.centurylink.mdw.designer.testing.TestFileLine) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) AutomatedTestResults(com.centurylink.mdw.plugin.designer.model.AutomatedTestResults) PartInitException(org.eclipse.ui.PartInitException) ConnectException(java.net.ConnectException) NamingException(javax.naming.NamingException) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) RemoteException(java.rmi.RemoteException) TestFile(com.centurylink.mdw.designer.testing.TestFile) LegacyExpectedResults(com.centurylink.mdw.plugin.designer.model.LegacyExpectedResults) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IFile(org.eclipse.core.resources.IFile) TestFile(com.centurylink.mdw.designer.testing.TestFile) File(com.centurylink.mdw.plugin.designer.model.File) JarFile(com.centurylink.mdw.plugin.designer.model.JarFile) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Example 47 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.

the class AutomatedTestActionGroup method createOpenProcessInstanceAction.

private IAction createOpenProcessInstanceAction() {
    IAction action = new Action() {

        public void run() {
            if (openProcessInstanceApplies(view.getSelectedItem())) {
                WorkflowProject project = ((WorkflowElement) view.getSelectedItem()).getProject();
                try {
                    Long procInstId = null;
                    if (view.getSelectedItem() instanceof AutomatedTestResults) {
                        AutomatedTestResults expectedResults = (AutomatedTestResults) view.getSelectedItem();
                        procInstId = expectedResults.getActualProcessInstanceId();
                    } else if (view.getSelectedItem() instanceof LegacyExpectedResults) {
                        LegacyExpectedResults expectedResult = (LegacyExpectedResults) view.getSelectedItem();
                        File resultsFile = expectedResult.getActualResultFile();
                        TestFile testFile = new TestFile(null, resultsFile.getPath());
                        testFile.load();
                        TestFileLine line1 = testFile.getLines().get(0);
                        procInstId = new Long(line1.getWord(3));
                    }
                    if (procInstId == null) {
                        MessageDialog.openWarning(view.getSite().getShell(), "No Results", "Unable to locate results file.");
                        return;
                    }
                    ProcessInstanceVO procInst = project.getDataAccess().getProcessInstance(procInstId);
                    Long processId = procInst.getProcessId();
                    ProcessVO procVO = project.getProcess(processId).getProcessVO();
                    if (procVO == null)
                        PluginMessages.uiError("Unable to locate process: " + processId, "Open Process Instance", project);
                    WorkflowProcess instance = new WorkflowProcess(project, procVO);
                    instance.setProcessInstance(procInst);
                    actionHandler.open(instance);
                } catch (Exception ex) {
                    PluginMessages.uiError(ex, "Open Process Instance", project);
                }
            }
        }
    };
    action.setId(MdwMenuManager.MDW_MENU_PREFIX + "open.process.instance");
    action.setText("Open Process Instance");
    ImageDescriptor imageDesc = MdwPlugin.getImageDescriptor("icons/process.gif");
    action.setImageDescriptor(imageDesc);
    return action;
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IAction(org.eclipse.jface.action.IAction) TestFileLine(com.centurylink.mdw.designer.testing.TestFileLine) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) AutomatedTestResults(com.centurylink.mdw.plugin.designer.model.AutomatedTestResults) IOException(java.io.IOException) TestFile(com.centurylink.mdw.designer.testing.TestFile) LegacyExpectedResults(com.centurylink.mdw.plugin.designer.model.LegacyExpectedResults) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IFile(org.eclipse.core.resources.IFile) TestFile(com.centurylink.mdw.designer.testing.TestFile) File(java.io.File) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) WorkflowElement(com.centurylink.mdw.plugin.designer.model.WorkflowElement) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Example 48 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.

the class ProcessInstanceListView method createSelectionControls.

private void createSelectionControls(Composite parent) {
    new Label(parent, SWT.NONE).setText("Workflow Project:");
    projectCombo = new Combo(parent, SWT.DROP_DOWN);
    GridData gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 160;
    projectCombo.setLayoutData(gd);
    refreshProjects();
    projectCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String projectName = projectCombo.getText().trim();
            workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(projectName);
            processVersion = null;
            refreshProcesses();
            processCombo.select(0);
            refreshVersions();
            versionCombo.select(0);
            resetPageIndex();
            clearVariables();
            refreshTable();
        }
    });
    projectCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String project = projectCombo.getText().trim();
            if (project.length() > 0 && projectCombo.indexOf(project) == -1) {
                processVersion = null;
                refreshProcesses();
                processCombo.select(0);
                refreshVersions();
                versionCombo.select(0);
                resetPageIndex();
                clearVariables();
                refreshTable();
            }
        }
    });
    // spacer
    new Label(parent, SWT.NONE).setText("    ");
    new Label(parent, SWT.NONE).setText("Process:");
    processCombo = new Combo(parent, SWT.DROP_DOWN);
    gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 160;
    processCombo.setLayoutData(gd);
    processCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String selected = processCombo.getText().trim();
            if (selected.length() == 0) {
                processVersion = null;
                refreshVersions();
                versionCombo.select(0);
            } else {
                ProcessVO processVO = workflowProject.getDesignerProxy().getLatestProcessVO(selected);
                processVersion = new WorkflowProcess(workflowProject, processVO);
                refreshVersions();
                versionCombo.select(1);
            }
            resetPageIndex();
            clearVariables();
            refreshTable();
        }
    });
    processCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String process = processCombo.getText().trim();
            if (process.length() > 0 && processCombo.indexOf(process) == -1) {
                processVersion = null;
                refreshVersions();
                versionCombo.select(0);
                resetPageIndex();
                clearVariables();
                refreshTable();
            }
        }
    });
    // spacer
    new Label(parent, SWT.NONE).setText("    ");
    new Label(parent, SWT.NONE).setText("Version:");
    versionCombo = new Combo(parent, SWT.DROP_DOWN);
    gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 50;
    versionCombo.setLayoutData(gd);
    versionCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            // clear out filter version
            if (contentProvider.getFilter() != null)
                contentProvider.getFilter().setProcess(null);
            String version = versionCombo.getText().trim();
            if (version.isEmpty() && processVersion.getId() == 0)
                // avoid re-retrieve
                return;
            processVersion = getProcessVersion(processVersion, version);
            resetPageIndex();
            refreshTable();
        }
    });
    versionCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            String version = versionCombo.getText().trim();
            if (version.length() > 0 && versionCombo.indexOf(version) == -1) {
                processVersion = null;
                resetPageIndex();
                refreshTable();
            }
        }
    });
    // spacer
    new Label(parent, SWT.NONE).setText("    ");
    instanceCountLabel = new Label(parent, SWT.NONE);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    instanceCountLabel.setLayoutData(gd);
    instanceCountLabel.setText("Showing: ");
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) Combo(org.eclipse.swt.widgets.Combo) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 49 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.

the class WorkflowProject method findUnpackagedProcesses.

/**
 * Gets the top-level unpackaged version for all processes. Side effect: if
 * a version is later than than in any package, it's added to the default
 * package. The results are populated with their unpackaged descendant
 * process versions.
 */
private List<WorkflowProcess> findUnpackagedProcesses() {
    List<WorkflowProcess> unpackagedProcesses = new ArrayList<>();
    for (ProcessVO processVO : getDataAccess().getProcesses(false)) {
        ProcessVO topUnpackaged = null;
        ProcessVO toCheck = processVO;
        // if process version is later than that in any package,
        // it belongs in the top-level default package
        boolean toCheckIsLatest = true;
        for (WorkflowPackage pkg : getTopLevelPackages()) {
            if (pkg.isDefaultPackage())
                continue;
            WorkflowProcess packaged = pkg.getProcess(processVO.getProcessName());
            if (packaged != null && packaged.getVersion() >= toCheck.getVersion()) {
                toCheckIsLatest = false;
                break;
            }
        }
        if (toCheckIsLatest) {
            WorkflowProcess pv = new WorkflowProcess(this, toCheck);
            getDefaultPackage().addProcess(pv);
            pv.addElementChangeListener(this);
            toCheck = toCheck.getPrevVersion();
        }
        // add the hierarchy of old unpackaged processes
        while (toCheck != null) {
            if (!isPackaged(toCheck)) {
                topUnpackaged = toCheck;
                break;
            }
            toCheck = toCheck.getPrevVersion();
        }
        if (topUnpackaged != null) {
            WorkflowProcess processVersion = new WorkflowProcess(this, topUnpackaged);
            processVersion.setDescendantProcessVersions(getUnpackagedDescendantProcesses(processVersion));
            unpackagedProcesses.add(processVersion);
        }
    }
    Collections.sort(unpackagedProcesses);
    return unpackagedProcesses;
}
Also used : WorkflowPackage(com.centurylink.mdw.plugin.designer.model.WorkflowPackage) ArrayList(java.util.ArrayList) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 50 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO in project mdw-designer by CenturyLinkCloud.

the class WorkflowProject method findProcesses.

/**
 * Returns the process versions belonging to a package version.
 */
private List<WorkflowProcess> findProcesses(WorkflowPackage aPackage) {
    List<WorkflowProcess> processVersions = new ArrayList<>();
    for (ProcessVO processVO : getDataAccess().getAllProcesses(false)) {
        if (aPackage.getPackageVO().containsProcess(processVO.getProcessId())) {
            WorkflowProcess processVersion = new WorkflowProcess(this, processVO);
            if (// vcs assets
            !processVersions.contains(processVersion)) // would add
            // same-versioned
            // archived
            // processes
            {
                processVersion.setPackage(aPackage);
                processVersions.add(processVersion);
            }
        }
    }
    Collections.sort(processVersions);
    return processVersions;
}
Also used : ArrayList(java.util.ArrayList) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Aggregations

ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)92 ArrayList (java.util.ArrayList)29 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)28 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)25 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)17 IOException (java.io.IOException)17 HashMap (java.util.HashMap)15 RemoteException (java.rmi.RemoteException)14 ProcessWorker (com.centurylink.mdw.designer.utils.ProcessWorker)12 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)11 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)11 JSONException (org.json.JSONException)11 RuleSetVO (com.centurylink.mdw.model.value.attribute.RuleSetVO)10 XmlException (org.apache.xmlbeans.XmlException)10 ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)9 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)9 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)8 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)8 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)7 AuthenticationException (com.centurylink.mdw.auth.AuthenticationException)5