Search in sources :

Example 1 with ActivityInfoDocument

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

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

the class ActivityStateAndEventDocumentBuilder method fillActivityInfo.

/**
 * fill the activitiesWithEvents and activitiesWithEventsOrdered using the infoDocList
 * Need to be done as event-info can be stored only in activitiesWithEvents and activitiesWithEventsOrdered
 * (parent class doesn't support for event-info management)
 *
 * @param be          Activity Event
 * @param infoDocList Activity Information Document
 */
private void fillActivityInfo(ActivityEvent be, List<ActivityInfoDocument> infoDocList) {
    ActivityInfoDocument infoDoc = null;
    for (ActivityInfoDocument inf : infoDocList) {
        if (inf.getActivityInfo().getAiid().equals(String.valueOf(be.getActivityId()))) {
            infoDoc = inf;
        }
    }
    if (activitiesWithEvents.get(be.getActivityId()) == null) {
        activitiesWithEvents.put(be.getActivityId(), new ActivityInfoWithEventsDocument(infoDoc));
    }
    addActivitiesWithEventOrdered(infoDoc);
}
Also used : ActivityInfoDocument(org.apache.ode.bpel.pmapi.ActivityInfoDocument)

Example 3 with ActivityInfoDocument

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

Example 4 with ActivityInfoDocument

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

the class ActivityStateAndEventDocumentBuilder method onEvent.

// private boolean removeCompleted = false;
/**
 * Update activitiesWithEventsOrdered and activitiesWithEvents based on the event
 *
 * @param be BPEL Event
 */
public void onEvent(BpelEvent be) {
    super.onEvent(be);
    List<ActivityInfoDocument> infoDocList = super.getActivities();
    // Adding the event information
    if (be instanceof ActivityEvent) {
        final ActivityEvent event = (ActivityEvent) be;
        // Fill the activity info to activitiesWithEvents &
        fillActivityInfo(event, infoDocList);
        // activitiesWithEventsOrdered
        ActivityInfoWithEventsDocument actinf = lookup(event);
        assert actinf != null;
    // TODO: Denis please fill the gaps
    // if (event instanceof ActivityEnabledEvent) {
    // 
    // }
    // if (event instanceof ActivityExecStartEvent) {
    // 
    // } else if (event instanceof ActivityExecEndEvent) {
    // 
    // }
    }
}
Also used : ActivityEvent(org.apache.ode.bpel.evt.ActivityEvent) ActivityInfoDocument(org.apache.ode.bpel.pmapi.ActivityInfoDocument)

Aggregations

ActivityInfoDocument (org.apache.ode.bpel.pmapi.ActivityInfoDocument)4 ArrayList (java.util.ArrayList)1 ActivityRecoveryDAO (org.apache.ode.bpel.dao.ActivityRecoveryDAO)1 ActivityEvent (org.apache.ode.bpel.evt.ActivityEvent)1 BpelEvent (org.apache.ode.bpel.evt.BpelEvent)1 ActivityStateDocumentBuilder (org.apache.ode.bpel.evtproc.ActivityStateDocumentBuilder)1 EventInfoListDocument (org.apache.ode.bpel.pmapi.EventInfoListDocument)1 TEventInfo (org.apache.ode.bpel.pmapi.TEventInfo)1 TEventInfoList (org.apache.ode.bpel.pmapi.TEventInfoList)1 TFailureInfo (org.apache.ode.bpel.pmapi.TFailureInfo)1 EventDAOImpl (org.apache.ode.dao.jpa.EventDAOImpl)1 ScopeDAOImpl (org.apache.ode.dao.jpa.ScopeDAOImpl)1 Activities_type0 (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Activities_type0)1 ActivityInfoType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityInfoType)1