Integrate Mapper

The integrate command performs an upsert operation of selected backend objects. This operation is not available for all types of objects. This command is particularly useful in a situation where the caller does not (and should not) know about typed IDs and other “internal” data fields, i.e. typically in an integration scenario. The only mandatory pre-requisite for this command is that the object’s defined business key fields (vary per object type) are present in every request. No type ID or version fields are required. This also means that no version checking is performed, thus the request will overwrite existing data of that record regardless of other changes.

Attribute

Description

Attribute

Description

includeUnmappedProperties

Sets implicit mapping for each attribute. It simplifies mapping because you do not need to define each attribute. If it is set to true, the mapper will map all keys included in the provided model.

If you want to override the implicit mapping of an attribute by explicit mapping, add the attribute name into excludeProperties.

excludeProperties

Defines a set of properties that should be excluded from mapping. It is used together with includeUnmappedProperties=true

Multiple excluded properties are written as a comma-separated list.

Note that the format slightly differs among different IM versions:

<pfx:loadMapper id="mapper" excludeProperties="attribute2,attribute3" includeUnmappedProperties="true"/>
<pfx:loadMapper id="mapper" excludeProperties="#{'attribute2,attribute3'.split(',')}" includeUnmappedProperties="true"/>

convertEmptyStringToNull (since 1.1.2)

Converts all empty strings to null values. It is handy when you send data to Pricefx: if you send an empty value, the filter # in Pricefx UI does not work and also the Groovy logic mainly operates with nulls instead of "".

includeNulls (since 2.6.3)

Allows null values to be forwarded to the payload of the integrate request in order to update a field to null value. To set this behavior globally for the integrate method, just set the IM property integration.components.api.integrate.includeNulls to true.

 

Element

Description

Element

Description

body

Maps a value from the body.

This example converts the input property 'material' into output property 'sku':

<body in="material" out="sku" />

When use the predicate attribute, the record will be updated only if the provided condition is valid.

<integrateMapper id="mapper"> <body in="inAttribute1"/> <body in="inAttribute2" out="outAttribute2"/> <body in="inAttribute3" out="outAttribute3" predicate="predicateExpression"/> <simple expression="simple_expression" out="outAttribute5"/> <groovy expression="groovy_expression" out="outAttribute6"/> </integrateMapper>

simple

Evaluates a simple language expression.

In this example we do same operation like in the body example:

<simple expression="${body[material]} out="sku" />

groovy

Evaluates a Groovy language expression. Expressions can contain any Groovy code.

In this example we do same operation like in the body and simple examples:

<groovy expression="body.material" out="sku"/>

In the Groovy context, the following properties are available by default:

  • exchange

  • headers

  • body

It is also possible to get the record index (zero-based) from the exchange properties like this:

<groovy expression="exchange.properties.PfxRecordIndex" out="attribute9"/>

header

Maps a value from the message header. This example takes the header parameter with the name 'messageId' and puts 'messageId' into the message:

<header in="messageId" out="message"/>

property

Maps a value from the exchange property:

<property in="userName" out="username"/>

Each element can also have the converter attribute which converts data to the required format or type. 

IntegrationManager version 5.8.0