Search in sources :

Example 1 with BpelEvent

use of org.apache.ode.bpel.evt.BpelEvent 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 BpelEvent

use of org.apache.ode.bpel.evt.BpelEvent 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 3 with BpelEvent

use of org.apache.ode.bpel.evt.BpelEvent 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;
}
Also used : ActivityInfoDocument(org.apache.ode.bpel.pmapi.ActivityInfoDocument) Activities_type0(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Activities_type0) ArrayList(java.util.ArrayList) ScopeDAOImpl(org.apache.ode.dao.jpa.ScopeDAOImpl) BpelEvent(org.apache.ode.bpel.evt.BpelEvent) ActivityStateDocumentBuilder(org.apache.ode.bpel.evtproc.ActivityStateDocumentBuilder) TFailureInfo(org.apache.ode.bpel.pmapi.TFailureInfo) ActivityInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityInfoType) ActivityRecoveryDAO(org.apache.ode.bpel.dao.ActivityRecoveryDAO) EventDAOImpl(org.apache.ode.dao.jpa.EventDAOImpl)

Aggregations

ArrayList (java.util.ArrayList)3 BpelEvent (org.apache.ode.bpel.evt.BpelEvent)3 EventDAOImpl (org.apache.ode.dao.jpa.EventDAOImpl)3 ScopeDAOImpl (org.apache.ode.dao.jpa.ScopeDAOImpl)3 ActivityRecoveryDAO (org.apache.ode.bpel.dao.ActivityRecoveryDAO)2 TFailureInfo (org.apache.ode.bpel.pmapi.TFailureInfo)2 ActivityInfoType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityInfoType)2 ScopeDAO (org.apache.ode.bpel.dao.ScopeDAO)1 ActivityStateDocumentBuilder (org.apache.ode.bpel.evtproc.ActivityStateDocumentBuilder)1 ActivityInfoDocument (org.apache.ode.bpel.pmapi.ActivityInfoDocument)1 EventInfoListDocument (org.apache.ode.bpel.pmapi.EventInfoListDocument)1 TActivityInfo (org.apache.ode.bpel.pmapi.TActivityInfo)1 TEventInfoList (org.apache.ode.bpel.pmapi.TEventInfoList)1 ActivityInfoWithEventsDocument (org.wso2.carbon.bpel.core.ode.integration.utils.ActivityInfoWithEventsDocument)1 ActivityLifeCycleEventsDocumentBuilder (org.wso2.carbon.bpel.core.ode.integration.utils.ActivityLifeCycleEventsDocumentBuilder)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 Activities_type0 (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Activities_type0)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