Search in sources :

Example 1 with TEventInfo

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

use of org.apache.ode.bpel.pmapi.TEventInfo in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method fillEventInfo.

private EventInfoList fillEventInfo(EventInfoList eventInfoList, TEventInfoList infoList) {
    EventInfo[] infoArray = new EventInfo[infoList.sizeOfEventInfoArray()];
    List<TEventInfo> list = infoList.getEventInfoList();
    for (int i = 0; i < list.size(); i++) {
        infoArray[i] = new EventInfo();
        EventInfo eventInfo = infoArray[i];
        TEventInfo listElem = list.get(i);
        eventInfo.setName(listElem.getName());
        eventInfo.setType(listElem.getType());
        eventInfo.setLineNumber(listElem.getLineNumber());
        eventInfo.setTimestamp(listElem.getTimestamp());
    // TODO: need to change schema and validate the methods
    }
    /*
        for (int i = 0; i < list.size(); i++) {
            infoArray[i] = new TEventInfo
            TEventInfoListSequence tEventInfo = infoArray[i];
            //tEventInfo = new TEventInfo();
            org.apache.ode.bpel.pmapi.TEventInfo listElem = list.get(i);
            tEventInfo.setActivityDefinitionId(listElem.getActivityDefinitionId());
            //tEventInfo.setActivityFailureReason(listElem.getActivityFailureReason());
            tEventInfo.setActivityId(listElem.getActivityId());
            tEventInfo.setActivityName(listElem.getActivityName());
            //tEventInfo.setActivityRecoveryAction(listElem.getActivityRecoveryAction());
            tEventInfo.setActivityType(listElem.getActivityType());
            //tEventInfo.setCorrelationKey(listElem.getCorrelationKey());
            //tEventInfo.setCorrelationSet(listElem.getCorrelationSet());
            //tEventInfo.setExplanation(listElem.getExplanation());
            //tEventInfo.setExpression(listElem.getExpression());
            //tEventInfo.setFault(listElem.getFault());
            tEventInfo.setProcessId(listElem.getProcessId());
            tEventInfo.setScopeId(listElem.getScopeId());
            tEventInfo.setScopeName(listElem.getScopeName());

        }*/
    eventInfoList.setEventInfo(infoArray);
    return eventInfoList;
}
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)

Example 3 with TEventInfo

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

Example 4 with TEventInfo

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

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

TEventInfo (org.apache.ode.bpel.pmapi.TEventInfo)5 TEventInfoList (org.apache.ode.bpel.pmapi.TEventInfoList)3 EventInfoListDocument (org.apache.ode.bpel.pmapi.EventInfoListDocument)2 EventInfo (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EventInfo)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ActivityInfoDocument (org.apache.ode.bpel.pmapi.ActivityInfoDocument)1