Table of Contents |
---|
Overview
mod-gobi receives request from edge-orders and maps the XML received from GOBI to an order format the mod-orders supports.
Currently mod-gobi supports below order types:
- Listed Electronic Monograph
- Listed Electronic serial
- Listed Print Monograph
- Listed Print Serial
- Unlisted Print Monograph
- UnlistedPrint Serial
The fields received from GOBI need to be mapped to proper fields in orders. By default there are few fields supported by each order type and the mapping for each type is listed here:
https://github.com/folio-org/mod-gobi/tree/master/src/main/resources
Methods and fields to translate the specified type
Supported fields
Defined in the https://github.com/folio-org/mod-gobi/blob/master/src/main/resources/mapping.json → properties.field
How to use
Code Block | ||||
---|---|---|---|---|
| ||||
{
"field": "APPROVED",
"dataSource": {
"default": "true",
"translation": "toBoolean",
"translateDefault": true
}
} |
The body of the request could look like below with
- field: one of the defined field from https://github.com/folio-org/mod-gobi/blob/master/src/main/resources/mapping.json → properties.field
- dataSource.default: default value
- datasource.translation: defined and implemented method from https://github.com/folio-org/mod-gobi/blob/master/src/main/resources/mapping.json → properties.dataSource.properties.translation
Supported methods
Defined in the https://github.com/folio-org/mod-gobi/blob/master/src/main/resources/mapping.json → properties.dataSource.properties.translation
How to use
Update mapping for "Listed Print Monograph" → https://github.com/folio-org/mod-gobi/blob/master/src/main/resources/ListedPrintMonograph.json
Insert mapping configuration in the "mappings" of the https://github.com/folio-org/mod-gobi/blob/master/src/main/resources/ListedPrintMonograph.json
Code Block | ||||
---|---|---|---|---|
| ||||
{
"field": "EXPENSE_CLASS",
"dataSource": {
"from": "//LocalData[Description='LocalData5']/Value",
"default" : "unspecified",
"translation": "lookupExpenseClassId",
"translateDefault": true
}
}
|
The body of the request could look like below with
- field: one of the defined field from https://github.com/folio-org/mod-gobi/blob/master/src/main/resources/mapping.json → properties.field
- dataSource.from: XPath to the valuse from GOBI order
- datasource.translation: defined and implemented method from https://github.com/folio-org/mod-gobi/blob/master/src/main/resources/mapping.json → properties.dataSource.properties.translation
Customize order mappings
However, there are scenario when the library wants to specify their own mapping or default values for certain fields , instead of those specified in the module.
This can be achieved by specifying a custom mapping in mod-configuration.
Example Request
The body of the request could look like below with
...
Code Block |
---|
curl --request POST 'https://{okapiURL}/configurations/entries' \ --header 'Content-Type: application/json' \ --header 'x-okapi-token: {x-okapi-token}\ --data-raw '{ "module" : "GOBI", "configName" : "orderMappings", "code" : "gobi.order.ListedElectronicMonograph", "description" : "GOBI order mappings", "enabled" : true, "value" : "{\"orderType\":\"ListedElectronicMonograph\",\"mappings\":[{\"field\":\"CURRENCY\",\"dataSource\":{\"from\":\"//ListPrice/Currency\",\"default\":\"USD\"}},{\"field\":\"TITLE\",\"dataSource\":{\"from\":\"//datafield[@tag='\''245'\'']/*\",\"combinator\":\"concat\"}},{\"field\":\"LIST_UNIT_PRICE_ELECTRONIC\",\"dataSource\":{\"from\":\"//ListPrice/Amount\",\"default\":\"0\",\"translation\": \"toDouble\"}},{\"field\":\"PO_LINE_ESTIMATED_PRICE\",\"dataSource\":{\"from\":\"//NetPrice/Amount\",\"defaultMapping\": { \"dataSource\":{ \"from\": \"//ListPrice/Amount//EstPrice\",\"default\":\"15.0\",\"translation\": \"toDouble\",\"combinator\" : \"multiply\"}},\"translation\": \"toDouble\"}}]}" } ' |
Other points to note:
- By default there is no entry in mod-configuration, the default values used are stored inside the mod-gobi module
- No entry is necessary in mod-configuration if the default values are acceptable
- There should be one entry for each order type in order to override values
- If mod-configuration is not reachable for any reason while an order is being placed, the default rules are used to proceed with placing the order
...