Class DefaultAtpFormulaService
- java.lang.Object
-
- de.hybris.platform.warehousing.atp.formula.services.impl.DefaultAtpFormulaService
-
- All Implemented Interfaces:
AtpFormulaService
public class DefaultAtpFormulaService extends java.lang.Object implements AtpFormulaService
Default implementation ofAtpFormulaService
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringEXTERNALprotected static java.util.List<java.lang.String>operatorListprotected static java.lang.StringRETURNED
-
Constructor Summary
Constructors Constructor Description DefaultAtpFormulaService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendResults(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<java.lang.Long> results, java.lang.String atpFormulaVar, java.lang.reflect.Method method)Appends the result into the results object if the ATP var is part of the ATP formulaAtpFormulaModelcreateAtpFormula(AtpFormulaModel atpFormula)Creates anAtpFormulaModelvoiddeleteAtpFormula(java.lang.String formulaCode)Deletes anAtpFormulaModelfrom its code.java.util.Collection<AtpFormulaModel>getAllAtpFormula()Retrieves collection of allAtpFormulaModelin the system.AtpFormulaModelgetAtpFormulaByCode(java.lang.String formulaCode)Retrieves anAtpFormulaModelby its code.protected AtpFormulaDaogetAtpFormulaDao()protected java.util.Map<java.lang.String,java.lang.String>getAtpFormulaVar2ArithmeticOperatorMap()protected java.util.List<java.lang.Long>getAtpFormulaVariableValue(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<java.lang.Long> results, java.beans.PropertyDescriptor formulaVarPropDescriptor, AtpFormulaModel atpFormula)Gets the value for a specific atpformula variable namejava.lang.LonggetAtpValueFromFormula(AtpFormulaModel atpFormula, java.util.Map<java.lang.String,java.lang.Object> params)Retrieves the ATP value from a specific formulaprotected AvailableToPromiseDaogetAvailableToPromiseDao()protected BaseStoreServicegetBaseStoreService()protected ModelServicegetModelService()protected voidloopThroughAtpMethods(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<java.lang.Long> results, java.lang.String atpFormulaVar)Loops throughAvailableToPromiseDaomethods to aggregate values for ATP calculationvoidsetAtpFormulaDao(AtpFormulaDao atpFormulaDao)voidsetAtpFormulaVar2ArithmeticOperatorMap(java.util.Map<java.lang.String,java.lang.String> atpFormulaVar2ArithmeticOperatorMap)voidsetAvailableToPromiseDao(AvailableToPromiseDao availableToPromiseDao)voidsetBaseStoreService(BaseStoreService baseStoreService)voidsetModelService(ModelService modelService)AtpFormulaModelupdateAtpFormula(AtpFormulaModel atpFormula)Updates anAtpFormulaModelbased on its code
-
-
-
Field Detail
-
EXTERNAL
protected static final java.lang.String EXTERNAL
- See Also:
- Constant Field Values
-
RETURNED
protected static final java.lang.String RETURNED
- See Also:
- Constant Field Values
-
operatorList
protected static final java.util.List<java.lang.String> operatorList
-
-
Method Detail
-
getAtpFormulaByCode
public AtpFormulaModel getAtpFormulaByCode(java.lang.String formulaCode)
Description copied from interface:AtpFormulaServiceRetrieves anAtpFormulaModelby its code.- Specified by:
getAtpFormulaByCodein interfaceAtpFormulaService- Parameters:
formulaCode- The formula code for which we want to retrieve a specificAtpFormulaModel.- Returns:
- the corresponding
AtpFormulaModel.
-
getAllAtpFormula
public java.util.Collection<AtpFormulaModel> getAllAtpFormula()
Description copied from interface:AtpFormulaServiceRetrieves collection of allAtpFormulaModelin the system.- Specified by:
getAllAtpFormulain interfaceAtpFormulaService- Returns:
- the collection of all
AtpFormulaModel.
-
createAtpFormula
public AtpFormulaModel createAtpFormula(AtpFormulaModel atpFormula)
Description copied from interface:AtpFormulaServiceCreates anAtpFormulaModel- Specified by:
createAtpFormulain interfaceAtpFormulaService- Parameters:
atpFormula- The ATP formula to be created.- Returns:
- the created
AtpFormulaModel.
-
updateAtpFormula
public AtpFormulaModel updateAtpFormula(AtpFormulaModel atpFormula)
Description copied from interface:AtpFormulaServiceUpdates anAtpFormulaModelbased on its code- Specified by:
updateAtpFormulain interfaceAtpFormulaService- Parameters:
atpFormula- The ATP formula to be updated.- Returns:
- the up to date
AtpFormulaModel.
-
deleteAtpFormula
public void deleteAtpFormula(java.lang.String formulaCode)
Description copied from interface:AtpFormulaServiceDeletes anAtpFormulaModelfrom its code. Only possible if the formula is not assign to any base store- Specified by:
deleteAtpFormulain interfaceAtpFormulaService- Parameters:
formulaCode- The formula code that we want to delete
-
getAtpValueFromFormula
public java.lang.Long getAtpValueFromFormula(AtpFormulaModel atpFormula, java.util.Map<java.lang.String,java.lang.Object> params)
Description copied from interface:AtpFormulaServiceRetrieves the ATP value from a specific formula- Specified by:
getAtpValueFromFormulain interfaceAtpFormulaService- Parameters:
atpFormula- TheAtpFormulaModelfrom which we want to retrieve the ATP valueparams- The list ofStockLevelModelto gather in order to define the ATP value- Returns:
- the number of available item according to the params
-
getAtpFormulaVariableValue
protected java.util.List<java.lang.Long> getAtpFormulaVariableValue(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<java.lang.Long> results, java.beans.PropertyDescriptor formulaVarPropDescriptor, AtpFormulaModel atpFormula)Gets the value for a specific atpformula variable name- Parameters:
params- The parameters to apply to the method matching the name inAvailableToPromiseDaoresults- The list of results already found and to which the result must be addedformulaVarPropDescriptor- ThePropertyDescriptorfor AtpFormulaVariable's property for which the value is requestedatpFormula-- Returns:
- the complete list of values including the found value
-
loopThroughAtpMethods
protected void loopThroughAtpMethods(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<java.lang.Long> results, java.lang.String atpFormulaVar) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetExceptionLoops throughAvailableToPromiseDaomethods to aggregate values for ATP calculation- Parameters:
params- The parameters to apply to the method matching the name inAvailableToPromiseDaoresults- The list of results already found and to which the result must be addedatpFormulaVar- The Name of thePropertyDescriptorfor AtpFormulaVariable's property for which the value is requested- Throws:
java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetException
-
appendResults
protected void appendResults(java.util.Map<java.lang.String,java.lang.Object> params, java.util.List<java.lang.Long> results, java.lang.String atpFormulaVar, java.lang.reflect.Method method) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetExceptionAppends the result into the results object if the ATP var is part of the ATP formula- Parameters:
params- The parameters to apply to the method matching the name inAvailableToPromiseDaoresults- The list of results already found and to which the result must be addedatpFormulaVar- The Name of thePropertyDescriptorfor AtpFormulaVariable's property for which the value is requestedmethod- The method to invoke to retrieve the value to append- Throws:
java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetException
-
getAvailableToPromiseDao
protected AvailableToPromiseDao getAvailableToPromiseDao()
-
setAvailableToPromiseDao
public void setAvailableToPromiseDao(AvailableToPromiseDao availableToPromiseDao)
-
getBaseStoreService
protected BaseStoreService getBaseStoreService()
-
setBaseStoreService
public void setBaseStoreService(BaseStoreService baseStoreService)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getAtpFormulaDao
protected AtpFormulaDao getAtpFormulaDao()
-
setAtpFormulaDao
public void setAtpFormulaDao(AtpFormulaDao atpFormulaDao)
-
getAtpFormulaVar2ArithmeticOperatorMap
protected java.util.Map<java.lang.String,java.lang.String> getAtpFormulaVar2ArithmeticOperatorMap()
-
setAtpFormulaVar2ArithmeticOperatorMap
public void setAtpFormulaVar2ArithmeticOperatorMap(java.util.Map<java.lang.String,java.lang.String> atpFormulaVar2ArithmeticOperatorMap)
-
-