public class LoadContext<E> extends java.lang.Object implements DataLoadContext, java.io.Serializable
DataManager
.
Typical usage:
LoadContext<User> context = new LoadContext(userMetaClass).setQuery( new LoadContext.Query("select u from sec$User u where u.login like :login") .setParameter("login", "a%") .setMaxResults(10)) .setFetchPlan("user.browse"); List<User> users = dataManager.loadList(context);
Instead of using this class directly, consider fluent interface with the entry point in UnconstrainedDataManager.load(Class)
.
Modifier and Type | Class and Description |
---|---|
static class |
LoadContext.Query
Class that defines a query to be executed for data loading.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.List<AccessConstraint<?>> |
accessConstraints |
protected FetchPlan |
fetchPlan |
protected java.util.Map<java.lang.String,java.io.Serializable> |
hints |
protected java.lang.Object |
id |
protected java.util.List<java.lang.Object> |
idList |
protected boolean |
joinTransaction |
protected boolean |
loadPartialEntities |
protected MetaClass |
metaClass |
protected java.util.List<LoadContext.Query> |
prevQueries |
protected LoadContext.Query |
query |
protected int |
queryKey |
Modifier | Constructor and Description |
---|---|
protected |
LoadContext() |
|
LoadContext(MetaClass metaClass) |
Modifier and Type | Method and Description |
---|---|
LoadContext<?> |
copy()
Creates a copy of this LoadContext instance.
|
java.util.List<AccessConstraint<?>> |
getAccessConstraints()
Returns directly accessible list of access constraints.
|
MetaClass |
getEntityMetaClass() |
FetchPlan |
getFetchPlan() |
java.util.Map<java.lang.String,java.lang.Object> |
getHints() |
java.lang.Object |
getId() |
java.util.List<?> |
getIds() |
java.util.List<LoadContext.Query> |
getPreviousQueries()
Allows to execute query on a previous query result.
|
LoadContext.Query |
getQuery() |
int |
getQueryKey() |
boolean |
isJoinTransaction() |
boolean |
isLoadPartialEntities() |
LoadContext<E> |
setAccessConstraints(java.util.Collection<AccessConstraint<?>> accessConstraints)
Sets list of access constraints.
|
LoadContext<E> |
setFetchPlan(FetchPlan fetchPlan) |
LoadContext<E> |
setHint(java.lang.String hintName,
java.io.Serializable value)
Sets custom hint that should be used by the query.
|
LoadContext<E> |
setHints(java.util.Map<java.lang.String,java.io.Serializable> hints)
Sets custom hints that should be used by the query.
|
LoadContext<E> |
setId(java.lang.Object id) |
LoadContext<E> |
setIds(java.util.Collection<?> ids) |
LoadContext<E> |
setJoinTransaction(boolean joinTransaction) |
LoadContext<E> |
setLoadPartialEntities(boolean loadPartialEntities)
Whether to load partial entities.
|
LoadContext<E> |
setQuery(LoadContext.Query query) |
LoadContext<E> |
setQueryKey(int queryKey) |
LoadContext.Query |
setQueryString(java.lang.String queryString) |
java.lang.String |
toString() |
protected MetaClass metaClass
protected LoadContext.Query query
protected FetchPlan fetchPlan
protected java.lang.Object id
protected java.util.List<java.lang.Object> idList
protected java.util.List<LoadContext.Query> prevQueries
protected java.util.List<AccessConstraint<?>> accessConstraints
protected int queryKey
protected boolean loadPartialEntities
protected boolean joinTransaction
protected java.util.Map<java.lang.String,java.io.Serializable> hints
public LoadContext(MetaClass metaClass)
metaClass
- metaclass of the loaded entitiesprotected LoadContext()
public MetaClass getEntityMetaClass()
@Nullable public LoadContext.Query getQuery()
public LoadContext<E> setQuery(LoadContext.Query query)
query
- query definitionpublic LoadContext.Query setQueryString(java.lang.String queryString)
setQueryString
in interface DataLoadContext
queryString
- JPQL query string. Only named parameters are supported.@Nullable public FetchPlan getFetchPlan()
public LoadContext<E> setFetchPlan(FetchPlan fetchPlan)
fetchPlan
- fetchPlan that is used for loading entities@Nullable public java.lang.Object getId()
public LoadContext<E> setId(java.lang.Object id)
id
- id of an entity to be loadedpublic java.util.List<?> getIds()
public LoadContext<E> setIds(java.util.Collection<?> ids)
ids
- identifiers of entities to be loadedpublic java.util.List<LoadContext.Query> getPreviousQueries()
public int getQueryKey()
public LoadContext<E> setQueryKey(int queryKey)
queryKey
- key of the current stack of sequential queries, which is unique for the current user sessionpublic java.util.Map<java.lang.String,java.lang.Object> getHints()
public LoadContext<E> setHint(java.lang.String hintName, java.io.Serializable value)
public LoadContext<E> setHints(java.util.Map<java.lang.String,java.io.Serializable> hints)
public boolean isLoadPartialEntities()
setFetchPlan(FetchPlan)
.
The state of FetchPlan.loadPartialEntities()
is ignored when the fetchPlan is passed to DataManager
.
public LoadContext<E> setLoadPartialEntities(boolean loadPartialEntities)
setFetchPlan(FetchPlan)
.
The state of FetchPlan.loadPartialEntities()
is ignored when the fetchPlan is passed to DataManager
.
public java.util.List<AccessConstraint<?>> getAccessConstraints()
public LoadContext<E> setAccessConstraints(@Nullable java.util.Collection<AccessConstraint<?>> accessConstraints)
public boolean isJoinTransaction()
public LoadContext<E> setJoinTransaction(boolean joinTransaction)
public LoadContext<?> copy()
public java.lang.String toString()
toString
in class java.lang.Object