Package com.veeva.vault.sdk.api.query
Interface Query.Builder
- Enclosing interface:
- Query
public static interface Query.Builder
-
Method Summary
Modifier and TypeMethodDescriptionappendOrderBy(List<String> orderBy) Appends to theORDER BYclause.appendSelect(Collection<String> select) Appends to theSELECTclause.appendWhere(QueryLogicalOperator operator, String where) Appends to theWHEREclause using the providedQueryLogicalOperator.build()Retrieves the completedQuery.Sets theFINDclause, replacing any previously set value.withFrom(String queryTarget, QueryTargetOption... queryTargetOption) Sets the query target which appears in theFROMclause.withMaxRows(long maxRows) Sets theMAXROWSclause, replacing any previously set value.withOrderBy(List<String> orderBy) Sets theORDER BYclause, replacing previously set values.withSelect(Collection<String> select) Sets theSELECTclause, replacing previously set values.withSkip(long skip) Sets theSKIPclause, replacing any previously set value.Sets theWHEREclause, replacing previously set values.
-
Method Details
-
withSelect
Sets theSELECTclause, replacing previously set values.- Parameters:
select- terms to be used in theSELECTclause- Returns:
- this Builder
-
appendSelect
Appends to theSELECTclause.- Parameters:
select- terms to append to theSELECTclause- Returns:
- this Builder
-
withFrom
Sets the query target which appears in theFROMclause. This call replaces previously set values. Optional:QueryTargetOption(s) set the scope of the query target.- Parameters:
queryTarget- target of the queryqueryTargetOption- option(s) to apply to the query target- Returns:
- this Builder
-
withFind
Sets theFINDclause, replacing any previously set value. The providedfindwill be wrapped in parentheses.For example, to generate:
Use:FIND ( 'tylenol' SCOPE ALL )withFind("'tylenol' SCOPE ALL")- Parameters:
find-FINDclause- Returns:
- this Builder
-
withWhere
Sets theWHEREclause, replacing previously set values.- Parameters:
where-WHEREclause- Returns:
- this Builder
-
appendWhere
Appends to theWHEREclause using the providedQueryLogicalOperator. Parentheses will be inserted to preserve the logic of any previously setWHEREclause.For example, the following code:
Will produce thequeryBuilder.withWhere("name__v = 'VeevaProm'", "OR name__v = 'Cholecap'"); queryBuilder.appendWhere(QueryLogicalOperator.AND, "status__v = 'active'");WHEREclause:WHERE ( name__v = 'VeevaProm' OR name__v = 'Cholecap' ) AND ( status__v = 'active' )If no
WHEREclause was previously set, theoperatoris ignored.- Parameters:
operator- logical operator with which to append thisWHEREclausewhere-WHEREclause- Returns:
- this Builder
-
withOrderBy
Sets theORDER BYclause, replacing previously set values.- Parameters:
orderBy- terms to be used in theORDER BYclause- Returns:
- this Builder
-
appendOrderBy
Appends to theORDER BYclause.- Parameters:
orderBy- terms to append to theORDER BYclause- Returns:
- this Builder
-
withMaxRows
Sets theMAXROWSclause, replacing any previously set value.- Parameters:
maxRows- value for theMAXROWSclause- Returns:
- this Builder
-
withSkip
Sets theSKIPclause, replacing any previously set value.- Parameters:
skip- value for theSKIPclause- Returns:
- this Builder
-
build
Query build()Retrieves the completedQuery.The
SELECTandFROMclauses must not be empty.- Returns:
- the completed Query
-