Search in sources :

Example 11 with ActivityVO

use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.

the class Importer method updateSubProcessIdAttributes.

/**
 * Update processid attribute for calling processes within this package.
 * TODO: Get rid of this method, which is only needed for ancient (pre-4.5)
 * runtimes.
 */
private void updateSubProcessIdAttributes(ProcessVO processVO) throws DataAccessException, XmlException {
    // save calling processes to update subprocess activity attributes
    boolean toUpdate = false;
    if (processVO.getActivities() != null) {
        for (ActivityVO actVO : processVO.getActivities()) {
            String procNameAttr = actVO.getAttribute(PROCESS_NAME);
            String procVerAttr = actVO.getAttribute(PROCESS_VERSION);
            if (procNameAttr != null && procVerAttr != null) {
                toUpdate = true;
            }
        }
        if (processVO.getSubProcesses() != null) {
            for (ProcessVO embedded : processVO.getSubProcesses()) {
                for (ActivityVO actVO : embedded.getActivities()) {
                    String procNameAttr = actVO.getAttribute(PROCESS_NAME);
                    String procVerAttr = actVO.getAttribute(PROCESS_VERSION);
                    if (procNameAttr != null && procVerAttr != null) {
                        toUpdate = true;
                    }
                }
            }
        }
    }
    if (toUpdate) {
        ProcessVO procVO = dataAccess.getDesignerDataAccess().getProcess(processVO.getProcessId(), processVO);
        for (ActivityVO actVO : procVO.getActivities()) {
            String procNameAttr = actVO.getAttribute(PROCESS_NAME);
            String procVerAttr = actVO.getAttribute(PROCESS_VERSION);
            if (procNameAttr != null && procVerAttr != null) {
                for (ProcessVO checkVO : importedPackageVO.getProcesses()) {
                    if (checkVO.getProcessName().equals(procNameAttr) && String.valueOf(checkVO.getVersion()).equals(procVerAttr))
                        actVO.setAttribute("processid", checkVO.getProcessId().toString());
                }
            }
        }
        if (procVO.getSubProcesses() != null) {
            for (ProcessVO embedded : procVO.getSubProcesses()) {
                for (ActivityVO actVO : embedded.getActivities()) {
                    String procNameAttr = actVO.getAttribute(PROCESS_NAME);
                    String procVerAttr = actVO.getAttribute(PROCESS_VERSION);
                    if (procNameAttr != null && procVerAttr != null) {
                        for (ProcessVO checkVO : importedPackageVO.getProcesses()) {
                            if (checkVO.getProcessName().equals(procNameAttr) && String.valueOf(checkVO.getVersion()).equals(procVerAttr))
                                actVO.setAttribute("processid", checkVO.getProcessId().toString());
                        }
                    }
                }
            }
        }
        dataAccess.getDesignerDataAccess().updateProcess(procVO, 0, false);
    }
}
Also used : ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO)

Example 12 with ActivityVO

use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.

the class DesignerPage method setSynchronizationActivity.

private void setSynchronizationActivity(Node node) {
    List<ActivityVO> as = node.graph.getProcessVO().getUpstreamActivities(node.getId());
    StringBuilder sb = new StringBuilder();
    for (ActivityVO a : as) {
        if (sb.length() > 0)
            sb.append("#");
        sb.append(a.getActivityName());
    }
    node.setAttribute(WorkAttributeConstant.SYNCED_ACTIVITIES, sb.toString());
}
Also used : ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO)

Example 13 with ActivityVO

use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.

the class Graph method addNode.

/**
 * This is for pasting
 * @param actvo
 * @return
 */
public Node addNode(GraphCommon owner, ActivityVO sourceact, int xoff, int yoff, boolean recordchange, boolean newLogicalId) {
    Long pActId = genNodeId();
    ArrayList<AttributeVO> attributes = new ArrayList<AttributeVO>();
    for (AttributeVO attr : sourceact.getAttributes()) {
        AttributeVO nattr = new AttributeVO(attr.getAttributeName(), attr.getAttributeValue());
        attributes.add(nattr);
    }
    ActivityVO nodet = new ActivityVO(pActId, sourceact.getActivityName(), sourceact.getActivityDescription(), sourceact.getImplementorClassName(), attributes);
    owner.getProcessVO().getActivities().add(nodet);
    if (newLogicalId) {
        String lid;
        if (owner instanceof SubGraph) {
            lid = ((SubGraph) owner).getGraph().generateLogicalId("A");
        } else {
            lid = ((Graph) owner).generateLogicalId("A");
        }
        nodet.setAttribute(WorkAttributeConstant.LOGICAL_ID, lid);
    }
    Node node = new Node(nodet, owner, metainfo);
    if (newLogicalId && node.isTaskActivity()) {
        node.setAttribute(TaskActivity.ATTRIBUTE_TASK_LOGICAL_ID, null);
    }
    node.x += xoff;
    node.y += yoff;
    owner.nodes.add(node);
    if (recordchange)
        node.getChanges().setChangeType(Changes.NEW);
    setDirtyLevel(DIRTY);
    return node;
}
Also used : AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) MbengNode(com.qwest.mbeng.MbengNode) ArrayList(java.util.ArrayList)

Example 14 with ActivityVO

use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.

the class ProcessValidator method validate.

public void validate(boolean checkImplementors, NodeMetaInfo implInfo) throws ValidationException {
    if (packageVO != null) {
        // check if processes are up to date
        for (ProcessVO proc : packageVO.getProcesses()) {
            if (proc.getNextVersion() != null)
                errors.add("Process " + proc.getProcessName() + " has newer versions");
        }
        // check implementors
        if (checkImplementors) {
            Map<String, ActivityImplementorVO> has = new HashMap<String, ActivityImplementorVO>();
            Map<String, String> hasnot = new HashMap<String, String>();
            for (ActivityImplementorVO ai : packageVO.getImplementors()) {
                has.put(ai.getImplementorClassName(), ai);
            }
            for (ProcessVO proc : packageVO.getProcesses()) {
                for (ActivityVO act : proc.getActivities()) {
                    String v = act.getImplementorClassName();
                    if (!has.containsKey(v))
                        hasnot.put(v, v);
                }
                if (proc.getSubProcesses() != null) {
                    for (ProcessVO subproc : proc.getSubProcesses()) {
                        for (ActivityVO act : subproc.getActivities()) {
                            String v = act.getImplementorClassName();
                            if (!has.containsKey(v))
                                hasnot.put(v, v);
                        }
                    }
                }
            }
            for (String v : hasnot.keySet()) {
                errors.add("Implementor " + v + " is used but not included");
            }
        }
        // validate each process
        for (ProcessVO proc : packageVO.getProcesses()) {
            process = proc;
            validateProcess(implInfo);
        }
    } else {
        validateProcess(implInfo);
    }
    if (errors.size() > 0)
        throw new ValidationException(errors);
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) HashMap(java.util.HashMap) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO)

Example 15 with ActivityVO

use of com.centurylink.mdw.model.value.activity.ActivityVO in project mdw-designer by CenturyLinkCloud.

the class ProcessWorker method moveStartActivityToFirst.

private void moveStartActivityToFirst(ProcessVO processVO, NodeMetaInfo metainfo) {
    for (int i = 0; i < processVO.getActivities().size(); i++) {
        ActivityVO act = processVO.getActivities().get(i);
        ActivityImplementorVO nmi = metainfo.find(act.getImplementorClassName());
        if (nmi == null)
            continue;
        if (nmi.isStart()) {
            if (i > 0) {
                processVO.getActivities().remove(i);
                processVO.getActivities().add(0, act);
            }
            return;
        }
    }
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO)

Aggregations

ActivityVO (com.centurylink.mdw.model.value.activity.ActivityVO)17 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)11 ArrayList (java.util.ArrayList)8 WorkTransitionVO (com.centurylink.mdw.model.value.work.WorkTransitionVO)6 MbengNode (com.qwest.mbeng.MbengNode)6 HashMap (java.util.HashMap)5 ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)4 AttributeVO (com.centurylink.mdw.model.value.attribute.AttributeVO)4 VariableVO (com.centurylink.mdw.model.value.variable.VariableVO)3 HashSet (java.util.HashSet)2 TextNoteVO (com.centurylink.mdw.model.value.activity.TextNoteVO)1 RuleSetVO (com.centurylink.mdw.model.value.attribute.RuleSetVO)1 ExternalEventVO (com.centurylink.mdw.model.value.event.ExternalEventVO)1 PackageVO (com.centurylink.mdw.model.value.process.PackageVO)1 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)1 DomDocument (com.qwest.mbeng.DomDocument)1 FormatDom (com.qwest.mbeng.FormatDom)1 MbengException (com.qwest.mbeng.MbengException)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1