Class BrowseFilter
- java.lang.Object
-
- com.inductiveautomation.ignition.common.browsing.BrowseFilter
-
- All Implemented Interfaces:
java.io.Serializable
public class BrowseFilter extends java.lang.Object implements java.io.Serializable
This is a filter for our common browsing framework. It can be used to filter new results, or to continue a previous browse. It allows filtering on type and name, and limiting the number of items returned.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BrowseFilter.FilterPropertyValue
Serializable version of PropertyValuestatic class
BrowseFilter.NameFilter
This filter class allows for the definition of one or more potential filters for a specific type id.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DATA_TYPE_PROP
static java.lang.String
MAX_RESULTS_PROP
static BrowseFilter
NONE
static int
NOT_SPECIFIED
static java.lang.String
QUALITY_PROP
static java.lang.String
TAG_TYPE_PROP
static java.lang.String
TYPE_ID_PROP
static java.lang.String
VALUE_SOURCE_PROP
-
Constructor Summary
Constructors Constructor Description BrowseFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExcludeProperty(Property<?> property, java.lang.Object value)
Can be used be external entities to perform their own exclude filtering.protected void
addNameFilter(BrowseFilter.NameFilter filter)
BrowseFilter
addNameFilter(java.lang.String typeId, java.lang.String... filters)
Adds one or more name filters for a specific type id.void
addProperty(Property<?> property, java.lang.Object value)
Add a property to filter on.boolean
checkNameFilters(QualifiedPath path)
Returns whether or not the provided path passes the name filters defined on this browse filter.boolean
checkNameFilters(TagPath path)
boolean
checkProperties(PropertyValueSource toCheck)
Returns true if all property values in this browse filter match the same property values in the passed property value source, or if no property values have been specified in this browse filter.java.lang.String[]
getAllowedTypes()
Returns the type ids of the sub types allowed by the filter.java.lang.String
getContinuationPoint()
The continuation point is a system specific object that can be used to continue a browse, if the maximum return size was previously reached.BrowseFilter.FilterPropertyValue
getFilterExcludeProperty(Property<?> property)
Can be used be external entities to perform their own exclude filtering.BrowseFilter.FilterPropertyValue
getFilterProperty(Property<?> property)
int
getMaxResults()
Returns the maximum number of values that should be returned.BrowseFilter.NameFilter[]
getNameFilters()
Returns the name filter conditions defined.java.util.Map<java.lang.String,BrowseFilter.NameFilter>
getNameFiltersAsMap()
Returns the name filters, but as a map, with the type id as the key.int
getOffset()
Returns the desired offset, which means to skip the first number of results that would match.boolean
isEmptyFilter()
boolean
isRecursive()
BrowseFilter
setAllowedTypes(java.lang.String[] allowedTypes)
BrowseFilter
setContinuationPoint(java.lang.String continuationPoint)
Sets the continuation point in order to continue a browse that was previously started and then limited.BrowseFilter
setMaxResults(int maxResults)
Sets the maximum number of results that should be returned.BrowseFilter
setNameFilters(BrowseFilter.NameFilter[] filters)
Defines the name filters that apply to this filter.BrowseFilter
setOffset(int offset)
Indicates that we wish to skip a certain number of results.BrowseFilter
setRecursive(boolean recursive)
-
-
-
Field Detail
-
NONE
public static final BrowseFilter NONE
-
NOT_SPECIFIED
public static final int NOT_SPECIFIED
- See Also:
- Constant Field Values
-
MAX_RESULTS_PROP
public static final java.lang.String MAX_RESULTS_PROP
- See Also:
- Constant Field Values
-
TAG_TYPE_PROP
public static final java.lang.String TAG_TYPE_PROP
- See Also:
- Constant Field Values
-
DATA_TYPE_PROP
public static final java.lang.String DATA_TYPE_PROP
- See Also:
- Constant Field Values
-
VALUE_SOURCE_PROP
public static final java.lang.String VALUE_SOURCE_PROP
- See Also:
- Constant Field Values
-
TYPE_ID_PROP
public static final java.lang.String TYPE_ID_PROP
- See Also:
- Constant Field Values
-
QUALITY_PROP
public static final java.lang.String QUALITY_PROP
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAllowedTypes
public java.lang.String[] getAllowedTypes()
Returns the type ids of the sub types allowed by the filter. Returns null if there is no restriction.
-
setAllowedTypes
public BrowseFilter setAllowedTypes(java.lang.String[] allowedTypes)
-
getNameFilters
public BrowseFilter.NameFilter[] getNameFilters()
Returns the name filter conditions defined. Name filters are created on a per-type basis, and are used with wildcards to limit the items returned.
-
getNameFiltersAsMap
public java.util.Map<java.lang.String,BrowseFilter.NameFilter> getNameFiltersAsMap()
Returns the name filters, but as a map, with the type id as the key.
-
setNameFilters
public BrowseFilter setNameFilters(BrowseFilter.NameFilter[] filters)
Defines the name filters that apply to this filter.
-
addNameFilter
protected void addNameFilter(BrowseFilter.NameFilter filter)
-
addNameFilter
public BrowseFilter addNameFilter(java.lang.String typeId, java.lang.String... filters)
Adds one or more name filters for a specific type id. Name filters may include wild cards (*), and are applied in a non-exclusive manner. In other words, if any of the filters pass for a specific type, the object will pass.
-
getMaxResults
public int getMaxResults()
Returns the maximum number of values that should be returned. Returns -1 if there is no restriction.
-
setMaxResults
public BrowseFilter setMaxResults(int maxResults)
Sets the maximum number of results that should be returned. May be set to -1 to indicate no restriction.
-
getContinuationPoint
public java.lang.String getContinuationPoint()
The continuation point is a system specific object that can be used to continue a browse, if the maximum return size was previously reached.
-
setContinuationPoint
public BrowseFilter setContinuationPoint(java.lang.String continuationPoint)
Sets the continuation point in order to continue a browse that was previously started and then limited.
-
getOffset
public int getOffset()
Returns the desired offset, which means to skip the first number of results that would match. Returns -1 if there is no offset.
-
setOffset
public BrowseFilter setOffset(int offset)
Indicates that we wish to skip a certain number of results. -1 (default) indicates that we don't want to skip any results.
-
isRecursive
public boolean isRecursive()
-
setRecursive
public BrowseFilter setRecursive(boolean recursive)
-
addProperty
public void addProperty(Property<?> property, java.lang.Object value)
Add a property to filter on. Only items that contain this property will be checked.
-
getFilterProperty
public BrowseFilter.FilterPropertyValue getFilterProperty(Property<?> property)
-
addExcludeProperty
public void addExcludeProperty(Property<?> property, java.lang.Object value)
Can be used be external entities to perform their own exclude filtering. Currently, checkProperties() does NOT take exclude properties into account.
-
getFilterExcludeProperty
public BrowseFilter.FilterPropertyValue getFilterExcludeProperty(Property<?> property)
Can be used be external entities to perform their own exclude filtering. Currently, checkProperties() does NOT take exclude properties into account. Will return null if the specified property is not in this filter.
-
checkProperties
public boolean checkProperties(PropertyValueSource toCheck)
Returns true if all property values in this browse filter match the same property values in the passed property value source, or if no property values have been specified in this browse filter. Note that if the passed property value source does not contain a certain filter property, then that property check will be skipped.
-
checkNameFilters
public boolean checkNameFilters(QualifiedPath path)
Returns whether or not the provided path passes the name filters defined on this browse filter. If filters are defined for a type id, and the path contains that type id, one of the filters must match for the path to be valid.
-
checkNameFilters
public boolean checkNameFilters(TagPath path)
-
isEmptyFilter
public boolean isEmptyFilter()
- Returns:
- true if no filter properties have been set, i.e. BrowseFilter.NONE
-
-