com.ibm.commerce.contract.tc.commands

Class ContractTCSaveCmdImpl

  • java.lang.Object
    • com.ibm.websphere.command.CacheableCommandImpl
      • com.ibm.commerce.command.MeasuredCacheableCommandImpl
        • com.ibm.commerce.command.AbstractECTargetableCommand
          • com.ibm.commerce.command.ControllerCommandImpl
            • com.ibm.commerce.contract.tc.commands.ContractTCSaveCmdImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.AccCommand, com.ibm.commerce.command.ControllerCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, ContractTCSaveCmd, com.ibm.commerce.security.Protectable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class ContractTCSaveCmdImpl
    extends com.ibm.commerce.command.ControllerCommandImpl
    implements ContractTCSaveCmd
    This is the default implementation of the ContractTCSaveCmd controller command.

    Input parameters:

    Name Description
    contractId The contract ID. It is mandatory.
    lastUpdatedTime the last update time string.
    xmlString The XML string contains the terms and conditions.
    bValidation Sets the XSD validation flag. If the flag is set to true, the XML parser will validate the XML instance against the specified XSD file. true: validate, false: do not validate.

    Output parameters:

    None.

    Behaviour:

    Saves the specified terms and conditions (WebSphere Commerce Enterprise only). If the deploy flag set to true and the contract in either Active or Suspend state, then the updated terms and conditions will be deployed to the specified store.

    Access Beans used:

    • ContractAccessBean
    • TermConditionAccessBean
    • TermConditionDescriptionAccessBean
    • LanguageAccessBean
    • ParticipantAccessBean ContractJDBCHelperAccessBean.getTCAccessBeanNameBySubType(String subType).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Integer[] getCatalogFilterReferencedStoreIds()
      This method returns the referenced store identifiers for catalog filter term condition.
      java.lang.Integer[] getPriceRuleReferencedStoreIds()
      This method provides the Id of stores which will be affected by applying a price rule TC to a contract.
      com.ibm.commerce.accesscontrol.AccessVector getResources()
      Gets the access vector accessed by this command.
      com.ibm.commerce.datatype.TypedProperty getViewInputProperties()
      This method is called by the web controller to retrieve the request properties set by the setRequestProperties() method.
      void performExecute()
      Executes the business logic of this command implementation.
      void setContractId(java.lang.Long contractId)
      Sets the ID of the contract to be updated.
      void setLastUpdatedTime(java.lang.String lastUpdatedTime)
      Sets the last update time of the contract.
      void setRequestProperties(com.ibm.commerce.datatype.TypedProperty aRequestProperties)
      Retrieves input parameters from the request properties.
      void setXML(java.lang.String xmlStirng)
      Sets XML string of the terms and conditions to save.
      void setXSDValidation(boolean bValidation)
      Sets the XSD validation flag.
      void validateParameters()
      Validates the contract to check if it is in right state for this process.
      • Methods inherited from class java.lang.Object

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

        checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
      • Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand

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

        checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
      • Methods inherited from interface com.ibm.commerce.command.AccCommand

        accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
      • Methods inherited from interface com.ibm.commerce.command.ECCommand

        checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
      • Methods inherited from interface com.ibm.commerce.security.Protectable

        fulfills, getOwner
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • SYNCHRONOUS_DEPLOYMENT

        public static final java.lang.String SYNCHRONOUS_DEPLOYMENT
        The synchronous deployment parameter.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ContractTCSaveCmdImpl

        public ContractTCSaveCmdImpl()
    • Method Detail

      • getCatalogFilterReferencedStoreIds

        public java.lang.Integer[] getCatalogFilterReferencedStoreIds()
        This method returns the referenced store identifiers for catalog filter term condition. If the current term condition is not catalog filter termcondition, return "0" for the store identifier. It will be called by dynamic cache invalidation framework.
        Returns:
        Integer[]
      • getPriceRuleReferencedStoreIds

        public java.lang.Integer[] getPriceRuleReferencedStoreIds()
        This method provides the Id of stores which will be affected by applying a price rule TC to a contract. It will be called by dynacache invalidation framework
        Returns:
        the store Id array.
      • getResources

        public com.ibm.commerce.accesscontrol.AccessVector getResources()
                                                                 throws com.ibm.commerce.exception.ECException
        Gets the access vector accessed by this command. The default implementation returns null indicating that no protectable resource is accessed by this command. It is the responsibilities of the command writer to return the protectable primary resource(s) and the corresponding actions accessed by this command.

        Specified by:
        getResources in interface com.ibm.commerce.command.ECCommand
        Overrides:
        getResources in class com.ibm.commerce.command.AbstractECTargetableCommand
        Returns:
        AccessVector - a vector of resource action pairs
        Throws:
        com.ibm.commerce.exception.ECException
      • getViewInputProperties

        public com.ibm.commerce.datatype.TypedProperty getViewInputProperties()
        This method is called by the web controller to retrieve the request properties set by the setRequestProperties() method. The tools need to override this method because otherwise the properties passed into the controller command would be then passed onto the view command. This is unnecessary for the tools and actually will break us when using the ReDirectView command. Because the URL to re-direct to cannot be more than 500 chars. The XML parameter alone passed into the controller command is longer than this. And therefore without overriding this method we couldn't re-direct to the view command.
        Specified by:
        getViewInputProperties in interface com.ibm.commerce.command.ControllerCommand
        Overrides:
        getViewInputProperties in class com.ibm.commerce.command.ControllerCommandImpl
        Returns:
        com.ibm.commerce.datatype.TypeProperty
      • performExecute

        public void performExecute()
                            throws com.ibm.commerce.exception.ECException
        Executes the business logic of this command implementation. The method saves the terms and conditions. If the deploy flag is set to true, it will deploy the updated terms and conditions.
        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 - Raised with message _ERR_CONTRACT_TC_SAVE whenever the system has a problem
        See Also:
        AbstractECTargetableCommand#performExecute()
      • setContractId

        public void setContractId(java.lang.Long contractId)
        Sets the ID of the contract to be updated.
        Specified by:
        setContractId in interface ContractTCSaveCmd
        Parameters:
        contractId - The contract ID.
      • setLastUpdatedTime

        public void setLastUpdatedTime(java.lang.String lastUpdatedTime)
        Sets the last update time of the contract.
        Specified by:
        setLastUpdatedTime in interface ContractTCSaveCmd
        Parameters:
        lastUpdatedTime - the last update time string
      • setRequestProperties

        public void setRequestProperties(com.ibm.commerce.datatype.TypedProperty aRequestProperties)
                                  throws com.ibm.commerce.exception.ECApplicationException
        Retrieves input parameters from the request properties.
        Specified by:
        setRequestProperties in interface com.ibm.commerce.command.ControllerCommand
        Overrides:
        setRequestProperties in class com.ibm.commerce.command.ControllerCommandImpl
        Parameters:
        aRequestProperties - An TypedProperty object contains the input parameters.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with message _ERR_MISSING_CMD_PARAMETER when contractId and the input XML string is missed.
        See Also:
        ControllerCommand#setRequestProperties(TypedProperty)
      • setXML

        public void setXML(java.lang.String xmlStirng)
        Sets XML string of the terms and conditions to save.
        Specified by:
        setXML in interface ContractTCSaveCmd
        Parameters:
        xmlStirng - The XML string contains the terms and conditions.
      • setXSDValidation

        public void setXSDValidation(boolean bValidation)
        Sets the XSD validation flag. If the flag is set to true, the XML parser will validate the XML instance against the specified XSD file.
        Specified by:
        setXSDValidation in interface ContractTCSaveCmd
        Parameters:
        bValidation - the validation flag, true: validate, false: do not validate.
      • validateParameters

        public void validateParameters()
                                throws com.ibm.commerce.exception.ECException
        Validates the contract to check if it is in right state for this process. Also the method based on the last updated time parameter to compare with the last updated time of the contract. Then to see if the contract has been changed by someone else.
        Specified by:
        validateParameters in interface com.ibm.commerce.command.ECCommand
        Overrides:
        validateParameters in class com.ibm.commerce.command.AbstractECTargetableCommand
        Throws:
        com.ibm.commerce.exception.ECException - Raised with message _ERR_WRONG_CONTRACT_STATE when if the contract in one of the following states: Cancel, Closed, Pending, DeploymentInProgress, DeploymentFailed, or the contract is not in Active state but the deploy flag is set to true. Raised with _ERR_CONTRACT_OBJECT_NOT_FOUND if the contract cannot be found, it is based on the provided contract id. Raised with _ERR_CONTRACT_HAS_BEEN_CHANGED if the contract has been changed by someone else.
        See Also:
        AbstractECTargetableCommand#validateParameters()