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!”).

PropertyDescription
statusSubmission 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.
messageAdditional message visible in the “Additional details” of submission.
fileKeyTODO
itemsStatuses 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).

PropertyDescription
productIdPDX id of the product.
externalProductIdId 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.
accountIdAccount id for which status is registered. Product’s account id is stored in #Account-attribute .
statusProduct 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.
messageAdditional message visible in the “Product details” of submission. If multiple messages are provided, they will all be listed.
externalStatusExternal statuses for external status attributes.
filesTODO

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.

PropertyDescription
idPDX owned product id.
nameProduct name - special attribute in PDX.
externalIdAdapter owned product id. Is set by adapter by setting the externalProductId on ItemStatus in SubmitStatus event.
categoryIdId of the category where product belongs.
familyIdId of the product’s family.
createdDate/time when product was created.
attributesMap 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:

PropertyDescription
idPDX attribute id (notice that it is not channel specific id - external id has to be looked up in the datastandard definition).
disabledFlag indicating that attribute is disabled - adapter can decide not to send disabled values.
attrValueValue 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.

PropertyDescription
valueText 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.

PropertyDescription
valueList 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.

PropertyDescription
valuePDX id of the asset.
assetMetadataAdditional asset properties.
idPDX id of the asset.
nameName of the asset file.
urlPDX asset url.
externalUrlExternal asset url (if asset was downloaded from url by PDX on import) or file name (if asset was uploaded to PDX).
contentTypeMIME type of the asset.
heightAsset height - if possible to specify (i.e. for image/* MIME types).
widthAsset 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.

PropertyDescription
valueList of PDX ids of the assets.
assetsMetadataList 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.

PropertyDescription
valueList of other attributes - including other composites.

Multi-Composite Attribute

Implemented by MultiCompositeAttribute represents a list of composites.

PropertyDescription
valueList of composites.