Class 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
    • 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

      • 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 interface Scriptable
      • getFieldsMapping

        public java.util.Map<java.lang.String,​CalculableGroovyTemplate.FieldDetails> getFieldsMapping()
        Get parameters for groovy script.
        Returns:
        variable name to FieldsDetail map