Transform Classes
Last updated
Last updated
It is possible to define any number and type of new transformation classes with specialized configurations. Rierino is shipped with the following default classes:
This class(com.rierino.handler.transform.AddToPayloadTransform) extends a selected payload element with a constant Json node provided as string.
element
Json path of payload element to create / extend
parameters
value
Json string to extend element with
{"test":false}
This class(com.rierino.handler.transform.JMESPayloadTransform) transforms event payload using a JMESPath pattern.
pattern
JMESPath pattern to calculate value
{language:parameters.language, currency:parameters.currency}
patternElement
Json path to payload element which defines JMESPath pattern to calculate value
parameters.pattern
extend
Whether calculated value should replace payload or extend it
true
store
Whether JMESPath expression should be cached for future executions (defaults to true)
false
inputElement
Json path for the input element to transform
parameters
outputElement
Json path to output calculated results
result
errorAs
Element to include error message on, if the pattern fails
error
This class(com.rierino.handler.transform.JMESArrayPayloadTransform) transforms array elements of an event payload using a JMESPath pattern with access to a parent data element as well (which is not supported by JMESPath out of box).
pattern
JMESPath pattern to calculate value
{parentValue: data.value, entryValue: entry.value}
patternElement
Json path to payload element which defines JMESPath pattern to calculate value
parameters.pattern
dataElement
Json path to payload element which will populate "data" field in JMES input
parameters.parent
arrayElement
Json path to payload element which is an array will populate "entry" field in JMES input with each of its entries
parameters.results
entryPath
Json path to extract specific element from array "entry" to simplify JMESPath patterns
data.main
filter
Whether JMESPath returns a boolean value for filtering arrayElement only (defaults to true)
false
excludeNulls
Whether null results should be excluded from JMESPath results (defaults to true)
false
outputElement
Json path to output results on event payload (null replaces arrayElement itself)
output
store
Whether JMESPath expression should be cached for future executions (defaults to true)
false
errorAs
Element to include error message on, if the pattern fails
error
This class(com.rierino.handler.transform.AddExpToPayloadTransform) adds the result of an expression to event payload.
element
Json path of payload element to use / extend
date
as
Json path to return results in (null for replacing element)
result
expression
Expression to execute
now
This transformation allows additional parameters based on the expression value:
Replaces given char sequence in element with a new char sequence.
target
Text to find
old
replacement
Text to replace with
new
Replaces all matchings of a regex in element with a new char sequence.
target
Regex to find
[0-9]
replacement
Text to replace with
0
Replaces named parameters found from a regex in element with given pattern.
target
Regex to find
/source/(?<folder>\\w+)/(?<file>\\w+)
replacement
Pattern to replace with
/target/${folder}/${file}
Returns substring from element.
beginIndex
Char index to start from
0
endIndex
Char index to end with (null means till the end)
5
Splits element into an array with a given delimiter.
delimiter
Regex delimiter to use
,
Joins an element array with a given delimiter.
delimiter
Delimiter to join elements
,
Concatenates element with a prefix and/or suffix.
prefix
Prefix to append
pre_
suffix
Suffix to append
_post
Performs a lookup for configuration parameter value - such as secrets or connection parameters.
parameter
Parameter reference
rierino.mongo.main.uri
type
Lookup/injection type (static, dynamic, both)
static
This class(com.rierino.handler.transform.LookupPayloadTransform) traverses a list of ids in event payload and enriches them with another list matching on ids.
lookup
Json path of payload element to lookup from
lookup
lookupId
Name of id fields in lookup array
id
traverse
Json traverse expression of payload element to enrich
list.*
traverseId
Name of id fields in traverse entries
id
as
Name of field to inject lookup values in traversed path (null for merged results)
-
This class(com.rierino.handler.transform.ScriptingPayloadTransform) allows using scripting languages to transform event payload.
script
Full scripting code returning output (or editing event payload directly)
value * 2
language
Scripting engine to use (if helperClass is not defined)
groovy
helperClass
Java class name for the scripting engine helper
com.rierino.handler.util.helper.JavaScriptHelper
nodePath
Json path to the input node in event payload
parameters
paramsPath
Key-value pairs for passing multiple variables from different Json paths
foo=data.in,bar=data.val
outputPath
Json path to output on event payload
data.output
This class(com.rierino.handler.transform.GenerateIDTransform) uses an ID generator to create a unique ID inside the payload.
element
Json path to add generated id on
id
generator
ID generator class
com.rierino.handler.util.generator.NumberIDGenerator
generatorId
assigned to generator
product_gen
version
ID generator version to use
1
*
All additional parameters that are applicable for the ID generator class
numberGenerator=com.rierino.handler.util.generator.EpochNumberGenerator
ID generators are cached inside GenerateIDTransform by generatorId value, so, parameter changes are not applied unless the service is restarted or version parameter value is updated. Both actions create a new instance of the generator.
This class(com.rierino.handler.transform.CopyInPayloadTransform) copies data from one section of payload to another.
from
Json path to copy from
parameters.filters
to
Json path to copy to
filters
move
Whether element should be moved instead of a copy
true
This class(com.rierino.handler.transform.ReducePayloadTransform) removes list of elements from event payload.
list
Comma separated list of Json paths to remove
product.metadata,product.internal
Thıs class(com.rierino.handler.transform.NoopTransform) performs no action on the event, and is typically used as a placeholder.
This class(com.rierino.handler.transform.AddErrorToPayloadTransform) copies event error details to event payload.
element
Json path of payload element to create / extend
error
This class(com.rierino.handler.transform.AddMetaToPayloadTransform) copies request metadata to event payload as "meta" element.
This class(com.rierino.handler.transform.AppendPartitionToPayloadTransform) appends partition digits from a payload element to another payload element. Typically used for creating a linked entity with the same partition as a master entity.
from
Json path for id to get partition digits from
guest.id
to
Json path to add partition digits to
basket.id
char
Delimiter before the partition digits
-
This class(com.rierino.handler.transform.EventParameterToPayloadTransform) copies list of elements from full event contents to payload. Parameters defined for this transform step act as key value pairs, where keys are the target payload paths and values are the event source content paths (e.g. sessionId=requestMeta.sessionId).
This class(com.rierino.handler.transform.RequestIdToPayloadTransform) adds requestId to event payload.
element
Json path of payload element to create / extend
requestId
This class(com.rierino.handler.transform.SetResultTransform) resets the result data of an event, typically used for returning specific contents in case of an error.
status
Result status to set for the event
FAIL
errorPattern
JMES pattern to apply on event payload to return error contents
{"failId": id}
errorCode
Error code to return for the event
123
errorMessage
Error message to return for the event
Could not find requested id
errorHttp
Http error code to return for the event
404
This class(com.rierino.handler.transform.AddClaimsToPayloadTransform) adds claims from request metadata (if configured in gateway token) to event payload.
element
Json path of payload element to create / extend (claims as default)
user