use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EventInfoList 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.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EventInfoList in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method fillEventInfo.
private EventInfoList fillEventInfo(EventInfoList eventInfoList, TEventInfoList infoList) {
EventInfo[] infoArray = new EventInfo[infoList.sizeOfEventInfoArray()];
List<TEventInfo> list = infoList.getEventInfoList();
for (int i = 0; i < list.size(); i++) {
infoArray[i] = new EventInfo();
EventInfo eventInfo = infoArray[i];
TEventInfo listElem = list.get(i);
eventInfo.setName(listElem.getName());
eventInfo.setType(listElem.getType());
eventInfo.setLineNumber(listElem.getLineNumber());
eventInfo.setTimestamp(listElem.getTimestamp());
// TODO: need to change schema and validate the methods
}
/*
for (int i = 0; i < list.size(); i++) {
infoArray[i] = new TEventInfo
TEventInfoListSequence tEventInfo = infoArray[i];
//tEventInfo = new TEventInfo();
org.apache.ode.bpel.pmapi.TEventInfo listElem = list.get(i);
tEventInfo.setActivityDefinitionId(listElem.getActivityDefinitionId());
//tEventInfo.setActivityFailureReason(listElem.getActivityFailureReason());
tEventInfo.setActivityId(listElem.getActivityId());
tEventInfo.setActivityName(listElem.getActivityName());
//tEventInfo.setActivityRecoveryAction(listElem.getActivityRecoveryAction());
tEventInfo.setActivityType(listElem.getActivityType());
//tEventInfo.setCorrelationKey(listElem.getCorrelationKey());
//tEventInfo.setCorrelationSet(listElem.getCorrelationSet());
//tEventInfo.setExplanation(listElem.getExplanation());
//tEventInfo.setExpression(listElem.getExpression());
//tEventInfo.setFault(listElem.getFault());
tEventInfo.setProcessId(listElem.getProcessId());
tEventInfo.setScopeId(listElem.getScopeId());
tEventInfo.setScopeName(listElem.getScopeName());
}*/
eventInfoList.setEventInfo(infoArray);
return eventInfoList;
}
use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EventInfoList in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method fillActivityLifeCycleEventsList.
private void fillActivityLifeCycleEventsList(ActivityLifeCycleEventsListType activityLifeCycleEventsList, EventInfoListDocument infoList) {
List<TEventInfo> list;
if (infoList.getEventInfoList() == null) {
list = infoList.addNewEventInfoList().getEventInfoList();
} else {
list = infoList.getEventInfoList().getEventInfoList();
}
List<EventInfo> eventInfoList = new ArrayList<EventInfo>();
Map<Long, Boolean> isFaultMap = new HashMap<Long, Boolean>();
for (TEventInfo tInfo : list) {
EventInfo info = new EventInfo();
info.setType(tInfo.getType());
info.setName(tInfo.getName());
info.setLineNumber(tInfo.getLineNumber());
info.setTimestamp(tInfo.getTimestamp());
info.setActivityId(tInfo.getActivityId());
info.setActivityName(tInfo.getActivityName());
if (tInfo.getName().equals("ActivityFailureEvent")) {
if (isFaultMap.get(tInfo.getActivityId()) == null) {
isFaultMap.put(tInfo.getActivityId(), true);
}
} else if (tInfo.getName().equals("ActivityExecEndEvent")) {
if (isFaultMap.get(tInfo.getActivityId()) != null) {
isFaultMap.remove(tInfo.getActivityId());
}
isFaultMap.put(tInfo.getActivityId(), false);
}
info.setActivityType(tInfo.getActivityType());
info.setScopeId(tInfo.getScopeId());
info.setScopeName(tInfo.getScopeName());
eventInfoList.add(info);
}
for (EventInfo info : eventInfoList) {
boolean isFault = isFaultMap.get(info.getActivityId()) == null ? false : isFaultMap.get(info.getActivityId());
info.setIsRecoveryRequired(isFault);
activityLifeCycleEventsList.addEventInfo(info);
}
}
Aggregations