public class DefaultObjectFacade extends Object implements ObjectFacade
ObjectFacadeStrategy.| Modifier and Type | Field and Description |
|---|---|
static String |
COCKPITNG_CRUD_COCKPIT_EVENT_NOTIFICATION |
static String |
CTX_PARAM_UPDATED_OBJECT_IS_NEW |
protected TypeFacade |
typeFacade |
CTX_DISABLE_CRUD_COCKPIT_EVENT_NOTIFICATION, CTX_PARAM_SUPPRESS_EVENTOBJECT_CREATED_EVENT, OBJECTS_DELETED_EVENT, OBJECTS_UPDATED_EVENT| Constructor and Description |
|---|
DefaultObjectFacade() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
clone(T objectToClone,
Context ctx)
Clone an object by given object data.
|
<T> T |
create(String typeId)
Creates a new object in the system using given object data.
|
<T> T |
create(String typeId,
Context ctx)
Creates a new object in the system using given object data.
|
<T> ObjectFacadeOperationResult<T> |
delete(Collection<T> objects,
Context ctx)
Deletes many given objects from the system.
Default implementation calls ObjectCRUDHandler.delete(Object, Context) in a loop and does not publish
ObjectCRUDHandler.OBJECTS_DELETED_EVENT event. |
<T> void |
delete(T object)
Deletes an object from system.
|
<T> void |
delete(T object,
Context ctx)
Deletes given object from the system.
|
protected CockpitGlobalEventPublisher |
getEventPublisher() |
protected boolean |
isCockpitEventNotificationDisabledInCtx(Context ctx) |
protected boolean |
isCockpitEventNotificationEnabled() |
<T> boolean |
isModified(T object)
Tells if an object is not persisted or has unsaved changes.
|
<T> boolean |
isNew(T object)
Tells if an object has been created and has not been saved yet.
|
<T> T |
load(String id)
Gets an object instance by it's id.
|
<T> T |
load(String id,
Context ctx)
Gets an object instance by it's id.
|
protected void |
populateEventContext(Context source,
DefaultCockpitEvent destination)
Deprecated.
since 6.5
|
protected void |
publishEvent(String eventName,
Object object,
Context ctx) |
<T> T |
reload(T object)
Gets a fresh instance of the given object.
|
<T> T |
reload(T object,
Context ctx)
Gets a fresh instance of the given object.
|
<T> ObjectFacadeOperationResult<T> |
save(Collection<T> objects,
Context ctx)
Persist objects by given collection data.
|
<T> T |
save(T objectToSave)
Persist an object by given object data.
|
<T> T |
save(T object,
Context ctx)
Persist an object by given object data.
|
protected <T> T |
saveSingleObject(T object,
Context ctx) |
void |
setCockpitProperties(CockpitProperties cockpitProperties) |
void |
setEventPublisher(CockpitGlobalEventPublisher eventPublisher) |
void |
setEventQueue(CockpitEventQueue eventQueue)
Deprecated.
since 6.5
|
void |
setStrategyRegistry(AbstractStrategyRegistry<ObjectFacadeStrategy,Object> strategyRegistry) |
void |
setTypeFacade(TypeFacade typeFacade) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclone, delete, reload, savereloadpublic static final String CTX_PARAM_UPDATED_OBJECT_IS_NEW
public static final String COCKPITNG_CRUD_COCKPIT_EVENT_NOTIFICATION
protected TypeFacade typeFacade
public <T> T load(String id) throws ObjectNotFoundException
ObjectFacadeload in interface ObjectFacadeid - The unique qualifier of the object.ObjectNotFoundException - if no object with the given id could be found.public <T> T load(String id, Context ctx) throws ObjectNotFoundException
ObjectCRUDHandlerload in interface ObjectCRUDHandlerid - 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 foundpublic <T> void delete(T object)
throws ObjectDeletionException
ObjectFacadedelete in interface ObjectFacadeobject - The object which should be deleted.ObjectDeletionException - if the given object could not be deleted.public <T> void delete(T object,
Context ctx)
throws ObjectDeletionException
ObjectCRUDHandlerdelete in interface ObjectCRUDHandlerobject - which should get deletedctx - context specifying application settingsObjectDeletionException - if the given object could not be deletedpublic <T> ObjectFacadeOperationResult<T> delete(Collection<T> objects, Context ctx)
ObjectCRUDHandlerObjectCRUDHandler.delete(Object, Context) in a loop and does not publish
ObjectCRUDHandler.OBJECTS_DELETED_EVENT event.delete in interface ObjectCRUDHandlerobjects - which should get deletedpublic <T> T create(String typeId) throws ObjectCreationException
ObjectFacadecreate in interface ObjectFacadetypeId - The type qualifier specifying the type of which the new object is an instance.ObjectCreationException - if the object couldn't be created, like an object with the specified id already exists.public <T> T create(String typeId, Context ctx) throws ObjectCreationException
ObjectCRUDHandlercreate in interface ObjectCRUDHandlertypeId - 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 existspublic <T> T save(T objectToSave)
throws ObjectSavingException
ObjectFacadesave in interface ObjectFacadeobjectToSave - An object, on which the save action should be applied (usually persisting in a DBS)ObjectSavingException - if the object couldn't be persisted, like a unique attribute was updated to be non-unique.protected <T> T saveSingleObject(T object,
Context ctx)
throws ObjectSavingException
ObjectSavingExceptionpublic <T> T save(T object,
Context ctx)
throws ObjectSavingException
ObjectCRUDHandlersave in interface ObjectCRUDHandlerobject - 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-uniquepublic <T> ObjectFacadeOperationResult<T> save(Collection<T> objects, Context ctx)
save in interface ObjectCRUDHandlerobjects - the data for updating objects in system. Each object is saved separately in a dedicated transaction.ctx - context specifying the loaded attributes of the returned object as well as application settingspublic <T> T reload(T object,
Context ctx)
throws ObjectNotFoundException
ObjectCRUDHandlerreload in interface ObjectCRUDHandlerobject - 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).public <T> T reload(T object)
throws ObjectNotFoundException
ObjectFacadereload in interface ObjectFacadeobject - The object that should be refreshed.ObjectNotFoundException - If the current object couldn't be found (could be deleted in the mean time).public <T> boolean isNew(T object)
ObjectCRUDHandlerisNew in interface ObjectCRUDHandlerT - object type.object - the object to check.public <T> boolean isModified(T object)
ObjectCRUDHandlerisModified in interface ObjectCRUDHandlerT - object type.object - the object to check.public <T> T clone(T objectToClone,
Context ctx)
throws ObjectCloningException
ObjectCRUDHandlerclone in interface ObjectCRUDHandlerobjectToClone - - 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.public void setStrategyRegistry(AbstractStrategyRegistry<ObjectFacadeStrategy,Object> strategyRegistry)
@Deprecated public void setEventQueue(CockpitEventQueue eventQueue)
eventPublisherpublic void setCockpitProperties(CockpitProperties cockpitProperties)
protected CockpitGlobalEventPublisher getEventPublisher()
public void setEventPublisher(CockpitGlobalEventPublisher eventPublisher)
public void setTypeFacade(TypeFacade typeFacade)
@Deprecated protected void populateEventContext(Context source, DefaultCockpitEvent destination)
DefaultCockpitGlobalEventPublisherprotected boolean isCockpitEventNotificationEnabled()
protected boolean isCockpitEventNotificationDisabledInCtx(Context ctx)
Copyright © 2018. All rights reserved.