Usage of nested OR (logical OR condition), AND (logical AND condition) combined with FILTERS in TIBCO BusinessEvents with Oracle Coherence .

Usage of nested OR (logical OR condition), AND (logical AND condition) combined with FILTERS in TIBCO BusinessEvents with Oracle Coherence .

book

Article ID: KB0089732

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Resolution:
Description:
============
Usage of nested OR (logical OR condition), AND (logical AND condition) combined with FILTERS in TIBCO BusinessEvents with Oracle Coherence .

Environment:
============
TIBCO BusinessEvents 4.x
Oracle Coherence
Operating System(s): All

Resolution:
============
The code snippets below show how to combine nested multiple OR , AND conditions with FILTERS in  TIBCO BusinessEvents. You might need to add more C_AND or C_OR condition blocks to suit your requirement but is not necessary.

// OR Condition using C_ANY (TO replicate the following logical order in Business Events code (P5 == 5 || P5 == 6)) see the snippet below)

Object[] filters =Object[2]{};
Object serviceCodeFilter1 = Coherence.Filters.C_Equals(Coherence.Extractors.C_StringAtomGetter("f5"),Coherence.Constants.C_StringConstant("5"));    
Object serviceCodeFilter2 = Coherence.Filters.C_Equals(Coherence.Extractors.C_StringAtomGetter("f5"),Coherence.Constants.C_StringConstant("6"));    
filters[0] = serviceCodeFilter1;
filters[1] = serviceCodeFilter2;
Object result1 = Coherence.Filters.C_Any(filters);

// AND Condition using C_AND (TO replicate the following logical order in Business Events code (P3 == 3 && P4 == 4) see the snippet below)

Object result2 = Coherence.Filters.C_Equals(Coherence.Extractors.C_StringAtomGetter("f3"),Coherence.Constants.C_StringConstant("3"));    
Object result3 = Coherence.Filters.C_Equals(Coherence.Extractors.C_StringAtomGetter("f4"),Coherence.Constants.C_StringConstant("4"));    
Object fillter = Coherence.Filters.C_And(result1,result2);
Object filllter = Coherence.Filters.C_And(fillter,result3);

// FILTER EXECUTION

Concept[] ding = Coherence.Query.C_QueryConcepts(cacheName, filllter, true);    
System.debugOut("");

Issue/Introduction

Usage of nested OR (logical OR condition), AND (logical AND condition) combined with FILTERS in TIBCO BusinessEvents with Oracle Coherence .