public interface ObjectCRUDHandler
| Modifier and Type | Field and Description |
|---|---|
static String |
OBJECT_CREATED_EVENT |
static String |
OBJECTS_DELETED_EVENT |
static String |
OBJECTS_UPDATED_EVENT |
| Modifier and Type | Method and Description |
|---|---|
default <T> T |
clone(T objectToClone,
Context ctx)
Clone an object by given object data.
|
<T> T |
create(String typeId,
Context ctx)
Creates a new object in the system using given object data.
|
default <T> ObjectFacadeOperationResult<T> |
delete(Collection<T> objects,
Context ctx)
Deletes many given objects from the system.
Default implementation calls delete(Object, Context) in a loop and does not publish
OBJECTS_DELETED_EVENT event. |
<T> void |
delete(T object,
Context ctx)
Deletes given object from the system.
|
default <T> boolean |
isModified(T object)
Tells if an object is not persisted or has unsaved changes.
|
default <T> boolean |
isNew(T object)
Tells if an object has been created and has not been saved yet.
|
<T> T |
load(String id,
Context ctx)
Gets an object instance by it's id.
|
default <T> ObjectFacadeOperationResult<T> |
reload(Collection<T> objects,
Context ctx)
Gets a fresh instance of the given collection of objects.
|
<T> T |
reload(T object,
Context ctx)
Gets a fresh instance of the given object.
|
default <T> ObjectFacadeOperationResult<T> |
save(Collection<T> objects,
Context ctx)
Persist objects by given collection data.
|
<T> T |
save(T object,
Context ctx)
Persist an object by given object data.
|
static final String OBJECTS_DELETED_EVENT
static final String OBJECT_CREATED_EVENT
static final String OBJECTS_UPDATED_EVENT
<T> T load(String id, Context ctx) throws ObjectNotFoundException
id - for which the object is neededctx - context specifying the loaded attributes of the returned object as well as application settingsObjectNotFoundException - if no object with the given id could be found<T> void delete(T object,
Context ctx)
throws ObjectDeletionException
object - which should get deletedctx - context specifying application settingsObjectDeletionException - if the given object could not be deleteddefault <T> ObjectFacadeOperationResult<T> delete(Collection<T> objects, Context ctx)
delete(Object, Context) in a loop and does not publish
OBJECTS_DELETED_EVENT event.objects - which should get deletedctx - <T> T create(String typeId, Context ctx) throws ObjectCreationException
typeId - the data for creation of object in systemctx - context specifying the loaded attributes of the returned object as well as application settingsObjectCreationException - if the object couldn't be created, like an object with the specified id already exists<T> T save(T object,
Context ctx)
throws ObjectSavingException
object - the data for updating an object in systemctx - context specifying the loaded attributes of the returned object as well as application settingsObjectSavingException - if the object couldn't be persisted, like a unique attribute was updated to be non-uniquedefault <T> ObjectFacadeOperationResult<T> save(Collection<T> objects, Context ctx)
objects - the data for updating objects in system.ctx - context specifying the loaded attributes of the returned object as well as application settings.<T> T reload(T object,
Context ctx)
throws ObjectNotFoundException
object - The object that should be refreshed.ctx - context specifying the loaded attributes of the returned object as well as application settingsObjectNotFoundException - If the current object couldn't be found (could be deleted in the mean time).default <T> ObjectFacadeOperationResult<T> reload(Collection<T> objects, Context ctx)
objects - The collection of object that should be refreshed.ctx - context specifying the loaded attributes of the returned object as well as application settingsdefault <T> boolean isNew(T object)
T - object type.object - the object to check.default <T> boolean isModified(T object)
T - object type.object - the object to check.default <T> T clone(T objectToClone,
Context ctx)
throws ObjectCloningException
objectToClone - - source object to be cloned.ctx - context specifying the loaded attributes of the returned object as well as application settings.ObjectCloningException - if cannot perform the clone.Copyright © 2018. All rights reserved.