java.lang.Object
com.adaptris.core.services.conditional.conditions.ConditionImpl
com.adaptris.core.scripting.services.conditional.conditions.ConditionFunction
All Implemented Interfaces:
ComponentLifecycle, Condition

@ComponentProfile(summary="Condition that makes use of the javascript scripting engine for condition evaluation", tag="condition,service") public class ConditionFunction extends ConditionImpl
A javascript condition.

This makes use of the Invocable extension to ScriptEngine, to allow you to define the function that will be executed to evaluate the condition. The function name should always be evaluateScript; take a single parameter (in this case it will be the current AdaptrisMessage; and return true or false. For instance to check a specific metadata value then you might have this function definition

 
     function evaluateScript(message) {
       return message.getMetadataValue('myMetadataKey').equals('myValue');
     }
 
 

Similar to EmbeddedScriptingService; the logger is bound as log.

In the adapter configuration file this class is aliased as function which is the preferred alternative to the fully qualified classname when building your configuration.

  • Constructor Details

    • ConditionFunction

      public ConditionFunction()
    • ConditionFunction

      public ConditionFunction(String func)
  • Method Details