public class QueryProvider
extends java.lang.Object
QueryProvider
provides methods for creating and executing
Query
for data access and methods to read
single BusinessObject
.
This Class is usually used in Rule-classes and allows API access only
Query
,
BusinessObject
Constructor and Description |
---|
QueryProvider() |
Modifier and Type | Method and Description |
---|---|
static <PK,T extends BusinessObject<PK>> |
create(java.lang.Class<T> type)
This methods returns an instance of
Query that is type-specific to the class given
as parameter. |
static <PK,T extends BusinessObject<PK>> |
execute(Query<T> query,
Attribute<?>... attributes)
This methods executes a
Query and returns a list of found BusinessObject of the type
determined by the Query type. |
static <PK,T extends BusinessObject<PK>> |
executeSingleResult(Query<T> query,
Attribute<?>... attributes)
This methods executes a
Query and returns a single result BusinessObject of the type
determined by the Query type. |
static <PK,T extends BusinessObject<PK>> |
getById(java.lang.Class<T> type,
PK id,
Attribute<?>... attributes)
Deprecated.
|
static <PK,T extends Stateful & BusinessObject<PK>> |
getByProcess(Process<T> process,
Process<T>... additionalProcesses)
This method returns all
BusinessObject s that contain one of the given processes;A Process is always assigned to one
entity, so the type of the BusinessObject does not have to be mentioned explicitly;There must be at least one process |
static <PK,T extends Stateful & BusinessObject<PK>> |
getByState(java.lang.Class<T> type,
State state,
State... additionalStates)
This method returns all
BusinessObject s that contain one of the given states;A State is always assigned to one
statemodel, that can be used by several entities. |
void |
setQueryService(QueryService service) |
public void setQueryService(QueryService service)
public static <PK,T extends BusinessObject<PK>> Query<T> create(java.lang.Class<T> type)
public static <PK,T extends BusinessObject<PK>> java.util.List<T> execute(Query<T> query, Attribute<?>... attributes)
Query
and returns a list of found BusinessObject
of the type
determined by the Query
type.
An IllegalArgumentException
is thrown if an attribute is compared to null and NULL or NOTNULL is not used.query
- type-specific list of BusinessObject
BusinessObject
>public static <PK,T extends BusinessObject<PK>> T executeSingleResult(Query<T> query, Attribute<?>... attributes) throws BusinessException
Query
and returns a single result BusinessObject
of the type
determined by the Query
type.
Returns null if nothing found and throws exception if query returns more than one row.
An IllegalArgumentException
is thrown if an attribute is compared to null and NULL or NOTNULL is not used.query
- type-specific BusinessObject
BusinessObject
;BusinessException
@Deprecated public static <PK,T extends BusinessObject<PK>> T getById(java.lang.Class<T> type, PK id, Attribute<?>... attributes)
BusinessObject
that can be found for the given
Id; Parameter Class<T> type is necessary to ensure type-safetytype
- - type-specific classid
- - Id of the element to search for in the databaseBusinessObject
public static <PK,T extends Stateful & BusinessObject<PK>> java.util.List<T> getByProcess(Process<T> process, Process<T>... additionalProcesses) throws BusinessException
BusinessObject
s that contain one of the given processes;Process
is always assigned to one
entity, so the type of the BusinessObject does not have to be mentioned explicitly;process
- additionalProcesses
- BusinessException
public static <PK,T extends Stateful & BusinessObject<PK>> java.util.List<T> getByState(java.lang.Class<T> type, State state, State... additionalStates) throws BusinessException
BusinessObject
s that contain one of the given states;State
is always assigned to one
statemodel, that can be used by several entities. So the type of the BusinessObject must be mentioned explicitly;type
- state
- additionalStates
- BusinessException
Copyright © 2024. All rights reserved.