public interface CQL
Modifier and Type | Method and Description |
---|---|
static Predicate |
and(CqnPredicate p1,
CqnPredicate p2)
Creates a conjunction of two given predicates
|
static Predicate |
and(Iterable<? extends CqnPredicate> predicates)
Creates a conjunction of given predicates
|
static Value<Number> |
average(CqnValue value)
Creates an average function call on the given element or expression.
|
static BooleanFunction |
booleanFunc(String name,
List<? extends CqnValue> args)
Creates a CDS QL function call that is send to the underlying data store.
|
static Predicate |
comparison(CqnValue lhs,
CqnComparisonPredicate.Operator op,
CqnValue rhs)
Creates a comparison predicate.
|
static Predicate |
connect(CqnConnectivePredicate.Operator operator,
Iterable<? extends CqnPredicate> predicates)
Creates a logical connection of given predicates
CqnPredicate . |
static <T> Literal<T> |
constant(T value)
Creates a _constant_ CDS QL
Literal hinting to the runtime that the
value should be treated as constant. |
static Predicate |
containment(CqnContainmentTest.Position position,
CqnValue value,
CqnValue substring,
boolean caseInsensitive)
Creates a predicate that tests whether a string value contains a given
substring at a given position
CqnContainmentTest.Position |
static Predicate |
contains(CqnValue value,
CqnValue substring,
boolean caseInsensitive)
Creates a predicate that tests whether a string value contains a given
substring
|
static Predicate |
copy(CqnPredicate pred)
Creates a copy of the given predicate.
|
static Predicate |
copy(CqnPredicate pred,
Modifier modifier)
Creates a modified copy of the given predicate.
|
static <S extends CqnStatement> |
copy(S statement)
Creates a copy of the given CQN statement.
|
static <S extends CqnStatement> |
copy(S statement,
Modifier modifier)
Creates a modified copy of the given CQN statement.
|
static Value<Long> |
count()
Creates a count all function call.
|
static Value<Long> |
count(CqnElementRef element)
Creates a count function call on the given element.
|
static Value<Long> |
countDistinct(CqnValue value)
Creates an count distinct function call on the given element or expression.
|
static Predicate |
endsWith(CqnValue value,
CqnValue suffix,
boolean caseInsensitive)
Creates a predicate that tests whether a string value ends with a given
suffix
|
static StructuredType<?> |
entity(String qualifiedName)
Creates a
StructuredType representing a CDS entity. |
static Predicate |
exists(CqnSelect subQuery)
Creates an exists predicate that tests if a given subquery returns any row
|
static Value<Number> |
expression(CqnValue left,
CqnArithmeticExpression.Operator op,
CqnValue right)
Creates an arithmetic expression.
|
static <T> FunctionCall<T> |
func(String name,
CqnValue... args)
Creates a CDS QL function call that is send to the underlying data store.
|
static <T> FunctionCall<T> |
func(String name,
List<? extends CqnValue> args)
Creates a CDS QL function call that is send to the underlying data store.
|
static <T> ElementRef<T> |
get(List<? extends CqnReference.Segment> segments)
Creates an
ElementRef representing a path from a CDS entity to an
element of this or another entity. |
static <T> ElementRef<T> |
get(String path)
Creates an
ElementRef representing a path from a CDS entity to an
element of this or another entity. |
static Predicate |
in(CqnValue lhs,
Collection<? extends CqnValue> values)
Creates an in predicate.
|
static Predicate |
in(CqnValue lhs,
CqnValue valueSet)
Creates an in predicate.
|
static CqnToken |
list(List<? extends CqnValue> values)
Creates a
CqnListValue composing given values |
static <T> Literal<T> |
literal(T value)
Deprecated.
use constant() for _constant_ and val() for _non-constant_
handling
|
static Predicate |
match(StructuredTypeRef ref,
Predicate pred,
CqnMatchPredicate.Quantifier quantifier)
Creates a match predicate that tests if a given ref matches a given filter
|
static Predicate |
matching(Map<String,?> elementToValueMap)
Creates a predicate from a map of element names to values or parameters.
|
static <T> Value<T> |
max(CqnValue value)
Creates a max function call on the given element or expression.
|
static <T> Value<T> |
min(CqnValue value)
Creates a min function call on the given element or expression.
|
static Predicate |
not(CqnPredicate predicate)
Negates a given
CqnPredicate . |
static Value<Instant> |
now()
Creates an
ElementRef to be used in queries to represent $now. |
static Predicate |
or(CqnPredicate p1,
CqnPredicate p2)
Creates a disjunction of two given predicates
|
static Predicate |
or(Iterable<? extends CqnPredicate> predicates)
Creates a disjunction of given predicates
|
static <T> Parameter<T> |
param()
|
static <T> Parameter<T> |
param(int index)
Creates an indexed
Parameter to be used in CQN statements. |
static <T> Parameter<T> |
param(String name)
Creates a named
Parameter to be used in queries. |
static Value<?> |
plain(String value)
Creates a CQN plain value, which is directly send to the underlying data
store.
|
static <S extends CqnReference.Segment> |
refSegment(String id)
Creates a segment of a structured type or element reference without filter.
|
static CqnReference.Segment |
refSegment(String id,
CqnPredicate filter)
Creates a segment of a structured type or element reference with a filter
condition.
|
static <S extends CqnReference.Segment> |
refSegments(List<String> segmentIds)
Creates a list of reference segments without filter.
|
static Predicate |
search(String term)
Creates a search predicate.
|
static CqnSortSpecification |
sort(CqnValue value,
CqnSortSpecification.Order order)
Creates a
CqnSortSpecification that sorts a value by a given order |
static CqnStar |
star() |
static Predicate |
startsWith(CqnValue value,
CqnValue prefix,
boolean caseInsensitive)
Creates a predicate that tests whether a string value starts with a given
prefix
|
static Value<Number> |
sum(CqnValue value)
Creates a sum function call on the given element or expression.
|
static StructuredType<?> |
to(List<? extends CqnReference.Segment> segments)
Creates a
StructuredType representing a path from a CDS entity to
another entity. |
static StructuredType<?> |
to(String path)
Creates a
StructuredType representing a path from a CDS entity to
another entity. |
static Value<String> |
toLower(String val)
Creates a CDS QL expression for converting the given string value to lower
case using the rules of the underlying data store.
|
static Value<String> |
toLower(Value<String> val)
Creates a CDS QL expression for converting the given string value to lower
case using the rules of the underlying data store.
|
static Value<String> |
toUpper(String val)
Creates a CDS QL expression for converting the given string value to upper
case using the rules of the underlying data store.
|
static Value<String> |
toUpper(Value<String> val)
Creates a CDS QL expression for converting the given string value to upper
case using the rules of the underlying data store.
|
static Value<String> |
userId()
Creates an
ElementRef on the available $user.id value. |
static Value<String> |
userLocale()
Creates an
ElementRef on the available $user.locale value. |
static <T> Literal<T> |
val(T value)
Creates a _non-constant_ CDS QL
Literal hinting to the runtime that
the value should not be treated as constant. |
static Value<Instant> |
validFrom()
Creates an
ElementRef on the available $validFrom value. |
static Value<Instant> |
validTo()
Creates an
ElementRef on the available $validTo value. |
static Collector<CqnPredicate,?,CqnPredicate> |
withAnd()
Returns a
Collector that connects the input predicates with AND. |
static Collector<CqnPredicate,?,CqnPredicate> |
withOr()
Returns a
Collector that connects the input predicates with OR. |
static Predicate copy(CqnPredicate pred)
pred
- the predicate to be copiedstatic Predicate copy(CqnPredicate pred, Modifier modifier)
pred
- the predicate to be copiedmodifier
- the modifier for altering the copystatic <S extends CqnStatement> S copy(S statement)
S
- the type of CqnStatementstatement
- the CQN statement to be copiedstatic <S extends CqnStatement> S copy(S statement, Modifier modifier)
S
- the type of CqnStatementstatement
- the CQN statement to be copiedmodifier
- the modifier for altering the copystatic <T> FunctionCall<T> func(String name, CqnValue... args)
T
- the return type of the function callname
- the name of the function to be calledargs
- the arguments of the functionstatic <T> FunctionCall<T> func(String name, List<? extends CqnValue> args)
T
- the return type of the function callname
- the name of the function to be calledargs
- the arguments of the functionstatic BooleanFunction booleanFunc(String name, List<? extends CqnValue> args)
name
- the name of the function to be calledargs
- the arguments of the function@Deprecated static <T> Literal<T> literal(T value)
Literal
to be used in queries.T
- the type of the literalvalue
- the value of the literalstatic <T> Literal<T> constant(T value)
Literal
hinting to the runtime that the
value should be treated as constant.T
- the type of the constantvalue
- the value of the constantstatic <T> Literal<T> val(T value)
Literal
hinting to the runtime that
the value should not be treated as constant.T
- the type of the non-constant valuevalue
- the value of the non-constant valueparam()
static Predicate not(CqnPredicate predicate)
CqnPredicate
.predicate
- the CqnPredicate
to be negatedstatic Predicate and(CqnPredicate p1, CqnPredicate p2)
p1
- 1st operand of the conjunctionp2
- 2nd operand of the conjunctionstatic Collector<CqnPredicate,?,CqnPredicate> withAnd()
Collector
that connects the input predicates with AND.
If there are none the Collector
returns TRUE.static Predicate or(CqnPredicate p1, CqnPredicate p2)
p1
- 1st operand of the disjunctionp2
- 2nd operand of the disjunctionstatic Predicate and(Iterable<? extends CqnPredicate> predicates)
predicates
- the predicates to connectstatic Predicate or(Iterable<? extends CqnPredicate> predicates)
predicates
- the predicates to connectstatic Collector<CqnPredicate,?,CqnPredicate> withOr()
Collector
that connects the input predicates with OR.
If there are none the Collector
returns FALSE.static Predicate connect(CqnConnectivePredicate.Operator operator, Iterable<? extends CqnPredicate> predicates)
CqnPredicate
.operator
- operator to connect the predicates withpredicates
- the predicates to connect@Deprecated static <T> Parameter<T> param()
Parameter
to be used in queries.T
- the type of the parameterstatic <T> Parameter<T> param(int index)
Parameter
to be used in CQN statements. Can be
used with positional parameter values.T
- the type of the parameterindex
- the parameter index. If used with positional parameter values,
start with 0 for the first parameterstatic <T> Parameter<T> param(String name)
Parameter
to be used in queries.T
- the type of the parametername
- the parameter namestatic Value<?> plain(String value)
value
- the value contentstatic Value<Long> count(CqnElementRef element)
element
- the ref to the element to be countedstatic <T> Value<T> min(CqnValue value)
T
- the type of the valuevalue
- the ref to the element to be counted or an expressionstatic <T> Value<T> max(CqnValue value)
T
- the type of the valuevalue
- the ref to the element to be counted or an expressionstatic Value<Number> sum(CqnValue value)
value
- the ref to the element to be counted or an expressionstatic Value<Number> average(CqnValue value)
value
- the ref to the element to be counted or an expressionstatic Value<Long> countDistinct(CqnValue value)
value
- the ref to the element to be counted or an expressionstatic Predicate contains(CqnValue value, CqnValue substring, boolean caseInsensitive)
value
- the string valuesubstring
- the substring to test forcaseInsensitive
- whether the test should be case insensitivestatic Predicate startsWith(CqnValue value, CqnValue prefix, boolean caseInsensitive)
value
- the string valueprefix
- the prefix to test forcaseInsensitive
- whether the test should be case insensitivestatic Predicate endsWith(CqnValue value, CqnValue suffix, boolean caseInsensitive)
value
- the string valuesuffix
- the suffix to test forcaseInsensitive
- whether the test should be case insensitivestatic Predicate containment(CqnContainmentTest.Position position, CqnValue value, CqnValue substring, boolean caseInsensitive)
CqnContainmentTest.Position
position
- the positionvalue
- the string valuesubstring
- the substring to test forcaseInsensitive
- whether the test should be case insensitivestatic Value<String> toLower(Value<String> val)
val
- the String value to be convertedstatic Value<String> toLower(String val)
val
- the String value to be convertedstatic Value<String> toUpper(Value<String> val)
val
- the String value to be convertedstatic Value<String> toUpper(String val)
val
- the String value to be convertedstatic StructuredType<?> entity(String qualifiedName)
StructuredType
representing a CDS entity.qualifiedName
- the qualified name of the CDS entityStructuredType
representing the CDS entitystatic StructuredType<?> to(String path)
StructuredType
representing a path from a CDS entity to
another entity.path
- a String of association element names separated by '.'StructuredType
representing the path to a CDS entitystatic StructuredType<?> to(List<? extends CqnReference.Segment> segments)
StructuredType
representing a path from a CDS entity to
another entity.segments
- the segments of the pathStructuredType
representing the path to a CDS entitystatic <T> ElementRef<T> get(String path)
ElementRef
representing a path from a CDS entity to an
element of this or another entity.T
- the type of the elementpath
- a String of element names separated by '.', where all except the
last segment represent association elements.ElementRef
representing the path to the CDS elementstatic <T> ElementRef<T> get(List<? extends CqnReference.Segment> segments)
ElementRef
representing a path from a CDS entity to an
element of this or another entity.T
- the type of the elementsegments
- the segments of the pathElementRef
representing the path to the CDS elementstatic <S extends CqnReference.Segment> S refSegment(String id)
refSegment(String, CqnPredicate)
to create a segment with
filter condition.id
- the id of the segmentCqnReference.Segment
)static CqnReference.Segment refSegment(String id, CqnPredicate filter)
id
- the id of the segmentfilter
- the filter of the segmentstatic <S extends CqnReference.Segment> List<S> refSegments(List<String> segmentIds)
segmentIds
- the ids of the segmentsCqnReference.Segment
)static Value<Number> expression(CqnValue left, CqnArithmeticExpression.Operator op, CqnValue right)
left
- the left-hand side of the expressionop
- the operatorright
- the right-hand side of the expressionstatic Predicate comparison(CqnValue lhs, CqnComparisonPredicate.Operator op, CqnValue rhs)
lhs
- the left-hand side of the comparisonop
- the comparison operatorrhs
- the right-hand side of the comparisonstatic Predicate in(CqnValue lhs, Collection<? extends CqnValue> values)
lhs
- the value to be checked if it's contained in the collectionvalues
- the collection of valuesstatic Predicate in(CqnValue lhs, CqnValue valueSet)
lhs
- the value to be checked if it's contained in the collectionvalueSet
- the value describing a collection of valuesstatic Predicate search(String term)
term
- the search termstatic Predicate exists(CqnSelect subQuery)
subQuery
- the subquery that performs the existence teststatic Predicate match(StructuredTypeRef ref, Predicate pred, CqnMatchPredicate.Quantifier quantifier)
ref
- the referencepred
- the filterquantifier
- all or anystatic Value<Instant> now()
ElementRef
to be used in queries to represent $now.static Value<Instant> validFrom()
ElementRef
on the available $validFrom value.static Value<Instant> validTo()
ElementRef
on the available $validTo value.static Value<String> userLocale()
ElementRef
on the available $user.locale value.static Value<String> userId()
ElementRef
on the available $user.id value.static CqnStar star()
static CqnToken list(List<? extends CqnValue> values)
CqnListValue
composing given valuesvalues
- the componentsstatic Predicate matching(Map<String,?> elementToValueMap)
elementToValueMap
- the element name to value map defining the conditionstatic CqnSortSpecification sort(CqnValue value, CqnSortSpecification.Order order)
CqnSortSpecification
that sorts a value by a given ordervalue
- the valueorder
- the orderCopyright © 2023 SAP. All rights reserved.