General Mapper

General Mapper extends behavior of Integration Templates with several features described below.

step.json Example

This is a valid example of use of General Mapper. Feel free to add more steps if needed.

{ "steps": [ { "type": "integration-init", "name": "basic", "occurrence": "many" }, { "type": "general-mapper", "name": "general-mapper", "mapperType": "multilevelMapper", "mapperPlaceholder": "mapper", "sourceConnectionTypes": ["BasicConnection", "OAuth2Connection"], "targetConnectionTypes": ["PriceFxClient"], "placeholders": [ { "name": "pfx-api.settings", "params": [ "objectType", "pricingParameterName", "pricingParameterId", "dsUniqueName" ] }, { "name": "general-api.targetUri", "valueParam": "targetUri" }, { "name": "general-api.sourceUri", "valueParam" : "sourceUri" }, { "name": "general-api.sourceConnection", "valueParam" : "sourceConnection" }, { "name": "general-api.targetConnection", "valueParam" : "targetConnection" }, { "name": "general-api.sourceMetadataUri", "valueParam" : "sourceMetadataUri" } ] }, { "type": "deploy-integration", "name": "deploy-integration" } ] }

General Mapper Step Fields

Attribute name

Type

Description

Required

Attribute name

Type

Description

Required

type

String

Type of the step

true

name

String

Name of the step

true

mapperType

String

Type of the mapper used to process data.

The mapper type should be always "multilevelMapper" to ensure correct functioning of General Mapper.

true

mapperPlaceholder

String

Placeholder of the mapper to use in the definition file.

For simplicity use always "mapper".

true

sourceConnectionTypes

Array of strings

Connection type supported by the General Mapper step.
In this field, we restrict the supported connection for input. You can provide an empty array, so a user can use all connections available in IntegrationManager.

In the step.json above only "BasicConnection" and "OAuth2Connection" are allowed.

true

targetConnectionTypes

Array of strings

Connection type supported by the General Mapper step.
In this field, we restrict the supported connection for output. You can provide an empty array, so a user can use all connections connections available in IntegrationManager.

In the step.json above only "BasicConnection" and "PriceFxClient" are allowed.

true

placehoders

 

Object

This uses the same approach as Integration Mapper.

Placeholders store the Pricefx connection data filled in by the user in UI.

Parameters:

  • Used only for PriceFxClient

    • objectType – PFX entity type

    • pricingParameterName – Record name of PP table

    • pricingParameterId – Record ID of PP table

    • dsUniqueName – Name of PFX data source you want load the data from

    • Parameters are used as an unfolded array like this pfx-api.settings

  • valueParam – Used for general REST calls

    • general-api.sourceConnection – Source connection defined in the UI

    • general-api.targetConnection – Target connection defined in the UI

    • general-api.sourceUri – Specified source URI

    • general-api.targetUri - Specified target URI

    • general-api.sourceMetadataUri - Specified metadata URI.

 

Example of Placeholders Use in Route Definition

<route id="${placeholder}"> <from uri="timer://fooAdasdaDAdadasd?repeatCount=1"/> <!-- Get last synchronization timestamp from PriceFx config and create 'where' clause for Salesforce --> <log message="Retrieving last account synchronization timestamp"/> <to uri="pfx-config:get?name=synchronize.account.sf.to.pfx.timestamp"/> <log message="Last account synchronization timestamp from config = ${body}"/> <choice> <when> <simple>${body} == null</simple> <log message="Last account synchronization timestamp from config is empty, all Accounts will be fetched from Salesforce"/> </when> <otherwise> <setHeader name="lastModifiedDateWhereClause"> <groovy>' and LastModifiedDate>'+request.body</groovy> </setHeader> </otherwise> </choice> <!-- Get data from Salesforce, using 'where' clause defined in previous step --> <log message="Getting data from Salesforce"/> <!-- The '%20' character must be included on every new line in multiline query --> <toD uri="pfx-rest:get?connection={{general-api.sourceConnection}}&amp;uri={{general-api.sourceUri}}&amp;q= select id %20 from Account%20 where IsDeleted=false${header.lastModifiedDateWhereClause}"/> <log message="Response from Salesforce = ${body}"/> <!-- Load Accounts from Salesforce to PriceFx --> <to uri="pfx-json:unmarshal"/> <setBody> <simple>${body[records]}</simple> </setBody> <log message="Loading data to PriceFx, body = ${body}"/> <to uri="pfx-api:loaddata?{{pfx-api.settings}}&amp;connection={{general-api.targetConnection}}&amp;mapper={{mapper}}"/> <log message="Data loaded, response = ${body}"/> <!-- Set synchronization timestamp in PriceFx config after finished load --> <setHeader name="lastSynchronizeTimestamp"> <!-- Salesforce keeps all dates in UTC zone --> <groovy>new Date().format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone('UTC'))</groovy> </setHeader> <toD uri="pfx-config:set?name=synchronize.account.sf.to.pfx.timestamp&amp;value=${header.lastSynchronizeTimestamp}"/> </route>

Supported Connection Types

  • JwtConnection

  • BasicConnection

  • OAuth2Connection

  • PriceFxClient

  • NoopConnection

  • SftpConnection

 

Metadata Options

There are three options how to create a mapper from metadata:

  1. Automatic – You do not need to provide metadata, everything is already in the selected configuration.

  2. Semi-automatic – You need to provide metadata, however fields are already defined in the configuration. Only types/constraints are taken from the metadata.

  3. Manual – You need to provide metadata which will be used. The configuration contains a Groovy section called transformer, which transforms expected metadata into an internal representation which is later shown to the user in the mapping area.

Example

Let’s assume we want to fetch data to Pricefx using a general mapper and our metadata are in the file.

 

Shows standard processing of General Mapper with a snippet of uploaded metadata (on the left side) and a snippet of selected configuration (on the right side). The metadata fetching is semi-automatic here.

Options:

  • Connection From – Name of the connection to the source system.

  • Configuration – Defined in IntegrationManager and maintained by the template team. Users only select the configuration that matches the metadata.

  • Connection URI – URI from which the actual data is fetched. The URI is relative to base URL of the connection (e.g. /api/opportunity/MyOpp).

  • Advanced Options – This option is used when the metadata are not defined statically in the configuration but you need to fetch them otherwise.

  • Metadata URI – If your metadata are located on the internet or other URI location (e.g. SFTP), put the URI here. The URI is relative to base URL of the connection (e.g. /services/v48/opportunity/describe).

  • Metadata file drop – Very useful when you have metadata somewhere else or in the file and you want to use them. You just drag-and-drop them into the area and the metadata will be loaded from the file. You must provide metadata according to the selected configuration. Otherwise, if you provide different metadata, the configuration’s transformer would not be able to process them right. You should be guided by the configuration name – in the example, we expect ‘opportunity’ in version ‘48’ for Salesforce – you should provide such metadata.

  • Mapper section – In the mapping section you should select left and right columns based on the metadata (left) and Pricefx (right).

  • Other options are standard mapper options described above.

 

 

 

 

 

 

 

f

PlatformManager version 1.75.0