use of org.apache.ode.bpel.pmapi.ActivityInfoDocument 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.ActivityInfoDocument in project carbon-business-process by wso2.
the class ActivityStateAndEventDocumentBuilder method fillActivityInfo.
/**
* fill the activitiesWithEvents and activitiesWithEventsOrdered using the infoDocList
* Need to be done as event-info can be stored only in activitiesWithEvents and activitiesWithEventsOrdered
* (parent class doesn't support for event-info management)
*
* @param be Activity Event
* @param infoDocList Activity Information Document
*/
private void fillActivityInfo(ActivityEvent be, List<ActivityInfoDocument> infoDocList) {
ActivityInfoDocument infoDoc = null;
for (ActivityInfoDocument inf : infoDocList) {
if (inf.getActivityInfo().getAiid().equals(String.valueOf(be.getActivityId()))) {
infoDoc = inf;
}
}
if (activitiesWithEvents.get(be.getActivityId()) == null) {
activitiesWithEvents.put(be.getActivityId(), new ActivityInfoWithEventsDocument(infoDoc));
}
addActivitiesWithEventOrdered(infoDoc);
}
use of org.apache.ode.bpel.pmapi.ActivityInfoDocument 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;
}
use of org.apache.ode.bpel.pmapi.ActivityInfoDocument in project carbon-business-process by wso2.
the class ActivityStateAndEventDocumentBuilder method onEvent.
// private boolean removeCompleted = false;
/**
* Update activitiesWithEventsOrdered and activitiesWithEvents based on the event
*
* @param be BPEL Event
*/
public void onEvent(BpelEvent be) {
super.onEvent(be);
List<ActivityInfoDocument> infoDocList = super.getActivities();
// Adding the event information
if (be instanceof ActivityEvent) {
final ActivityEvent event = (ActivityEvent) be;
// Fill the activity info to activitiesWithEvents &
fillActivityInfo(event, infoDocList);
// activitiesWithEventsOrdered
ActivityInfoWithEventsDocument actinf = lookup(event);
assert actinf != null;
// TODO: Denis please fill the gaps
// if (event instanceof ActivityEnabledEvent) {
//
// }
// if (event instanceof ActivityExecStartEvent) {
//
// } else if (event instanceof ActivityExecEndEvent) {
//
// }
}
}
Aggregations