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
}
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
}
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);
}
}
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;
}
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);
}
Aggregations