TScopeInfo.Activities activities = scopeInfo.addNewActivities();
List<BpelEvent> events = scope.listEvents();
ActivityStateDocumentBuilder b = new ActivityStateDocumentBuilder();
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());