java.lang.Object
org.alfresco.rest.framework.resource.parameters.where.QueryHelper.WalkerCallbackAdapter
org.alfresco.rest.framework.resource.parameters.where.BasicQueryWalker
All Implemented Interfaces:
QueryHelper.WalkerCallback

public class BasicQueryWalker extends QueryHelper.WalkerCallbackAdapter
Basic implementation of QueryHelper.WalkerCallbackAdapter providing universal handling of Where query clauses. This implementation supports AND operator and all clause types. Be default, walker verifies strictly if expected or unexpected properties, and it's comparison types are present in query and throws InvalidQueryException if they are missing.
  • Field Details

    • clausesNegatable

      protected boolean clausesNegatable
    • validateStrictly

      protected boolean validateStrictly
  • Constructor Details

    • BasicQueryWalker

      public BasicQueryWalker()
    • BasicQueryWalker

      public BasicQueryWalker(String... expectedPropertyNames)
    • BasicQueryWalker

      public BasicQueryWalker(Collection<String> expectedPropertyNames)
  • Method Details

    • setClausesNegatable

      public void setClausesNegatable(boolean clausesNegatable)
    • setValidateStrictly

      public void setValidateStrictly(boolean validateStrictly)
    • exists

      public void exists(String propertyName, boolean negated)
      Description copied from interface: QueryHelper.WalkerCallback
      Called any time an EXISTS clause is encountered.
      Parameters:
      propertyName - Name of the property
      negated - returns true if "NOT EXISTS" was used
    • between

      public void between(String propertyName, String firstValue, String secondValue, boolean negated)
      Description copied from interface: QueryHelper.WalkerCallback
      Called any time a BETWEEN clause is encountered.
      Parameters:
      propertyName - Name of the property
      firstValue - String
      secondValue - String
      negated - returns true if "NOT BETWEEN" was used
    • comparison

      public void comparison(int type, String propertyName, String propertyValue, boolean negated)
      Description copied from interface: QueryHelper.WalkerCallback
      One of EQUALS LESSTHAN GREATERTHAN LESSTHANOREQUALS GREATERTHANOREQUALS;
    • in

      public void in(String propertyName, boolean negated, String... propertyValues)
      Description copied from interface: QueryHelper.WalkerCallback
      Called any time an IN clause is encountered.
      Parameters:
      propertyName - Name of the property
      negated - returns true if "NOT IN" was used
      propertyValues - the property values
    • matches

      public void matches(String propertyName, String propertyValue, boolean negated)
      Description copied from interface: QueryHelper.WalkerCallback
      Called any time a MATCHES clause is encountered.
      Parameters:
      propertyName - Name of the property
      propertyValue - String
      negated - returns true if "NOT MATCHES" was used
    • and

      public void and()
      Description copied from interface: QueryHelper.WalkerCallback
      Called any time an AND is encountered.
    • verifyPropertyExpectedness

      protected void verifyPropertyExpectedness(String propertyName)
      Verify if property is expected, if not throws InvalidQueryException.
    • verifyClausesNegatability

      protected void verifyClausesNegatability(boolean negated, String propertyName)
      Verify if clause negations are allowed, if not throws InvalidQueryException.
    • isAndSupported

      protected boolean isAndSupported()
    • addProperties

      protected void addProperties(String propertyName, int clauseType, String... propertyValues)
    • addProperties

      protected void addProperties(String propertyName, int clauseType, boolean negated, String... propertyValues)
    • containsProperty

      protected boolean containsProperty(String propertyName)
    • containsProperty

      protected boolean containsProperty(String propertyName, int clauseType, boolean negated)
    • getProperty

      public Collection<String> getProperty(String propertyName, int type, boolean negated)
    • getProperty

      public WhereProperty getProperty(String propertyName)
    • getProperties

      public List<WhereProperty> getProperties(String... propertyNames)
    • getPropertiesAsMap

      public Map<String,WhereProperty> getPropertiesAsMap(String... propertyNames)