Class ProductOptionsCustomPersistenceHandler
java.lang.Object
org.broadleafcommerce.openadmin.server.service.handler.CustomPersistenceHandlerAdapter
org.broadleafcommerce.admin.server.service.handler.ProductOptionsCustomPersistenceHandler
- All Implemented Interfaces:
CustomPersistenceHandler,org.springframework.core.Ordered
@Component("blProductOptionsCustomPersistenceHandler")
public class ProductOptionsCustomPersistenceHandler
extends CustomPersistenceHandlerAdapter
This class is used to prevent updates to Product Options if "Use in Sku generation" is true but no "Allowed Values"
have been set.
- Author:
- Nathan Moore (nathanmoore)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ProductOptionDaoprotected org.broadleafcommerce.common.sandbox.SandBoxHelperFields inherited from interface org.broadleafcommerce.openadmin.server.service.handler.CustomPersistenceHandler
DEFAULT_ORDERFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncanHandleFetch(PersistencePackage persistencePackage) canHandleUpdate(PersistencePackage persistencePackage) fetch(PersistencePackage persistencePackage, CriteriaTransferObject cto, DynamicEntityDao dynamicEntityDao, RecordHelper helper) update(PersistencePackage persistencePackage, DynamicEntityDao dynamicEntityDao, RecordHelper helper) protected booleanvalidateProductOption(ProductOption adminInstance, Entity entity) This function checks if a Product Option's "Use in sku generation" field is set to true without any allowed values set.Methods inherited from class org.broadleafcommerce.openadmin.server.service.handler.CustomPersistenceHandlerAdapter
add, canHandleAdd, canHandleInspect, canHandleRemove, getClassForName, getMetadata, getOrder, getPolymorphicClasses, getResultSet, inspect, isAdornedListOperation, isAssignableFrom, isBasicOperation, isMapOperation, meetsCustomCriteria, remove, willHandleSecurity
-
Field Details
-
productOptionDao
-
sandBoxHelper
protected org.broadleafcommerce.common.sandbox.SandBoxHelper sandBoxHelper
-
-
Constructor Details
-
ProductOptionsCustomPersistenceHandler
public ProductOptionsCustomPersistenceHandler()
-
-
Method Details
-
canHandleUpdate
- Specified by:
canHandleUpdatein interfaceCustomPersistenceHandler- Overrides:
canHandleUpdatein classCustomPersistenceHandlerAdapter
-
canHandleFetch
- Specified by:
canHandleFetchin interfaceCustomPersistenceHandler- Overrides:
canHandleFetchin classCustomPersistenceHandlerAdapter
-
fetch
public DynamicResultSet fetch(PersistencePackage persistencePackage, CriteriaTransferObject cto, DynamicEntityDao dynamicEntityDao, RecordHelper helper) throws org.broadleafcommerce.common.exception.ServiceException - Specified by:
fetchin interfaceCustomPersistenceHandler- Overrides:
fetchin classCustomPersistenceHandlerAdapter- Throws:
org.broadleafcommerce.common.exception.ServiceException
-
update
public Entity update(PersistencePackage persistencePackage, DynamicEntityDao dynamicEntityDao, RecordHelper helper) throws org.broadleafcommerce.common.exception.ServiceException - Specified by:
updatein interfaceCustomPersistenceHandler- Overrides:
updatein classCustomPersistenceHandlerAdapter- Throws:
org.broadleafcommerce.common.exception.ServiceException
-
validateProductOption
This function checks if a Product Option's "Use in sku generation" field is set to true without any allowed values set. This is what we are trying to prevent from happening. If "Use in sku generation" is true and there are no Allowed Values, the functions returns true.- Parameters:
adminInstance- : The Product Option being validated- Returns:
- boolean: Default is false. Returns whether the Product Option needs any Allowed Values .
-