Class PermissionAwareObjectFacade
- java.lang.Object
-
- com.hybris.cockpitng.dataaccess.facades.object.impl.DefaultObjectFacade
-
- com.hybris.cockpitng.dataaccess.facades.object.impl.PermissionAwareObjectFacade
-
- All Implemented Interfaces:
ObjectCRUDHandler,ObjectFacade
public class PermissionAwareObjectFacade extends DefaultObjectFacade
ExtendsDefaultObjectFacadeand adds permission checks on each action.
-
-
Field Summary
-
Fields inherited from class com.hybris.cockpitng.dataaccess.facades.object.impl.DefaultObjectFacade
COCKPITNG_CRUD_COCKPIT_EVENT_NOTIFICATION, CTX_PARAM_UPDATED_OBJECT_IS_NEW, typeFacade
-
Fields inherited from interface com.hybris.cockpitng.dataaccess.facades.object.ObjectCRUDHandler
OBJECT_CREATED_EVENT, OBJECTS_DELETED_EVENT, OBJECTS_UPDATED_EVENT
-
Fields inherited from interface com.hybris.cockpitng.dataaccess.facades.object.ObjectFacade
CTX_DISABLE_CRUD_COCKPIT_EVENT_NOTIFICATION, CTX_PARAM_SUPPRESS_EVENT
-
-
Constructor Summary
Constructors Constructor Description PermissionAwareObjectFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tclone(T objectToClone, Context ctx)Clone an object by given object data.<T> Tcreate(java.lang.String typeId, Context ctx)Creates a new object in the system using given object data.<T> ObjectFacadeOperationResult<T>delete(java.util.Collection<T> objects, Context ctx)Deletes many given objects from the system.
Default implementation callsObjectCRUDHandler.delete(Object, Context)in a loop and does not publishObjectCRUDHandler.OBJECTS_DELETED_EVENTevent.<T> voiddelete(T object, Context ctx)Deletes given object from the system.protected <T> java.util.Set<java.lang.String>getModifiedProperties(T objectToSave, Context ctx)Tries to identify modified properties.PermissionFacadegetPermissionFacade()TypeFacadegetTypeFacade()Active type facade.<T> Tload(java.lang.String id, Context ctx)Gets an object instance by it's id.<T> Tsave(T objectToSave, Context ctx)Persist an object by given object data.voidsetLabelService(LabelService labelService)voidsetPermissionFacade(PermissionFacade permissionFacade)-
Methods inherited from class com.hybris.cockpitng.dataaccess.facades.object.impl.DefaultObjectFacade
create, delete, getEventPublisher, getObjectId, isCockpitEventNotificationDisabledInCtx, isCockpitEventNotificationEnabled, isDeleted, isModified, isNew, load, populateEventContext, publishEvent, reload, reload, save, save, saveSingleObject, setCockpitProperties, setEventPublisher, setEventQueue, setStrategyRegistry, setTypeFacade
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.hybris.cockpitng.dataaccess.facades.object.ObjectCRUDHandler
reload
-
Methods inherited from interface com.hybris.cockpitng.dataaccess.facades.object.ObjectFacade
clone, delete, isPersisted, reload, save
-
-
-
-
Method Detail
-
load
public <T> T load(java.lang.String id, Context ctx) throws ObjectNotFoundExceptionDescription copied from interface:ObjectCRUDHandlerGets an object instance by it's id.- Specified by:
loadin interfaceObjectCRUDHandler- Overrides:
loadin classDefaultObjectFacade- Parameters:
id- for which the object is neededctx- context specifying the loaded attributes of the returned object as well as application settings- Returns:
- the object instance for given id loaded with attributes defined in context
- Throws:
ObjectNotFoundException- if no object with the given id could be found
-
delete
public <T> void delete(T object, Context ctx) throws ObjectDeletionExceptionDescription copied from interface:ObjectCRUDHandlerDeletes given object from the system.- Specified by:
deletein interfaceObjectCRUDHandler- Overrides:
deletein classDefaultObjectFacade- Parameters:
object- which should get deletedctx- context specifying application settings- Throws:
ObjectDeletionException- if the given object could not be deleted
-
delete
public <T> ObjectFacadeOperationResult<T> delete(java.util.Collection<T> objects, Context ctx)
Description copied from interface:ObjectCRUDHandlerDeletes many given objects from the system.
Default implementation callsObjectCRUDHandler.delete(Object, Context)in a loop and does not publishObjectCRUDHandler.OBJECTS_DELETED_EVENTevent.- Specified by:
deletein interfaceObjectCRUDHandler- Overrides:
deletein classDefaultObjectFacade- Parameters:
objects- which should get deleted- Returns:
- Result of the operation containing both successful and failed objects. Should never be null.
-
create
public <T> T create(java.lang.String typeId, Context ctx) throws ObjectCreationExceptionDescription copied from interface:ObjectCRUDHandlerCreates a new object in the system using given object data.- Specified by:
createin interfaceObjectCRUDHandler- Overrides:
createin classDefaultObjectFacade- Parameters:
typeId- the data for creation of object in systemctx- context specifying the loaded attributes of the returned object as well as application settings- Returns:
- the created object with attributes loaded as specified in context
- Throws:
ObjectCreationException- if the object couldn't be created, like an object with the specified id already exists
-
clone
public <T> T clone(T objectToClone, Context ctx) throws ObjectCloningExceptionDescription copied from interface:ObjectCRUDHandlerClone an object by given object data.- Specified by:
clonein interfaceObjectCRUDHandler- Overrides:
clonein classDefaultObjectFacade- Parameters:
objectToClone- - source object to be cloned.ctx- context specifying the loaded attributes of the returned object as well as application settings.- Returns:
- ObjectFacadeOperationResult object.
- Throws:
ObjectCloningException- if cannot perform the clone.
-
save
public <T> T save(T objectToSave, Context ctx) throws ObjectSavingExceptionDescription copied from interface:ObjectCRUDHandlerPersist an object by given object data.- Specified by:
savein interfaceObjectCRUDHandler- Overrides:
savein classDefaultObjectFacade- Parameters:
objectToSave- the data for updating an object in systemctx- context specifying the loaded attributes of the returned object as well as application settings- Returns:
- the updated object
- Throws:
ObjectSavingException- if the object couldn't be persisted, like a unique attribute was updated to be non-unique
-
getModifiedProperties
protected <T> java.util.Set<java.lang.String> getModifiedProperties(T objectToSave, Context ctx)Tries to identify modified properties.- Parameters:
objectToSave- The object with potentially modified properties.ctx- An additionalContext.
-
getPermissionFacade
public PermissionFacade getPermissionFacade()
-
setPermissionFacade
public void setPermissionFacade(PermissionFacade permissionFacade)
-
getTypeFacade
public TypeFacade getTypeFacade()
Active type facade.- Returns:
- currently used type facade.
-
setLabelService
public void setLabelService(LabelService labelService)
-
-