Gets/lists entities from the external system.
Properties
|
Option |
Type |
Default |
Description |
|---|---|---|---|
|
|
String |
|
Defines a connection to the target system. Another way to define the connection is to specify the |
|
|
String |
|
Defines the URL of the target system. Use if the connection is not specified. |
|
|
String |
|
Defines the username for authentication. Use if the connection is not specified. |
|
|
String |
|
Defines the password for authentication. Use if the connection is not specified. |
|
|
String |
|
Defines the entity type. |
|
|
String |
|
Defines the entity identifier. Mandatory for the update/delete methods. Optional for the read method. |
|
|
String |
* |
Specifies a subset of the entity properties that should be returned back. If not specified, all properties are selected. It is a comma-separated list. E.g. |
|
|
String |
|
A predicate expression that selects only entities which match the expression. E.g.
|
|
|
String |
|
Determines what values are used to order a collection of selected entities. E.g. |
|
|
Integer |
|
Defines the number of records to skip (from the beginning). If defined, the selected collection skips the first N entities and returns just the remaining subset. |
|
|
Integer |
|
Defines the number of records to include (from the beginning). If defined, just the first N entities from the selected collection are selected. |
|
|
String |
none |
Supported values are:
|
Examples
Search for entities and load them into Pricefx:
<route id="sap4hana-list-with-connection">
<from uri="timer:in?repeatCount=1&delay=5000"/>
<to uri="pfx-odata2://read?entity=A_CreditMemoRequest&$select=CreditMemoRequest,TransactionCurrency,TotalNetAmount,CreditMemoRequestType,PricingDate,CreditMemoRequestDate&$filter=TransactionCurrency eq 'USD' and OverallSDProcessStatus eq 'A'&$orderby=CreditMemoRequest desc&$top=1&$skip=0&connection=cognitus"/>
<to uri="pfx-api:loaddata?objectType=P&connection=aperture-labs&mapper=pfimcore354"/>
</route>
Authenticate using serviceUrl and credentials in URI:
<route id="sap4hana-list-with-properties-connection-details">
<from uri="timer:in?repeatCount=1&delay=5000"/>
<to uri="pfx-odata2://read?entity=A_CreditMemoRequest&$select=CreditMemoRequest,TransactionCurrency,TotalNetAmount,CreditMemoRequestType,PricingDate,CreditMemoRequestDate&$filter=TransactionCurrency eq 'USD' and OverallSDProcessStatus eq 'A'&$orderby=CreditMemoRequest desc&$top=1&$skip=0&serviceUrl={{sap.url}}&username={{sap.username}}&password={{sap.password}}"/>
<to uri="pfx-api:loaddata?objectType=P&connection=aperture-labs&mapper=pfimcore354"/>
</route>
Search for an entity defined by a single ID:
<route id="sap4hana-get">
<from uri="timer:in?repeatCount=1&delay=5000"/>
<setHeader headerName="PfxOpenData2.id"><constant>60000001</constant></setHeader>
<to uri="pfx-odata2://read?entity=A_CreditMemoRequest&connection=cognitus"/>
<to uri="pfx-api:loaddata?objectType=P&connection=aperture-labs&mapper=pfimcore354"/>
</route>
Search for an entity defined by a composite ID:
<route id="sap4hana-get-with-composite-id">
<from uri="timer:in?repeatCount=1&delay=5000"/>
<setHeader headerName="PfxOpenData2.id"><groovy>['CreditMemoRequest':'60000001','CreditMemoRequestItem':'10']</groovy></setHeader>
<to uri="pfx-odata2://read?entity=A_CreditMemoRequestItem&connection=cognitus"/>
<to uri="pfx-api:loaddata?objectType=P&connection=aperture-labs&mapper=pfimcore354"/>
</route>
Batch read and upload to Pricefx:
<route id="sap4hana-batch-read" autoStartup="true">
<from uri="timer:in?repeatCount=1&delay=5000"/>
<!-- Read with option '$inlinecount=allpages' that returns count of all records along with first batch -->
<to uri="pfx-odata2://read?entity=A_CreditMemoRequest&$skip=0&$top=0&$inlinecount=allpages&connection=cognitus"/>
<log message="Detected [${headers['PfxOpenData2.$inlinecount']}] records." />
<!-- Set batch size -->
<setHeader headerName="$top"><constant>4</constant></setHeader>
<loop doWhile="true">
<groovy>headers['PfxOpenData2.$inlinecount'] > (exchange.getProperty('CamelLoopIndex', 0, Integer) + 1) * headers.$top.toInteger()</groovy>
<setHeader headerName="$skip"><groovy>exchange.getProperty('CamelLoopIndex', 0, Integer) * headers.$top.toInteger()</groovy></setHeader>
<log message="Batch [#${exchangeProperty.CamelLoopIndex}]. Fetching [${header.$top}] elements form index [${header.$skip}]. "/>
<to uri="pfx-odata2://read?entity=A_CreditMemoRequest&connection=cognitus"/>
<log message="Processing ${body}"/>
<to uri="pfx-api:loaddata?objectType=P&connection=aperture-labs&mapper=pfimcore354"/>
</loop>
<log message="Job done. Fetched [${headers['PfxOpenData2.$inlinecount']}] in [${exchangeProperty.CamelLoopIndex} + 1)] batches with size [${header.$top}]."/>
</route>