Interface ObjectFacade
-
- All Superinterfaces:
ObjectCRUDHandler
- All Known Implementing Classes:
DefaultObjectFacade,PermissionAwareObjectFacade
public interface ObjectFacade extends ObjectCRUDHandler
Facade for retrieval and modifying of objects.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCTX_DISABLE_CRUD_COCKPIT_EVENT_NOTIFICATIONDeprecated, for removal: This API element is subject to removal in a future version.since 6.7 useCTX_PARAM_SUPPRESS_EVENT.static java.lang.StringCTX_PARAM_SUPPRESS_EVENT-
Fields inherited from interface com.hybris.cockpitng.dataaccess.facades.object.ObjectCRUDHandler
OBJECT_CREATED_EVENT, OBJECTS_DELETED_EVENT, OBJECTS_UPDATED_EVENT
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T> Tclone(T objectToClone)Clone an object by given object data.<T> Tcreate(java.lang.String typeId)Creates a new object in the system using given object data.default <T> ObjectFacadeOperationResult<T>delete(java.util.Collection<T> objects)Deletes many objects from the system.<T> voiddelete(T object)Deletes an object from system.default booleanisPersisted(java.lang.Object object)Checks if object is persisted<T> Tload(java.lang.String id)Gets an object instance by it's id.default <T> ObjectFacadeOperationResult<T>reload(java.util.Collection<T> objects)Gets a fresh instance of the given collection of objects.<T> Treload(T object)Gets a fresh instance of the given object.default <T> ObjectFacadeOperationResult<T>save(java.util.Collection<T> objects)Persist objects by given collection data.<T> Tsave(T objectToSave)Persist an object by given object data.-
Methods inherited from interface com.hybris.cockpitng.dataaccess.facades.object.ObjectCRUDHandler
clone, create, delete, delete, getObjectId, isDeleted, isModified, isNew, load, reload, reload, save, save
-
-
-
-
Field Detail
-
CTX_PARAM_SUPPRESS_EVENT
static final java.lang.String CTX_PARAM_SUPPRESS_EVENT
- See Also:
- Constant Field Values
-
CTX_DISABLE_CRUD_COCKPIT_EVENT_NOTIFICATION
@Deprecated(since="6.7", forRemoval=true) static final java.lang.String CTX_DISABLE_CRUD_COCKPIT_EVENT_NOTIFICATIONDeprecated, for removal: This API element is subject to removal in a future version.since 6.7 useCTX_PARAM_SUPPRESS_EVENT. Since 6.7 it is not used and will be removed.- See Also:
- Constant Field Values
-
-
Method Detail
-
load
<T> T load(java.lang.String id) throws ObjectNotFoundExceptionGets an object instance by it's id.- Parameters:
id- The unique qualifier of the object.- Returns:
- loaded object instance for given id
- Throws:
ObjectNotFoundException- if no object with the given id could be found.
-
delete
<T> void delete(T object) throws ObjectDeletionExceptionDeletes an object from system.- Parameters:
object- The object which should be deleted.- Throws:
ObjectDeletionException- if the given object could not be deleted.
-
delete
default <T> ObjectFacadeOperationResult<T> delete(java.util.Collection<T> objects)
Deletes many objects from the system.- Parameters:
objects- Objects which should be deleted.- Returns:
- Result of the operation. Should never be null.
-
create
<T> T create(java.lang.String typeId) throws ObjectCreationExceptionCreates a new object in the system using given object data.- Parameters:
typeId- The type qualifier specifying the type of which the new object is an instance.- Returns:
- The newly created object.
- Throws:
ObjectCreationException- if the object couldn't be created, like an object with the specified id already exists.
-
save
<T> T save(T objectToSave) throws ObjectSavingExceptionPersist an object by given object data.- Parameters:
objectToSave- An object, on which the save action should be applied (usually persisting in a DBS)- Returns:
- The updated object, if saving it was successful.
- Throws:
ObjectSavingException- if the object couldn't be persisted, like a unique attribute was updated to be non-unique.
-
save
default <T> ObjectFacadeOperationResult<T> save(java.util.Collection<T> objects)
Persist objects by given collection data.- Parameters:
objects- the data for updating objects in system.- Returns:
- ObjectFacadeOperationResult object.
-
reload
<T> T reload(T object) throws ObjectNotFoundExceptionGets a fresh instance of the given object. Usually it re-fetches a domain object from the persistence layer, but could also just return the same instance, if the object is not managed.- Parameters:
object- The object that should be refreshed.- Returns:
- A new instance of the given object, or the object itself, if it's not managed.
- Throws:
ObjectNotFoundException- If the current object couldn't be found (could be deleted in the mean time).
-
reload
default <T> ObjectFacadeOperationResult<T> reload(java.util.Collection<T> objects)
Gets a fresh instance of the given collection of objects. Usually it re-fetches a domain object from the persistence layer, but could also just return the same instance, if the object is not managed. If an item in collection couldn't be found (could be deleted in the mean time) then item won't be added to collection- Parameters:
objects- The collection of object that should be refreshed.- Returns:
- Two collections: one with objects that succeeded reloading (new instances of the given objects, or the object itself, if it's not managed) and second collection with objects that failed to be reloaded.
-
clone
default <T> T clone(T objectToClone) throws ObjectCloningExceptionClone an object by given object data.- Parameters:
objectToClone- - source object to be cloned.- Returns:
- cloned object.
- Throws:
ObjectCloningException- if cannot perform the clone.
-
isPersisted
default boolean isPersisted(java.lang.Object object)
Checks if object is persisted- Parameters:
object- object to check- Returns:
- true if object was persisted, false if not
-
-