public class GenericDataSupplier extends java.lang.Object implements DataSupplier
NAME
Constructor and Description |
---|
GenericDataSupplier() |
Modifier and Type | Method and Description |
---|---|
java.util.Set<Entity> |
commit(CommitContext context)
Commits a collection of new or detached entity instances to the data store.
|
<E extends Entity> |
commit(E instance)
Commits the entity to the data store.
|
<E extends Entity> |
commit(E entity,
java.lang.String viewName)
Commits the entity to the data store.
|
<E extends Entity> |
commit(E instance,
View view)
Commits the entity to the data store.
|
long |
getCount(LoadContext<? extends Entity> context)
Returns the number of entity instances for the given query passed in the
LoadContext . |
<E extends Entity> |
load(LoadContext<E> context)
Loads a single entity instance.
|
<E extends Entity> |
loadList(LoadContext<E> context)
Loads collection of entity instances.
|
java.util.List<KeyValueEntity> |
loadValues(ValueLoadContext context)
Loads list of key-value pairs.
|
<E extends Entity> |
newInstance(MetaClass metaClass)
Create a new entity instance
|
<E extends Entity> |
reload(E entity,
java.lang.String viewName)
Reloads the entity instance from data store with the view specified.
|
<E extends Entity> |
reload(E entity,
View view)
Reloads the entity instance from data store with the view specified.
|
<E extends Entity> |
reload(E entity,
View view,
MetaClass metaClass)
Reloads the entity instance from data store with the view specified.
|
<E extends Entity> |
reload(E entity,
View view,
MetaClass metaClass,
boolean loadDynamicAttributes)
Reloads the entity instance from data store with the view specified.
|
void |
remove(Entity entity)
Removes the entity instance from the data store.
|
DataManager |
secure()
Returns the DataManager implementation that is guaranteed to apply security restrictions.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
load, loadValue, loadValues
public <E extends Entity> E newInstance(MetaClass metaClass)
DataSupplier
newInstance
in interface DataSupplier
metaClass
- entity MetaClasspublic <E extends Entity> E reload(E entity, java.lang.String viewName)
DataManager
reload
in interface DataManager
entity
- reloading instanceviewName
- view namepublic <E extends Entity> E reload(E entity, View view)
DataManager
reload
in interface DataManager
entity
- reloading instanceview
- view objectpublic <E extends Entity> E reload(E entity, View view, @Nullable MetaClass metaClass)
DataManager
reload
in interface DataManager
entity
- reloading instanceview
- view objectmetaClass
- desired MetaClass, if null - original entity's metaclass is usedpublic <E extends Entity> E reload(E entity, View view, @Nullable MetaClass metaClass, boolean loadDynamicAttributes)
DataManager
reload
in interface DataManager
entity
- reloading instanceview
- view objectmetaClass
- desired MetaClass, if null - original entity's metaclass is usedloadDynamicAttributes
- whether to load dynamic attributes for the entitypublic <E extends Entity> E commit(E instance, @Nullable View view)
DataManager
commit
in interface DataManager
instance
- entity instanceview
- view object, affects the returned committed instancepublic <E extends Entity> E commit(E entity, @Nullable java.lang.String viewName)
DataManager
commit
in interface DataManager
entity
- entity instanceviewName
- view name, affects the returned committed instancepublic <E extends Entity> E commit(E instance)
DataManager
commit
in interface DataManager
instance
- entity instancepublic void remove(Entity entity)
DataManager
remove
in interface DataManager
entity
- entity instancepublic java.util.List<KeyValueEntity> loadValues(ValueLoadContext context)
DataManager
loadValues
in interface DataService
loadValues
in interface DataManager
context
- defines a query for scalar values and a list of keys for returned KeyValueEntitypublic DataManager secure()
DataManager
By default, DataManager does not apply security when used on the middleware. Use this method if you want to run the same code both on the client and middle tier. For example:
AppBeans.get(DataManager.class).secure().load(context);
secure
in interface DataManager
public java.util.Set<Entity> commit(CommitContext context)
DataManager
commit
in interface DataService
commit
in interface DataManager
context
- CommitContext
object, containing committing entities and other information@Nullable public <E extends Entity> E load(LoadContext<E> context)
DataManager
The depth of object graphs, starting from loaded instances, defined by View
object passed in LoadContext
.
load
in interface DataService
load
in interface DataManager
context
- LoadContext
object, defining what and how to load@Nonnull public <E extends Entity> java.util.List<E> loadList(LoadContext<E> context)
DataManager
The depth of object graphs, starting from loaded instances, defined by View
object passed in LoadContext
.
loadList
in interface DataService
loadList
in interface DataManager
context
- LoadContext
object, defining what and how to loadpublic long getCount(LoadContext<? extends Entity> context)
DataManager
LoadContext
.getCount
in interface DataService
getCount
in interface DataManager
context
- defines the query