public static String getNode(List<Node> tarList, List<Node> nodeList, List<Node> finList,boolean flag){
List<Node> temp = new ArrayList<Node>();
loop : for(Node tar : tarList){
String tid = tar.getId();
String tpid = tar.getPid();
String tversion = tar.getVersion();
int tLevel = tar.getLevel();
for(Node node : nodeList){
String nid = node.getId();
String npid = node.getPid();
String ntversion = node.getVersion();
int nLevel = node.getLevel();
if (tpid.equals(nid)) {
temp.add(node);
if (nLevel == 0) {
flag = false;
break loop;
}
}
}
}
finList.addAll(temp);
nodeList.removeAll(temp);
tarList = temp;
if (flag) {
getNode(tarList, nodeList, finList, flag);
}
return "finish";
}