Klasse FunctionStep

java.lang.Object
org.obrel.core.RelatedObject
org.obrel.core.SerializableRelatedObject
Alle implementierten Schnittstellen:
Serializable, org.obrel.core.Relatable

public class FunctionStep extends ProcessStep
A process step implementation that evaluates input parameters with a function and stores the resulting output value in a process parameter. All function steps inherently support a rollback of their execution. During a rollback the step will simply clear the output parameter where the previous execution had stored the result (if the output parameter is defined).

This class support both unary and binary functions. For the latter the step parameter FUNCTION_SECONDARY_INPUT refers to the parameter which contains with the second input value for the invocation of the method BinaryFunction.evaluate(Object, Object). If the secondary input parameter is not set a binary function will be invoked as a unary function, thus keeping any preset secondary input.

Attention: The relation types of the input and output parameters need to be stored in wildcard form to allow the use of arbitrary parameters. This means that no generic type checking is possible between the function and parameter types. Therefore the application code must make sure that the types of the parameters match that of the given function or else an exception will occur at runtime.

The following parameters are supported (r = required, o = optional):

  • FUNCTION (r): The function to be evaluated. If this is a binary function it will be applied to both the main and secondary input values.
  • FUNCTION_MAIN_INPUT(o): The type of the parameter containing the main input value (the left value for binary functions); if not set NULL will be used.
  • FUNCTION_SECONDARY_INPUT(o): The type of the parameter containing the secondary (right-side) input value for binary functions; if not set NULL will be used.
  • FUNCTION_OUTPUT (o): The type of the parameter to receive the function result; if not set the result will be ignored; if neither input nor output parameter are set an exception will be thrown.
Siehe auch:
  • Felddetails

    • FUNCTION

      public static final org.obrel.core.RelationType<de.esoco.lib.expression.Function<?,?>> FUNCTION
      The function to evaluate the input parameter with.
    • FUNCTION_MAIN_INPUT

      public static final org.obrel.core.RelationType<org.obrel.core.RelationType<?>> FUNCTION_MAIN_INPUT
      The process parameter containing the main (left) input value for the function.
    • FUNCTION_SECONDARY_INPUT

      public static final org.obrel.core.RelationType<org.obrel.core.RelationType<?>> FUNCTION_SECONDARY_INPUT
      The process parameter containing the secondary (right) input value for a binary function.
    • FUNCTION_OUTPUT

      public static final org.obrel.core.RelationType<org.obrel.core.RelationType<?>> FUNCTION_OUTPUT
      The process parameter to store the function result in.
  • Konstruktordetails

    • FunctionStep

      public FunctionStep()
      Creates a new instance.
  • Methodendetails

    • canRollback

      protected boolean canRollback()
      Overridden to always return TRUE.
      Setzt außer Kraft:
      canRollback in Klasse ProcessStep
      Gibt zurück:
      TRUE if the step implementation support a rollback
      Siehe auch:
    • execute

      protected void execute()
      Evaluates the value of the input parameter with the function and stores the result in the output parameter.
      Angegeben von:
      execute in Klasse ProcessStep
      Löst aus:
      ProcessException - If the function evaluation yields an exception
    • rollback

      protected final void rollback() throws Exception
      Removes the FUNCTION_OUTPUT parameter from the process.
      Setzt außer Kraft:
      rollback in Klasse ProcessStep
      Löst aus:
      Exception - Any exception may be thrown if the rollback fails
      Siehe auch: