Search in sources :

Example 1 with WorkTransitionInstanceVO

use of com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO 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)

Example 2 with WorkTransitionInstanceVO

use of com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO in project mdw-designer by CenturyLinkCloud.

the class ProcessInstanceUpdater method updateTransitionInstance.

private void updateTransitionInstance(ProcessInstancePage procInstPage, Long procId, Long procInstId, String timestr, String id, String msg) {
    ProcessInstanceVO procInst = procInstPage.getProcessInstance();
    if (!isShowingThisInstance(procInst.getId()))
        this.showInstance(procInstPage);
    int k = id.indexOf('.');
    String transId = id.substring(0, k);
    String transInstId = id.substring(k + 1);
    Link link;
    if (!procInst.getId().equals(procInstId)) {
        // embedded process
        link = findLinkInSubgraph(procInstPage.getProcess(), new Long(transId));
        procInst = this.findEmbeddedProcessInstance(procInstPage.getProcess(), procInstId);
    } else {
        link = procInstPage.getProcess().findLink(new Long(transId));
    }
    if (link != null) {
        WorkTransitionInstanceVO transInst = null;
        for (WorkTransitionInstanceVO ti : procInst.getTransitions()) {
            if (ti.getTransitionInstanceID().toString().equals(transInstId)) {
                transInst = ti;
                break;
            }
        }
        // Date time = df.parse(timestr);
        if (transInst == null) {
            transInst = new WorkTransitionInstanceVO();
            procInst.getTransitions().add(transInst);
            transInst.setTransitionID(new Long(transId));
            transInst.setTransitionInstanceID(new Long(transInstId));
            transInst.setProcessInstanceID(procInst.getId());
            transInst.setStartDate(timestr);
            transInst.setEndDate(timestr);
            transInst.setStatusCode(WorkTransitionStatus.STATUS_COMPLETED);
            link.addInstance(transInst);
        }
    } else {
        System.out.println("Cannot find link with ID " + transId);
    }
    procInstPage.repaint();
}
Also used : WorkTransitionInstanceVO(com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO) Link(com.centurylink.mdw.designer.display.Link)

Example 3 with WorkTransitionInstanceVO

use of com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO in project mdw-designer by CenturyLinkCloud.

the class DesignerDataAccess method getTaskInstances.

private List<TaskInstanceVO> getTaskInstances(ProcessVO process, ProcessInstanceVO processInstance, Long activityId, List<TaskInstanceVO> allTaskInstances) throws DataAccessException {
    List<TaskInstanceVO> taskInstances = new ArrayList<>();
    for (TaskInstanceVO taskInstance : allTaskInstances) {
        String secondaryOwner = taskInstance.getSecondaryOwnerType();
        if (OwnerType.DOCUMENT.equals(secondaryOwner) || "EXTERNAL_EVENT_INSTANCE".equals(secondaryOwner)) {
            String formDataString = null;
            if (OwnerType.DOCUMENT.equals(secondaryOwner))
                formDataString = rtinfo.getDocument(taskInstance.getSecondaryOwnerId()).getContent();
            else if ("EXTERNAL_EVENT_INSTANCE".equals(secondaryOwner))
                formDataString = rtinfo.getExternalEventDetails(taskInstance.getSecondaryOwnerId());
            FormDataDocument formDataDoc = new FormDataDocument();
            try {
                formDataDoc.load(formDataString);
                for (ActivityInstanceVO activityInstance : processInstance.getActivityInstances(activityId)) {
                    if (activityInstance.getId().equals(formDataDoc.getActivityInstanceId()))
                        taskInstances.add(taskInstance);
                }
            } catch (MbengException ex) {
                throw new DataAccessException(-1, ex.getMessage(), ex);
            }
        } else {
            // task instance secondary owner is work transition instance
            Long workTransInstId = taskInstance.getSecondaryOwnerId();
            for (WorkTransitionInstanceVO transitionInstance : processInstance.getTransitions()) {
                if (transitionInstance.getTransitionInstanceID().equals(workTransInstId)) {
                    Long transitionId = transitionInstance.getTransitionID();
                    WorkTransitionVO workTrans = process.getWorkTransition(transitionId);
                    if (workTrans == null && process.getSubProcesses() != null) {
                        for (ProcessVO subproc : process.getSubProcesses()) {
                            workTrans = subproc.getWorkTransition(transitionId);
                            if (workTrans != null)
                                break;
                        }
                    }
                    if (workTrans != null && workTrans.getToWorkId().equals(activityId))
                        taskInstances.add(taskInstance);
                }
            }
        }
    }
    return taskInstances;
}
Also used : MbengException(com.qwest.mbeng.MbengException) WorkTransitionInstanceVO(com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO) WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) ActivityInstanceVO(com.centurylink.mdw.model.value.work.ActivityInstanceVO) TaskInstanceVO(com.centurylink.mdw.model.value.task.TaskInstanceVO) ArrayList(java.util.ArrayList) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) FormDataDocument(com.centurylink.mdw.model.FormDataDocument) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException)

Example 4 with WorkTransitionInstanceVO

use of com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO in project mdw-designer by CenturyLinkCloud.

the class RunTimeDesignerCanvas method getToolTipText.

public String getToolTipText(MouseEvent arg0) {
    int x = arg0.getX();
    int y = arg0.getY();
    Graph process = page.getProcess();
    if (process.zoom != 100) {
        x = x * 100 / process.zoom;
        y = y * 100 / process.zoom;
    }
    Object obj = objectAt(process, x, y, getGraphics());
    if (obj != null && obj instanceof Node) {
        Node node = (Node) obj;
        List<ActivityInstanceVO> insts = node.getInstances();
        if (insts != null) {
            StringBuffer sb = new StringBuffer();
            sb.append("<html>");
            int k = 0;
            for (ActivityInstanceVO one : node.getInstances()) {
                sb.append(one.getId()).append(": ").append(one.getStartDate().toString()).append("<p>");
                k++;
                if (k >= 5)
                    break;
            }
            sb.append("</html>");
            return sb.toString();
        } else
            return null;
    } else if (obj != null && obj instanceof Link) {
        Link link = (Link) obj;
        List<WorkTransitionInstanceVO> insts = link.getInstances();
        if (insts != null) {
            StringBuffer sb = new StringBuffer();
            int k = 0;
            sb.append("<html>");
            for (WorkTransitionInstanceVO one : link.getInstances()) {
                sb.append(one.getTransitionInstanceID()).append(": ").append(one.getStartDate().toString()).append("<p>");
                k++;
                if (k >= 5)
                    break;
            }
            sb.append("</html>");
            return sb.toString();
        } else
            return null;
    } else
        return null;
}
Also used : WorkTransitionInstanceVO(com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO) Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) ActivityInstanceVO(com.centurylink.mdw.model.value.work.ActivityInstanceVO) Node(com.centurylink.mdw.designer.display.Node) ArrayList(java.util.ArrayList) List(java.util.List) Link(com.centurylink.mdw.designer.display.Link)

Example 5 with WorkTransitionInstanceVO

use of com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO in project mdw-designer by CenturyLinkCloud.

the class RunTimeDesignerCanvas method mouseClicked.

public void mouseClicked(MouseEvent arg0) {
    if (arg0.getButton() != 1)
        return;
    if (arg0.getClickCount() != 2)
        return;
    Graph process = page.getProcess();
    int x = arg0.getX();
    int y = arg0.getY();
    if (process.zoom != 100) {
        x = x * 100 / process.zoom;
        y = y * 100 / process.zoom;
    }
    Object obj = process.objectAt(x, y, getGraphics());
    if (obj == null)
        return;
    if (obj instanceof Link) {
        Link link = (Link) obj;
        try {
            List<WorkTransitionInstanceVO> workTransitionList;
            Long linkId = new Long(link.conn.getWorkTransitionId());
            if (link.from.graph instanceof SubGraph) {
                workTransitionList = new ArrayList<WorkTransitionInstanceVO>();
                SubGraph subgraph = (SubGraph) link.from.graph;
                if (subgraph.getInstances() != null) {
                    for (ProcessInstanceVO inst : subgraph.getInstances()) {
                        List<WorkTransitionInstanceVO> coll1 = inst.getTransitionInstances(linkId);
                        workTransitionList.addAll(coll1);
                    }
                }
            } else {
                workTransitionList = page.getProcessInstance().getTransitionInstances(linkId);
            }
            WorkTransitionsDialog workTransDialog = new WorkTransitionsDialog(page.frame);
            workTransDialog.setWorkTransitionList(workTransitionList);
            workTransDialog.setVisible(true);
        } catch (Exception ex) {
            ex.printStackTrace();
            page.frame.setNewServer();
        }
    }
}
Also used : WorkTransitionInstanceVO(com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO) Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Link(com.centurylink.mdw.designer.display.Link) ProcessInstanceVO(com.centurylink.mdw.model.value.process.ProcessInstanceVO)

Aggregations

WorkTransitionInstanceVO (com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO)5 Link (com.centurylink.mdw.designer.display.Link)3 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)3 ActivityInstanceVO (com.centurylink.mdw.model.value.work.ActivityInstanceVO)3 Graph (com.centurylink.mdw.designer.display.Graph)2 SubGraph (com.centurylink.mdw.designer.display.SubGraph)2 ArrayList (java.util.ArrayList)2 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 Node (com.centurylink.mdw.designer.display.Node)1 FormDataDocument (com.centurylink.mdw.model.FormDataDocument)1 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)1 TaskInstanceVO (com.centurylink.mdw.model.value.task.TaskInstanceVO)1 WorkTransitionVO (com.centurylink.mdw.model.value.work.WorkTransitionVO)1 MbengException (com.qwest.mbeng.MbengException)1 List (java.util.List)1