Search in sources :

Example 11 with WorkTransitionVO

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

the class ProcessWorker method convert_to_designer.

// remember and then delete hidden links
public void convert_to_designer(ProcessVO processVO) {
    if (processVO.isInRuleSet())
        return;
    WorkTransitionVO startTrans = null;
    List<WorkTransitionVO> hiddenLinks = new ArrayList<WorkTransitionVO>();
    List<WorkTransitionVO> invalidHiddenLinks = new ArrayList<WorkTransitionVO>();
    for (WorkTransitionVO w : processVO.getTransitions()) {
        if (w.getFromWorkId().equals(processVO.getProcessId())) {
            hiddenLinks.add(w);
            if (w.getEventType().equals(EventType.START))
                startTrans = w;
        } else if (w.isHidden()) {
            // somehow in 4.5 invalid hidden transitions are being added
            invalidHiddenLinks.add(w);
        }
    }
    processVO.setAttribute(WorkAttributeConstant.START_TRANSITION_ID, startTrans == null ? null : startTrans.getWorkTransitionId().toString());
    for (WorkTransitionVO w : hiddenLinks) {
        processVO.getTransitions().remove(w);
    }
    for (WorkTransitionVO w : invalidHiddenLinks) {
        processVO.getTransitions().remove(w);
    }
    List<ProcessVO> subProcesses = processVO.getSubProcesses();
    if (subProcesses != null) {
        for (ProcessVO subProcessVO : subProcesses) {
            WorkTransitionVO entryTrans = null;
            for (WorkTransitionVO w : hiddenLinks) {
                if (!w.getEventType().equals(EventType.START) && w.getToWorkId().equals(subProcessVO.getProcessId())) {
                    entryTrans = w;
                    break;
                }
            }
            startTrans = null;
            for (WorkTransitionVO w : subProcessVO.getTransitions()) {
                if (w.getEventType().equals(EventType.START)) {
                    startTrans = w;
                    break;
                }
            }
            if (startTrans != null)
                subProcessVO.getTransitions().remove(startTrans);
            subProcessVO.setAttribute(WorkAttributeConstant.ENTRY_TRANSITION_ID, entryTrans == null ? null : entryTrans.getWorkTransitionId().toString());
            subProcessVO.setAttribute(WorkAttributeConstant.START_TRANSITION_ID, startTrans == null ? null : startTrans.getWorkTransitionId().toString());
        }
    }
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) ArrayList(java.util.ArrayList) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO)

Example 12 with WorkTransitionVO

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

the class ProcessWorker method createHiddenTransition.

private void createHiddenTransition(ProcessVO owner, Long to, Integer type, String compcode, String existingId, int logicalId, boolean isInRuleSet) {
    Long transId = isInRuleSet ? logicalId : existingId == null ? new Long(0) : new Long(existingId);
    WorkTransitionVO trans = new WorkTransitionVO();
    trans.setEventType(type);
    trans.setProcessId(owner.getProcessId());
    trans.setWorkTransitionId(transId);
    trans.setFromWorkId(isInRuleSet ? 0L : owner.getProcessId());
    trans.setToWorkId(to);
    trans.setCompletionCode(compcode);
    trans.setAttribute(WorkAttributeConstant.LOGICAL_ID, "H" + logicalId);
    owner.getTransitions().add(trans);
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO)

Example 13 with WorkTransitionVO

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

Aggregations

WorkTransitionVO (com.centurylink.mdw.model.value.work.WorkTransitionVO)13 ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)6 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)6 ArrayList (java.util.ArrayList)6 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)4 MbengNode (com.qwest.mbeng.MbengNode)4 HashMap (java.util.HashMap)3 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)2 HashSet (java.util.HashSet)2 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)1 FormDataDocument (com.centurylink.mdw.model.FormDataDocument)1 ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)1 TextNoteVO (com.centurylink.mdw.model.value.activity.TextNoteVO)1 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)1 TaskInstanceVO (com.centurylink.mdw.model.value.task.TaskInstanceVO)1 ActivityInstanceVO (com.centurylink.mdw.model.value.work.ActivityInstanceVO)1 WorkTransitionInstanceVO (com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO)1 MbengException (com.qwest.mbeng.MbengException)1