|
2.8.0: 2008-09-08 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.basedb.core.PropertyFilter
public class PropertyFilter
Used to store filter settings in the current context. A filter is
a simple expression of the form: property operator value
,
ie. name = 'Nicklas'
or spots > 10000
.
SessionControl.getCurrentContext(Item)
,
ItemContext
Field Summary | |
---|---|
static int |
MAX_VALUE_LENGTH
The maximum allowed length of a filter value. |
private Operator |
operator
|
private String |
property
|
private String |
value
|
private String |
value_separator
The string/characters used as a separator in a string with more then one filter values. |
private Type |
valueType
|
Constructor Summary | |
---|---|
PropertyFilter(String property)
Create a new filter for a property. |
|
PropertyFilter(String property,
Operator operator,
String value,
Type valueType)
Create a new filter for a property. |
|
PropertyFilter(String property,
PropertyFilterData filter)
Create a new filter from a loaded database object. |
Method Summary | |
---|---|
(package private) PropertyFilterData |
getData()
Create a new database filter object from this filter. |
Restriction |
getDynamicRestriction(DbControl dc)
|
Operator |
getOperator()
Get the operator to use in the filter. |
String |
getProperty()
Get the name of the property this filter is used on. |
Restriction |
getRestriction()
Deprecated. Use getRestriction(DbControl) instead |
Restriction |
getRestriction(DbControl dc)
Create a restriction from the filter. |
String |
getValue()
Get the value to use in the filter. |
Object |
getValueAsObject()
Get the value as an object of the correct type. |
List<Object> |
getValuesAsObjects()
Splits the value string at each "|" and creates a list with objects from the substrings that were found. |
String |
getValueSeparator()
|
Type |
getValueType()
Get the type of the property. |
void |
setOperator(Operator operator)
Set the operator to use in the filter. |
void |
setValue(String value)
Set the value to use in the filter. |
void |
setValueType(Type valueType)
Set the type of the property. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAX_VALUE_LENGTH
private final String value_separator
private final String property
private Type valueType
private Operator operator
private String value
Constructor Detail |
---|
public PropertyFilter(String property)
property
- The name of the propertypublic PropertyFilter(String property, Operator operator, String value, Type valueType)
property
- The name of the propertyoperator
- The operator to usevalue
- The value to check againstvalueType
- The type of the valuePropertyFilter(String property, PropertyFilterData filter)
Method Detail |
---|
PropertyFilterData getData()
public String toString()
toString
in class Object
public String getProperty()
public Type getValueType()
public void setValueType(Type valueType)
valueType
- The typepublic Operator getOperator()
public void setOperator(Operator operator)
public String getValue()
public void setValue(String value)
value
- The value as a stringpublic Object getValueAsObject()
Type.parseString(String)
is used to convert
the value.
InvalidDataException
- If the string value can't be parsedpublic List<Object> getValuesAsObjects()
InvalidDataException
- If any of the string values can't be parsed.public Restriction getRestriction()
getRestriction(DbControl)
instead
public Restriction getRestriction(DbControl dc)
If the property starts with a $ it is interpreted as a alias.property
value, ignoring the root alias of the query. The alias is removed from the
property before proceeding.
If the property starts with a # or ## it is a filter on annotations. The rest of
the property is the ID of the annotation type, and we use a
AnnotationSimpleRestriction
object for the restriction. If there
is only one # in the prefix only direct annotations are searched, if there
are two ##, inherited annotations are also searched.
If the property starts with a £, the rest of the property is the path that
joins the ReporterData.getReporterListScores()
collection. The filter
value is the ID of the reporter list.
If the property starts with a @ the property is a collection of values and we always use an IN restriction, ignoring the specified operator.
The property may also start with $@.
public Restriction getDynamicRestriction(DbControl dc)
public String getValueSeparator()
|
2.8.0: 2008-09-08 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |