Class Manager

java.lang.Object
de.hybris.platform.jalo.Manager
All Implemented Interfaces:
ItemLifecycleListener, Serializable
Direct Known Subclasses:
AccessManager, C2LManager, EnumerationManager, Extension, ExtensionManager, FlexibleSearch, LinkManager, MediaManager, MetaInformationManager, NumberSeriesManager, OrderManager, ProductManager, TypeManager, UserManager

public abstract class Manager extends Object implements Serializable, ItemLifecycleListener
A Manager is responsible for providing basic functionality, mostly creating and finding items.

Each manager is assigned to a JaloSession and has via the getSession() method access to it.

See Also:
  • Constructor Details

    • Manager

      public Manager()
      Warning: Never call the constructor of any manager directly. Use the getInstance() method on each manager (e.g. ProductManager.getInstance()) to get the manager instance.
  • Method Details

    • init

      @Deprecated(since="ages", forRemoval=false) public void init()
      Deprecated.
      since ages - do not use it anymore! see PLA-10102
      called once for each tenant, so this method fits best to perform some initialization stuff
    • destroy

      @Deprecated(since="ages", forRemoval=false) public void destroy()
      Deprecated.
      since ages - do not use it anymore! see PLA-10102
      called once for each tenant, so this method fits best to perform some cleanup stuff
    • setTenant

      public void setTenant(Tenant tenant)
    • getTenant

      public Tenant getTenant()
    • getAllValuesSessionContext

      protected SessionContext getAllValuesSessionContext(SessionContext ctx)
      creates a session context instance for getting all localized property values using LocalizableItem.getLocalizedProperty(SessionContext, String). the return value will be a map { Language -> Object }

      the created session context simply doesnt have a language.

      use it as follows:

              public Map myMethod( SessionContext ctx )
              {
                ...
                      return (Map)this.getLocalizedProperty(
                              getAllValuesSessionContext(ctx),
                              "theKey"
                      );
              }
       
      Parameters:
      ctx - the original session contex
      Returns:
      a session context instance without a language set
    • getSession

      public JaloSession getSession()
      returns the assigned session.

      This is a very powerful method, it allows all items to gain access to the assigned JaloSession.

    • notifyItemRemoval

      protected void notifyItemRemoval(SessionContext ctx, Item item)
      TODO improve API doc Is called just before a item is being removed. No exception should be thrown here. Use checkBeforeItemRemoval(SessionContext, Item) instead.

      This method does nothing and may be overridden.

      Parameters:
      ctx - the currency session context
      item - the item which is going to be removed
      Since:
      2.10
    • checkBeforeItemRemoval

      protected void checkBeforeItemRemoval(SessionContext ctx, Item item) throws ConsistencyCheckException
      TODO improve API doc Override this method to implement pre-removal consistency checks. This method is called upon each Manager and allows aborting removal by throwing a ConsistencyCheckException. If no manager did so each one is notified by calling notifyItemRemoval(SessionContext, Item).

      This method does nothing and may be overridden.

      Parameters:
      ctx - the current session context
      item - the item which should be removed
      Throws:
      ConsistencyCheckException - thrown to abort removal due to consistency errors
      Since:
      2.10
    • extractRequiredRemoteFromItem

      protected final <T extends ItemRemote> T extractRequiredRemoteFromItem(Item item, Class<T> clazz)
    • extractNonRequiredRemoteFromItem

      protected final <T extends ItemRemote> T extractNonRequiredRemoteFromItem(Item item)
    • setAttribute

      public void setAttribute(String key, Object value)
      add an attribute to this object.

      the value will be mapped to this object until

      • it will be removed with setAttribute(key,null)
      • or the garbage collector will remove it because it is no longer needed.
      .
      Parameters:
      key - the key
      value - may be null; this will remove the transient object mapping
    • setTransientObject

      @Deprecated(since="ages", forRemoval=false) public void setTransientObject(String key, Object value)
      Deprecated.
      since ages - please use setAttribute(String,Object) instead.
      add an attribute to this Session.

    • getAttribute

      public Object getAttribute(String key)
      get a session attribute.

      a null is returned if no attribute is mapped to the given key.

      Parameters:
      key -
      Returns:
      the mapped object
    • getTransientObject

      @Deprecated(since="ages", forRemoval=false) public Object getTransientObject(String key)
      Deprecated.
      since ages - please use #getAttribute(String) instead.
      get a session attribute.
    • getAttributeMap

      public Map getAttributeMap()
      Returns the Complete Map of transient objects.

      Note: Changes are directly reflected to the BridgeAbstraction object. The returned map is bound to the object. So be careful when modifying the map.

    • getTransientObjectMap

      @Deprecated(since="ages", forRemoval=false) public Map getTransientObjectMap()
      Deprecated.
      since ages - please use getAttributeMap instead.
      Returns the Complete Map of mapped attributes.

      Returns:
      the map
    • getFirstItemByAttribute

      public Item getFirstItemByAttribute(Class itemClass, String attr, Object attrVal)
      Returns the first found Item of a given class which matches a given Attributevalue.
      Parameters:
      itemClass - The class of the Item
      attr - The Attribute
      attrVal - The Value of the Attribute to compare
      Returns:
      An Item or null
      Since:
      2.20
    • getFirstItemByAttribute

      @Deprecated(since="ages", forRemoval=false) public Item getFirstItemByAttribute(String attr, Object attrVal, Class itemClass)
      Deprecated.
      since ages - please use getFirstItemByAttribute(Class,String,Object)
      Returns the first found Item of a given class which matches a given Attributevalue.
      Since:
      2.20
    • getRemote

      public ManagerEJB getRemote()
    • getRemoteManagerClass

      public Class getRemoteManagerClass()
    • getSingletonManagerInstance

      @Deprecated(since="ages", forRemoval=false) public static <T> T getSingletonManagerInstance(Class<T> clazz, String extName)
      Deprecated.
      since ages
    • wrap

      public Object wrap(Object object)
    • writeReplace

      public abstract Object writeReplace() throws ObjectStreamException
      Throws:
      ObjectStreamException
    • beforeItemCreation

      public void beforeItemCreation(SessionContext ctx, ComposedType type, Item.ItemAttributeMap attributes) throws JaloBusinessException
      This method will be called before an item is created BUT AFTER the default values of this type are assigned
      Parameters:
      ctx - the currency session context
      type - the type of the item which will be created
      attributes - the attribute values to be used for creation
      Throws:
      JaloBusinessException
      See Also:
    • afterItemCreation

      public void afterItemCreation(SessionContext ctx, ComposedType type, Item createdItem, Item.ItemAttributeMap attributes) throws JaloBusinessException
      This method will be called after an item was created.
      Specified by:
      afterItemCreation in interface ItemLifecycleListener
      Parameters:
      ctx - the currency session context
      type - the type of the item which will be created
      createdItem - the created item
      Throws:
      JaloBusinessException
      See Also: