Package com.im.df.api.support
Class CalculableGroovyTemplate
- java.lang.Object
-
- com.im.df.api.support.CalculableGroovyTemplate
-
- All Implemented Interfaces:
Calculable
,Scriptable
public class CalculableGroovyTemplate extends java.lang.Object implements Scriptable
Calculable with groovy support. format patter is groovy script where field values are represented by @@field_id@@- Author:
- pzajac
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CalculableGroovyTemplate.CalcOperation
static class
CalculableGroovyTemplate.FieldDetails
A CalculableGroovyTemplate argument.
-
Constructor Summary
Constructors Constructor Description CalculableGroovyTemplate(DFEntity ent, com.im.ijcs.api.ddl.dto.FieldInfo.Script script, java.util.Map<java.lang.String,CalculableGroovyTemplate.FieldDetails> varNameToField, java.lang.Class<?> returnType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addField(java.lang.String varNam, CalculableGroovyTemplate.FieldDetails field)
java.util.Map<java.lang.String,CalculableGroovyTemplate.FieldDetails>
getFieldsMapping()
Get parameters for groovy script.DFField[]
getParams()
com.im.ijcs.api.ddl.dto.FieldInfo.Script
getScript()
java.lang.Object
getTestValue(java.util.Map<java.lang.String,java.lang.Object> values)
Get values without reading data from database.DFWrappedValue
getValue(java.util.Map<java.lang.String,java.lang.Object> values)
-
-
-
Constructor Detail
-
CalculableGroovyTemplate
public CalculableGroovyTemplate(DFEntity ent, com.im.ijcs.api.ddl.dto.FieldInfo.Script script, java.util.Map<java.lang.String,CalculableGroovyTemplate.FieldDetails> varNameToField, java.lang.Class<?> returnType)
-
-
Method Detail
-
addField
public void addField(java.lang.String varNam, CalculableGroovyTemplate.FieldDetails field)
-
getValue
public DFWrappedValue getValue(java.util.Map<java.lang.String,java.lang.Object> values)
- Specified by:
getValue
in interfaceCalculable
-
getTestValue
public java.lang.Object getTestValue(java.util.Map<java.lang.String,java.lang.Object> values) throws javax.script.ScriptException
Get values without reading data from database. Used for validation.- Parameters:
values
- testing values- Returns:
- result from script execution
- Throws:
javax.script.ScriptException
- If the evaluation fails.
-
getScript
public com.im.ijcs.api.ddl.dto.FieldInfo.Script getScript()
- Specified by:
getScript
in interfaceScriptable
-
getFieldsMapping
public java.util.Map<java.lang.String,CalculableGroovyTemplate.FieldDetails> getFieldsMapping()
Get parameters for groovy script.- Returns:
- variable name to FieldsDetail map
-
getParams
public DFField[] getParams()
- Specified by:
getParams
in interfaceCalculable
- Returns:
- fields used in script.
-
-