Search in sources :

Example 1 with ActivityLifeCycleEventsListType

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

the class InstanceManagementServiceSkeleton method getActivityLifeCycleEventsFromScope.

private ActivityLifeCycleEventsListType getActivityLifeCycleEventsFromScope(ScopeDAO scope) throws InstanceManagementException {
    final ActivityLifeCycleEventsListType activityLifeCycleEventsList = new ActivityLifeCycleEventsListType();
    /*dbexec(new BpelDatabase.Callable<Object>() {
            public Object run(BpelDAOConnection conn) throws InstanceManagementException {
                ScopeDAO scope = conn.getScope(siid);
                if (scope == null) {
                    String errMsg = "Scope " + siid + " not found.";
                    log.error(errMsg);
                    throw new InstanceManagementException(errMsg);
                }
                fillActivityLifeCycleEventsFromScope(activityLifeCycleEventsList, scope);
                return null;
            }
        });*/
    fillActivityLifeCycleEventsFromScope(activityLifeCycleEventsList, scope);
    return activityLifeCycleEventsList;
}
Also used : ActivityLifeCycleEventsListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityLifeCycleEventsListType)

Example 2 with ActivityLifeCycleEventsListType

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

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityLifeCycleEventsListType 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);
    }
}
Also used : TEventInfo(org.apache.ode.bpel.pmapi.TEventInfo) EventInfo(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EventInfo) TEventInfo(org.apache.ode.bpel.pmapi.TEventInfo) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)1 ScopeDAO (org.apache.ode.bpel.dao.ScopeDAO)1 BpelEvent (org.apache.ode.bpel.evt.BpelEvent)1 EventInfoListDocument (org.apache.ode.bpel.pmapi.EventInfoListDocument)1 TEventInfo (org.apache.ode.bpel.pmapi.TEventInfo)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 ActivityLifeCycleEventsListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityLifeCycleEventsListType)1 EventInfo (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EventInfo)1