Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This task evaluates a set of specified conditions, and if conditions are met, any task added under the "Then" branch are executed - otherwise any tasks added under the "Else" branch are executed.

Image Added

The main page of the task itself only contain the description, if you select "Conditions" in the tree, you can then specify any conditions that should be checked for.

Image Added

JSON Configuration

Below is a set of example configuration.

Code Block
languagejs
themeEclipse
{
  "class": "io.ceptor.pipeline.tasks.IfThenElseTask",
  "description": "If JSON input, validate it",
  "conditions.type": "and",
  "conditions": [{
    "deny": false,
    "values": ["application/json*"],
    "name": "content-type",
    "type": "header"
  }],
  "then": [], // List of tasks to execute if conditions are met
  "else": [] // Tasks executed if conditions are not met.
}

The conditions that can be specified are the same as the ones that can be specified for a location (see: Config - Locations ) - they are stored in the "conditions.type" and "conditions" attribute, where the type is "and" or "or", and each JSON Object in the conditions JSON Array contain a single condition.

The tasks under "then" are executed when the conditions are met, and those under "else" are executed if conditions were not met.