ALBPM Process API (PAPI)

fuego.papi
Interface Filter

All Superinterfaces:
Cloneable, Serializable

public interface Filter
extends Serializable, Cloneable

Filter is used to define a subset of instances returned from a View or set of Processes.

Filters have two parts: SearchScope and FilterAttribute. SearchScope defines which instances will be processed by the set of FilterAttributes. FilterAttributes define the filter conditions.

e.g. using the severity attribute.

     Filter filter = ProcessService.createFilter();
     filter.setSearchScope(ParticipantScope.ALL, StatusScope.ALL, null);
     filter.addAttribute(VarDefinition.getDefaultVarDefinition(VarDefinition.PRIORITY_ID),
                         Condition.IS, new Integer(Priority.HIGHEST));

     InstanceInfo[] instances = new InstanceInfo[0];
     try {
         instances = session.getInstancesByFilter(new String[] { "/MyProcess1", "/MyProcess2" }, filter);
     } catch (BatchOperationException batchException) {
         batchException.printStackTrace();
     }
 

If more than a condition for the same attribute (for example, Severity) is defined within a Filter, they will be connected to resolve the complete condition. This is accomplished using the logical operators OR and AND. Each connector is classified into a type and based on the combination of the same or different type, the OR or AND applies.

Classification I

DescriptionConnector
Is+
Is not-
Contains+
Not contains-
Using the above connectors, the following rules apply:
ConnectorConnectorOperatorDescription
++ORThe combination of two types of + will be connected by an OR
+-ANDThe combination of one type + and another type - will be connected by an AND
-+ANDThe combination of one type "-" and another type + will be connected by an AND
--ANDThe combination of two types of "-" will be connected by an AND

Ex.

ConditionsExplanation
Severity is Debug / Severity is Info Both conditions use the "is" connector, therefore results displayed in the Log Viewer will contain a severity of DebugORInfo
Severity is not Debug/ Severity is not Info Both conditions use the "is not" connector, therefore results displayed in the Log Viewer will contain a severity of DebugANDInfo

Classification II

Begin with:B
End with:E
Before:lower than sign.
After:greater than sign.
Lower than:lower than sign.
Higher than:greater than sign.
Using the above connectors, the following rules apply:
B, B: ORThe combination of two types of B will be connected by an OR
B, E: ANDThe combination of one type B and another type E will be connected by an AND
E, B: ANDThe combination of one type E and another type B will be connected by an AND
E, E: ORThe combination of two types of E will be connected by an OR
lower than, lower than: AND The combination of two types of lower than will be connected by an AND
lower than, greater than: OR The combination of one type lower than and another type greater than will be connected by an OR
greater than, lower than: AND The combination of one type greater than and another type lower than will be connected by an AND
greater than, greater than: AND The combination of two types of greater than will be connected by an AND

Ex.

ConditionsExplanation
Message Begins with "The server" / Message Ends with "successfully" The conditions will be combined using AND.
Level Higher than 2 / Level Lower than 5 The conditions will be combined using AND.


Method Summary
 void addAttribute(FilterAttribute attribute)
          Adds a new FilterAttribute to the filter.
This FilterAttribute will define a new condition for the filter.
 FilterAttribute addAttribute(VarDefinition variable, Comparison operator, boolean parametric)
          Adds a new parametric FilterAttribute to the filter.
In this case you define the variable, the comparison and if the filter attribute is parametric or not.
 FilterAttribute addAttribute(VarDefinition variable, Comparison operator, Object value)
          Adds a new FilterAttribute to the filter.
In this case you define the variable, the comparison and the value to compare.
 FilterAttribute addAttribute(VarDefinition variable, Comparison operator, Object value, boolean parametric)
          Adds a new parametric FilterAttribute to the filter.
In this case you define the variable, the comparison, the value to compare and if the filter attribute is parametric or not.
 void addFilter(Filter subFilter)
          Adds a new Filter to the Filter.
This filter added will define a new condition for the filter.
 void addRefineInstance(InstanceId instanceId)
          Deprecated. Adds a new filter into this filter with the instance to refine (addFilter(Filter)).
 List getAttributes()
          Gets all attributes added to the filter
 Map getAttributesByVariable()
          Gets all attributes added to the filter, grouped by VarDefinition Id.
 List getAttributesByVariable(String variable)
          Gets all attributes added to the filter for the specified variable.
 Comparator getComparator(Locale locale)
          Gets the java.util.Comparator generated by this filter.
 String getDescription()
          Gets the description of this filter.
 List getFilters()
          Returns all Filters added to this filter.
 String getGrabActivityName()
          Deprecated.  
 String getName()
          Gets the name of this filter.
 Ordering getOrdering()
          Gets the order of the instances that match with this filter.
 List getParametricAttributes()
          Gets all parametric attributes.
 List getRefineInstances()
          Deprecated. Use a filter into this filter to refine instances.
 SearchScope getSearchScope()
          Gets the scope of the filter.
The scope define the environment of the instances that could be process by the filter.
 boolean isCaseSensitive()
          Returns if this filter is case sensitive or not.
 boolean isMatchAll()
          Returns if this filter has match all or not.
 boolean isParametric()
          Returns if any attribute is parametric or not.
 boolean match(InstanceInfo instance, Participant participant)
          Checks if the specified instance match with this filter.
 void removeAttribute(FilterAttribute attribute)
          Removes an attribute from the filter.
 List removeAttributes(String variable)
          Removes all attribute for the specified variable id.
 boolean removeFilter(Filter subfilter)
          Removes a filter added to this filter.
 void setCaseSensitive(boolean caseSensitive)
          Sets if this filter is case sensitive or not.
If is case sensitive al comparations with characters will be case sensitive.
 void setGrabActivity(Activity activity)
          Deprecated. Find the instance that would you grab, and then execute the method ProcessServiceNESession.getGrabActivitiesForInstance(InstanceInfo), with that instance as argument, to obtain the activities which can grab it.
 void setGrabActivityName(String activity)
          Deprecated. Find the instance that would you grab, and then execute the method ProcessServiceNESession.getGrabActivitiesForInstance(InstanceInfo), with that instance as argument, to obtain the activities which can grab it.
 void setMatchAll(boolean matchAll)
          Sets if the instances must match with all attributes of the filter or not.
 void setName(String name)
          Sets the name of this filter.
 void setOrdering(Ordering ordering)
          Sets the order of the instances that match with this filter.
 void setSearchScope(SearchScope searchScope)
          Sets the scope of the filter.
The scope define the environment of the instances that could be process by the filter.
 

Method Detail

getAttributes

public List getAttributes()
Gets all attributes added to the filter

Returns:
List of FilterAttribute with all attributes added to the filter.
See Also:
FilterAttribute, List

getAttributesByVariable

public Map getAttributesByVariable()
Gets all attributes added to the filter, grouped by VarDefinition Id.

Returns:
Map with all attributes added to the filter, where the key is the VarDefinition Id and the value is a List of FilterAttribute with all attributes for this VarDefinition.
See Also:
FilterAttribute, Map, List

getAttributesByVariable

public List getAttributesByVariable(String variable)
Gets all attributes added to the filter for the specified variable.

Parameters:
variable - VarDefinition Id to obtain the FilterAttributes added.
Returns:
List of FilterAttribute added to the filter for the specified variable.
See Also:
FilterAttribute, List

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)
Sets if this filter is case sensitive or not.
If is case sensitive al comparations with characters will be case sensitive.

Parameters:
caseSensitive - true if is case sensitive.

isCaseSensitive

public boolean isCaseSensitive()
Returns if this filter is case sensitive or not.

Returns:
true if is case sensitive.

getComparator

public Comparator getComparator(Locale locale)
Gets the java.util.Comparator generated by this filter.

Returns:
Comparator generated by this filter.
See Also:
Comparator

getDescription

public String getDescription()
Gets the description of this filter.

Returns:
message with all information about this filter.

setGrabActivity

public void setGrabActivity(Activity activity)
Deprecated. Find the instance that would you grab, and then execute the method ProcessServiceNESession.getGrabActivitiesForInstance(InstanceInfo), with that instance as argument, to obtain the activities which can grab it.

Sets the Grab Activity for the filter.
If you set this activity, the filter will generate a Comparator to obtain all instances that you could grab to the activity specified.

Parameters:
activity - grab Activity where you want to grab.
See Also:
Activity

setGrabActivityName

public void setGrabActivityName(String activity)
Deprecated. Find the instance that would you grab, and then execute the method ProcessServiceNESession.getGrabActivitiesForInstance(InstanceInfo), with that instance as argument, to obtain the activities which can grab it.

Sets the Grab Activity for the filter.
If you set this activity, the filter will generate a Comparator to obtain all instances that you could grab to the activity specified.

Parameters:
activity - name of the Grab activity where you want to grab.
See Also:
Activity

getGrabActivityName

public String getGrabActivityName()
Deprecated.  

Gets name of the Grab activity.

Returns:
the grab activity name or null if the activity was not set.

setMatchAll

public void setMatchAll(boolean matchAll)
Sets if the instances must match with all attributes of the filter or not. If you set True the connector between attributes will be AND, if you set False the connector will be OR

Parameters:
matchAll - true for AND connector between attributes and false for OR

isMatchAll

public boolean isMatchAll()
Returns if this filter has match all or not. The match all attribute define if the connector between attributes is AND or OR.

Returns:
true if is match all and the connector is AND, false if not and the connector is OR.

setName

public void setName(String name)
Sets the name of this filter.

Parameters:
name - the new name of the filter.

getName

public String getName()
Gets the name of this filter.

Returns:
the name of the filter.

setOrdering

public void setOrdering(Ordering ordering)
Sets the order of the instances that match with this filter.

Parameters:
ordering - Ordering with the attributes to order
See Also:
Ordering

getOrdering

public Ordering getOrdering()
Gets the order of the instances that match with this filter.

Returns:
Ordering with the attributes used to order.
See Also:
Ordering

isParametric

public boolean isParametric()
Returns if any attribute is parametric or not.

Returns:
true if any attribute of the filter is parametric.

getParametricAttributes

public List getParametricAttributes()
Gets all parametric attributes.

Returns:
list with all FilterAttribute which have the FilterAttribute.isParametric() in true.
See Also:
List

getRefineInstances

public List getRefineInstances()
Deprecated. Use a filter into this filter to refine instances.

Gets the instances Id where this filter will be executed.

Returns:
list with the instance Id where this filter will be executed.
See Also:
List

setSearchScope

public void setSearchScope(SearchScope searchScope)
Sets the scope of the filter.
The scope define the environment of the instances that could be process by the filter.

Parameters:
searchScope - SearchScope to define the environment of the filter.
See Also:
SearchScope

getSearchScope

public SearchScope getSearchScope()
Gets the scope of the filter.
The scope define the environment of the instances that could be process by the filter.

Returns:
SearchScope of the filter.
See Also:
SearchScope

addAttribute

public FilterAttribute addAttribute(VarDefinition variable,
                                    Comparison operator,
                                    Object value)
Adds a new FilterAttribute to the filter.
In this case you define the variable, the comparison and the value to compare. That information will be used to generate a new FilterAttribute.
This FilterAttribute will define a new condition for the filter.

Parameters:
variable - VarDefinition to check. Cannot be null.
operator - Comparison to use. Cannot be null.
value - The value to compare with the instance value.
Returns:
FilterAttribute generated.

addAttribute

public FilterAttribute addAttribute(VarDefinition variable,
                                    Comparison operator,
                                    boolean parametric)
Adds a new parametric FilterAttribute to the filter.
In this case you define the variable, the comparison and if the filter attribute is parametric or not. That information will be used to generate a new FilterAttribute.
This FilterAttribute will define a new condition for the filter.

Parameters:
variable - VarDefinition to check. Cannot be null.
operator - Comparison to use. Cannot be null.
parametric - true if the filter attribute is parametric.
Returns:
FilterAttribute generated.

addAttribute

public FilterAttribute addAttribute(VarDefinition variable,
                                    Comparison operator,
                                    Object value,
                                    boolean parametric)
Adds a new parametric FilterAttribute to the filter.
In this case you define the variable, the comparison, the value to compare and if the filter attribute is parametric or not. That information will be used to generate a new FilterAttribute.
This FilterAttribute will define a new condition for the filter.

Parameters:
variable - VarDefinition to check. Cannot be null.
operator - Comparison to use. Cannot be null.
value - The value to compare with the instance value.
parametric - true if the filter attribute is parametric.
Returns:
FilterAttribute generated.

addFilter

public void addFilter(Filter subFilter)
Adds a new Filter to the Filter.
This filter added will define a new condition for the filter.

Parameters:
subFilter - Filter to add.

removeFilter

public boolean removeFilter(Filter subfilter)
Removes a filter added to this filter.

Parameters:
subfilter - subfilter to remove.
Returns:
true if the filter contained the specified subfilter.

getFilters

public List getFilters()
Returns all Filters added to this filter.

Returns:
list of added Filter.

addAttribute

public void addAttribute(FilterAttribute attribute)
Adds a new FilterAttribute to the filter.
This FilterAttribute will define a new condition for the filter.

Parameters:
attribute - FilterAttribute to add
See Also:
FilterAttribute

addRefineInstance

public void addRefineInstance(InstanceId instanceId)
Deprecated. Adds a new filter into this filter with the instance to refine (addFilter(Filter)).

Adds an instances ID where this filter will be executed.

Parameters:
instanceId - The instance id where the filter will be executed.

match

public boolean match(InstanceInfo instance,
                     Participant participant)
Checks if the specified instance match with this filter.

Parameters:
instance - instance to check
participant - Participant which execute the match
Returns:
true if the instance match with the filter.

removeAttribute

public void removeAttribute(FilterAttribute attribute)
Removes an attribute from the filter.

Parameters:
attribute - FilterAttribute to remove.

removeAttributes

public List removeAttributes(String variable)
Removes all attribute for the specified variable id.

Parameters:
variable - variable Id of the attribute to remove.
Returns:
List with all removed attributes.

ALBPM Process API (PAPI)

© Copyright 1996/2005 Fuego Inc. All Rights Reserved