Interface Query.Builder

Enclosing interface:
Query

public static interface Query.Builder
Creates an instance of Query. Calling methods to set the SELECT and FROM clauses is required.
  • Method Details

    • withSelect

      Query.Builder withSelect(Collection<String> select)
      Sets the SELECT clause, replacing previously set values.
      Parameters:
      select - terms to be used in the SELECT clause
      Returns:
      this Builder
    • appendSelect

      Query.Builder appendSelect(Collection<String> select)
      Appends to the SELECT clause.
      Parameters:
      select - terms to append to the SELECT clause
      Returns:
      this Builder
    • withFrom

      Query.Builder withFrom(String queryTarget, QueryTargetOption... queryTargetOption)
      Sets the query target which appears in the FROM clause. This call replaces previously set values. Optional: QueryTargetOption(s) set the scope of the query target.
      Parameters:
      queryTarget - target of the query
      queryTargetOption - option(s) to apply to the query target
      Returns:
      this Builder
    • withFind

      Query.Builder withFind(String find)
      Sets the FIND clause, replacing any previously set value. The provided find will be wrapped in parentheses.

      For example, to generate:

      FIND ( 'tylenol' SCOPE ALL )
      Use:
      withFind("'tylenol' SCOPE ALL")
      Parameters:
      find - FIND clause
      Returns:
      this Builder
    • withWhere

      Query.Builder withWhere(String where)
      Sets the WHERE clause, replacing previously set values.
      Parameters:
      where - WHERE clause
      Returns:
      this Builder
    • appendWhere

      Query.Builder appendWhere(QueryLogicalOperator operator, String where)
      Appends to the WHERE clause using the provided QueryLogicalOperator. Parentheses will be inserted to preserve the logic of any previously set WHERE clause.

      For example, the following code:

      queryBuilder.withWhere("name__v = 'VeevaProm'", "OR name__v = 'Cholecap'");
       queryBuilder.appendWhere(QueryLogicalOperator.AND, "status__v = 'active'");
      Will produce the WHERE clause:
      WHERE ( name__v = 'VeevaProm' OR name__v = 'Cholecap' ) AND ( status__v = 'active' )

      If no WHERE clause was previously set, the operator is ignored.

      Parameters:
      operator - logical operator with which to append this WHERE clause
      where - WHERE clause
      Returns:
      this Builder
    • withOrderBy

      Query.Builder withOrderBy(List<String> orderBy)
      Sets the ORDER BY clause, replacing previously set values.
      Parameters:
      orderBy - terms to be used in the ORDER BY clause
      Returns:
      this Builder
    • appendOrderBy

      Query.Builder appendOrderBy(List<String> orderBy)
      Appends to the ORDER BY clause.
      Parameters:
      orderBy - terms to append to the ORDER BY clause
      Returns:
      this Builder
    • withMaxRows

      Query.Builder withMaxRows(long maxRows)
      Sets the MAXROWS clause, replacing any previously set value.
      Parameters:
      maxRows - value for the MAXROWS clause
      Returns:
      this Builder
    • withSkip

      Query.Builder withSkip(long skip)
      Sets the SKIP clause, replacing any previously set value.
      Parameters:
      skip - value for the SKIP clause
      Returns:
      this Builder
    • build

      Query build()
      Retrieves the completed Query.

      The SELECT and FROM clauses must not be empty.

      Returns:
      the completed Query