Class QualificationBuilder

java.lang.Object
com.emc.documentum.rest.dfc.query.QualificationBuilder

public final class QualificationBuilder extends Object
A builder to construct the DQL qualification.
  • Constructor Details

    • QualificationBuilder

      public QualificationBuilder()
  • Method Details

    • condition

      public QualificationBuilder condition(String condition, Object... args)
      Append a condition to the qualification
      Parameters:
      condition - a condition template
      args - arguments for the condition template, the arguments will always be SQL escaped
      Returns:
      the QualificationBuilder
    • and

      public QualificationBuilder and()
      Append an "AND" without any condition to the qualification Typically, this will be used together with methods p and q below to append a complex OR condition
      Returns:
      the QualificationBuilder
    • initialOrAndCondition

      public QualificationBuilder initialOrAndCondition(String condition, Object... args)
      Sometimes, when a condition is added to the qualification, an "AND" should be added if this is NOT the initial condition in the qualification. and "AND" should NOT be added if this is the initial condition of the qualification. This method will add a condition to the qualification according to the current status of the qualification: if the qualification is still in initial status (no condition has been appended yet), "AND" will not be appended, otherwise, "AND" will be appended together with the formatted condition. It is recommended to add the mandatory condition first to the qualification using QualificationBuilder.condition, and use QualificationBuilder.and later. While if there is no mandatory condition and all conditions are optional, we could use this method
      Parameters:
      condition - a condition template
      args - arguments for the condition template, the arguments will always be SQL escaped
      Returns:
      the QualificationBuilder
    • and

      public QualificationBuilder and(String condition, Object... args)
      Append an "AND" condition to the qualification
      Parameters:
      condition - a condition template
      args - arguments for the condition template, the arguments will always be SQL escaped
      Returns:
      the QualificationBuilder
    • p

      Append an open parenthesis '(' to the qualification
      Returns:
      the QualificationBuilder
    • q

      Append a closed parenthesis ')' to the qualification
      Returns:
      the QualificationBuilder
    • or

      public QualificationBuilder or(String condition, List<String> variables)
      Append multiple conditions joined by OR, each variable in variables will be used in the condition template to be a formatted string and joined by OR later For example, qualification.or("X.%s", Arrays.asList("1", "2")) will give rise to a joined OR condition like "X.1 OR X.2"
      Parameters:
      condition - the condition template
      variables - a list of variables, and each of which will be used in the condition template
      Returns:
      a joined OR conditions
    • build

      public String build()
      Build the qualification string according to conditions provided
      Returns:
      the qualification string