com.ibm.commerce.contract.commands

Class ContractCopyCmdImpl

  • 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.commands.ContractCopyCmdImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.AccCommand, com.ibm.commerce.command.ControllerCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, ContractCopyCmd, com.ibm.commerce.security.Protectable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


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

    Input parameters:

    Name Description
    contractId The contract ID. It is mandatory.
    name The contract name. It is mandatory.
    accountId The account ID. It is mandatory.

    Output parameters:

    None.

    Behaviour:

    Copies a contract (WebSphere Commerce Enterprise only). If the command completes successfully, a new contract will be create. The contract will be in Draft state with majorVersion set to 1 and minorVersion set to 0. CopyContractCmd task command is called in this default implementation.

    Access Beans used:

    • ContractAccessBean
    • MemberAccessBean
    See Also:
    CopyContractCmdImpl
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      com.ibm.commerce.accesscontrol.AccessVector getResources()
      Gets the access vector accessed by this command.
      void performExecute()
      Executes the business logic of this command implementation.
      void setAccountId(java.lang.Long accountId)
      Sets the ID of the account to which to copy the contract.
      void setContractId(java.lang.Long contractId)
      Sets the ID of the contract to be copied from.
      void setNewContractName(java.lang.String name)
      Sets the name of the new contract.
      void setRequestProperties(com.ibm.commerce.datatype.TypedProperty aRequestProperties)
      Sets the request properties of this command implementation.
      void validateParameters()
      Extracts and validates the input parameters of this command implementation.
      • 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, getViewInputProperties, 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, getViewInputProperties, 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

      • CLASSNAME

        public static final java.lang.String CLASSNAME
        The full name of this class.
        See Also:
        Constant Field Values
      • COPYRIGHT

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

      • ContractCopyCmdImpl

        public ContractCopyCmdImpl()
    • Method Detail

      • 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 ContractAccessBean of the contract to be copied and the MemberAccessBean of the contract owner.

        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
        See Also:
        AbstractECTargetableCommand.getResources()
      • performExecute

        public void performExecute()
                            throws com.ibm.commerce.exception.ECException
        Executes the business logic of this command implementation. The method copys the specified contract. A new contract based on the specified one with the given contract name will be created.
        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_CMD_EXEC whenever the error occurs in CopyContractCmd. see that command for detail
        See Also:
        CopyContractCmdImpl.performExecute(), AbstractECTargetableCommand#performExecute()
      • setAccountId

        public void setAccountId(java.lang.Long accountId)
        Sets the ID of the account to which to copy the contract.
        Specified by:
        setAccountId in interface ContractCopyCmd
        Parameters:
        accountId - the ID of the account
      • setContractId

        public void setContractId(java.lang.Long contractId)
        Sets the ID of the contract to be copied from.
        Specified by:
        setContractId in interface ContractCopyCmd
        Parameters:
        contractId - the ID of the contract to be copied from
      • setNewContractName

        public void setNewContractName(java.lang.String name)
        Sets the name of the new contract.
        Specified by:
        setNewContractName in interface ContractCopyCmd
        Parameters:
        name - the name of the new contract
      • setRequestProperties

        public void setRequestProperties(com.ibm.commerce.datatype.TypedProperty aRequestProperties)
                                  throws com.ibm.commerce.exception.ECApplicationException
        Sets the request properties of this command implementation.
        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. For this default implementation, contractId, name , and URL parameters are required.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with message _ERR_MISSING_CMD_PARAMETER when one of the three parameters, contractId, name or URL, is missed from the URL. Raised with message _ERR_NUMBER_FORMAT_EXCEPTION if the provided contract ID cannot be converted to Long object.
        See Also:
        ControllerCommandImpl.setRequestProperties(TypedProperty)
      • validateParameters

        public void validateParameters()
                                throws com.ibm.commerce.exception.ECException
        Extracts and validates the input parameters of this command implementation. Validates if the given contract ID exists, and checks if there are any contracts exist with the same name as the new contract.
        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 EC_ERR_DUPLICATED_CONTRACT_NAME if there is/are contract(s) which has/have the same name as the new contract. Raised with message _ERR_CONTRACT_OBJECT_NOT_FOUND if the contract cannot be found. It is based on the provided contract ID. Raised with message _ERR_CONTRACT_SYS_GENERIC if the AccessBeans used in this method throw one of the following exceptions: CreateException, NamingException, RemoteException, FinderException.
        See Also:
        AbstractECTargetableCommand#validateParameters()