Search in sources :

Example 16 with ProcessInstanceVO

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

the class ListView method createContextMenu.

private Menu createContextMenu(Shell shell) {
    Menu menu = new Menu(shell, SWT.POP_UP);
    final StructuredSelection selection = (StructuredSelection) getTableViewer().getSelection();
    if (selection.size() == 1 && selection.getFirstElement() instanceof ProcessInstanceVO) {
        final Object element = selection.getFirstElement();
        MenuItem openItem = new MenuItem(menu, SWT.PUSH);
        openItem.setText("Open");
        openItem.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                handleOpen(element);
            }
        });
    }
    return menu;
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Example 17 with ProcessInstanceVO

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

the class ProcessHierarchyView method createPartControl.

public void createPartControl(Composite parent) {
    treeViewer = new TreeViewer(parent);
    treeViewer.setLabelProvider(new ProcessHierarchyLabelProvider());
    // action group
    actionGroup = new ProcessHierarchyActionGroup(this);
    actionGroup.fillActionBars(getViewSite().getActionBars());
    treeViewer.addOpenListener(new IOpenListener() {

        public void open(OpenEvent event) {
            for (Object item : getSelection().toList()) {
                if (item instanceof LinkedProcess)
                    actionGroup.getActionHandler().open(((LinkedProcess) item).getProcess());
                if (item instanceof LinkedProcessInstance) {
                    ProcessInstanceVO procInst = ((LinkedProcessInstance) item).getProcessInstance();
                    WorkflowProcess pv = processVersion.getProject().getProcess(procInst.getProcessId());
                    if (pv != null) {
                        WorkflowProcess toOpen = new WorkflowProcess(pv);
                        toOpen.setProcessInstance(procInst);
                        actionGroup.getActionHandler().open(toOpen);
                    }
                }
            }
        }
    });
}
Also used : IOpenListener(org.eclipse.jface.viewers.IOpenListener) LinkedProcess(com.centurylink.mdw.plugin.designer.views.ProcessHierarchyContentProvider.LinkedProcess) TreeViewer(org.eclipse.jface.viewers.TreeViewer) LinkedProcessInstance(com.centurylink.mdw.model.value.process.LinkedProcessInstance) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO) OpenEvent(org.eclipse.jface.viewers.OpenEvent)

Example 18 with ProcessInstanceVO

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

the class ProcessSearchQuery method searchInstances.

private void searchInstances(final WorkflowProject project, Map<String, String> criteria) {
    try {
        List<ProcessInstanceVO> instances = project.getDesignerProxy().getProcessInstances(criteria);
        for (ProcessInstanceVO instanceInfo : instances) {
            Long processId = instanceInfo.getProcessId();
            if (project.getProcess(processId) == null && instanceInfo.getOwner().equals(OwnerType.PROCESS_INSTANCE)) {
                Map<String, String> newCrit = new HashMap<String, String>();
                newCrit.put("id", instanceInfo.getOwnerId().toString());
                instanceInfo = project.getDesignerProxy().getProcessInstances(newCrit).get(0);
                processId = instanceInfo.getProcessId();
            }
            if (processId != null) {
                WorkflowProcess processVersion = project.getProcess(processId);
                if (// can
                processVersion == null && project.isFilePersist()) // happen
                // for
                // non-vcs
                // processes
                // or
                // Archived
                // processes
                {
                    ProcessVO processVO = new ProcessVO();
                    processVO.setProcessId(instanceInfo.getProcessId());
                    processVersion = new WorkflowProcess(project, processVO);
                    processVersion.setName(instanceInfo.getProcessName());
                    processVersion.setVersion(RuleSetVO.parseVersion(instanceInfo.getProcessVersion()));
                    processVO = project.getDataAccess().loadProcess(processVersion);
                    if (// otherwise retrieval will be
                    processVO != null)
                        // just-in-time
                        processVersion.setProcessVO(processVO);
                }
                if (processVersion != null) {
                    WorkflowProcess instance = new WorkflowProcess(processVersion);
                    instance.setProcessInstance(instanceInfo);
                    if (!getSearchResults().getMatchingElements().contains(instance))
                        getSearchResults().addMatchingElement(instance);
                }
            }
        }
    } catch (Exception ex) {
        showError(ex, "Retrieve Process Instances", project);
    }
}
Also used : HashMap(java.util.HashMap) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) WorkflowProcess(com.centurylink.mdw.plugin.designer.model.WorkflowProcess) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) PartInitException(org.eclipse.ui.PartInitException)

Example 19 with ProcessInstanceVO

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

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

the class LogWatcher method handleLogMessage.

private synchronized void handleLogMessage(String message) {
    Matcher matcher = pattern.matcher(message);
    if (matcher.matches()) {
        String time = matcher.group(1);
        final Long procId = new Long(matcher.group(2));
        final Long procInstId = new Long(matcher.group(3));
        String subtype = matcher.group(4);
        String id = matcher.group(5);
        String msg = matcher.group(6);
        try {
            ProcessInstanceVO processInstanceInfo = processInstances.get(procInstId);
            if (processInstanceInfo == null) {
                processInstanceInfo = new DesignerDataAccess(dataAccess).getProcessInstanceBase(procInstId, null);
                // only interested in one masterRequestId
                if (processInstanceInfo.getMasterRequestId().equals(masterRequestId))
                    processInstances.put(procInstId, processInstanceInfo);
            }
            if (!processInstanceInfo.getMasterRequestId().equals(masterRequestId))
                return;
            // log the message
            outputStream.println(message);
            if (watchProcess) {
                openInstance(processInstanceInfo);
                synchronized (this) {
                    ProcessInstancePage processInstancePage = processInstancePages.get(processInstanceInfo.getId());
                    accumulated.offer(new ProcessInstanceUpdater(procId, procInstId, processInstancePage, subtype, time, id, msg));
                }
            }
            if (msg.startsWith(WorkStatus.LOGMSG_PROC_COMPLETE) && procId.equals(process.getId()))
                scheduleShutdown = true;
        } catch (Exception ex) {
            PluginMessages.log(ex);
            shutdown();
        }
    }
}
Also used : Matcher(java.util.regex.Matcher) ProcessInstancePage(com.centurylink.mdw.designer.runtime.ProcessInstancePage) DesignerDataAccess(com.centurylink.mdw.designer.DesignerDataAccess) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO) IOException(java.io.IOException)

Aggregations

ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)40 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)10 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)9 IOException (java.io.IOException)9 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)7 HashMap (java.util.HashMap)7 DesignerDataAccess (com.centurylink.mdw.designer.DesignerDataAccess)6 ActivityInstanceVO (com.centurylink.mdw.model.value.work.ActivityInstanceVO)6 ArrayList (java.util.ArrayList)6 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)5 ProcessList (com.centurylink.mdw.model.value.process.ProcessList)5 XmlException (org.apache.xmlbeans.XmlException)5 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)5 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 JSONException (org.json.JSONException)5 Graph (com.centurylink.mdw.designer.display.Graph)4 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)4 Menu (org.eclipse.swt.widgets.Menu)4 MenuItem (org.eclipse.swt.widgets.MenuItem)4 PartInitException (org.eclipse.ui.PartInitException)4