|
Dashboard Builder Commons 6.0.0.Beta3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.dashboard.commons.filter.AbstractFilter
public abstract class AbstractFilter
An abstract that defines those basic services a entity filter.
| Field Summary | |
|---|---|
protected ThreadLocal |
_bshIntepreterThread
BSH interpreter per thread cache. |
protected Map |
_filterVarValues
Map used to store properties filter results when evauating the overall filter condition. |
protected String |
filterCondition
The filter condition logical expression. |
protected List |
filterProperties
Filter list. |
protected String |
gt
Greater than symbol. |
protected String |
gtOrEq
Greater or equals than symbol. |
protected Locale |
locale
The criteria locale. |
protected String |
lt
Less than symbol. |
protected String |
ltOrEq
Less or equals than symbol. |
protected String |
wildcard
Wildcard symbol. |
| Fields inherited from interface org.jboss.dashboard.commons.filter.FilterByCriteria |
|---|
ALLOW_ALL, ALLOW_ANY, ALLOW_NONE |
| Constructor Summary | |
|---|---|
AbstractFilter()
|
|
| 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. |
int |
compare(Comparable o1,
Comparable o2,
int ordering)
Compares two comparable objects. |
protected int |
compareBySimilarity(String propertyId,
Object pattern,
Object value)
Check if the given object instance matchs the specified pattern. |
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. |
boolean |
equals(Object obj)
|
protected Object |
executeBeanShellScript(String beanShellScript,
Map context)
Executes a BeanShell script. |
protected abstract String |
formatForComparison(String propertyId,
Object value)
Format a given property value valid for string comparfison against other values. |
protected abstract String |
formatForDisplay(String propertyId,
Object value)
Format a given property value as displayed for the the user. |
String |
getExtraInfo(String propertyId)
|
String |
getFilterCondition()
|
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. |
protected Object[] |
getProperty(String propertyId)
|
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. |
protected abstract Object |
getPropertyValue(String propertyId,
Object obj)
Retrieve the value for a given property. |
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(Map obj)
Apply the filter to the given object. |
boolean |
pass(Object obj)
Apply the filter to the given object. |
boolean |
pass(String propertyId,
Object value)
Check if a value satisfies a property filter. |
boolean |
pass(String propertyId,
Object value,
List allowedValues,
int allowMode)
Check if a given value (either a single object or a collection) satisfies a collection of allowed values. |
boolean |
passValue(String propertyId,
Object value,
List allowedValues,
int allowMode)
Check if a given value satisfies a collection of allowed values. |
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 logicalExpression)
Define the condition to be applied to the set of property filters when executing the pass(Object) method. |
void |
setGt(String gt)
|
void |
setGtOrEq(String gtOrEq)
|
void |
setLocale(Locale locale)
|
void |
setLt(String lt)
|
void |
setLtOrEq(String ltOrEq)
|
void |
setVariableName(String propertyId,
String varName)
An alias or variable to be assigned to the property . |
void |
setWildcard(String wildcard)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected List filterProperties
protected String filterCondition
protected String wildcard
protected String gt
protected String lt
protected String gtOrEq
protected String ltOrEq
protected Locale locale
protected transient Map _filterVarValues
protected transient ThreadLocal _bshIntepreterThread
| Constructor Detail |
|---|
public AbstractFilter()
| Method Detail |
|---|
public Locale getLocale()
FilterByCriteria
getLocale in interface FilterByCriteriapublic void setLocale(Locale locale)
setLocale in interface FilterByCriteriapublic String getWildcard()
FilterByCriteria
getWildcard in interface FilterByCriteriapublic void setWildcard(String wildcard)
public String getGt()
FilterByCriteria
getGt in interface FilterByCriteriapublic void setGt(String gt)
public String getGtOrEq()
FilterByCriteria
getGtOrEq in interface FilterByCriteriapublic void setGtOrEq(String gtOrEq)
public String getLt()
FilterByCriteria
getLt in interface FilterByCriteriapublic void setLt(String lt)
public String getLtOrEq()
FilterByCriteria
getLtOrEq in interface FilterByCriteriapublic void setLtOrEq(String ltOrEq)
public void addProperties(FilterByCriteria filter)
FilterByCriteria
addProperties in interface FilterByCriteria
public void addProperty(String propertyId,
Object minValue,
boolean minValueIncluded,
Object maxValue,
boolean maxValueIncluded,
Collection allowedValues,
int allowMode)
FilterByCriteria
addProperty in interface FilterByCriteriapropertyId - 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 -
public boolean addProperty(String propertyId,
String filterCriteria)
FilterByCriteria
addProperty in interface FilterByCriteriapropertyId - 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".
public void removeProperty(String propertyId)
FilterByCriteria
removeProperty in interface FilterByCriteriapublic void removeProperties(FilterByCriteria filter)
FilterByCriteria
removeProperties in interface FilterByCriteriapublic void removeAllProperty()
FilterByCriteria
removeAllProperty in interface FilterByCriteriapublic int getPropertyPriority(String propertyId)
FilterByCriteria
getPropertyPriority in interface FilterByCriteriapublic Comparable getPropertyMinValue(String propertyId)
FilterByCriteria
getPropertyMinValue in interface FilterByCriteriapublic boolean minValueIncluded(String propertyId)
FilterByCriteria
minValueIncluded in interface FilterByCriteriapublic Comparable getPropertyMaxValue(String propertyId)
FilterByCriteria
getPropertyMaxValue in interface FilterByCriteriapublic boolean maxValueIncluded(String propertyId)
FilterByCriteria
maxValueIncluded in interface FilterByCriteriapublic List getPropertyAllowedValues(String propertyId)
FilterByCriteria
getPropertyAllowedValues in interface FilterByCriteriapublic int getPropertyAllowMode(String propertyId)
FilterByCriteria
getPropertyAllowMode in interface FilterByCriteriaALLOW_ constants defined.
public void setVariableName(String propertyId,
String varName)
FilterByCriteriaFor more details see setFilterCondition(String logicalExpression) method.
setVariableName in interface FilterByCriteriapublic String getVariableName(String propertyId)
getVariableName in interface FilterByCriteriapublic String getExtraInfo(String propertyId)
getExtraInfo in interface FilterByCriteria
public void setExtraInfo(String propertyId,
String extraInfo)
FilterByCriteria
setExtraInfo in interface FilterByCriteriapublic void setFilterCondition(String logicalExpression)
FilterByCriteriapass(Object) method.
setFilterCondition in interface FilterByCriterialogicalExpression - 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:
As you can see, powerful and complex boolean expressions can be defined.
public String getFilterCondition()
public String[] getPropertyIds()
FilterByCriteria
getPropertyIds in interface FilterByCriteriapublic boolean containsProperty(String propertyId)
FilterByCriteria
containsProperty in interface FilterByCriteriapublic boolean containsProperty(Collection propIds)
FilterByCriteria
containsProperty in interface FilterByCriteriapropIds - A collection of property identifiers.protected Object[] getProperty(String propertyId)
public String toString()
toString in class Object
public boolean pass(String propertyId,
Object value)
throws IllegalArgumentException
pass in interface FilterByCriteriapropertyId - The property to pass.value - The value to check.
IllegalArgumentException
public boolean pass(String propertyId,
Object value,
List allowedValues,
int allowMode)
value - allowedValues - allowMode - See ALLOW_ constants defined.
public boolean passValue(String propertyId,
Object value,
List allowedValues,
int allowMode)
value - allowedValues - allowMode - See ALLOW_ constants defined.
protected int compareBySimilarity(String propertyId,
Object pattern,
Object value)
propertyId - The property to compare.pattern - The pattern. In Strings wildcard is accepted.value - The object to check.
public boolean pass(Map obj)
Filter
pass in interface Filterobj - A map containing pairs of [propertyId (String), propertyValue (Object)].
public boolean pass(Object obj)
Filter
pass in interface Filterobj - An object to be evaluated.
protected Object executeBeanShellScript(String beanShellScript,
Map context)
throws bsh.EvalError
beanShellScript - The script to execute in BeanShell format.context - A map of arguments to be passed to the script.
bsh.EvalError
public int compare(Comparable o1,
Comparable o2,
int ordering)
ordering: - 1=ascending, -1=descendingpublic FilterByCriteria cloneFilter()
FilterByCriteria
cloneFilter in interface FilterByCriteriapublic boolean equals(Object obj)
equals in class Object
protected abstract String formatForDisplay(String propertyId,
Object value)
propertyId - The property identifier.value - The value to format.
protected abstract String formatForComparison(String propertyId,
Object value)
propertyId - The property identifier.value - The value to format.
protected abstract Object getPropertyValue(String propertyId,
Object obj)
propertyId - The property to search value for.obj - The object instance to ask for.
|
Dashboard Builder Commons 6.0.0.Beta3 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||