use of org.apache.ode.bpel.evtproc.ActivityStateDocumentBuilder in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method getActivities.
private Activities_type0 getActivities(ScopeDAO scope) {
Activities_type0 activities = new Activities_type0();
Collection<ActivityRecoveryDAO> recoveries = scope.getProcessInstance().getActivityRecoveries();
/*List<BpelEvent> events = scope.listEvents();*/
Set<EventDAOImpl> eventsEntities = ((ScopeDAOImpl) scope).getEvents();
List<BpelEvent> events = new ArrayList<BpelEvent>();
for (EventDAOImpl event : eventsEntities) {
events.add(event.getEvent());
}
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());
failure.setDtFailure(toCalendar(recovery.getDateTime()));
failure.setActions(recovery.getActions());
failure.setRetries(recovery.getRetries());
ai.getActivityInfo().setStatus(TActivityStatus.FAILURE);
}
}
ActivityInfoType activity = new ActivityInfoType();
fillActivityInfo(activity, ai.getActivityInfo());
activities.addActivityInfo(activity);
}
return activities;
}
Aggregations