How can I access request/session objects from within CustomerPersistenceHandler?
I'm building a B2B commerce and some entities will have "merchant" property to store the owner of the entity. I can subclass ProductCustomPersistenceHandler and override following methods:
Code: Select all
@Override
public Boolean canHandleAdd(PersistencePackage persistencePackage);
@Override
public Boolean canHandleUpdate(PersistencePackage persistencePackage);
@Override
public Entity add(PersistencePackage persistencePackage, DynamicEntityDao dynamicEntityDao, RecordHelper helper) throws ServiceException;
In add method I want to set the "merchant" property that is stored in session. The question is how to access request/session object from CustomPersistenceHandler. It seems not passed to this module. Currently I extend AdminProductController and ProductCustomPersistenceHandler such as MerchantProductController and overload add method so I can retrieve current merchant from session and pass it to MerchantCustomPersistenceHandler as one of the properties. It's not that pretty, but don't know if there is better approach.
Thank you in advance!
-Charlie