public class InstanceLoaderImpl<E extends Entity> extends java.lang.Object implements InstanceLoader<E>
Constructor and Description |
---|
InstanceLoaderImpl(org.springframework.context.ApplicationContext applicationContext) |
Modifier and Type | Method and Description |
---|---|
LoadContext<E> |
createLoadContext() |
Condition |
getCondition()
Returns the root condition which is used together with the query when loading entities.
|
InstanceContainer<E> |
getContainer()
Returns the container which accepts the loaded entity.
|
DataContext |
getDataContext()
Returns data context.
|
protected DataManager |
getDataManager() |
java.lang.Object |
getEntityId()
Returns id of the entity to load.
|
java.util.function.Function<LoadContext<E>,E> |
getLoadDelegate()
Returns a function which will be used to load data instead of standard implementation.
|
java.lang.Object |
getParameter(java.lang.String name)
Returns a query parameter by its name.
|
java.util.Map<java.lang.String,java.lang.Object> |
getParameters()
Returns the map of query parameters.
|
java.lang.String |
getQuery()
Returns the query which is used for loading entities.
|
View |
getView()
Returns the view which is used when loading.
|
protected ViewRepository |
getViewRepository() |
boolean |
isLoadDynamicAttributes()
Returns true if the entity's dynamic attributes are loaded.
|
boolean |
isSoftDeletion()
Returns true if the loader respects soft deletion, i.e.
|
void |
load()
Loads data to the connected container.
|
protected boolean |
needLoad() |
void |
removeParameter(java.lang.String name)
Removes a query parameter.
|
protected View |
resolveView() |
void |
setCondition(Condition condition)
Sets the root condition which will be used together with the query when loading entities.
|
void |
setContainer(InstanceContainer<E> container)
Sets the container which accepts the loaded entity.
|
void |
setDataContext(DataContext dataContext)
Sets the data context for the loader.
|
void |
setEntityId(java.lang.Object entityId)
Sets the id of the entity to load.
|
void |
setLoadDelegate(java.util.function.Function<LoadContext<E>,E> delegate)
Sets a function which will be used to load data instead of standard implementation.
|
void |
setLoadDynamicAttributes(boolean loadDynamicAttributes)
Set to true to load the entity's dynamic attributes.
|
void |
setParameter(java.lang.String name,
java.lang.Object value)
Sets a query parameter.
|
void |
setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
Sets the map of query parameters.
|
void |
setQuery(java.lang.String query)
Sets a query which will be used for loading entities.
|
void |
setSoftDeletion(boolean softDeletion)
Set to false if you want to load softly deleted instances too.
|
void |
setView(java.lang.String viewName)
Sets the name of the view which is used when loading.
|
void |
setView(View view)
Sets the view which is used when loading.
|
public InstanceLoaderImpl(org.springframework.context.ApplicationContext applicationContext)
protected DataManager getDataManager()
protected ViewRepository getViewRepository()
@Nullable public DataContext getDataContext()
DataLoader
getDataContext
in interface DataLoader
public void setDataContext(DataContext dataContext)
DataLoader
setDataContext
in interface DataLoader
public void load()
DataLoader
load
in interface DataLoader
protected boolean needLoad()
public LoadContext<E> createLoadContext()
protected View resolveView()
public InstanceContainer<E> getContainer()
InstanceLoader
getContainer
in interface DataLoader
getContainer
in interface InstanceLoader<E extends Entity>
public void setContainer(InstanceContainer<E> container)
InstanceLoader
setContainer
in interface InstanceLoader<E extends Entity>
public java.lang.String getQuery()
DataLoader
getQuery
in interface DataLoader
public void setQuery(java.lang.String query)
DataLoader
setQuery
in interface DataLoader
public Condition getCondition()
DataLoader
getCondition
in interface DataLoader
public void setCondition(Condition condition)
DataLoader
setCondition
in interface DataLoader
public java.util.Map<java.lang.String,java.lang.Object> getParameters()
DataLoader
getParameters
in interface DataLoader
public void setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
DataLoader
setParameters
in interface DataLoader
public java.lang.Object getParameter(java.lang.String name)
DataLoader
getParameter
in interface DataLoader
public void setParameter(java.lang.String name, java.lang.Object value)
DataLoader
setParameter
in interface DataLoader
public void removeParameter(java.lang.String name)
DataLoader
removeParameter
in interface DataLoader
public java.lang.Object getEntityId()
InstanceLoader
getEntityId
in interface InstanceLoader<E extends Entity>
public void setEntityId(java.lang.Object entityId)
InstanceLoader
setEntityId
in interface InstanceLoader<E extends Entity>
public boolean isSoftDeletion()
DataLoader
isSoftDeletion
in interface DataLoader
public void setSoftDeletion(boolean softDeletion)
DataLoader
setSoftDeletion
in interface DataLoader
public boolean isLoadDynamicAttributes()
InstanceLoader
isLoadDynamicAttributes
in interface InstanceLoader<E extends Entity>
public void setLoadDynamicAttributes(boolean loadDynamicAttributes)
InstanceLoader
setLoadDynamicAttributes
in interface InstanceLoader<E extends Entity>
public java.util.function.Function<LoadContext<E>,E> getLoadDelegate()
InstanceLoader
getLoadDelegate
in interface InstanceLoader<E extends Entity>
public void setLoadDelegate(java.util.function.Function<LoadContext<E>,E> delegate)
InstanceLoader
setLoadDelegate
in interface InstanceLoader<E extends Entity>
public View getView()
InstanceLoader
getView
in interface InstanceLoader<E extends Entity>
public void setView(View view)
InstanceLoader
setView
in interface InstanceLoader<E extends Entity>
public void setView(java.lang.String viewName)
InstanceLoader
setView
in interface InstanceLoader<E extends Entity>