public class LoadContext<E extends Entity> extends java.lang.Object implements DataLoadContext, java.io.Serializable
DataManager
.
Typical usage:
LoadContext<User> context = LoadContext.create(User.class).setQuery( LoadContext.createQuery("select u from sec$User u where u.login like :login") .setParameter("login", "a%") .setMaxResults(10)) .setView("user.browse"); List<User> users = dataManager.loadList(context);
Instead of using this class directly, consider fluent interface with the entry point in DataManager.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 boolean |
authorizationRequired |
protected java.util.Map<java.lang.String,java.lang.Object> |
hints |
protected java.lang.Object |
id |
protected java.util.List<java.lang.Object> |
idList |
protected boolean |
joinTransaction |
protected boolean |
loadDynamicAttributes |
protected boolean |
loadPartialEntities |
protected java.lang.String |
metaClass |
protected java.util.List<LoadContext.Query> |
prevQueries |
protected LoadContext.Query |
query |
protected int |
queryKey |
protected boolean |
softDeletion |
protected View |
view |
Modifier | Constructor and Description |
---|---|
protected |
LoadContext() |
|
LoadContext(java.lang.Class<E> javaClass) |
|
LoadContext(MetaClass metaClass) |
Modifier and Type | Method and Description |
---|---|
LoadContext<?> |
copy()
Creates a copy of this LoadContext instance.
|
static <E extends Entity> |
create(java.lang.Class<E> entityClass)
Factory method to create a LoadContext instance.
|
static LoadContext.Query |
createQuery(java.lang.String queryString)
Factory method to create a LoadContext.Query instance for passing into
setQuery(Query) method. |
java.lang.String |
getEntityMetaClass() |
java.util.Map<java.lang.String,java.lang.Object> |
getHints() |
java.lang.Object |
getId() |
java.util.List<?> |
getIds() |
java.lang.String |
getMetaClass() |
java.util.List<LoadContext.Query> |
getPrevQueries()
Allows to execute query on a previous query result.
|
LoadContext.Query |
getQuery() |
int |
getQueryKey() |
View |
getView() |
boolean |
isAuthorizationRequired() |
boolean |
isJoinTransaction() |
boolean |
isLoadDynamicAttributes() |
boolean |
isLoadPartialEntities() |
boolean |
isSoftDeletion() |
LoadContext<E> |
setAuthorizationRequired(boolean authorizationRequired) |
LoadContext<E> |
setHint(java.lang.String hintName,
java.lang.Object value)
Sets custom hint 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> |
setLoadDynamicAttributes(boolean loadDynamicAttributes) |
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) |
LoadContext<E> |
setSoftDeletion(boolean softDeletion) |
LoadContext<E> |
setView(java.lang.String viewName) |
LoadContext<E> |
setView(View view) |
java.lang.String |
toString() |
protected java.lang.String metaClass
protected LoadContext.Query query
protected View view
protected java.lang.Object id
protected java.util.List<java.lang.Object> idList
protected boolean softDeletion
protected java.util.List<LoadContext.Query> prevQueries
protected int queryKey
protected boolean loadDynamicAttributes
protected boolean loadPartialEntities
protected boolean authorizationRequired
protected boolean joinTransaction
protected java.util.Map<java.lang.String,java.lang.Object> hints
public LoadContext(MetaClass metaClass)
metaClass
- metaclass of the loaded entitiespublic LoadContext(java.lang.Class<E> javaClass)
javaClass
- class of the loaded entitiesprotected LoadContext()
public static <E extends Entity> LoadContext<E> create(java.lang.Class<E> entityClass)
entityClass
- class of the loaded entitiespublic static LoadContext.Query createQuery(java.lang.String queryString)
setQuery(Query)
method.queryString
- JPQL query string. Only named parameters are supported.public java.lang.String getMetaClass()
public java.lang.String getEntityMetaClass()
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.public View getView()
public LoadContext<E> setView(View view)
view
- view that is used for loading entitiespublic LoadContext<E> setView(java.lang.String viewName)
viewName
- view that is used for loading entitiespublic 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 boolean isSoftDeletion()
public LoadContext<E> setSoftDeletion(boolean softDeletion)
softDeletion
- whether to use soft deletion when loading entitiespublic java.util.List<LoadContext.Query> getPrevQueries()
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.lang.Object value)
QueryHints
public boolean isLoadDynamicAttributes()
public LoadContext<E> setLoadDynamicAttributes(boolean loadDynamicAttributes)
loadDynamicAttributes
- whether to load dynamic attributespublic boolean isLoadPartialEntities()
setView(View)
.
The state of View.loadPartialEntities()
is ignored when the view is passed to DataManager
.
public LoadContext<E> setLoadPartialEntities(boolean loadPartialEntities)
setView(View)
.
The state of View.loadPartialEntities()
is ignored when the view is passed to DataManager
.
public boolean isAuthorizationRequired()
public LoadContext<E> setAuthorizationRequired(boolean authorizationRequired)
public boolean isJoinTransaction()
public LoadContext<E> setJoinTransaction(boolean joinTransaction)
public LoadContext<?> copy()
public java.lang.String toString()
toString
in class java.lang.Object