org.openl.codegen.template.RuleService-RuntimeContextConvertor.vm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.openl.rules.gen Show documentation
Show all versions of org.openl.rules.gen Show documentation
OpenL Code generation project
#foreach( $contextPropertyDefinition in $contextPropertyDefinitions )
#if ($tool.getTypeName($contextPropertyDefinition.Type.InstanceClass).contains('org.openl.rules.enumeration'))
private static $tool.getTypeName($contextPropertyDefinition.Type.InstanceClass) convert$tool.formatAccessorName($contextPropertyDefinition.Name)($tool.getTypeName($contextPropertyDefinition.Type.InstanceClass).replaceAll('org.openl.rules.enumeration','org.openl.rules.ruleservice.context.enumeration') $contextPropertyDefinition.Name) {
if ($contextPropertyDefinition.Name == null) {
return null;
}
return ${tool.getTypeName($contextPropertyDefinition.Type.InstanceClass)}.fromString(${contextPropertyDefinition.Name}.toString());
}
#end
#end
public static org.openl.rules.context.IRulesRuntimeContext covert(org.openl.rules.ruleservice.context.IRulesRuntimeContext context) {
org.openl.rules.context.IRulesRuntimeContext rulesRuntimeContext = RulesRuntimeContextFactory.buildRulesRuntimeContext();
#foreach( $contextPropertyDefinition in $contextPropertyDefinitions )
#if ($tool.getTypeName($contextPropertyDefinition.Type.InstanceClass).contains('org.openl.rules.enumeration'))
rulesRuntimeContext.set$tool.formatAccessorName($contextPropertyDefinition.Name)(convert$tool.formatAccessorName($contextPropertyDefinition.Name)(context.get$tool.formatAccessorName($contextPropertyDefinition.Name)()));
#else
rulesRuntimeContext.set$tool.formatAccessorName($contextPropertyDefinition.Name)(context.get$tool.formatAccessorName($contextPropertyDefinition.Name)());
#end
#end
return rulesRuntimeContext;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy