for (BpelEvent e : events)
b.onEvent(e);
for (ActivityInfoDocument ai : b.getActivities()) {
for (ActivityRecoveryDAO recovery : recoveries) {
if (String.valueOf(recovery.getActivityId()).equals(ai.getActivityInfo().getAiid())) {
TFailureInfo failure = ai.getActivityInfo().addNewFailure();
failure.setReason(recovery.getReason());
failure.setDtFailure(toCalendar(recovery.getDateTime()));
failure.setActions(recovery.getActions());
failure.setRetries(recovery.getRetries());
ai.getActivityInfo().setStatus(TActivityStatus.FAILURE);
}
}
activities.addNewActivityInfo().set(ai.getActivityInfo());
}
}
// otherwise at least try to get the information about failed activities
// TODO: we are losing information about which scope does failed activities belong to
// as failure table does not have scope id, we would attach every failed activity to process scope
else {
if(scope.getParentScope() == null) {
for (ActivityRecoveryDAO recovery : recoveries) {
ActivityInfoDocument ai = ActivityInfoDocument.Factory.newInstance();
ai.addNewActivityInfo().setAiid(String.valueOf(recovery.getActivityId()));
ai.getActivityInfo().setType("OActivity");
ai.getActivityInfo().setScope(TScopeRef.Factory.newInstance());
TFailureInfo failure = ai.getActivityInfo().addNewFailure();
failure.setReason(recovery.getReason());
failure.setDtFailure(toCalendar(recovery.getDateTime()));
failure.setActions(recovery.getActions());
failure.setRetries(recovery.getRetries());
ai.getActivityInfo().setStatus(TActivityStatus.FAILURE);
activities.addNewActivityInfo().set(ai.getActivityInfo());
}
}
}