Package de.hybris.platform.jalo
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
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterItemCreation(SessionContext ctx, ComposedType type, Item createdItem, Item.ItemAttributeMap attributes) This method will be called after an item was created.voidbeforeItemCreation(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 voidcheckBeforeItemRemoval(SessionContext ctx, Item item) TODO improve API doc Override this method to implement pre-removal consistency checks.voiddestroy()Deprecated.since ages - do not use it anymore! see PLA-10102protected final <T extends ItemRemote>
Tprotected final <T extends ItemRemote>
TextractRequiredRemoteFromItem(Item item, Class<T> clazz) protected SessionContextcreates a session context instance for getting all localized property values using LocalizableItem.getLocalizedProperty(SessionContext, String).getAttribute(String key) get a session attribute.Returns the Complete Map of transient objects.getFirstItemByAttribute(Class itemClass, String attr, Object attrVal) Returns the first found Item of a given class which matches a given Attributevalue.getFirstItemByAttribute(String attr, Object attrVal, Class itemClass) Deprecated.since ages - please use getFirstItemByAttribute(Class,String,Object)returns the assigned session.static <T> TgetSingletonManagerInstance(Class<T> clazz, String extName) Deprecated.since agesgetTransientObject(String key) Deprecated.since ages - please use #getAttribute(String) instead.Deprecated.since ages - please use getAttributeMap instead.voidinit()Deprecated.since ages - do not use it anymore! see PLA-10102protected voidnotifyItemRemoval(SessionContext ctx, Item item) TODO improve API doc Is called just before a item is being removed.voidsetAttribute(String key, Object value) add an attribute to this object.voidvoidsetTransientObject(String key, Object value) Deprecated.since ages - please use setAttribute(String,Object) instead.abstract Object
-
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 - do not use it anymore! see PLA-10102called once for each tenant, so this method fits best to perform some initialization stuff -
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
-
getTenant
-
getAllValuesSessionContext
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
returns the assigned session.This is a very powerful method, it allows all items to gain access to the assigned JaloSession.
-
notifyItemRemoval
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 eachManagerand 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
-
extractNonRequiredRemoteFromItem
-
setAttribute
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(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
get a session attribute.a
nullis returned if no attribute is mapped to the given key.- Parameters:
key-- Returns:
- the mapped object
-
getTransientObject
Deprecated.since ages - please use #getAttribute(String) instead.get a session attribute. -
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 - please use getAttributeMap instead.Returns the Complete Map of mapped attributes.- Returns:
- the map
-
getFirstItemByAttribute
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(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
-
getRemoteManagerClass
-
getSingletonManagerInstance
@Deprecated(since="ages", forRemoval=false) public static <T> T getSingletonManagerInstance(Class<T> clazz, String extName) Deprecated.since ages -
wrap
-
writeReplace
- 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 contexttype- the type of the item which will be createdattributes- 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:
afterItemCreationin interfaceItemLifecycleListener- Parameters:
ctx- the currency session contexttype- the type of the item which will be createdcreatedItem- the created item- Throws:
JaloBusinessException- See Also:
-