Search in sources :

Example 6 with WorkTransitionVO

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

the class ProcessValidator method checkForFloatingNodes.

/*
   *
   * @param graph
   * @return
   */
// AK..Added 06/10/2008
private void checkForFloatingNodes() {
    // boolean flag = false;
    HashSet<Long> linked_node_set = new HashSet<Long>();
    for (WorkTransitionVO link : process.getTransitions()) {
        linked_node_set.add(link.getFromWorkId());
        linked_node_set.add(link.getToWorkId());
    }
    // Now loop through all Nodes for each link to determine if any of the nodes from link-loop (outer) matches node from inner loop....
    for (ActivityVO node : process.getActivities()) {
        if (!linked_node_set.contains(node.getActivityId())) {
            errors.add("Activity '" + node.getActivityName() + "' has no transitions.");
        }
    }
// Inner while..loop
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) HashSet(java.util.HashSet)

Example 7 with WorkTransitionVO

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

the class ProcessValidator method checkForOverlappingLinks.

/*
       *
       * @param graph
       * @return
       */
// AK..Added 06/10/2008
private void checkForOverlappingLinks() {
    Map<Long, String> actnames = new HashMap<Long, String>();
    for (ActivityVO node : process.getActivities()) {
        actnames.put(node.getActivityId(), node.getActivityName());
    }
    HashSet<String> dispinfo_set = new HashSet<String>();
    for (WorkTransitionVO link : process.getTransitions()) {
        String dispinfo = AttributeVO.findAttribute(link.getAttributes(), WorkTransitionAttributeConstant.TRANSITION_DISPLAY_INFO);
        if (dispinfo == null)
            continue;
        if (dispinfo_set.contains(dispinfo)) {
            errors.add("There are overlap transitions between '" + actnames.get(link.getFromWorkId()) + "' and '" + actnames.get(link.getToWorkId()) + "'");
        } else {
            dispinfo_set.add(dispinfo);
        }
    }
// for..outer loop
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) HashMap(java.util.HashMap) ActivityVO(com.centurylink.mdw.model.value.activity.ActivityVO) HashSet(java.util.HashSet)

Example 8 with WorkTransitionVO

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

the class Transition method equals.

public boolean equals(Object o) {
    if (!(o instanceof Transition))
        return false;
    Transition other = (Transition) o;
    if (getId() <= 0 && other.getId() <= 0) {
        WorkTransitionVO thisWtVo = getLink().conn;
        WorkTransitionVO otherWtVo = other.getLink().conn;
        if (thisWtVo.getFromWorkId() == null) {
            if (otherWtVo.getFromWorkId() != null)
                return false;
        } else {
            if (!thisWtVo.getFromWorkId().equals(otherWtVo.getFromWorkId()))
                return false;
        }
        if (thisWtVo.getToWorkId() == null) {
            if (otherWtVo.getToWorkId() != null)
                return false;
        } else {
            if (!thisWtVo.getToWorkId().equals(otherWtVo.getToWorkId()))
                return false;
        }
        if (thisWtVo.getCompletionCode() == null) {
            if (otherWtVo.getCompletionCode() != null)
                return false;
        } else {
            if (!thisWtVo.getCompletionCode().equals(otherWtVo.getCompletionCode()))
                return false;
        }
        if (thisWtVo.getEventType() == null) {
            if (otherWtVo.getEventType() != null)
                return false;
        } else {
            if (!thisWtVo.getEventType().equals(otherWtVo.getEventType()))
                return false;
        }
        return super.equals(other);
    } else {
        return super.equals(other);
    }
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO)

Example 9 with WorkTransitionVO

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

the class Graph method addLink.

/**
 * this is for pasting
 * @param trans
 * @param fromId
 * @param toId
 * @return
 */
public Link addLink(GraphCommon owner, WorkTransitionVO trans, Long fromId, Long toId, int xoff, int yoff, boolean recordchange, boolean newLogicalId) {
    WorkTransitionVO conn = new WorkTransitionVO();
    conn.setFromWorkId(fromId);
    conn.setToWorkId(toId);
    conn.setEventType(trans.getEventType());
    conn.setWorkTransitionId(new Long(0));
    conn.setCompletionCode(trans.getCompletionCode());
    ArrayList<AttributeVO> attributes = new ArrayList<AttributeVO>();
    for (AttributeVO attr : trans.getAttributes()) {
        AttributeVO nattr = new AttributeVO(attr.getAttributeName(), attr.getAttributeValue());
        attributes.add(nattr);
    }
    conn.setAttributes(attributes);
    owner.getProcessVO().getTransitions().add(conn);
    if (newLogicalId) {
        String lid;
        if (owner instanceof SubGraph) {
            lid = ((SubGraph) owner).getGraph().generateLogicalId("T");
        } else {
            lid = ((Graph) owner).generateLogicalId("T");
        }
        conn.setAttribute(WorkAttributeConstant.LOGICAL_ID, lid);
    }
    Link link = new Link(owner.findNode(fromId), owner.findNode(toId), conn, arrowstyle);
    if (xoff != 0 || yoff != 0)
        link.shift(xoff, yoff, arrowstyle);
    owner.links.add(link);
    setDirtyLevel(DIRTY);
    if (recordchange)
        link.getChanges().setChangeType(Changes.NEW);
    return link;
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO) AttributeVO(com.centurylink.mdw.model.value.attribute.AttributeVO) ArrayList(java.util.ArrayList)

Example 10 with WorkTransitionVO

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

the class Graph method removeNode.

public void removeNode(Node node, boolean recordchange) {
    GraphCommon owner = node.graph;
    List<WorkTransitionVO> connectors = owner.getProcessVO().getTransitions();
    Long id = node.nodet.getActivityId();
    if (!recordchange || node.isNew()) {
        for (int i = connectors.size() - 1; i >= 0; i--) {
            WorkTransitionVO w = connectors.get(i);
            if (id.equals(w.getFromWorkId()) || id.equals(w.getToWorkId())) {
                connectors.remove(i);
            }
        }
        owner.getProcessVO().getActivities().remove(node.nodet);
        int i;
        Link link;
        for (i = owner.links.size() - 1; i >= 0; i--) {
            link = owner.links.get(i);
            if (link.from == node || link.to == node) {
                removeLink(link, recordchange);
            }
        }
        for (i = 0; i < owner.nodes.size(); i++) {
            if (node == owner.nodes.get(i)) {
                owner.nodes.remove(i);
                break;
            }
        }
    } else {
        int i;
        Link link;
        for (i = owner.links.size() - 1; i >= 0; i--) {
            link = owner.links.get(i);
            if (link.from == node || link.to == node) {
                link.getChanges().setChangeType(Changes.DELETE);
            }
        }
        node.getChanges().setChangeType(Changes.DELETE);
    }
    setDirtyLevel(DIRTY);
}
Also used : WorkTransitionVO(com.centurylink.mdw.model.value.work.WorkTransitionVO)

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