Merging data obtained from the From port into a complete item

The Retail_Item business object that the ItemCollector collaboration object receives on its From port might not be complete. The updated data contained in this incomplete item must be merged into the original, complete Retail_Item business object that exists in a local item store.

Flow

The ItemCollector collaboration object retrieves the copy of the Retail_Item from the local item store by sending the business object and a Retrieve verb to its local_store port to be passed to an ItemStore collaboration object, which actually retrieves the item and returns it to the ItemCollector collaboration object.

The ItemCollector collaboration object obtains the internals.correlationID value from the orginal Retail_Item saved in the ItemStore and copies it to the Retail_Item returned from the approval process. The value is copied into the internals.originalCorrelationID attribute of the Retail_Item. This value can be used by the Message Manager collaborations to access a corresponding MessageStore message.

The collaboration object checks if the original Retail_Item retrieved from the item store database contains cascaded GLNs. It then directs processing, as follows:
  • If the Retail_Item does not contain cascaded GLNs, the collaboration object merges the new data received from the WebSphere® MQ Workflow process into the Retail_Item business object that was read from the item store. See Merging static data by using the x_COPY ATTRIBUTE configuration properties: and Merging missing data by using the MISSING_DATA_CHILD_ATTRIBUTE configuration property for more information about merging.
    Note: If the business object does not have all the required data, causing the ItemValidation collaboration object to invoke a custom missing data retrieval process, it is at this point that this retrieval process would call an instance of an ItemCollector collaboration object to merge the retrieved data into the complete Retail_Item business object.
    The merged Retail_Item business object is routed to a Process_Reviewed_Item collaboration object via the ItemCollector collaboration object’s To port.
  • If the Retail_Item does contain cascaded GLNs, the collaboration object loops through the GLNs processing each one, as follows:
    1. It retrieves the copy of the Retail_Item that was stored by the ItemDispatcher collaboration object from the item store database by sending the business object and a Retrieve verb to its local_store port to be passed to an ItemStore collaboration object. The key used to access the item is the concatenation of the internals.correlationID attribute value of the original triggering business object and the internals.cascadedGlns.gln attribute value for the GLN being processed. The copy is returned to the collaboration object on its local_store port.
    2. The ItemCollector collaboration object merges the new data received from the WebSphere MQ Workflow process into the Retail_Item business object retrieved from the item store. Merging static data by using the x_COPY ATTRIBUTE configuration properties: and Merging missing data by using the MISSING_DATA_CHILD_ATTRIBUTE configuration property discuss merging.
      Note: If the business object does not have all the required data, causing the ItemValidation collaboration object to invoke a custom missing data retrieval process, this retrieval process calls an instance of an ItemCollector collaboration object to merge the retrieved data into the complete Retail_Item business object.
    3. The ItemCollector collaboration object obtains the internals.correlationID value from the orginal Retail_Item saved in the ItemStore and copies it to the Retail_Item returned from the approval process. The value is copied into the internals.originalCorrelationID attribute of the Retail_Item. This value can be used by the Message Manager collaborations to access a corresponding MessageStore message.
    4. The ItemCollector collaboration object then handles the business object according to its status value, as follows:
      • If the status value of the internals.cascadedGlns.item_status attribute is either Approved or Rejected, the merged Retail_Item business object is routed to a Process_Reviewed_Item collaboration object via the ItemCollector collaboration object’s To port.
      • If the status value of the internals.cascadedGlns.item_status attribute is Review or Accepted, the internals.cascadedGlns child business object is added to an array, as follows:
        • If the status is Review, it is added to an array of review cascaded GLNs.
        • If the status is Accepted, it is added to an array of accepted cascaded GLNs.
        Note: If the cascaded GLN is not the first GLN in its respective array, the ItemCollector collaboration object deletes the copy of the Retail_Item that was stored by the ItemDispatcher collaboration object from the item store database by sending the business object and a Delete verb to its local_store port to be passed to an ItemStore collaboration object. The key used to access the item is the concatenation of the internals.correlationID attribute value of the original triggering business object and the internals.cascadedGlns.gln attribute value of the newly created business object.
    5. After all of the cascaded GLNs are processed, all the GLNs with a status of Review are sent as a group by copying the array of review cascaded GLNs into the internals.cascadedGlns attribute, to a Process_Reviewed_Item collaboration object via the ItemCollector collaboration object’s To port. Similarly, all GLNs with a status of Accepted are sent as a group by copying the array of accepted cascaded GLNs into the internals.cascadedGlns attribute, to a Process_Reviewed_Item collaboration object via the ItemCollector collaboration object’s To port.
    6. The ItemCollector collaboration object calculates how many total cascaded GLNs have completed processing (that is, they have Approved, Rejected, or Error status). If all of the cascaded GLNs from the original message that was sent to the ItemDispatcher collaboration object have completed processing, it does the following:
      1. The ItemCollector collaboration object sets the Retail_Item attribute internals.lastCascadedGLN to true. The Message Manager collaboration can use this attribute to determine that all of the cascaded GLNs from the orginal Retail_Item have been processed and that, therefore, any MessageStore message can now be deleted. If all of the cascaded GLNs have not completed processing ItemCollector sets internals.lastCascadedGLN to false.
      2. Deletes the copy of the Retail_Item that was stored by the ItemValidation collaboration object from the item store database by sending the business object and a Delete verb to its local_store port to be passed to an ItemStore collaboration object, which performs the deletion. The key used to access the item is the internals.correlationID attribute value of the original triggering business object.

Parent topic: Overall process logic