use of org.apache.ode.bpel.pmapi.TEventInfoList 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.pmapi.TEventInfoList in project carbon-business-process by wso2.
the class ActivityStateAndEventDocumentBuilder method lookup.
// private void completed(ActivityInfoWithEventsDocument ainf) {
// if (removeCompleted) {
// activitiesWithEventsOrdered.remove(ainf);
// activitiesWithEvents.values().remove(ainf);
// }
// }
/**
* return the ActivityInfoWithEventsDocument object for a particular event
* Then take it and fill it with particular event info
* Note - this must be used after fillActivityInfo method, else aInfo will return a null ref.
*
* @param event Activity Event
* @return updated element due to event input
*/
private ActivityInfoWithEventsDocument lookup(ActivityEvent event) {
ActivityInfoWithEventsDocument actEvtInfoDoc = activitiesWithEvents.get(event.getActivityId());
ActivityInfoDocument aInfo = actEvtInfoDoc.getActivityInfoDoc();
EventInfoListDocument aEventList = actEvtInfoDoc.getEventInfoList();
if (aEventList == null) {
aEventList = EventInfoListDocument.Factory.newInstance();
actEvtInfoDoc.setEventInfoList(aEventList);
aEventList = actEvtInfoDoc.getEventInfoList();
}
TEventInfo eventInfo;
if (aEventList.getEventInfoList() == null) {
TEventInfoList eventInfoList = aEventList.addNewEventInfoList();
eventInfo = eventInfoList.addNewEventInfo();
} else {
eventInfo = aEventList.getEventInfoList().addNewEventInfo();
}
fillEventInfo(eventInfo, event);
addActivitiesWithEventOrdered(event, new ActivityInfoWithEventsDocument(aInfo, aEventList));
return activitiesWithEvents.get(event.getActivityId());
}
use of org.apache.ode.bpel.pmapi.TEventInfoList in project carbon-business-process by wso2.
the class ActivityLifeCycleEventsDocumentBuilder method fillEventInfo.
private void fillEventInfo(ActivityEvent event) {
TEventInfoList aEventList = activityLifeCycleEvents.getEventInfoList();
if (aEventList == null) {
aEventList = TEventInfoList.Factory.newInstance();
activityLifeCycleEvents.setEventInfoList(aEventList);
aEventList = activityLifeCycleEvents.getEventInfoList();
}
TEventInfo eventInfo = aEventList.addNewEventInfo();
eventInfo.setName(getClassName(BpelEvent.eventName(event)));
eventInfo.setLineNumber(event.getLineNo());
eventInfo.setTimestamp(convertDatetoCalendar(event.getTimestamp()));
eventInfo.setType(event.getType().toString());
eventInfo.setActivityId(event.getActivityId());
eventInfo.setActivityName(event.getActivityName());
eventInfo.setActivityType(event.getActivityType());
eventInfo.setScopeId(event.getScopeId());
eventInfo.setScopeName(event.getScopeName());
// activityLifeCycleEvents.
}
use of org.apache.ode.bpel.pmapi.TEventInfoList in project carbon-business-process by wso2.
the class ActivityStateAndEventDocumentBuilder method addActivitiesWithEventOrdered.
/**
* Update activitiesWithEventsOrdered using infoWithEventsDoc
*
* @param event Activity Event
* @param infoWithEventsDoc ActivityInfoWithEventsDocument
*/
private void addActivitiesWithEventOrdered(ActivityEvent event, ActivityInfoWithEventsDocument infoWithEventsDoc) {
boolean isExist = false;
for (ActivityInfoWithEventsDocument anActivitiesWithEventsOrdered : activitiesWithEventsOrdered) {
if (anActivitiesWithEventsOrdered.getActivityInfoDoc().getActivityInfo().getAiid().equals(infoWithEventsDoc.getActivityInfoDoc().getActivityInfo().getAiid())) {
isExist = true;
EventInfoListDocument aEventList = anActivitiesWithEventsOrdered.getEventInfoList();
if (aEventList == null) {
aEventList = EventInfoListDocument.Factory.newInstance();
anActivitiesWithEventsOrdered.setEventInfoList(aEventList);
aEventList = anActivitiesWithEventsOrdered.getEventInfoList();
}
TEventInfo eventInfo;
if (aEventList.getEventInfoList() == null) {
TEventInfoList eventInfoList = aEventList.addNewEventInfoList();
eventInfo = eventInfoList.addNewEventInfo();
} else {
eventInfo = aEventList.getEventInfoList().addNewEventInfo();
}
fillEventInfo(eventInfo, event);
break;
}
}
if (!isExist) {
activitiesWithEventsOrdered.add(infoWithEventsDoc);
}
}
Aggregations