org.broadleafcommerce.admin.server.service.handler
Class SkuCustomPersistenceHandler

java.lang.Object
  extended by org.broadleafcommerce.openadmin.server.service.handler.CustomPersistenceHandlerAdapter
      extended by org.broadleafcommerce.admin.server.service.handler.SkuCustomPersistenceHandler
All Implemented Interfaces:
CustomPersistenceHandler

public class SkuCustomPersistenceHandler
extends CustomPersistenceHandlerAdapter

Author:
Phillip Verheyden

Field Summary
protected  CatalogService catalogService
           
static String PRODUCT_OPTION_FIELD_PREFIX
           
 
Constructor Summary
SkuCustomPersistenceHandler()
           
 
Method Summary
 Entity add(PersistencePackage persistencePackage, DynamicEntityDao dynamicEntityDao, RecordHelper helper)
           
protected  void associateProductOptionValuesToSku(Entity entity, Sku adminInstance, DynamicEntityDao dynamicEntityDao)
          This initially removes all of the product option values that are currently related to the Sku and then re-associates the PrdouctOptionValues
 Boolean canHandleAdd(PersistencePackage persistencePackage)
           
 Boolean canHandleFetch(PersistencePackage persistencePackage)
           
 Boolean canHandleInspect(PersistencePackage persistencePackage)
           
 Boolean canHandleUpdate(PersistencePackage persistencePackage)
           
 DynamicResultSet fetch(PersistencePackage persistencePackage, com.anasoft.os.daofusion.cto.client.CriteriaTransferObject cto, DynamicEntityDao dynamicEntityDao, RecordHelper helper)
           
protected  List<Property> getProductOptionProperties(Entity entity)
           
 DynamicResultSet inspect(PersistencePackage persistencePackage, DynamicEntityDao dynamicEntityDao, InspectHelper helper)
          Build out the extra fields for the product options
 Entity update(PersistencePackage persistencePackage, DynamicEntityDao dynamicEntityDao, RecordHelper helper)
           
protected  Entity validateUniqueProductOptionValueCombination(Product product, List<Property> productOptionProperties, Sku currentSku)
          Ensures that the given list of ProductOptionValue IDs is unique for the given Product
 
Methods inherited from class org.broadleafcommerce.openadmin.server.service.handler.CustomPersistenceHandlerAdapter
canHandleRemove, remove, willHandleSecurity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRODUCT_OPTION_FIELD_PREFIX

public static String PRODUCT_OPTION_FIELD_PREFIX

catalogService

protected CatalogService catalogService
Constructor Detail

SkuCustomPersistenceHandler

public SkuCustomPersistenceHandler()
Method Detail

canHandleInspect

public Boolean canHandleInspect(PersistencePackage persistencePackage)
Specified by:
canHandleInspect in interface CustomPersistenceHandler
Overrides:
canHandleInspect in class CustomPersistenceHandlerAdapter

canHandleFetch

public Boolean canHandleFetch(PersistencePackage persistencePackage)
Specified by:
canHandleFetch in interface CustomPersistenceHandler
Overrides:
canHandleFetch in class CustomPersistenceHandlerAdapter

canHandleAdd

public Boolean canHandleAdd(PersistencePackage persistencePackage)
Specified by:
canHandleAdd in interface CustomPersistenceHandler
Overrides:
canHandleAdd in class CustomPersistenceHandlerAdapter

canHandleUpdate

public Boolean canHandleUpdate(PersistencePackage persistencePackage)
Specified by:
canHandleUpdate in interface CustomPersistenceHandler
Overrides:
canHandleUpdate in class CustomPersistenceHandlerAdapter

inspect

public DynamicResultSet inspect(PersistencePackage persistencePackage,
                                DynamicEntityDao dynamicEntityDao,
                                InspectHelper helper)
                         throws ServiceException
Build out the extra fields for the product options

Specified by:
inspect in interface CustomPersistenceHandler
Overrides:
inspect in class CustomPersistenceHandlerAdapter
Throws:
ServiceException

fetch

public DynamicResultSet fetch(PersistencePackage persistencePackage,
                              com.anasoft.os.daofusion.cto.client.CriteriaTransferObject cto,
                              DynamicEntityDao dynamicEntityDao,
                              RecordHelper helper)
                       throws ServiceException
Specified by:
fetch in interface CustomPersistenceHandler
Overrides:
fetch in class CustomPersistenceHandlerAdapter
Throws:
ServiceException

add

public Entity add(PersistencePackage persistencePackage,
                  DynamicEntityDao dynamicEntityDao,
                  RecordHelper helper)
           throws ServiceException
Specified by:
add in interface CustomPersistenceHandler
Overrides:
add in class CustomPersistenceHandlerAdapter
Throws:
ServiceException

update

public Entity update(PersistencePackage persistencePackage,
                     DynamicEntityDao dynamicEntityDao,
                     RecordHelper helper)
              throws ServiceException
Specified by:
update in interface CustomPersistenceHandler
Overrides:
update in class CustomPersistenceHandlerAdapter
Throws:
ServiceException

associateProductOptionValuesToSku

protected void associateProductOptionValuesToSku(Entity entity,
                                                 Sku adminInstance,
                                                 DynamicEntityDao dynamicEntityDao)
This initially removes all of the product option values that are currently related to the Sku and then re-associates the PrdouctOptionValues

Parameters:
entity -
adminInstance -

getProductOptionProperties

protected List<Property> getProductOptionProperties(Entity entity)

validateUniqueProductOptionValueCombination

protected Entity validateUniqueProductOptionValueCombination(Product product,
                                                             List<Property> productOptionProperties,
                                                             Sku currentSku)
Ensures that the given list of ProductOptionValue IDs is unique for the given Product

Parameters:
product -
productOptionValueIds -
currentSku - - for update operations, this is the current Sku that is being updated; should be excluded from attempting validation
Returns:
null if successfully validation, the error entity otherwise


Copyright © 2012. All Rights Reserved.