Class PersistGiftRegistryItemPurchaseRecordCmdImpl

  • All Implemented Interfaces:
    BusinessObjectDocumentCmd,, ECCommand, ECTargetableCommand, TaskCommand, PersistGiftRegistryItemPurchaseRecordCmd,,,,,,

    public class PersistGiftRegistryItemPurchaseRecordCmdImpl
    extends BusinessObjectDocumentCmdImpl
    implements PersistGiftRegistryItemPurchaseRecordCmd
    Default implementation of PersistGiftRegistryCmd. This implementation takes a UpdateGiftRegistryPurchaseRecordBOD, and persists all the GiftRegistryPurchaseRecordVO objects in it. The general rule of persistence is that a new purchase record value object will be inserted into database. Otherwise, the corresponding database record of a purchase record value object will be found. It will be updated based on the value of the purchase record as well as the verb of the value object. A value object of purchase record is considered new if it does not have purchaseRecordId or transactionId. If a purchase record has transactionId only, a lookup in the database will be performed. If a purchase record that has the transactionId is found in the database, this purchase record will be considered as an existing record. It will be updated instead of being created. The following are detailed behavior when a purchase record is being created or updated: -- When a purchase record is being created:
    • If the record has associated gift item ID, the corresponding gift item will be found from the database. The record's partNumber and partAuxiliaryKey will be updated with the found item's.
    • All the information in a purchase record will be write to the database
    • The gift item corresponding to the purchase record will be found, and the quantityBought property of the item will updated with the record's purchaseQuantity. For example,
        The quantityBought of an item is 0, and the purchaseQuantity of the item's purchase record is 1.
      • then the quantityBought will be updated to 1.
        If the quantityBought of the item 5, and the purchaseQuantity of the item's purchase record is -1.
      • The quantityBought will be updated to 4.
    -- When a purchase record is being updated:
    • The retrieved purchase record in database is based on either purchaseRecordId, or transactionId.
    • All the non-null data in the purchase record will be written to database
    • If only a verb indicates that a null value should be written to the database, the null value will be written to the database.
    • If a verb indicates that the purchase record's address should be removed, the address will be removed. Moreover, the purchase record's addressId will be set to null.
    ECException with the following messages will be thrown:
    • GiftRegistryMessage._ERR_GIFT_REGISTRY_ITEM_NOT_FOUND, if a given item in the given purchase records is not found
    • GiftRegistryMessage._ERR_GIFT_REGISTRY_PURCHASE_RECORD_EMPTY, if a null purchase record is being updated
    • GiftRegistryMessage._ERR_GIFT_REGISTRY_PURCHASE_RECORD_UPDATE, if any attempt to update a purchase record fails
    • ECMessage._ERR_USER_AUTHORITY, if the caller of this command does not have authority to use this command
      See Also:
      PersistGiftRegistryCmd, Serialized Form
      • Field Detail

        • COPYRIGHT

          public static final java.lang.String COPYRIGHT
          IBM copyright notice field.
          See Also:
          Constant Field Values
        • CLASS_NAME

          public static final java.lang.String CLASS_NAME
          The class name of this class
      • Constructor Detail

        • PersistGiftRegistryItemPurchaseRecordCmdImpl

          public PersistGiftRegistryItemPurchaseRecordCmdImpl()