com.ibm.commerce.promotion.uniquecode.commands

Class UniquePromotionCodesPopulateCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, UniquePromotionCodesPopulateCmd, Protectable, 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 UniquePromotionCodesPopulateCmdImpl
    extends ControllerCommandImpl
    implements UniquePromotionCodesPopulateCmd
    This command will create code generator or code loader according to the code specification of the promotion. Then it will use Physical Data Container to save the codes from code generator/loader into database. When one batch is finished and the total number of codes is not reached, it will schedule another same job to continue the process. When all codes successfully generated, the command will stop. If non-code of current batch is saved into database, the command will failed and will throw exception.
    See Also:
    Serialized Form
    • Constructor Detail

      • UniquePromotionCodesPopulateCmdImpl

        public UniquePromotionCodesPopulateCmdImpl()
    • Method Detail

      • performExecute

        public void performExecute()
                            throws ECException
        This method first checks the status is in canceled state. If in cancel state, then it will call clean code command to clean already generated code. Then if the status is in processing or not populated state, it will continue to populate codes into database.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException
      • accessControlCheck

        public boolean accessControlCheck()
                                   throws ECException
        This method performs a command level access control check by invoking the access control manager. If the check is not passed, then the status of the promotion is changed to 'Inactive', the code population status is changed to 'Failed' and the CALCODE records in the CALCODEMGP, CATENCALCD, CATGPCALCD and SHPMODCLCD tables are removed.
        Specified by:
        accessControlCheck in interface AccCommand
        Overrides:
        accessControlCheck in class AbstractECTargetableCommand
        Returns:
        This method returns true if the user has authority; otherwise it throws an exception.
        Throws:
        ECException - An ECApplicationException is thrown when an _ERR_USER_AUTHORITY error occurs.
      • scheduleNextBatch

        public void scheduleNextBatch(int newBatchSize)
                               throws ECException
        Schedule another job to go on with the code generation process.
        Parameters:
        newBatchSize - An Integer value representing the new batch size
        Throws:
        ECException
      • cleanCodeInDB

        public void cleanCodeInDB()
        Invokes the UniquePromotionCodesCleanCmd command to clean all generated code in the database