Class DefaultRuleCompilerContext
- java.lang.Object
-
- de.hybris.platform.ruleengineservices.compiler.impl.DefaultRuleCompilerContext
-
- All Implemented Interfaces:
RuleCompilerContext
public class DefaultRuleCompilerContext extends java.lang.Object implements RuleCompilerContext
Default implementation ofRuleCompilerContext.
-
-
Constructor Summary
Constructors Constructor Description DefaultRuleCompilerContext(RuleCompilationContext ruleCompilationContext, AbstractRuleModel rule, java.lang.String moduleName, RuleIrVariablesGenerator variablesGenerator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFailureException(java.lang.Exception exception)voidaddProblem(RuleCompilerProblem problem)Adds a problem arose during compilation process to the list.RuleIrLocalVariablesContainercreateLocalContainer()A shortcut toRuleIrVariablesGenerator.createLocalContainer().java.lang.StringgenerateLocalVariable(RuleIrLocalVariablesContainer container, java.lang.Class<?> type)java.lang.StringgenerateVariable(java.lang.Class<?> type)A shortcut toRuleIrVariablesGenerator.generateVariable(Class).java.util.Map<java.lang.String,RuleActionDefinitionData>getActionDefinitions()Returns action definitions for rulejava.util.Map<java.lang.String,java.lang.Object>getAttributes()Returns a mutableMapthat can be used to store attributes associated with thisRuleCompilerContext.java.util.Map<java.lang.String,RuleConditionDefinitionData>getConditionDefinitions()Returns condition definitions for rulejava.util.List<java.lang.Exception>getFailureExceptions()Returns all failure causing exceptions for thisRuleCompilerContext.java.lang.StringgetModuleName()Returns the rules module name.java.util.List<RuleCompilerProblem>getProblems()Returns all problems arose during compilation process.AbstractRuleModelgetRule()Returns the rule.RuleCompilationContextgetRuleCompilationContext()get Rules compilation context for a given compilationjava.util.List<RuleConditionData>getRuleConditions()Returns rule conditions for rulejava.util.List<RuleParameterData>getRuleParameters()Returns the rule parameters.longgetRuleVersion()Returns the rule version.RuleIrVariablesGeneratorgetVariablesGenerator()Returns the variables generator valid for this compiler context.voidsetRuleVersion(long version)Provides means of setting engine version of the rule.
-
-
-
Constructor Detail
-
DefaultRuleCompilerContext
public DefaultRuleCompilerContext(RuleCompilationContext ruleCompilationContext, AbstractRuleModel rule, java.lang.String moduleName, RuleIrVariablesGenerator variablesGenerator)
-
-
Method Detail
-
getRule
public AbstractRuleModel getRule()
Description copied from interface:RuleCompilerContextReturns the rule.- Specified by:
getRulein interfaceRuleCompilerContext- Returns:
- rule
-
getModuleName
public java.lang.String getModuleName()
Description copied from interface:RuleCompilerContextReturns the rules module name.- Specified by:
getModuleNamein interfaceRuleCompilerContext- Returns:
- rules module name
-
getRuleParameters
public java.util.List<RuleParameterData> getRuleParameters()
Description copied from interface:RuleCompilerContextReturns the rule parameters.- Specified by:
getRuleParametersin interfaceRuleCompilerContext- Returns:
- The rule parameters
-
getVariablesGenerator
public RuleIrVariablesGenerator getVariablesGenerator()
Description copied from interface:RuleCompilerContextReturns the variables generator valid for this compiler context.- Specified by:
getVariablesGeneratorin interfaceRuleCompilerContext- Returns:
- the variables generator
-
generateVariable
public java.lang.String generateVariable(java.lang.Class<?> type)
Description copied from interface:RuleCompilerContextA shortcut toRuleIrVariablesGenerator.generateVariable(Class).- Specified by:
generateVariablein interfaceRuleCompilerContext- Parameters:
type- - the type- Returns:
- the name of the variable
-
createLocalContainer
public RuleIrLocalVariablesContainer createLocalContainer()
Description copied from interface:RuleCompilerContextA shortcut toRuleIrVariablesGenerator.createLocalContainer().- Specified by:
createLocalContainerin interfaceRuleCompilerContext- Returns:
- the current container
-
generateLocalVariable
public java.lang.String generateLocalVariable(RuleIrLocalVariablesContainer container, java.lang.Class<?> type)
Description copied from interface:RuleCompilerContext- Specified by:
generateLocalVariablein interfaceRuleCompilerContexttype- - the type- Returns:
- the name of the variable
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Description copied from interface:RuleCompilerContextReturns a mutableMapthat can be used to store attributes associated with thisRuleCompilerContext.- Specified by:
getAttributesin interfaceRuleCompilerContext- Returns:
- the map containing the attributes
-
addFailureException
public void addFailureException(java.lang.Exception exception)
-
getFailureExceptions
public java.util.List<java.lang.Exception> getFailureExceptions()
Description copied from interface:RuleCompilerContextReturns all failure causing exceptions for thisRuleCompilerContext.- Specified by:
getFailureExceptionsin interfaceRuleCompilerContext
-
getProblems
public java.util.List<RuleCompilerProblem> getProblems()
Description copied from interface:RuleCompilerContextReturns all problems arose during compilation process.- Specified by:
getProblemsin interfaceRuleCompilerContext
-
addProblem
public void addProblem(RuleCompilerProblem problem)
Description copied from interface:RuleCompilerContextAdds a problem arose during compilation process to the list.- Specified by:
addProblemin interfaceRuleCompilerContext
-
getConditionDefinitions
public java.util.Map<java.lang.String,RuleConditionDefinitionData> getConditionDefinitions()
Description copied from interface:RuleCompilerContextReturns condition definitions for rule- Specified by:
getConditionDefinitionsin interfaceRuleCompilerContext
-
getActionDefinitions
public java.util.Map<java.lang.String,RuleActionDefinitionData> getActionDefinitions()
Description copied from interface:RuleCompilerContextReturns action definitions for rule- Specified by:
getActionDefinitionsin interfaceRuleCompilerContext
-
getRuleConditions
public java.util.List<RuleConditionData> getRuleConditions()
Description copied from interface:RuleCompilerContextReturns rule conditions for rule- Specified by:
getRuleConditionsin interfaceRuleCompilerContext
-
getRuleCompilationContext
public RuleCompilationContext getRuleCompilationContext()
Description copied from interface:RuleCompilerContextget Rules compilation context for a given compilation- Specified by:
getRuleCompilationContextin interfaceRuleCompilerContext- Returns:
- instance of
RuleCompilationContext
-
getRuleVersion
public long getRuleVersion()
Description copied from interface:RuleCompilerContextReturns the rule version.- Specified by:
getRuleVersionin interfaceRuleCompilerContext- Returns:
- engine rule version
-
setRuleVersion
public void setRuleVersion(long version)
Description copied from interface:RuleCompilerContextProvides means of setting engine version of the rule.- Specified by:
setRuleVersionin interfaceRuleCompilerContext- Parameters:
version- - engine rule version
-
-