Class FilterImpl

  • All Implemented Interfaces:
    Filter

    public class FilterImpl
    extends java.lang.Object
    implements Filter
    A filter or lookup condition.
    • Constructor Detail

      • FilterImpl

        public FilterImpl​(SelectorImpl selector,
                          java.lang.String queryStatement,
                          QueryLimits settings)
        Create a filter.
        Parameters:
        selector - the selector for the given filter
        queryStatement - the query statement
      • FilterImpl

        public FilterImpl​(Filter filter)
    • Method Detail

      • newTestInstance

        public static FilterImpl newTestInstance()
        Create a new filter instance that is used for unit testing. This method is relatively slow, because it creates a new query engine setting object. Therefore, it is only to be used for testing. At runtime, the public constructor should be used instead.
        Returns:
        the filter
      • setPreparing

        public void setPreparing​(boolean preparing)
      • isPreparing

        public boolean isPreparing()
      • isPrepared

        public boolean isPrepared​(SelectorImpl selector)
        Whether the given selector is already prepared during the prepare phase of a join. That means, check whether the passed selector can already provide data.
        Parameters:
        selector - the selector to test
        Returns:
        true if it is already prepared
      • getPath

        public java.lang.String getPath()
        Get the path.
        Specified by:
        getPath in interface Filter
        Returns:
        the path
      • getPathPlan

        public java.lang.String getPathPlan()
        Description copied from interface: Filter
        Get the plan for the path.
        Specified by:
        getPathPlan in interface Filter
        Returns:
        the plan
      • setPath

        public void setPath​(java.lang.String path)
      • isDistinct

        public boolean isDistinct()
      • setDistinct

        public void setDistinct​(boolean distinct)
      • setAlwaysFalse

        public void setAlwaysFalse()
      • isAlwaysFalse

        public boolean isAlwaysFalse()
        Description copied from interface: Filter
        If the filter condition can not possibly match any row, due to a contradiction in the query (for example "x=1 and x=2").
        Specified by:
        isAlwaysFalse in interface Filter
        Returns:
        true if the filter condition can not match any row
      • getNodeType

        @Nullable
        public @Nullable java.lang.String getNodeType()
        Description copied from interface: Filter
        Returns the name of the filter node type.
        Specified by:
        getNodeType in interface Filter
        Returns:
        nodetype name
      • matchesAllTypes

        public boolean matchesAllTypes()
        Description copied from interface: Filter
        Checks whether nodes of all types can match this filter.
        Specified by:
        matchesAllTypes in interface Filter
        Returns:
        true iff there are no type restrictions
      • getSupertypes

        @NotNull
        public @NotNull java.util.Set<java.lang.String> getSupertypes()
        Description copied from interface: Filter
        Returns the names of the filter node type and all its supertypes.
        Specified by:
        getSupertypes in interface Filter
        Returns:
        supertype name
      • getPrimaryTypes

        @NotNull
        public @NotNull java.util.Set<java.lang.String> getPrimaryTypes()
        Description copied from interface: Filter
        Returns the names of all matching primary node types.
        Specified by:
        getPrimaryTypes in interface Filter
        Returns:
        primary node type names
      • getMixinTypes

        @NotNull
        public @NotNull java.util.Set<java.lang.String> getMixinTypes()
        Description copied from interface: Filter
        Returns the names of all matching mixin node types.
        Specified by:
        getMixinTypes in interface Filter
        Returns:
        mixin node type names
      • getPropertyRestrictions

        public java.util.Collection<Filter.PropertyRestriction> getPropertyRestrictions()
        Description copied from interface: Filter
        Get the list of property restrictions, if any. Each property may contain multiple restrictions, for example x=1 and x=2. For this case, only multi-valued properties match that contain both 1 and 2.
        Specified by:
        getPropertyRestrictions in interface Filter
        Returns:
        the conditions (an empty collection if not used)
      • getPropertyRestriction

        public Filter.PropertyRestriction getPropertyRestriction​(java.lang.String propertyName)
        Description copied from interface: Filter
        Get the most restrictive property restriction for the given property, if any.
        Specified by:
        getPropertyRestriction in interface Filter
        Parameters:
        propertyName - the property name
        Returns:
        the first restriction, or null if there is no restriction for this property
      • testPath

        public boolean testPath​(java.lang.String path)
      • restrictPropertyAsList

        public void restrictPropertyAsList​(java.lang.String propertyName,
                                           java.util.List<PropertyValue> list)
      • restrictProperty

        public void restrictProperty​(java.lang.String propertyName,
                                     Operator op,
                                     PropertyValue v)
      • restrictProperty

        public void restrictProperty​(java.lang.String propertyName,
                                     Operator op,
                                     PropertyValue v,
                                     int propertyType)
      • getPropertyRestrictions

        public java.util.List<Filter.PropertyRestriction> getPropertyRestrictions​(java.lang.String propertyName)
        Description copied from interface: Filter
        Get the all property restriction for the given property.
        Specified by:
        getPropertyRestrictions in interface Filter
        Parameters:
        propertyName - the property name
        Returns:
        the list of restrictions (possibly empty, never null)
      • toString

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

        public void restrictPath​(java.lang.String addedPath,
                                 Filter.PathRestriction addedPathRestriction)
      • getFulltextConditions

        public java.util.List<java.lang.String> getFulltextConditions()
        Description copied from interface: Filter
        Get the fulltext search conditions, if any.
        Specified by:
        getFulltextConditions in interface Filter
        Returns:
        the conditions (an empty collection if not used)
      • restrictFulltextCondition

        public void restrictFulltextCondition​(java.lang.String condition)
      • setFullTextConstraint

        public void setFullTextConstraint​(FullTextExpression constraint)
      • getFullTextConstraint

        public FullTextExpression getFullTextConstraint()
        Description copied from interface: Filter
        Get the fulltext search condition expression, if any.
        Specified by:
        getFullTextConstraint in interface Filter
        Returns:
        the condition (null if none)
      • containsNativeConstraint

        public boolean containsNativeConstraint()
        Description copied from interface: Filter
        Whether the filter contains a native condition.
        Specified by:
        containsNativeConstraint in interface Filter
        Returns:
        true if it does
      • getQueryStatement

        @Nullable
        public @Nullable java.lang.String getQueryStatement()
        Description copied from interface: Filter
        Get the complete query statement. The statement should only be used for logging purposes.
        Specified by:
        getQueryStatement in interface Filter
        Returns:
        the query statement (possibly null)
      • setMatchesAllTypes

        public void setMatchesAllTypes​(boolean matchesAllTypes)
      • isAccessible

        public boolean isAccessible​(java.lang.String path)
        Description copied from interface: Filter
        check whether a certain (valid) path is accessible (can be read) from the user associated with the query Session
        Specified by:
        isAccessible in interface Filter
        Parameters:
        path - a valid JCR path
        Returns:
        true if path can be read by the calling user, false otherwise.