Dashboard Builder Commons 6.2.0.CR4

org.jboss.dashboard.commons.filter
Interface FilterByCriteria

All Superinterfaces:
Filter
All Known Implementing Classes:
AbstractFilter, ThreadProfileFilter

public interface FilterByCriteria
extends Filter

A filter designed to configure filter criteria for objects properties.


Field Summary
static int ALLOW_ALL
          Allow only if all values are satisfied.
static int ALLOW_ANY
          Allow if some value is satisfied.
static int ALLOW_NONE
          Allow if none of the specified values are satisfied.
 
Method Summary
 void addProperties(FilterByCriteria filter)
          Add all the specified filter properties.
 void addProperty(String propertyId, Object minValue, boolean minValueIncluded, Object maxValue, boolean maxValueIncluded, Collection allowedValues, int allowMode)
          Specifies a property for the filter.
 boolean addProperty(String propertyId, String filterCriteria)
          Specifies a property for the filter in a unstructured way.
 FilterByCriteria cloneFilter()
          Create an exact copy of this filter instance.
 boolean containsProperty(Collection propIds)
          Check if a filter is defined for any of the property identifiers given.
 boolean containsProperty(String propertyId)
          Check if the given property filter has been defined.
 String getExtraInfo(String propertyId)
           
 String getGt()
          The greater than symbol.
 String getGtOrEq()
          The greater or equals than symbol.
 Locale getLocale()
          The criteria always belongs to a locale.
 String getLt()
          The less than symbol.
 String getLtOrEq()
          The less or equals than symbol.
 List getPropertyAllowedValues(String propertyId)
          Get the set of allowed values for the property.
 int getPropertyAllowMode(String propertyId)
          Get the allow mode for a property.
 String[] getPropertyIds()
          Retgrieve the property ids. specified for this filter.
 Comparable getPropertyMaxValue(String propertyId)
          Get the max. value allowed for the property in the filter.
 Comparable getPropertyMinValue(String propertyId)
          Get the min. value allowed for the property in the filter.
 int getPropertyPriority(String propertyId)
          Get the prioority for a given property defined in the filter.
 String getVariableName(String propertyId)
           
 String getWildcard()
          The wildcard symbol used by the filter to compare properties.
 boolean maxValueIncluded(String propertyId)
          Check if max. value defined must be considered as valid.
 boolean minValueIncluded(String propertyId)
          Check if min. value defined must be considered as valid.
 boolean pass(String propertyId, Object value)
          Check if a value satisfies a defined property filter.
 void removeAllProperty()
          Clear filter.
 void removeProperties(FilterByCriteria filter)
          Remove all the specified filter properties.
 void removeProperty(String propertyId)
          Remove property from the filter.
 void setExtraInfo(String propertyId, String extraInfo)
          Set additional information regarding the property.
 void setFilterCondition(String booleanExpression)
          Define the condition to be applied to the set of property filters when executing the pass(Object) method.
 void setLocale(Locale locale)
           
 void setVariableName(String propertyId, String varName)
          An alias or variable to be assigned to the property .
 
Methods inherited from interface org.jboss.dashboard.commons.filter.Filter
pass, pass
 

Field Detail

ALLOW_ALL

static final int ALLOW_ALL
Allow only if all values are satisfied.

See Also:
Constant Field Values

ALLOW_ANY

static final int ALLOW_ANY
Allow if some value is satisfied.

See Also:
Constant Field Values

ALLOW_NONE

static final int ALLOW_NONE
Allow if none of the specified values are satisfied.

See Also:
Constant Field Values
Method Detail

getLocale

Locale getLocale()
The criteria always belongs to a locale.


setLocale

void setLocale(Locale locale)

addProperty

void addProperty(String propertyId,
                 Object minValue,
                 boolean minValueIncluded,
                 Object maxValue,
                 boolean maxValueIncluded,
                 Collection allowedValues,
                 int allowMode)
Specifies a property for the filter.

Parameters:
propertyId - The property to set.
minValue - The minimun value allowed for the property.
minValueIncluded - The minimun value is considered as a valid value.
maxValue - The maximum value allowed for the property.
maxValueIncluded - The maximum value is considered as a valid value.
allowedValues - A set of values allowed.
allowMode -
  • ALLOW_ALL=All values must be satisfied.
  • ALLOW_ANY=At least one value must be satisfied.
  • ALLOW_NONE=Any value must be satisfied.

addProperty

boolean addProperty(String propertyId,
                    String filterCriteria)
Specifies a property for the filter in a unstructured way.

Parameters:
propertyId - The property to set.
filterCriteria - The criteria for the property. Operators are allowed here: wildcard, greater than, less than and comma. e.g: ">1000", "Rev*", "1000, 1002, 1003".
Returns:
Property added or not. e.g: If criteria string is empty then it returns false.

addProperties

void addProperties(FilterByCriteria filter)
Add all the specified filter properties.


getPropertyIds

String[] getPropertyIds()
Retgrieve the property ids. specified for this filter.

Returns:
An array of ids.

containsProperty

boolean containsProperty(String propertyId)
Check if the given property filter has been defined.


containsProperty

boolean containsProperty(Collection propIds)
Check if a filter is defined for any of the property identifiers given.

Parameters:
propIds - A collection of property identifiers.

removeProperty

void removeProperty(String propertyId)
Remove property from the filter.


removeProperties

void removeProperties(FilterByCriteria filter)
Remove all the specified filter properties.


removeAllProperty

void removeAllProperty()
Clear filter.


getPropertyPriority

int getPropertyPriority(String propertyId)
Get the prioority for a given property defined in the filter.

Parameters:
propertyId -
Returns:
A priority ordinal.

getPropertyMinValue

Comparable getPropertyMinValue(String propertyId)
Get the min. value allowed for the property in the filter.


minValueIncluded

boolean minValueIncluded(String propertyId)
Check if min. value defined must be considered as valid. To be applied only when min. value is defined.


getPropertyMaxValue

Comparable getPropertyMaxValue(String propertyId)
Get the max. value allowed for the property in the filter.


maxValueIncluded

boolean maxValueIncluded(String propertyId)
Check if max. value defined must be considered as valid. To be applied only when max. value is defined.


getPropertyAllowedValues

List getPropertyAllowedValues(String propertyId)
Get the set of allowed values for the property.


getPropertyAllowMode

int getPropertyAllowMode(String propertyId)
Get the allow mode for a property.

Returns:
See ALLOW_ constants defined.

setVariableName

void setVariableName(String propertyId,
                     String varName)
An alias or variable to be assigned to the property . Useful in the definition of custom filter conditions. Such variable it models the boolean result obtained after applying the property filter for a given object. This variable can be used in the definition of custom filter conditions for the filter (as a boolean expressions).

For more details see setFilterCondition(String logicalExpression) method.


getVariableName

String getVariableName(String propertyId)

setExtraInfo

void setExtraInfo(String propertyId,
                  String extraInfo)
Set additional information regarding the property. f.i: the text an user typed as a search criteria for a given property.


getExtraInfo

String getExtraInfo(String propertyId)

setFilterCondition

void setFilterCondition(String booleanExpression)
Define the condition to be applied to the set of property filters when executing the pass(Object) method.

Parameters:
booleanExpression - A logical expression where we can combine the different property pass results in order to calculate the overall filter result. Boolean AND, OR and NOT operators are supported.

Next some logical expressions samples:

First of all, define variables for properties.
  • setVariableName("processId", "a");
  • setVariableName("stepName", "b");
  • setVariableName("processDescrCode", "c");
    Second step, define filter logical expression:
  • Sample 1: setFilterCondition("NOT a OR b");
  • Sample 2: setFilterCondition("c AND (a OR b)");

As you can see, powerful and complex boolean expressions can be defined.


getWildcard

String getWildcard()
The wildcard symbol used by the filter to compare properties.


getGt

String getGt()
The greater than symbol.


getGtOrEq

String getGtOrEq()
The greater or equals than symbol.


getLt

String getLt()
The less than symbol.


getLtOrEq

String getLtOrEq()
The less or equals than symbol.


pass

boolean pass(String propertyId,
             Object value)
Check if a value satisfies a defined property filter.

Parameters:
propertyId - The property to pass.
value - The value to check.

cloneFilter

FilterByCriteria cloneFilter()
Create an exact copy of this filter instance.


Dashboard Builder Commons 6.2.0.CR4

Copyright © 2012-2015 JBoss by Red Hat. All Rights Reserved.