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 |
---|---|---|---|
| String | Type of the step | true |
| String | Name of the step | true |
| String | Type of the mapper used to process data. The mapper type should be always | true |
| String | Placeholder of the mapper to use in the definition file. For simplicity use always | true |
| Array of strings | Connection type supported by the General Mapper step. In the step.json above only | true |
| Array of strings | Connection type supported by the General Mapper step. In the step.json above only | true |
| Object | This uses the same approach as Integration Mapper. Placeholders store the Pricefx connection data filled in by the user in UI. Parameters:
|
|
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}}&uri={{general-api.sourceUri}}&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}}&connection={{general-api.targetConnection}}&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&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:
Automatic – You do not need to provide metadata, everything is already in the selected configuration.
Semi-automatic – You need to provide metadata, however fields are already defined in the configuration. Only types/constraints are taken from the metadata.
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:
|
f
PlatformManager version 1.75.0