Class 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 Detail

      • ManagerEJB

        public ManagerEJB()
    • Method Detail

      • 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; use canRemoveItem(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:
        1. Check if item is stageable; if it is, throw exception (we can
        2. call prepareItemRemove(ItemRemote)
        3. Depending on the given stagingMethod do:
          Productive Stage
        4. Remove staged copy (item.getStagedCopy()) of item, if it exist
        5. call NotifyManager.notifyItemRemove( item )
        6. Remove the entity
        7. Remove staged copy (item.getStagedCopy()) of item, if it exist
        8. Mark item as removed (item.setRemoved(true)
        Throws:
        ConsistencyCheckException
        See Also:
        prepareItemRemove(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.