com.ibm.commerce.security.commands

Class MigrateUserEntriesCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, MigrateUserEntriesCmd, 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
    Direct Known Subclasses:
    GiftRegistryMigrateUserEntriesCmdImpl


    public class MigrateUserEntriesCmdImpl
    extends TaskCommandImpl
    implements MigrateUserEntriesCmd

    This task command is used to migrate resources owned by one user to another. The mandatory resources that are migrated are Addresses, Current Orders, Interest Items, Order Items, Orders, and Order templates.

    By default, this command will not merge the shopping cart for the 2 users, but it can be configured to do so by:

    • a) Setting the mergeCart flag in the request property in the command context to true. OR:
    • b) Setting MemberSubSystem/MergeCartsAtAuthentication/enabled in the wc-server.xml to true.
    The mergeCart flag in the request property will take higher priority.

    Before executing this task command the following sets should be performed:

    • setOldUser
    • setNewUser
    See Also:
    Serialized Form
    • Field Detail

      • ERRTASK_NAME

        public static final java.lang.String ERRTASK_NAME
        Error task name.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MigrateUserEntriesCmdImpl

        public MigrateUserEntriesCmdImpl()
    • Method Detail

      • migrateAddresses

        public void migrateAddresses(UserAccessBean abOldUser,
                                     UserAccessBean abNewUser)
                              throws ECException
        This method migrates addresses from one user to another user. In the case of nickname collision, the most recent address overwrites the old one. In the case of collision on the self-address, whichever address is selected is assigned the self-address flag.
        Specified by:
        migrateAddresses in interface MigrateUserEntriesCmd
        Parameters:
        abOldUser - The Old User, whose addresses are to be migrated.
        abNewUser - The New User, who will get the new addresses.
        Throws:
        ECException
      • migrateCoupons

        public void migrateCoupons(UserAccessBean abOldUser,
                                   UserAccessBean abNewUser)
                            throws ECException
        This method migrates coupons from one user to another user. Only the coupons in state 'Usable' will be transfered.
        Parameters:
        abOldUser - The Old User, whose coupons are to be migrated.
        abNewUser - The New User, who will get the new coupons.
        Throws:
        ECException
      • migratePersonalization

        public void migratePersonalization(UserAccessBean abOldUser,
                                           UserAccessBean abNewUser)
                                    throws ECException
        This method migrates the customer segment information for a customer. The customer segments to which the customer belonged to by their personalization ID will be copied from a guest user to the new user.
        Parameters:
        abOldUser - The old user, who may have entries in the DMMBRGRPPZN database table.
        abNewUser - The new user, to whom the DMMBRGRPPZN entries should be copied.
        Throws:
        ECException
      • migrateExperimentResult

        public void migrateExperimentResult(UserAccessBean abNewUser)
                                     throws ECException
        This method migrates experiment results from a generic or guest user to the given new user.
        Parameters:
        abNewUser - The New User, who owns the experiment results.
        Throws:
        ECException
      • migrateExperimentResult

        public void migrateExperimentResult(UserAccessBean abOldUser,
                                            UserAccessBean abNewUser)
                                     throws ECException
        This method migrates experiment results from a generic or guest user to the given new user.
        Parameters:
        abOldUser - The Old User, who owns the experiment results.
        abNewUser - The New User, who owns the experiment results.
        Throws:
        ECException
      • migratePhoenixCoupon

        public void migratePhoenixCoupon(UserAccessBean abOldUser,
                                         UserAccessBean abNewUser)
                                  throws ECException
        This method migrates Phoenix Coupons.
        Parameters:
        abOldUser - - the old user, whose coupons are to be migrated.
        abNewUser - - the new user, who will receive the new coupons.
        Throws:
        ECException
      • performExecute

        public void performExecute()
                            throws ECException
        This method migrates all resources for a user. It delegates to the following methods:
        1. migrateAddresses()
        2. migrateInterestItems()
        3. migrateCurrentOrders()
        4. migrateOrderTemplates()
        5. migrateCoupons()
        6. migratePhoenixCoupon()
        7. migrateExperimentResults()
        8. migratePersonalization()
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException
      • setNewUser

        public void setNewUser(UserAccessBean abNewUser)
        This method sets the new user who is the recipient of the migrated resources from the old user.
        Specified by:
        setNewUser in interface MigrateUserEntriesCmd
        Parameters:
        abNewUser - The new user access bean.
      • setOldUser

        public void setOldUser(UserAccessBean abOldUser)
        This method sets the old user whose resources are to be migrated to the new user.
        Specified by:
        setOldUser in interface MigrateUserEntriesCmd
        Parameters:
        abOldUser - The old user access bean.
      • migratePersonalizationId

        public static void migratePersonalizationId(java.lang.Integer storeId,
                                                    java.lang.String origPersonalizationId,
                                                    java.lang.String newPersonalizationId)
                                             throws ECSystemException
        Reserved for IBM internal use.

        This method migrates the data associated with an original personalization ID to a new personalization ID. This method is expected to be called when a guest user does operations on the site which are being tracked against an original personalization ID, and then later registers. Once the user registers, a new personalization ID is assigned to the user if the old personalization ID is already associated with an existing registered user in the site. In this case, any information that was tracked against the old personalization ID needs to be migrated to the new personalization ID.

        Parameters:
        storeId - store ID. If store ID is null, the user behavior information will not be updated.
        origPersonalizationId - old Personalization ID
        newPersonalizationId - new Personalization ID
        Throws:
        ECSystemException
      • mergeCart

        public void mergeCart(UserAccessBean abNewUser)
                       throws ECException
        This method is used to merge the cart of the user.
        Parameters:
        abNewUser - The new user, who will receive the new order tempaltes.
        Throws:
        ECException