Search in sources :

Example 1 with ProcessInstanceVO

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

the class DesignerDataAccess method deleteProcessInstances.

public void deleteProcessInstances(List<ProcessInstanceVO> processInstances) throws DataAccessException {
    if (processInstances.isEmpty())
        return;
    List<Long> ids = new ArrayList<>();
    for (ProcessInstanceVO instance : processInstances) ids.add(instance.getId());
    rtinfo.deleteProcessInstances(ids);
    auditLog(Action.Delete, Entity.ProcessInstance, 0L, ids.get(0) + " ...");
}
Also used : ArrayList(java.util.ArrayList) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Example 2 with ProcessInstanceVO

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

the class ImageServletHelper method generateImageForProcessInstance.

/**
 * Generate a process image from the designer server.
 */
public BufferedImage generateImageForProcessInstance(Long pProcInstId) throws ServletException {
    try {
        DesignerDataAccess dao = new DesignerDataAccess(new Server(), null, onServer);
        ProcessInstanceVO pi = dao.getProcessInstanceBase(pProcInstId, null);
        if (pi == null) {
            throw new ServletException("Failed to locate the ProcessInstance for ProcessInstanceId:" + pProcInstId);
        }
        return generateImage(pi, dao);
    } catch (Exception ex) {
        log(ex);
        throw new ServletException(ex);
    }
}
Also used : ServletException(javax.servlet.ServletException) Server(com.centurylink.mdw.designer.utils.Server) DesignerDataAccess(com.centurylink.mdw.designer.DesignerDataAccess) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO) ServletException(javax.servlet.ServletException)

Example 3 with ProcessInstanceVO

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

the class ImageServletHelper method loadCompletionMap.

private Graph loadCompletionMap(ProcessVO procdef, ProcessInstanceVO processInstance, DesignerDataAccess dao, NodeMetaInfo metainfo) throws Exception {
    ProcessInstanceVO fullInfo = dao.getProcessInstanceAll(processInstance.getId(), procdef);
    processInstance.copyFrom(fullInfo);
    IconFactory iconFactory = new IconFactory();
    iconFactory.setDesignerDataAccess(dao);
    Graph graph = new Graph(procdef, processInstance, metainfo, iconFactory);
    if (graph.subgraphs != null) {
        if (procdef.isInRuleSet()) {
            Map<String, String> pMap = new HashMap<>();
            pMap.put("owner", OwnerType.MAIN_PROCESS_INSTANCE);
            pMap.put("ownerId", processInstance.getId().toString());
            pMap.put("processId", procdef.getProcessId().toString());
            List<ProcessInstanceVO> childProcessInstances = dao.getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, procdef, null).getItems();
            for (ProcessInstanceVO childInst : childProcessInstances) {
                ProcessInstanceVO fullChildInfo = dao.getProcessInstanceAll(childInst.getId(), procdef);
                childInst.copyFrom(fullChildInfo);
                Long subprocId = new Long(childInst.getComment());
                for (SubGraph subgraph : graph.subgraphs) {
                    if (subgraph.getProcessVO().getProcessId().equals(subprocId)) {
                        List<ProcessInstanceVO> insts = subgraph.getInstances();
                        if (insts == null) {
                            insts = new ArrayList<>();
                            subgraph.setInstances(insts);
                        }
                        insts.add(childInst);
                        break;
                    }
                }
            }
        } else {
            for (SubGraph subgraph : graph.subgraphs) {
                Map<String, String> pMap = new HashMap<>();
                pMap.put("owner", OwnerType.PROCESS_INSTANCE);
                pMap.put("ownerId", processInstance.getId().toString());
                pMap.put("processId", subgraph.getProcessVO().getProcessId().toString());
                List<ProcessInstanceVO> childProcessInstances = dao.getProcessInstanceList(pMap, 0, QueryRequest.ALL_ROWS, procdef, null).getItems();
                subgraph.setInstances(childProcessInstances);
                for (ProcessInstanceVO childInst : childProcessInstances) {
                    ProcessInstanceVO fullChildInfo = dao.getProcessInstanceAll(childInst.getId(), procdef);
                    childInst.copyFrom(fullChildInfo);
                }
            }
        }
    }
    graph.setStatus(new StringBuffer());
    return graph;
}
Also used : HashMap(java.util.HashMap) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO) IconFactory(com.centurylink.mdw.designer.icons.IconFactory)

Example 4 with ProcessInstanceVO

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

the class ImageServletHelper method generateImageForSecondaryOwner.

/**
 * Generate a process image from the designer server.
 */
public BufferedImage generateImageForSecondaryOwner(String pSecOwner, Long pSecOwnerId) throws ServletException {
    try {
        DesignerDataAccess dao = new DesignerDataAccess(new Server(), null, onServer);
        ProcessInstanceVO pi = dao.getProcessInstanceForSecondary(pSecOwner, pSecOwnerId);
        if (pi == null) {
            throw new ServletException("Failed to locate the ProcessInstance for Secondary Owner and OwnerId");
        }
        return generateImage(pi, dao);
    } catch (Exception ex) {
        log(ex);
        throw new ServletException(ex);
    }
}
Also used : ServletException(javax.servlet.ServletException) Server(com.centurylink.mdw.designer.utils.Server) DesignerDataAccess(com.centurylink.mdw.designer.DesignerDataAccess) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO) ServletException(javax.servlet.ServletException)

Example 5 with ProcessInstanceVO

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

the class SubGraph method setStatus.

void setStatus(StringBuffer errmsg) {
    for (Link link : this.links) link.setColor(Color.LIGHT_GRAY);
    if (instances == null)
        return;
    for (ProcessInstanceVO instance : instances) {
        String newStatus = Integer.toString(instance.getStatusCode());
        if (status == null)
            status = newStatus;
        else
            status = status + newStatus;
        for (ActivityInstanceVO ai : instance.getActivities()) {
            Node node = findNode(ai.getDefinitionId());
            if (node != null) {
                node.addInstance(ai, true);
            } else {
                if (!OwnerType.PROCESS.equals(ai.getStatusMessage())) {
                    // not a subgraph
                    errmsg.append("  activity ").append(ai.getDefinitionId()).append('\n');
                }
            }
        }
        String v = processVO.getAttribute(WorkAttributeConstant.START_TRANSITION_ID);
        Long startTransitionId = (v == null) ? new Long(0) : new Long(v);
        for (WorkTransitionInstanceVO ti : instance.getTransitions()) {
            Link link = this.findLink(ti.getTransitionID());
            if (link != null) {
                link.addInstance(ti);
            } else if (!ti.getTransitionID().equals(startTransitionId)) {
                errmsg.append("  transition ").append(ti.getTransitionID()).append('\n');
            }
        }
    }
}
Also used : WorkTransitionInstanceVO(com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO) ActivityInstanceVO(com.centurylink.mdw.model.value.work.ActivityInstanceVO) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

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