Search in sources :

Example 1 with TEventInfoList

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;
}
Also used : ActivitiesWithEvents_type0(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivitiesWithEvents_type0) TEventInfoList(org.apache.ode.bpel.pmapi.TEventInfoList) ArrayList(java.util.ArrayList) ScopeDAOImpl(org.apache.ode.dao.jpa.ScopeDAOImpl) BpelEvent(org.apache.ode.bpel.evt.BpelEvent) TActivityInfo(org.apache.ode.bpel.pmapi.TActivityInfo) TFailureInfo(org.apache.ode.bpel.pmapi.TFailureInfo) ActivityInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityInfoType) EventInfoList(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EventInfoList) TEventInfoList(org.apache.ode.bpel.pmapi.TEventInfoList) ActivityRecoveryDAO(org.apache.ode.bpel.dao.ActivityRecoveryDAO) ActivityStateAndEventDocumentBuilder(org.wso2.carbon.bpel.core.ode.integration.utils.ActivityStateAndEventDocumentBuilder) ActivityInfoWithEventsDocument(org.wso2.carbon.bpel.core.ode.integration.utils.ActivityInfoWithEventsDocument) ActivityInfoWithEventsType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityInfoWithEventsType) EventDAOImpl(org.apache.ode.dao.jpa.EventDAOImpl)

Example 2 with TEventInfoList

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());
}
Also used : TEventInfo(org.apache.ode.bpel.pmapi.TEventInfo) EventInfoListDocument(org.apache.ode.bpel.pmapi.EventInfoListDocument) TEventInfoList(org.apache.ode.bpel.pmapi.TEventInfoList) ActivityInfoDocument(org.apache.ode.bpel.pmapi.ActivityInfoDocument)

Example 3 with TEventInfoList

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.
}
Also used : TEventInfo(org.apache.ode.bpel.pmapi.TEventInfo) TEventInfoList(org.apache.ode.bpel.pmapi.TEventInfoList)

Example 4 with TEventInfoList

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);
    }
}
Also used : TEventInfo(org.apache.ode.bpel.pmapi.TEventInfo) EventInfoListDocument(org.apache.ode.bpel.pmapi.EventInfoListDocument) TEventInfoList(org.apache.ode.bpel.pmapi.TEventInfoList)

Aggregations

TEventInfoList (org.apache.ode.bpel.pmapi.TEventInfoList)4 TEventInfo (org.apache.ode.bpel.pmapi.TEventInfo)3 EventInfoListDocument (org.apache.ode.bpel.pmapi.EventInfoListDocument)2 ArrayList (java.util.ArrayList)1 ActivityRecoveryDAO (org.apache.ode.bpel.dao.ActivityRecoveryDAO)1 BpelEvent (org.apache.ode.bpel.evt.BpelEvent)1 ActivityInfoDocument (org.apache.ode.bpel.pmapi.ActivityInfoDocument)1 TActivityInfo (org.apache.ode.bpel.pmapi.TActivityInfo)1 TFailureInfo (org.apache.ode.bpel.pmapi.TFailureInfo)1 EventDAOImpl (org.apache.ode.dao.jpa.EventDAOImpl)1 ScopeDAOImpl (org.apache.ode.dao.jpa.ScopeDAOImpl)1 ActivityInfoWithEventsDocument (org.wso2.carbon.bpel.core.ode.integration.utils.ActivityInfoWithEventsDocument)1 ActivityStateAndEventDocumentBuilder (org.wso2.carbon.bpel.core.ode.integration.utils.ActivityStateAndEventDocumentBuilder)1 ActivitiesWithEvents_type0 (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivitiesWithEvents_type0)1 ActivityInfoType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityInfoType)1 ActivityInfoWithEventsType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityInfoWithEventsType)1 EventInfoList (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EventInfoList)1