Try OpenEdge Now
skip to main content
BP Server Developer's Guide
JMS based event publisher : Event filters : Prefilter conditions on event context data
 

Prefilter conditions on event context data

The default ANDFilter also supports filter conditions on any data from event context. All filter conditions using event context should be specified as a name value pair in a Java Map object.

Methods supported

The value object EventChannel supports the following methods to specify the filter conditions on primary data, or using event context data.
EventChannel chn = new EventChannel("sbmTopic", EventChannel.TOPIC);
Chn.addFilterCondition(EventChannel.EVENT_TYPE, "BP Server,BPM Events");
Chn.addFilterCondition(EventChannel.EVENT_VALUES, "P_CREATED,P_INSTALLED, P_REMOVED");
Chn.addFilterCondition(EventChannel.PT_NAMES, "Hiring,Approval,Assignment");
Chn.addFilterCondition(EventChannel.WS_NAMES, "worstep1,workstep2,workstep3");
Chn.addFilterCondition(EventChannel.EVENT_CONTEXT, Map nameValuePair);
chn.removeFilterCondition(EventChannel.EVENT_TYPE);
chn.removeFilterCondition(EventChannel.EVENT_VALUES);
chn.removeFilterCondition(EventChannel.PT_NAMES);
If a context filter is to be set for EventChannel.EVENT_CONTEXT key, then its value should be Map. For example, in the above code, consider
Chn.addFilterCondition(EventChannel.EVENT_CONTEXT, Map nameValuePair);
A possible nameValuePair would be contextFilterMap with the following additional code:
HashMap contextFilterMap = new HashMap();
Vector PI_Values = new Vector();
PI_Values.add(new Long("1428"));
contextFilterMap.put("CTX.PROCESSINSTANCEID", PI_Values);
eventChannel.addFilterCondition(EventChannel.EVENT_CONTEXT, contextFilterMap);
The HashMap needs a key of type CTX.PROCESSINSTANCEID where the value should be Vector.