Class 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
    • Constructor Detail

      • BrowseFilter

        public BrowseFilter()
    • 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.
      • 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.
      • 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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object