Class CharacteristicValueRulesResultHandlerImpl
java.lang.Object
de.hybris.platform.sap.productconfig.rules.cps.handler.impl.CharacteristicValueRulesResultHandlerImpl
- All Implemented Interfaces:
CharacteristicValueRulesResultHandler
public class CharacteristicValueRulesResultHandlerImpl
extends Object
implements CharacteristicValueRulesResultHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDiscount(CharacteristicValueRulesResultModel newRulesResult, List<CharacteristicValueRulesResultModel> characteristicValueRulesResults) voidaddMessageToRulesResult(DiscountMessageRulesResultModel message, String configId, String csticName, String csticValueName) protected BigDecimalcalculateDiscount(BigDecimal existingDiscount, BigDecimal newDiscount) cloneMessageIfRequired(DiscountMessageRulesResultModel message, boolean isFirst) protected List<CharacteristicValueRulesResultModel>cloneRulesResultModelList(ProductConfigurationModel targetConfigModel, List<CharacteristicValueRulesResultModel> sourceRulesResultModelList) voidcopyAndPersistRuleResults(String sourceConfigId, String targetConfigId) Copies the CharacteristicValueRulesResult from the source ProductConfiguration and persists it for the target ProductConfigurationcreates an empty instancecreates an empty instancevoiddeleteRulesResultsByConfigId(String configId) findResult(String csticName, String csticValueName, List<CharacteristicValueRulesResultModel> characteristicValueRulesResults) protected de.hybris.platform.servicelayer.model.ModelServiceprotected de.hybris.platform.sap.productconfig.services.intf.ProductConfigurationPersistenceServicegetRulesResultsByConfigId(String configId) Returns the list of CharacteristicValueResultModel objects associated with given configuration id.voidmergeDiscountAndPersistResults(CharacteristicValueRulesResultModel result, String configId) Persists a CharacteristicValueRulesResult with the given data.voidsetModelService(de.hybris.platform.servicelayer.model.ModelService modelService) voidsetPersistenceService(de.hybris.platform.sap.productconfig.services.intf.ProductConfigurationPersistenceService persistenceService)
-
Constructor Details
-
CharacteristicValueRulesResultHandlerImpl
public CharacteristicValueRulesResultHandlerImpl()
-
-
Method Details
-
getRulesResultsByConfigId
Description copied from interface:CharacteristicValueRulesResultHandlerReturns the list of CharacteristicValueResultModel objects associated with given configuration id.- Specified by:
getRulesResultsByConfigIdin interfaceCharacteristicValueRulesResultHandler- Parameters:
configId- Configuration id- Returns:
- list of CharacteristicValueResultModel objects
-
deleteRulesResultsByConfigId
- Specified by:
deleteRulesResultsByConfigIdin interfaceCharacteristicValueRulesResultHandler- Parameters:
configId- Configuration id
-
mergeDiscountAndPersistResults
public void mergeDiscountAndPersistResults(CharacteristicValueRulesResultModel result, String configId) Description copied from interface:CharacteristicValueRulesResultHandlerPersists a CharacteristicValueRulesResult with the given data. Adds it to the list of rules result at the configuration model identified by given id. If a rules result already exists for the given characteristic/value pair the discount is added to the existing one. The discount sum cannot exceed 100%.- Specified by:
mergeDiscountAndPersistResultsin interfaceCharacteristicValueRulesResultHandler- Parameters:
result- to persistconfigId- id of the configuration to which this result belongs to
-
addMessageToRulesResult
public void addMessageToRulesResult(DiscountMessageRulesResultModel message, String configId, String csticName, String csticValueName) - Specified by:
addMessageToRulesResultin interfaceCharacteristicValueRulesResultHandler- Parameters:
message- discount message instanceconfigId- configuration idcsticName- name of cstic for which the message is persistetcsticValueName- name of cstic value for which the message is persistet - may be null
-
cloneMessageIfRequired
public DiscountMessageRulesResultModel cloneMessageIfRequired(DiscountMessageRulesResultModel message, boolean isFirst) -
createInstance
Description copied from interface:CharacteristicValueRulesResultHandlercreates an empty instance- Specified by:
createInstancein interfaceCharacteristicValueRulesResultHandler- Returns:
- a new instance
-
createMessageInstance
Description copied from interface:CharacteristicValueRulesResultHandlercreates an empty instance- Specified by:
createMessageInstancein interfaceCharacteristicValueRulesResultHandler- Returns:
- a new instance
-
addDiscount
protected void addDiscount(CharacteristicValueRulesResultModel newRulesResult, List<CharacteristicValueRulesResultModel> characteristicValueRulesResults) -
findResult
public List<CharacteristicValueRulesResultModel> findResult(String csticName, String csticValueName, List<CharacteristicValueRulesResultModel> characteristicValueRulesResults) -
calculateDiscount
-
copyAndPersistRuleResults
Description copied from interface:CharacteristicValueRulesResultHandlerCopies the CharacteristicValueRulesResult from the source ProductConfiguration and persists it for the target ProductConfiguration- Specified by:
copyAndPersistRuleResultsin interfaceCharacteristicValueRulesResultHandler- Parameters:
sourceConfigId- source configuration IdtargetConfigId- configuration Id
-
cloneRulesResultModelList
protected List<CharacteristicValueRulesResultModel> cloneRulesResultModelList(ProductConfigurationModel targetConfigModel, List<CharacteristicValueRulesResultModel> sourceRulesResultModelList) -
getModelService
protected de.hybris.platform.servicelayer.model.ModelService getModelService() -
setModelService
public void setModelService(de.hybris.platform.servicelayer.model.ModelService modelService) -
getPersistenceService
protected de.hybris.platform.sap.productconfig.services.intf.ProductConfigurationPersistenceService getPersistenceService() -
setPersistenceService
public void setPersistenceService(de.hybris.platform.sap.productconfig.services.intf.ProductConfigurationPersistenceService persistenceService)
-