Search in sources :

Example 1 with ActivityInfoType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityInfoType 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 ActivityInfoType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityInfoType in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method fillActivityInfo.

private ActivityInfoType fillActivityInfo(ActivityInfoType activity, TActivityInfo actInfo) {
    activity.setAiid(actInfo.getAiid());
    activity.setDateCompleted(actInfo.getDtCompleted());
    activity.setDateEnabled(actInfo.getDtEnabled());
    activity.setDateStarted(actInfo.getDtStarted());
    activity.setName(actInfo.getName());
    activity.setType(actInfo.getType());
    TFailureInfo failure = actInfo.getFailure();
    if (failure != null) {
        FailureInfoType failureInfo = new FailureInfoType();
        failureInfo.setActions(failure.getActions());
        failureInfo.setDateFailure(failure.getDtFailure());
        failureInfo.setReason(failure.getReason());
        failureInfo.setRetries(failure.getRetries());
        activity.setFailure(failureInfo);
    }
    activity.setStatus(activityStatusMap.get(actInfo.getStatus()));
    return activity;
}
Also used : FailureInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.FailureInfoType) TFailureInfo(org.apache.ode.bpel.pmapi.TFailureInfo)

Example 3 with ActivityInfoType

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityInfoType 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

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