Search in sources :

Example 1 with EventInfoListDocument

use of org.apache.ode.bpel.pmapi.EventInfoListDocument 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);
    }
}
Also used : EventInfoListDocument(org.apache.ode.bpel.pmapi.EventInfoListDocument) ScopeDAO(org.apache.ode.bpel.dao.ScopeDAO) ActivityLifeCycleEventsDocumentBuilder(org.wso2.carbon.bpel.core.ode.integration.utils.ActivityLifeCycleEventsDocumentBuilder) ArrayList(java.util.ArrayList) ScopeDAOImpl(org.apache.ode.dao.jpa.ScopeDAOImpl) BpelEvent(org.apache.ode.bpel.evt.BpelEvent) EventDAOImpl(org.apache.ode.dao.jpa.EventDAOImpl)

Example 2 with EventInfoListDocument

use of org.apache.ode.bpel.pmapi.EventInfoListDocument 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 EventInfoListDocument

use of org.apache.ode.bpel.pmapi.EventInfoListDocument 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

EventInfoListDocument (org.apache.ode.bpel.pmapi.EventInfoListDocument)3 TEventInfo (org.apache.ode.bpel.pmapi.TEventInfo)2 TEventInfoList (org.apache.ode.bpel.pmapi.TEventInfoList)2 ArrayList (java.util.ArrayList)1 ScopeDAO (org.apache.ode.bpel.dao.ScopeDAO)1 BpelEvent (org.apache.ode.bpel.evt.BpelEvent)1 ActivityInfoDocument (org.apache.ode.bpel.pmapi.ActivityInfoDocument)1 EventDAOImpl (org.apache.ode.dao.jpa.EventDAOImpl)1 ScopeDAOImpl (org.apache.ode.dao.jpa.ScopeDAOImpl)1 ActivityLifeCycleEventsDocumentBuilder (org.wso2.carbon.bpel.core.ode.integration.utils.ActivityLifeCycleEventsDocumentBuilder)1