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);
Modifier and Type | Class and Description |
---|---|
static class |
LoadContext.Query
Class that defines a query to be executed for data loading.
|
Constructor and Description |
---|
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.util.Map<java.lang.String,java.lang.Object> |
getDbHints() |
java.lang.Object |
getId() |
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 |
isLoadDynamicAttributes() |
boolean |
isLoadPartialEntities() |
boolean |
isSoftDeletion() |
LoadContext<E> |
setId(java.lang.Object id) |
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() |
public LoadContext(MetaClass metaClass)
metaClass
- metaclass of the loaded entitiespublic LoadContext(java.lang.Class<E> javaClass)
javaClass
- class of the loaded entitiespublic 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 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 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> getDbHints()
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 LoadContext<?> copy()
public java.lang.String toString()
toString
in class java.lang.Object