com.ibm.commerce.contract.commands

Class DeployContractCmdImpl

  • java.lang.Object
    • com.ibm.websphere.command.CacheableCommandImpl
      • com.ibm.commerce.command.MeasuredCacheableCommandImpl
        • com.ibm.commerce.command.AbstractECTargetableCommand
          • com.ibm.commerce.command.TaskCommandImpl
            • com.ibm.commerce.contract.commands.DeployContractCmdImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, com.ibm.commerce.command.TaskCommand, DeployContractCmd, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class DeployContractCmdImpl
    extends com.ibm.commerce.command.TaskCommandImpl
    implements DeployContractCmd
    This is the default implementation of the DeployContractCmd task command.

    Behaviour:

      Deploy a contract to the specified store (WebSphere Commerce Enterprise only). If the contract is a Hosting or Distributor contract, it also creates sub organization and store.
      This command manages local transactions for the thread internally by calling com.ibm.commerce.server.TransactionManager.begin(); com.ibm.commerce.server.TransactionManager.commit();

    AccessBeans called:

    • BusinessPolicyAccessBean
    • ContractAccessBean
    • com.ibm.commerce.contract.objects.ContractJDBCHelperAccessBean
    • MemberAccessBean
    • MemberGroupAccessBean
    • OrganizationAccessBean
    • StoreDefaultAccessBean
    • TermConditionAccessBean
    • TradingAgreementAccessBean
    • UserAccessBean
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CLASSNAME
      The name of this class is "com.ibm.commerce.contract.commands.DeployContractCmdImpl".
      static java.lang.String COPYRIGHT
      The internal copyright field.
      static java.lang.String PRICE_RULE_TC
      Constant for price rule term condition.
      static java.lang.String PRICE_RULE_TC_PROPERTY_BEGIN_DATE
      Constant for the name of the price rule begin date property in the price rule term condition.
      static java.lang.String PRICE_RULE_TC_PROPERTY_EXPIRY_DATE
      Constant for the name of the price rule expiry date property in the price rule term condition.
      static java.lang.String PRICE_RULE_TC_PROPERTY_RULE_ID
      Constant for the name of the price rule identifier property in the price rule term condition.
    • Constructor Summary

      Constructors 
      Constructor and Description
      DeployContractCmdImpl()
      The default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.sql.Timestamp getCurrentTime(com.ibm.commerce.command.CommandContext commandContext)
      Returns the current time from the command context.
      com.ibm.commerce.contract.objects.ExtendedTermConditionAccessBean getValidPriceRuleExtendeTC(java.lang.Long contractID, java.lang.Long memberID, java.sql.Timestamp currentTime) 
      boolean isValidDate(java.sql.Timestamp beginDate, java.sql.Timestamp expiryDate, java.sql.Timestamp currentTime)
      Check whether the date is valid compared with the current time.
      boolean isValidPriceRuleId(java.lang.String priceRuleId)
      Check whether the price rule id is not empty
      void performExecute()
      Executes the business logic of this command implementation.
      void setContractId(java.lang.Long newContractId)
      Sets the contract Id
      void setMaxContractNameLength(int maxLength)
      Sets the Maximum length of the contract name.
      void setRequestProperties(com.ibm.commerce.datatype.TypedProperty aRequestProperties)
      Sets the requestProperties.
      void setSynchronousDeployment(boolean synchronousDeploymentFlag)
      Sets the synchronousDeployment flag to indicate contract should be deployed synchronously.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand

        accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
      • Methods inherited from interface com.ibm.commerce.command.CacheableECCommand

        execute
      • Methods inherited from interface com.ibm.commerce.command.ECCommand

        checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
    • Field Detail

      • CLASSNAME

        public static final java.lang.String CLASSNAME
        The name of this class is "com.ibm.commerce.contract.commands.DeployContractCmdImpl".
        See Also:
        Constant Field Values
      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        The internal copyright field.
        See Also:
        Constant Field Values
      • PRICE_RULE_TC

        public static final java.lang.String PRICE_RULE_TC
        Constant for price rule term condition.
        See Also:
        Constant Field Values
      • PRICE_RULE_TC_PROPERTY_BEGIN_DATE

        public static final java.lang.String PRICE_RULE_TC_PROPERTY_BEGIN_DATE
        Constant for the name of the price rule begin date property in the price rule term condition.
        See Also:
        Constant Field Values
      • PRICE_RULE_TC_PROPERTY_EXPIRY_DATE

        public static final java.lang.String PRICE_RULE_TC_PROPERTY_EXPIRY_DATE
        Constant for the name of the price rule expiry date property in the price rule term condition.
        See Also:
        Constant Field Values
      • PRICE_RULE_TC_PROPERTY_RULE_ID

        public static final java.lang.String PRICE_RULE_TC_PROPERTY_RULE_ID
        Constant for the name of the price rule identifier property in the price rule term condition.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DeployContractCmdImpl

        public DeployContractCmdImpl()
        The default constructor
    • Method Detail

      • getCurrentTime

        public java.sql.Timestamp getCurrentTime(com.ibm.commerce.command.CommandContext commandContext)
        Returns the current time from the command context. First, check the time from the preview context. Then, check the time from the command context. Finally, check the time from the request properties. If there is no time in the request properties, get the current system time and save it in the request properties for next use.
        Parameters:
        commandContext - The command context. It may be null. If it is null, return the current system time.
        Returns:
        The current time. It doesn't return null.
      • getValidPriceRuleExtendeTC

        public com.ibm.commerce.contract.objects.ExtendedTermConditionAccessBean getValidPriceRuleExtendeTC(java.lang.Long contractID,
                                                                                                            java.lang.Long memberID,
                                                                                                            java.sql.Timestamp currentTime)
                                                                                                     throws com.ibm.commerce.exception.ECSystemException
        Throws:
        com.ibm.commerce.exception.ECSystemException
      • isValidDate

        public boolean isValidDate(java.sql.Timestamp beginDate,
                                   java.sql.Timestamp expiryDate,
                                   java.sql.Timestamp currentTime)
        Check whether the date is valid compared with the current time.
        Parameters:
        beginDate - The begin date. Can be null.
        expiryDate - The end date. Can be null.
        currentTime - The current time.
        Returns:
        True if the date is valid. Otherwise, false.
      • isValidPriceRuleId

        public boolean isValidPriceRuleId(java.lang.String priceRuleId)
        Check whether the price rule id is not empty
        Parameters:
        priceRuleId - The price rule id. Can be empty or null.
        Returns:
        If the price rule id is not empty, return true; otherwise return false.
      • performExecute

        public void performExecute()
                            throws com.ibm.commerce.exception.ECException
        Executes the business logic of this command implementation.
        Specified by:
        performExecute in interface com.ibm.commerce.command.ECCommand
        Overrides:
        performExecute in class com.ibm.commerce.command.AbstractECTargetableCommand
        Throws:
        com.ibm.commerce.exception.ECException
        com.ibm.commerce.exception.ECSystemException - Raised with message _ERR_FINDER_EXCEPTION whenever a FinderException is occured Raised with message _ERR_REMOTE_EXCEPTION whenever a RemoteException is occured Raised with message _ERR_NAMING_EXCEPTION whenever a NamingException is occured Raised with message _ERR_CREATE_EXCEPTION whenever a CreateException is occured Raised with message _ERR_SQL_EXCEPTION whenever a SQLException is occured Raised with message _ERR_PARSE_XML the contract XML cannot be parsed Raised with message _ERR_CONTRACT_CMD_EXEC whenever an error is occured
        See Also:
        AbstractECTargetableCommand.performExecute()
      • setContractId

        public void setContractId(java.lang.Long newContractId)
        Sets the contract Id
        Parameters:
        newContractId - new contract id
      • setMaxContractNameLength

        public void setMaxContractNameLength(int maxLength)
        Sets the Maximum length of the contract name.
        Parameters:
        maxLength - The maximum length allowed for the contract name
      • setRequestProperties

        public void setRequestProperties(com.ibm.commerce.datatype.TypedProperty aRequestProperties)
                                  throws com.ibm.commerce.exception.ECApplicationException
        Sets the requestProperties.
        Specified by:
        setRequestProperties in interface DeployContractCmd
        Parameters:
        aRequestProperties - Request properties EC_CONTRACT_ID and EC_TARGET_STORE_ID are both required
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with message _ERR_MISSING_CMD_PARAMETER if the contract id or target store id is not specified in the request properties
      • setSynchronousDeployment

        public void setSynchronousDeployment(boolean synchronousDeploymentFlag)
        Sets the synchronousDeployment flag to indicate contract should be deployed synchronously.
        Specified by:
        setSynchronousDeployment in interface DeployContractCmd
        Parameters:
        synchronousDeploymentFlag - true for synchronous deployment, false for asynchronous deployment