Search in sources :

Example 41 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO 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 42 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO 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 43 with ProcessVO

use of com.centurylink.mdw.model.value.process.ProcessVO 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 44 with ProcessVO

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

the class ActivityLaunchMainTab method initializeFrom.

@Override
public void initializeFrom(ILaunchConfiguration launchConfig) {
    super.initializeFrom(launchConfig);
    try {
        refreshActivities();
        String activityIdStr = launchConfig.getAttribute(ActivityLaunchConfiguration.ACTIVITY_ID, "");
        Long activityId = new Long(activityIdStr);
        ProcessVO processVO = getProcess().getProcessVO();
        activityVO = processVO.getActivityVO(activityId);
        int selIdx = 0;
        for (int i = 0; i < processVO.getActivities().size(); i++) {
            if (processVO.getActivities().get(i).getActivityId().equals(activityVO.getActivityId())) {
                selIdx = i;
                break;
            }
        }
        activityNameCombo.select(selIdx);
    } catch (CoreException ex) {
        PluginMessages.uiError(ex, "Launch Init", getProject());
    }
    validatePage();
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO)

Example 45 with ProcessVO

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

the class ImageServletHelper method generateImage.

/**
 * Generate a process image from the designer server.
 */
private BufferedImage generateImage(ProcessInstanceVO pProcInst, DesignerDataAccess dao) throws ServletException {
    try {
        log("Loading Process " + pProcInst.getProcessId());
        NodeMetaInfo metainfo = new NodeMetaInfo();
        metainfo.init(dao.getActivityImplementors(), DataAccess.currentSchemaVersion);
        ProcessVO processVO = dao.getProcess(new Long(pProcInst.getProcessId()), null);
        new ProcessWorker().convert_to_designer(processVO);
        pProcInst.setProcessName(processVO.getProcessName());
        Graph graph = loadCompletionMap(processVO, pProcInst, dao, metainfo);
        Dimension graphsize = graph.getGraphSize();
        RunTimeDesignerImage canvas = new RunTimeDesignerImage(graph, dao);
        int hMargin = 72, vMargin = 72;
        BufferedImage image = new BufferedImage(graphsize.width + hMargin, graphsize.height + vMargin, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = image.createGraphics();
        g2.setBackground(Color.WHITE);
        g2.clearRect(0, 0, image.getWidth(), image.getHeight());
        canvas.paintComponent(g2);
        g2.dispose();
        return image;
    } catch (Throwable t) {
        log(t);
        if (t.getCause() != null) {
            log(t.getCause());
        }
        throw new ServletException(t);
    }
}
Also used : NodeMetaInfo(com.centurylink.mdw.designer.utils.NodeMetaInfo) ServletException(javax.servlet.ServletException) ProcessWorker(com.centurylink.mdw.designer.utils.ProcessWorker) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) RunTimeDesignerImage(com.centurylink.mdw.designer.runtime.RunTimeDesignerImage) Dimension(java.awt.Dimension) BufferedImage(java.awt.image.BufferedImage) Graphics2D(java.awt.Graphics2D)

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