com.ibm.commerce.component.giftregistry.commands

Class PersistGiftRegistryCmdImpl

  • All Implemented Interfaces:
    BusinessObjectDocumentCmd, com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, PersistGiftRegistryCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class PersistGiftRegistryCmdImpl
    extends BusinessObjectDocumentCmdImpl
    implements PersistGiftRegistryCmd
    Default implementation of PersistGiftRegistryCmd. The following protocol will be used to determine if a row has been created for a GiftRegistry:
    • If a value object has its corresponding row's unique identifier, the corresponding row has been created in the database. For simplicity, the default implementation assumes primary key will be used as the unique identifier, except for GiftRegistryVO.
    • For a GiftRegistryVO, the situation is a little complicated:
      • If a GiftRegistryVO has neither externalId nor giftRegistryId, it is new.
      • If a GiftRegistryVO has giftRegistryId, it is to be updated.
      • If a GiftRegistryVO has only externalId, database will be searched for a record with the externalId. If such record is found, the gift registry is to be updated. Otherwise, it is new and its externalId is as given.
    • If a corresponding row of a value object has only compound primary key, a corresponding row is already created. If both the parent node (the containing value object) has its corresponding row created and the value object's primary key can be found in database. This implies that all the containment relations are compositions. That is, a child node does not exist if its parent does not exist.
    • Otherwise, a value object does not have a corresponding row in database yet.
How the updates are done:
  1. If no corresponding row is found for a value object, new row(s) will be created. Otherwise, the row(s) will be updated with the values in the value object if the values are not null.
  2. All the fields indicated in the Verb will be written to database regardless of whether the indicated value is null or not.
Here are rules regarding persisting various value object:
  • Any empty or null value object will be ignored.
  • If a new registrant doesn't have addresses information at all, the registrant will not be created at all.
  • The values in database will always be synchronized with value objects.
  • Adding an existing item to the same gift registry, the quantity of the item will be incremented.
  • If any UserAuthentication is to be updated, the command makes sure that guest password and registrant password for the same gift registry will be different.
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

      • PersistGiftRegistryCmdImpl

        public PersistGiftRegistryCmdImpl()