* @param activityId1
* @param activityId2
* @return true表示在同一个执行线上,false表示不在同一个执行线上
*/
public boolean isInSameLine(String activityId1, String activityId2) {
Node node1 = (Node) this.findWFElementById(activityId1);
Node node2 = (Node) this.findWFElementById(activityId2);
if (node1 == null || node2 == null)
return false;
List<Node> connectableNodes4Activity1 = new ArrayList<Node>();
connectableNodes4Activity1.add(node1);
connectableNodes4Activity1.addAll(getReachableNodes(activityId1));
connectableNodes4Activity1.addAll(getEnterableNodes(activityId1));
List<Node> connectableNodes4Activity2 = new ArrayList<Node>();
connectableNodes4Activity2.add(node2);
connectableNodes4Activity2.addAll(getReachableNodes(activityId2));
connectableNodes4Activity2.addAll(getEnterableNodes(activityId2));
/*
* System.out.println("===Inside WorkflowProcess.isInSameLine()::connectableNodes4Activity1.size()="
* +connectableNodes4Activity1.size());System.out.println(
* "===Inside WorkflowProcess.isInSameLine()::connectableNodes4Activity2.size()="
* +connectableNodes4Activity2.size());
* System.out.println("-----------------------activity1--------------");
* for (int i=0;i<connectableNodes4Activity1.size();i++){ Node node =
* (Node)connectableNodes4Activity1.get(i);
* System.out.println("node.id of act1 is "+node.getId()); }
*
*
* System.out.println("---------------------activity2--------------------"
* ); for (int i=0;i<connectableNodes4Activity2.size();i++){ Node node =
* (Node)connectableNodes4Activity2.get(i);
* System.out.println("node.id of act2 is "+node.getId()); }
*/
if (connectableNodes4Activity1.size() != connectableNodes4Activity2.size()) {
return false;
}
for (int i = 0; i < connectableNodes4Activity1.size(); i++) {
Node node = connectableNodes4Activity1.get(i);
boolean find = false;
for (int j = 0; j < connectableNodes4Activity2.size(); j++) {
Node tmpNode = connectableNodes4Activity2.get(j);
if (node.getId().equals(tmpNode.getId())) {
find = true;
break;
}
}
if (!find)