Package de.hybris.platform.jalo
Class Manager
- java.lang.Object
-
- de.hybris.platform.jalo.Manager
-
- All Implemented Interfaces:
ItemLifecycleListener
,java.io.Serializable
- Direct Known Subclasses:
AccessManager
,C2LManager
,EnumerationManager
,Extension
,ExtensionManager
,FlexibleSearch
,LinkManager
,MediaManager
,MetaInformationManager
,NumberSeriesManager
,OrderManager
,ProductManager
,TypeManager
,UserManager
public abstract class Manager extends java.lang.Object implements java.io.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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Manager.GenericManagerSingletonCreator
static class
Manager.ManagerSingletonCreator
-
Constructor Summary
Constructors Constructor Description Manager()
Warning: Never call the constructor of any manager directly.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
afterItemCreation(SessionContext ctx, ComposedType type, Item createdItem, Item.ItemAttributeMap attributes)
This method will be called after an item was created.void
beforeItemCreation(SessionContext ctx, ComposedType type, Item.ItemAttributeMap attributes)
This method will be called before an item is created BUT AFTER the default values of this type are assignedprotected void
checkBeforeItemRemoval(SessionContext ctx, Item item)
TODO improve API doc Override this method to implement pre-removal consistency checks.void
destroy()
Deprecated.since ages - do not use it anymore! see PLA-10102protected <T extends ItemRemote>
TextractNonRequiredRemoteFromItem(Item item)
protected <T extends ItemRemote>
TextractRequiredRemoteFromItem(Item item, java.lang.Class<T> clazz)
protected SessionContext
getAllValuesSessionContext(SessionContext ctx)
creates a session context instance for getting all localized property values using LocalizableItem.getLocalizedProperty(SessionContext, String).java.lang.Object
getAttribute(java.lang.String key)
get a session attribute.java.util.Map
getAttributeMap()
Returns the Complete Map of transient objects.Item
getFirstItemByAttribute(java.lang.Class itemClass, java.lang.String attr, java.lang.Object attrVal)
Returns the first found Item of a given class which matches a given Attributevalue.Item
getFirstItemByAttribute(java.lang.String attr, java.lang.Object attrVal, java.lang.Class itemClass)
Deprecated.since ages - please use getFirstItemByAttribute(Class,String,Object)ManagerEJB
getRemote()
java.lang.Class
getRemoteManagerClass()
JaloSession
getSession()
returns the assigned session.static <T> T
getSingletonManagerInstance(java.lang.Class<T> clazz, java.lang.String extName)
Deprecated.since agesTenant
getTenant()
java.lang.Object
getTransientObject(java.lang.String key)
Deprecated.since ages - please use #getAttribute(String) instead.java.util.Map
getTransientObjectMap()
Deprecated.since ages - please use getAttributeMap instead.void
init()
Deprecated.since ages - do not use it anymore! see PLA-10102protected void
notifyItemRemoval(SessionContext ctx, Item item)
TODO improve API doc Is called just before a item is being removed.void
setAttribute(java.lang.String key, java.lang.Object value)
add an attribute to this object.void
setTenant(Tenant tenant)
void
setTransientObject(java.lang.String key, java.lang.Object value)
Deprecated.since ages - please use setAttribute(String,Object) instead.java.lang.Object
wrap(java.lang.Object object)
abstract java.lang.Object
writeReplace()
-
-
-
Method Detail
-
init
@Deprecated public void init()
Deprecated.since ages - do not use it anymore! see PLA-10102called once for each tenant, so this method fits best to perform some initialization stuff
-
destroy
@Deprecated public void destroy()
Deprecated.since ages - do not use it anymore! see PLA-10102called 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. UsecheckBeforeItemRemoval(SessionContext, Item)
instead.This method does nothing and may be overridden.
- Parameters:
ctx
- the currency session contextitem
- 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 eachManager
and allows aborting removal by throwing aConsistencyCheckException
. If no manager did so each one is notified by callingnotifyItemRemoval(SessionContext, Item)
.This method does nothing and may be overridden.
- Parameters:
ctx
- the current session contextitem
- 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, java.lang.Class<T> clazz)
-
extractNonRequiredRemoteFromItem
protected final <T extends ItemRemote> T extractNonRequiredRemoteFromItem(Item item)
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.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 keyvalue
- may be null; this will remove the transient object mapping
- it will be removed with
-
setTransientObject
@Deprecated public void setTransientObject(java.lang.String key, java.lang.Object value)
Deprecated.since ages - please use setAttribute(String,Object) instead.add an attribute to this Session.
-
getAttribute
public java.lang.Object getAttribute(java.lang.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 public java.lang.Object getTransientObject(java.lang.String key)
Deprecated.since ages - please use #getAttribute(String) instead.get a session attribute.
-
getAttributeMap
public java.util.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 public java.util.Map getTransientObjectMap()
Deprecated.since ages - please use getAttributeMap instead.Returns the Complete Map of mapped attributes.- Returns:
- the map
-
getFirstItemByAttribute
public Item getFirstItemByAttribute(java.lang.Class itemClass, java.lang.String attr, java.lang.Object attrVal)
Returns the first found Item of a given class which matches a given Attributevalue.- Parameters:
itemClass
- The class of the Itemattr
- The AttributeattrVal
- The Value of the Attribute to compare- Returns:
- An Item or null
- Since:
- 2.20
-
getFirstItemByAttribute
@Deprecated public Item getFirstItemByAttribute(java.lang.String attr, java.lang.Object attrVal, java.lang.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 java.lang.Class getRemoteManagerClass()
-
getSingletonManagerInstance
@Deprecated public static <T> T getSingletonManagerInstance(java.lang.Class<T> clazz, java.lang.String extName)
Deprecated.since ages
-
wrap
public java.lang.Object wrap(java.lang.Object object)
-
writeReplace
public abstract java.lang.Object writeReplace() throws java.io.ObjectStreamException
- Throws:
java.io.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 contexttype
- the type of the item which will be createdattributes
- the attribute values to be used for creation- Throws:
JaloBusinessException
- See Also:
This method does nothing and may be overridden. CAUTION: This method will be called inside a transaction !!!
-
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 interfaceItemLifecycleListener
- Parameters:
ctx
- the currency session contexttype
- the type of the item which will be createdcreatedItem
- the created item- Throws:
JaloBusinessException
- See Also:
This method does nothing and may be overridden. CAUTION: This method will be called inside a transaction !!!
-
-