Package de.hybris.platform.persistence
Class ManagerEJB
- java.lang.Object
-
- de.hybris.platform.persistence.ManagerEJB
-
- Direct Known Subclasses:
EnumerationManagerEJB
,ExtensionEJB
,ExtensionManagerEJB
,LinkManagerEJB
,MetaInformationManagerEJB
,TypeManagerEJB
public abstract class ManagerEJB extends java.lang.Object
Default abstract class for implementing a Manager. A Manager in the hybris platform is a session bean that provides methods for handling one or more types of 'Items'.
Handling means- Creating items
- Removing items
- Perfom rollback/commit on stageable items
- Search specified items
For example a ProductManager is responsible for creating/removing and searching Products.
Additional each manager has to implement methods which are called by the system (the NotifyManager) if a item is removed or the system is initialized.
-
-
Constructor Summary
Constructors Constructor Description ManagerEJB()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canRemoveItem(ItemRemote item)
In case a manager wants to abort the removal of an Item this method should return false.void
ejbCreate()
Default implementation of EJB method.void
ejbPostCreate()
Default implementation of EJB method.protected PersistencePool
getPersistencePool()
boolean
isReinitialization(java.util.Map params)
void
notifyItemRemove(ItemRemote item)
Callback method to get notified if an item in the hybris platform is going to be removed.void
prepareItemRemove(ItemRemote item)
Called before a not stageable item is removed.void
removeItem(ItemRemote item)
Removes an Item which is not stageable.
-
-
-
Method Detail
-
getPersistencePool
protected PersistencePool getPersistencePool()
-
notifyItemRemove
public void notifyItemRemove(ItemRemote item)
Callback method to get notified if an item in the hybris platform is going to be removed.
Each manager can perform some cleanups.
It is a major failure to throw an exception here to abort item removal; usecanRemoveItem(ItemRemote)
instead to signal your veto.
-
canRemoveItem
public boolean canRemoveItem(ItemRemote item) throws ConsistencyCheckException
In case a manager wants to abort the removal of an Item this method should return false. Since all manager are asked before you can assume that no changes are made when one manager aborts.- Throws:
ConsistencyCheckException
- you can either throw an exception or return false
-
isReinitialization
public boolean isReinitialization(java.util.Map params)
-
removeItem
public void removeItem(ItemRemote item) throws ConsistencyCheckException
Removes an Item which is not stageable. The following tasks are done by this method:- Check if item is stageable; if it is, throw exception (we can
- call
prepareItemRemove(ItemRemote)
- Depending on the given stagingMethod do:
Productive Stage - Remove staged copy (item.getStagedCopy()) of item, if it exist
- call NotifyManager.notifyItemRemove( item )
- Remove the entity
- Remove staged copy (item.getStagedCopy()) of item, if it exist
- Mark item as removed (item.setRemoved(true)
- Throws:
ConsistencyCheckException
- See Also:
prepareItemRemove(ItemRemote)
-
prepareItemRemove
public void prepareItemRemove(ItemRemote item) throws ConsistencyCheckException
Called before a not stageable item is removed. This is a default implementation and can be overridden by subclasses to provide consistency checks.- Throws:
ConsistencyCheckException
- See Also:
removeItem(ItemRemote)
-
ejbCreate
public void ejbCreate()
Default implementation of EJB method.
Each manager have to provide a non parameter create-method. This implementation just returns and does nothing.
-
ejbPostCreate
public void ejbPostCreate()
Default implementation of EJB method.
Each manager have to provide a non parameter postCreate-method. This implementation just returns and does nothing.
-
-