Search in sources :

Example 31 with WorkflowProcess

use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.

the class LogWatcher method isEmbeddedProcess.

private boolean isEmbeddedProcess(ProcessInstanceVO processInstance) {
    if (processInstance.isNewEmbedded())
        return true;
    if (!processInstance.getOwner().equals(OwnerType.PROCESS_INSTANCE))
        return false;
    ProcessInstanceVO parentInstance = processInstances.get(processInstance.getOwnerId());
    if (parentInstance == null)
        // possible when the instance is a subprocess of an
        return false;
    // embedded
    WorkflowProcess parentProcDef = process.getProject().getProcess(parentInstance.getProcessId());
    if (parentProcDef.getProcessVO().getSubProcesses() != null) {
        for (ProcessVO childproc : parentProcDef.getProcessVO().getSubProcesses()) {
            if (childproc.getProcessId().equals(processInstance.getProcessId()))
                return true;
        }
    }
    return false;
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Example 32 with WorkflowProcess

use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.

the class ProcessLaunchMainTab method createProcessSection.

protected void createProcessSection(Composite parent) {
    Group processVersionGroup = new Group(parent, SWT.NONE);
    processVersionGroup.setText("Process Version");
    GridLayout gl = new GridLayout();
    gl.numColumns = 5;
    processVersionGroup.setLayout(gl);
    GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.grabExcessHorizontalSpace = true;
    processVersionGroup.setLayoutData(gd);
    new Label(processVersionGroup, SWT.NONE).setText("Process: ");
    processNameCombo = new Combo(processVersionGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 250;
    processNameCombo.setLayoutData(gd);
    refreshProcesses();
    processNameCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refreshVersions();
            setDirty(true);
            validatePage();
        }
    });
    // spacer
    new Label(processVersionGroup, SWT.NONE).setText("    ");
    new Label(processVersionGroup, SWT.NONE).setText("Version: ");
    processVersionCombo = new Combo(processVersionGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 35;
    processVersionCombo.setLayoutData(gd);
    refreshVersions();
    processVersionCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String version = processVersionCombo.getText();
            if (version.length() == 0) {
                process = null;
            } else {
                String name = processNameCombo.getText().trim();
                if (name.length() == 0) {
                    process = null;
                } else {
                    ProcessVO processVO = project.getDesignerProxy().getProcessVO(name, version);
                    if (processVO != null) {
                        process = new WorkflowProcess(project, processVO);
                        openProcess(process);
                        refreshVariables(process);
                    }
                }
            }
            setDirty(true);
            validatePage();
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) 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 33 with WorkflowProcess

use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.

the class ProcessLaunchMainTab method refreshVersions.

private void refreshVersions() {
    processVersionCombo.removeAll();
    processVersionCombo.add("");
    String processName = processNameCombo.getText();
    if (processName.length() == 0) {
        process = null;
        processVersionCombo.select(0);
    } else {
        ProcessVO processVO = project.getDesignerProxy().getLatestProcessVO(processName);
        process = new WorkflowProcess(project, processVO);
        for (WorkflowProcess pv : process.getAllProcessVersions()) {
            processVersionCombo.add(pv.getVersionString());
        }
        processVersionCombo.select(1);
    }
}
Also used : ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 34 with WorkflowProcess

use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.

the class ImportProcessWizard method postRunUpdates.

protected void postRunUpdates() {
    WorkflowProcess process = getPage().getProcess();
    // don't know whether process was newly created or updated with a new
    // version -- fire both
    getProject().getDataAccess().getDesignerDataModel().addProcess(process.getProcessVO());
    process.sync();
    process.addElementChangeListener(getProject());
    process.fireElementChangeEvent(ChangeType.ELEMENT_CREATE, process);
    process.fireElementChangeEvent(ChangeType.VERSION_CHANGE, process.getVersionString());
}
Also used : WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Example 35 with WorkflowProcess

use of com.centurylink.mdw.plugin.designer.model.WorkflowProcess in project mdw-designer by CenturyLinkCloud.

the class WorkflowAssetEditor method openWorkflowAsset.

private void openWorkflowAsset() {
    if (workflowAsset instanceof WorkflowProcess) {
        IWorkbenchPage page = MdwPlugin.getActivePage();
        WorkflowProcess proc = (WorkflowProcess) workflowAsset;
        try {
            page.openEditor(proc, "mdw.editors.process");
        } catch (PartInitException ex) {
            PluginMessages.uiError(MdwPlugin.getShell(), ex, "Open Process", getProject());
        }
    } else if (workflowAsset instanceof TaskTemplate) {
        IWorkbenchPage page = MdwPlugin.getActivePage();
        TaskTemplate taskTemplate = (TaskTemplate) workflowAsset;
        try {
            FileEditorInput editorInput = new FileEditorInput(taskTemplate.getAssetFile());
            TaskTemplateEditor editor = (TaskTemplateEditor) page.openEditor(editorInput, "mdw.editors.taskTemplate");
            editor.setProcess(getProcess());
        } catch (PartInitException ex) {
            PluginMessages.uiError(MdwPlugin.getShell(), ex, "Open Process", getProject());
        }
    } else {
        ((WorkflowAsset) workflowAsset).openFile(new NullProgressMonitor());
    }
}
Also used : TaskTemplate(com.centurylink.mdw.plugin.designer.model.TaskTemplate) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) TaskTemplateEditor(com.centurylink.mdw.plugin.designer.editors.TaskTemplateEditor) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess)

Aggregations

WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)85 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)28 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)21 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)21 PartInitException (org.eclipse.ui.PartInitException)20 ArrayList (java.util.ArrayList)17 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)15 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)12 ExternalEvent (com.centurylink.mdw.plugin.designer.model.ExternalEvent)11 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)11 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)10 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)9 IEditorPart (org.eclipse.ui.IEditorPart)9 ProcessEditor (com.centurylink.mdw.plugin.designer.editors.ProcessEditor)8 IFile (org.eclipse.core.resources.IFile)8 CoreException (org.eclipse.core.runtime.CoreException)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)8 IOException (java.io.IOException)7 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)6 Activity (com.centurylink.mdw.plugin.designer.model.Activity)6