use of org.apache.ode.bpel.evt.BpelEvent in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method getActivitiesWithEvents.
private ActivitiesWithEvents_type0 getActivitiesWithEvents(ScopeDAO scope) {
ActivitiesWithEvents_type0 activitiesWithEvents = new ActivitiesWithEvents_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());
}
ActivityStateAndEventDocumentBuilder docBuilder = new ActivityStateAndEventDocumentBuilder();
for (BpelEvent e : events) {
docBuilder.onEvent(e);
}
for (ActivityInfoWithEventsDocument aweDoc : docBuilder.getActivitiesWithEvents()) {
for (ActivityRecoveryDAO recovery : recoveries) {
if (String.valueOf(recovery.getActivityId()).equals(aweDoc.getActivityInfoDoc().getActivityInfo().getAiid())) {
TFailureInfo failure = aweDoc.getActivityInfoDoc().getActivityInfo().addNewFailure();
failure.setReason(recovery.getReason());
failure.setDtFailure(toCalendar(recovery.getDateTime()));
failure.setActions(recovery.getActions());
failure.setRetries(recovery.getRetries());
aweDoc.getActivityInfoDoc().getActivityInfo().setStatus(TActivityStatus.FAILURE);
}
}
ActivityInfoWithEventsType activityWE = new ActivityInfoWithEventsType();
TActivityInfo actInfoDoc = aweDoc.getActivityInfoDoc().getActivityInfo();
TEventInfoList evtInfoList = aweDoc.getEventInfoList().getEventInfoList();
// add activityInfo
// add event info
ActivityInfoType activity = fillActivityInfo(new ActivityInfoType(), actInfoDoc);
/*XmlOptions opt = new XmlOptions();
opt = opt.setSaveOuter();*/
EventInfoList eventList = fillEventInfo(new EventInfoList(), evtInfoList);
activityWE.setActivityInfo(activity);
activityWE.setActivityEventsList(eventList);
activitiesWithEvents.addActivityInfoWithEvents(activityWE);
}
return activitiesWithEvents;
}
use of org.apache.ode.bpel.evt.BpelEvent in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method fillActivityLifeCycleEventsFromScope.
private void fillActivityLifeCycleEventsFromScope(ActivityLifeCycleEventsListType activityLifeCycleEventsList, ScopeDAO scope) {
// 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());
}
ActivityLifeCycleEventsDocumentBuilder docBuilder = new ActivityLifeCycleEventsDocumentBuilder();
for (BpelEvent e : events) {
docBuilder.onEvent(e);
}
EventInfoListDocument infoList = docBuilder.getActivityLifeCycleEvents();
fillActivityLifeCycleEventsList(activityLifeCycleEventsList, infoList);
for (ScopeDAO childScope : scope.getChildScopes()) {
fillActivityLifeCycleEventsFromScope(activityLifeCycleEventsList, childScope);
}
}
use of org.apache.ode.bpel.evt.BpelEvent 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