ArrayList<GraphElement> res = new ArrayList<GraphElement>();
for (HistoryActivityInstance hpi : list) {
loger.fine("Handling: " + hpi.getActivityName());
if (hpi instanceof HistoryActivityInstanceImpl) {
HistoryActivityInstanceImpl activity = (HistoryActivityInstanceImpl) hpi;
String activityName = activity.getActivityName();
if (res.isEmpty()) { //initialize start node and its transition
GraphElement startNode = processGraphElements.get("__AWF__start_node");
if (startNode != null) {
res.add(startNode);
}
GraphElement firstTransition = processGraphElements.get("__AWF__start_transition_to_" + activityName);
if (firstTransition != null) {
res.add(firstTransition);
}
}
StateNode sn = (StateNode) processGraphElements.get(activityName);
ArrayList<StateNode> arrayList = new ArrayList<StateNode>();
Collection<GraphElement> values = processGraphElements.values();
for (GraphElement graphElement : values) {
if(graphElement instanceof StateNode){
arrayList.add((StateNode) graphElement);
}
}
if (sn == null) continue;
sn = sn.cloneNode();
sn.setUnfinished(activity.getEndTime() == null);
sn.setLabel(activityName + ": " + hpi.getDuration() + "ms");
res.add(sn);
//look for transition
TransitionArc ta = (TransitionArc) processGraphElements.get(activityName + "_" + activity.getTransitionName());
if (ta == null) { //look for default!
ta = (TransitionArc) processGraphElements.get("__AWF__default_transition_" + activityName);
}
if (ta == null) {
continue;