com.ibm.commerce.security.commands
Class MigrateUserEntriesCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.security.commands.MigrateUserEntriesCmdImpl
All Implemented Interfaces:
ECCommand, ECTargetableCommand, MigrateUserEntriesCmd, TaskCommand

public class MigrateUserEntriesCmdImpl
extends TaskCommandImpl
implements MigrateUserEntriesCmd

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

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

    setOldUser
    setNewUser
See Also:
Serialized Form

Field Summary
static java.lang.String ERRTASK_NAME
          Error task name.
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.security.commands. MigrateUserEntriesCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECTargetableCommand
COPYRIGHT
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
MigrateUserEntriesCmdImpl()
           
 
Method Summary
protected  UserAccessBean getNewUser()
          Retrieves the new user which would be recipient of migrated resources from the old user.
protected  UserAccessBean getOldUser()
          Retrieves the old user whose resources are to be migrated to the new user.
 void migrateAddresses( UserAccessBean abOldUser, UserAccessBean abNewUser)
          Migrates addresses from one user to another user.
 void migrateCoupons( UserAccessBean abOldUser, UserAccessBean abNewUser)
          Migrates coupons from one user to another user.
 void migrateCurrentOrders( UserAccessBean abOldUser, UserAccessBean abNewUser)
          Migrates current orders from one user to another user.
 void migrateInterestItems( UserAccessBean abOldUser, UserAccessBean abNewUser)
          Migrates interest items from one user to another user.
 void migrateOrders( UserAccessBean abOldUser, UserAccessBean abNewUser)
          Migrates orders from one user to another user.
 void migrateOrderTemplates( UserAccessBean abOldUser, UserAccessBean abNewUser)
          Migrates order templates from one user to another user.
 void performExecute()
          Migrates all resources for a user.
 void setNewUser( UserAccessBean abNewUser)
          Sets the new user which would be recipient of migrated addresses from the old user.
 void setOldUser( UserAccessBean abOldUser)
          Sets the old user whose addresses are to be migrated to the new user.
 void validateParameters()
          Validates the parameters.
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

getNewUser

protected UserAccessBean getNewUser()
Retrieves the new user which would be recipient of migrated resources from the old user.
Returns:
abNewUser The new user accessbean.

getOldUser

protected UserAccessBean getOldUser()
Retrieves the old user whose resources are to be migrated to the new user.
Returns:
The old user accessbean.

migrateAddresses

public void migrateAddresses(UserAccessBean abOldUser,
UserAccessBean abNewUser)
                      throws ECException
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 selfaddress 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
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

migrateCurrentOrders

public void migrateCurrentOrders(UserAccessBean abOldUser,
UserAccessBean abNewUser)
                          throws ECException
Migrates current orders from one user to another user.
Specified by:
migrateCurrentOrders in interface MigrateUserEntriesCmd
Parameters:
abOldUser - The Old User, whose current orders are to be migrated.
abNewUser - The New User, who will get the new current orders.
Throws:
ECException

migrateInterestItems

public void migrateInterestItems(UserAccessBean abOldUser,
UserAccessBean abNewUser)
                          throws ECException
Migrates interest items from one user to another user.
Specified by:
migrateInterestItems in interface MigrateUserEntriesCmd
Parameters:
abOldUser - The Old User, whose interest items are to be migrated.
abNewUser - The New User, who will get the new interest items.
Throws:
ECException

migrateOrders

public void migrateOrders(UserAccessBean abOldUser,
UserAccessBean abNewUser)
                   throws ECException
Migrates orders from one user to another user.
Specified by:
migrateOrders in interface MigrateUserEntriesCmd
Parameters:
abOldUser - The Old User, whose orders are to be migrated.
abNewUser - The New User, who will get the new orders.
Throws:
ECException

migrateOrderTemplates

public void migrateOrderTemplates(UserAccessBean abOldUser,
UserAccessBean abNewUser)
                           throws ECException
Migrates order templates from one user to another user.
Specified by:
migrateOrderTemplates in interface MigrateUserEntriesCmd
Parameters:
abOldUser - The Old User, whose order templates are to be migrated.
abNewUser - The New User, who will get the new order templates.
Throws:
ECException

performExecute

public void performExecute()
                    throws ECException
Migrates all resources for a user. Delegates to migrateAddresses(), then migrateInterestItems(), then migrateCurrentOrders(), then migrateOrderTemplates() and then to migrateCoupons()
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException

setNewUser

public void setNewUser(UserAccessBean abNewUser)
Sets the new user which would be recipient of migrated addresses from the old user.
Specified by:
setNewUser in interface MigrateUserEntriesCmd
Parameters:
abNewUser - The new user accessbean.

setOldUser

public void setOldUser(UserAccessBean abOldUser)
Sets the old user whose addresses are to be migrated to the new user.
Specified by:
setOldUser in interface MigrateUserEntriesCmd

validateParameters

public void validateParameters()
                        throws ECException
Validates the parameters. Ensures that the new user and the old user parameters have been set.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException