Merging data into a complete item

Describes the operation of the an ItemCollector collaboration object, which builds a complete business object by merging partial business objects containing updated information into a complete copy of the business object retrieved from a local item store.

Related collaboration templates and business objects

See the following related collaboration templates for more information: See the following related business object for more information:

Description

The Retail_Item business object passed to an ItemCollector collaboration object might not be complete. The updated data contained in this incomplete item must be merged into the complete Retail_Item business object that was saved in the local item store before the item was sent to business review/approval or missing data retrieval processing. The ItemCollector collaboration object retrieves the copy of the Retail_Item that was stored by the ItemValidation collaboration object from the local item store. It retrieves the item 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. See Persisting, retrieving, updating, or deleting an item to or from a local item store.

The ItemCollector collaboration object obtains the internals.correlationID value from the orginal Retail_Item saved in the local item store 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 message store database entry.

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.
    Note: If the business object had not had all required data present, 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 internals.lastCascadedGLN attribute of the merged Retail_Item business object is set to true indicating there are no other cascaded GLN Retail_Items to be processed and the Retail_Item 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 does the following:
    1. It 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 ItemCollector 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. 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.
        Note: If the business object had not had all required data present, 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.
      3. 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. The ItemCollector collaboration object uses the original count of cascaded GLNs retrieved from the original Retail_Item from the item store to determine if the Approved or Rejected Retail_Item is the last item for the group of cascaded GLNs. If it is the last the internals.lastCascadedGLN attribute of the Retail_Item is set to true. If it is not the last item the attribute is set to false.
        • 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 the 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, which performs the deletion. 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.
    2. 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.
    3. 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. Sets the internals.lastCascadedGLN attribute of the Retail_Item to true.
      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: Solution Development Guide