com.ibm.commerce.contract.commands
Class ContractNewVersionCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.ControllerCommandImpl
                    |
                    +--com.ibm.commerce.contract.commands.ContractNewVersionCmdImpl
All Implemented Interfaces:
AccCommand, ContractNewVersionCmd, ControllerCommand, ECCommand, ECTargetableCommand

public class ContractNewVersionCmdImpl
extends ControllerCommandImpl
implements ContractNewVersionCmd

Create a new version of a specified contract (WebSphere Commerce Business Edition only). The state of the specified contract has to be in one of the following state: Approved, Active, Suspended, DeploymentInProgress, and DeploymentFailed. The new contract will have the same name as the specified one. If both majorVersion and minorVersion are provided, the command respect the versions. otherwise, the new contract will have the same major version number with the old contract, and the minor version will be one plus the largest minor version with the same contract name, origin, owner, majorVerion. This new contract will be in Draft version. The following AccessBeans are used in this default implementation: ContractAccessBean, MemberAccessBean

See Also:
CopyContractCmdImpl, Serialized Form

Field Summary
static java.lang.String CLASSNAME
          The name of the default implementation.
static java.lang.String COPYRIGHT
          IBM copyright notice field.
 
Fields inherited from class com.ibm.commerce.command. ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.contract.commands. ContractNewVersionCmd
defaultCommandClassName, NAME
 
Constructor Summary
ContractNewVersionCmdImpl()
           
 
Method Summary
  AccessVector getResources()
          Gets the access vector accessed by this command.
 void performExecute()
          The method copys the specified contract.
 void setContractId(java.lang.Long contractId)
          Sets the ID of the contract to be copied from.
 void setNewContractMajorVersion(java.lang.Integer majorVersion)
          Sets the major version number of the new contract.
 void setNewContractMinorVersion(java.lang.Integer minorVersion)
          Sets the minor version number of the new contract.
 void setRequestProperties( TypedProperty aRequestProperties)
          Retrieves input parameters from the request properties.
 void validateParameters()
          Validates if the given contract ID exists, and checks if there are any contracts exist with the same name as the new contract.
 
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, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, 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
 
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, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 

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

CLASSNAME

public static final java.lang.String CLASSNAME
The name of the default implementation.
See Also:
Constant Field Values
Constructor Detail

ContractNewVersionCmdImpl

public ContractNewVersionCmdImpl()
Method Detail

getResources

public AccessVector getResources()
                          throws 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 ECCommand
Overrides:
getResources in class AbstractECTargetableCommand
Returns:
AccessVector - a vector of resource action pairs
Throws:
ECException
See Also:
AbstractECTargetableCommand.getResources()

performExecute

public void performExecute()
                    throws ECException
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 ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
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()

setContractId

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

setNewContractMajorVersion

public void setNewContractMajorVersion(java.lang.Integer majorVersion)
Sets the major version number of the new contract.
Specified by:
setNewContractMajorVersion in interface ContractNewVersionCmd
Parameters:
majorVersion - the major version number of the new contract

setNewContractMinorVersion

public void setNewContractMinorVersion(java.lang.Integer minorVersion)
Sets the minor version number of the new contract.
Specified by:
setNewContractMinorVersion in interface ContractNewVersionCmd

setRequestProperties

public void setRequestProperties(TypedProperty aRequestProperties)
                          throws ECApplicationException
Retrieves input parameters from the request properties.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Parameters:
aRequestProperties - An TypedProperty object contains the input parameters. For this default implementation, contractId, and URL parameters are required.
Throws:
ECApplicationException - Raised with message _ERR_MISSING_CMD_PARAMETER when one of the three parameters, contractId or URL, is missed from the URL. Raised with message _ERR_NUMBER_FORMAT_EXCEPTION if the provided contractId parameter cannot be converted to Long object, or majorVersion, minorVersion parameter cannot be converted to Integer object.
See Also:
ControllerCommandImpl.setRequestProperties(TypedProperty)

validateParameters

public void validateParameters()
                        throws ECException
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 ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException - Raised with message _ERR_WRONG_CONTRACT_STATE if the contract is in one of the following states: Draft, Pending, Rejected, Closed, Canceled Raised with message _ERR_CONTRACT_OBJECT_NOT_FOUND if the contract cannot be found based on the provided contract ID. Raised with message _ERR_CONTRACT_VERSIONS if the provided version of the contract already exists. 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()