Submissions Object Model
Submit Status
SubmitStatus returned by submitBatch method is used to set submission and individual products statuses.
Statuses for all batches are automatically merged into single status event. Adapter can control aggregated status event status and message by providing custom implementation of SubmitStatusAggregationStrategy interface. By default Status which is highest in the hierarchy is chosen (i.e. Error if any of batches resulted in Error) and distinct messages are joined into single message (i.e. “All good.\nError!” if some batches resulted in “All good.” and some in “Error!”).
Property | Description |
---|---|
status | Submission status reported by adapter. Possible values are: Error, Pending, Sent, Success. Error (error() method in SubmitStatus) - denotes submission as “Failed” in submission log. In most cases submission should not recover from this state. Pending (pending() method in SubmitStatus) - denotes submission as “Pending” in submission log. This is not terminal state and should be later updated in Status-handling process. Success (success() method in SubmitStatus) - denotes submission as “Success” in submission log. Submission should not change this state. Subsequent changes of products' statuses should only be registered on single product level - see Status-handling process description for more details. |
message | Additional message visible in the “Additional details” of submission. |
fileKey | TODO |
items | Statuses for particular products. It is possible that some products are in error status while submission as a whole is successful - then submission will be marked as “Partial” in the submission log. Remember to return statuses for all products because otherwise submission will also be marked as “Partial”. |
Examples:
{
"status" : "Success",
"message" : "Products were submitted.",
"items" : [ ]
}
SubmitStatus submitStatus = SubmitStatus.success()
.withMessage("Products were submitted.")
.build();
Item Status
ItemStatus describes the status of a single product (not only in the context of a submission).
Property | Description |
---|---|
productId | PDX id of the product. |
externalProductId | Id of the product in the external system. If set will be visible in product details and available in Product for submission processing. If set it means that product was previously submitted. |
accountId | Account id for which status is registered. Product’s account id is stored in #Account-attribute . |
status | Product status reported by adapter. Possible values are: None, Pending, Sent, Error, Review, Success, Rejected, Returned. None is a special status which when sent will not change the current product status - useful if product status in PDX are not know. |
message | Additional message visible in the “Product details” of submission. If multiple messages are provided, they will all be listed. |
externalStatus | External statuses for external status attributes. |
files | TODO |
Examples:
{
"productId" : "1200983127222",
"externalProductId" : "1878902",
"accountId" : "default",
"status" : "Success",
"messages" : [ "this is an important message to supplier" ],
"channelProcessingStages" : [ "sent" ],
"externalStatus" : {
"WORKFLOW_STATE" : [ "STEP workflow state" ]
}
}
ItemStatus itemStatus = ItemStatus.accepted("1200983127222", "this is an important message to supplier")
.withExternalProductId("1878902")
.withAccountId("default")
.withExternalStatus("WORKFLOW_STATE", "STEP workflow state")
.withChannelProcessingStage("sent")
.build();
Product
Product object represents single product.
Property | Description |
---|---|
id | PDX owned product id. |
name | Product name - special attribute in PDX. |
externalId | Adapter owned product id. Is set by adapter by setting the externalProductId on ItemStatus in SubmitStatus event. |
categoryId | Id of the category where product belongs. |
familyId | Id of the product’s family. |
created | Date/time when product was created. |
attributes | Map of product’s attributes. Key in this map is PDX product id not the external id. Different attribute types are represented by sub-classes of the AbstractAttribute class. |
Attributes
Base class for all attribute types is AbstractAttribute. It defines two basic properties:
Property | Description |
---|---|
id | PDX attribute id (notice that it is not channel specific id - external id has to be looked up in the datastandard definition). |
disabled | Flag indicating that attribute is disabled - adapter can decide not to send disabled values. |
attrValue | Value of the attribute - different for each attribute type. |
Example:
{
"attributeType": "TextAttribute",
"id": "PRICE",
"disabled": false,
"value": "123.23",
"languageValue": {
"default": "123.23"
}
},
{
"attributeType": "MultiTextAttribute",
"id": "ACCOUNT_DISCRIMINATOR",
"disabled": false,
"value": [
"1234", "7891"
]
},
{
"attributeType": "TextAttribute",
"id": "DISABLED_ALWAYS",
"disabled": true,
"value": "DISABLED_ALWAYS"
}
Different Attribute types
Text Attribute
Implemented by TextAttribute represents simple text value.
Property | Description |
value | Text value of the attribute (Java type: String). |
Example:
{
"attributeType": "TextAttribute",
"id": "PRICE",
"disabled": false,
"value": "123.23",
"languageValue": {
"default": "123.23"
}
}
Multi-Text Attribute
Implemented by MultiTextAttribute represents list of simple text values.
Property | Description |
value | List of text values of the attribute (Java type: List). |
Example:
{
"attributeType": "MultiTextAttribute",
"id": "ACCOUNT_DISCRIMINATOR",
"disabled": false,
"value": [
"1234", "7891"
]
}
Asset Attribute
Implemented by AssetAttribute represents the single asset attribute which can contain various types of files.
Property | Description |
---|---|
value | PDX id of the asset. |
assetMetadata | Additional asset properties. |
id | PDX id of the asset. |
name | Name of the asset file. |
url | PDX asset url. |
externalUrl | External asset url (if asset was downloaded from url by PDX on import) or file name (if asset was uploaded to PDX). |
contentType | MIME type of the asset. |
height | Asset height - if possible to specify (i.e. for image/* MIME types). |
width | Asset width - if possible to specify (i.e. for image/* MIME types). |
Example:
{
"attributeType": "AssetAttribute",
"id": "ASSET_BRAND_LOGO",
"disabled": false,
"value": "40673de5-1fd3-42ec-873b-ab4aa124af79",
"assetMetadata": {
"id": "40673de5-1fd3-42ec-873b-ab4aa124af79",
"name": "11fa559e-3f63-5790-b08b-d67120bee658.jpg",
"url": "https://assets.s3.amazonaws.com/clientid/40673de5-1fd3-42ec-873b-ab4aa124af79/40673de5-1fd3-42ec-873b-ab4aa124af79.jpg",
"externalUrl": "11fa559e-3f63-5790-b08b-d67120bee658.jpg"
"contentType": "image/jpeg",
"height": 400,
"width": 400
}
}
Multi-Asset Attribute
Implemented by MultiAssetAttribute represents a list of assets.
Property | Description |
---|---|
value | List of PDX ids of the assets. |
assetsMetadata | List of assetMetadata (as described above) object of the assets. |
Composite Attribute
Implemented by CompositeAttribute represents more complicated structures consisting of other attributes - including other composites.
Property | Description |
---|---|
value | List of other attributes - including other composites. |
Multi-Composite Attribute
Implemented by MultiCompositeAttribute represents a list of composites.
Property | Description |
---|---|
value | List of composites. |
Updated over 1 year ago