com.ibm.commerce.contract.tc.commands
Class ContractTCSaveCmdImpl

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

public class ContractTCSaveCmdImpl
extends ControllerCommandImpl
implements ContractTCSaveCmd

Saves the specified terms and conditions (WebSphere Commerce Business Edition only). This is the default implementation of ContractTCSaveCmd. If the deploy flag set to true and the contract in eithor Active or Suspend state, the updated terms and conditions will be deployed to the specified store. The following AccessBeans are called in the default implementation: ContractAccessBean, TermConditionAccessBean, TermConditionDescriptionAccessBean, LanguageAccessBean, ParticipantAccessBean, ContractJDBCHelperAccessBean.getTCAccessBeanNameBySubType(String subType).

See Also:
Serialized Form

Field Summary
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.tc.commands. ContractTCSaveCmd
defaultCommandClassName
 
Constructor Summary
ContractTCSaveCmdImpl()
           
 
Method Summary
  AccessVector getResources()
          Gets the access vector accessed by this command.
  TypedProperty getViewInputProperties()
          This method is called by the web controller to retrieve the request properties set by the setRequestProperties() method.
 void performExecute()
          The method saves the terms and conditions.
 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( 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 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, 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, 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
Constructor Detail

ContractTCSaveCmdImpl

public ContractTCSaveCmdImpl()
Method Detail

getResources

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

getViewInputProperties

public 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 comman 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 ControllerCommand
Overrides:
getViewInputProperties in class ControllerCommandImpl
Returns:
com.ibm.commerce.datatype.TypeProperty

performExecute

public void performExecute()
                    throws ECException
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 ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - Raised with message _ERR_CONTRACT_TC_SAVE whenever the system has a problem
See Also:
AbstratECTargetableCommand#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(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.
Throws:
ECApplicationException - Raised with message _ERR_MISSING_CMD_PARAMETER when contractId and the input xml string are 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 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 to see if the contract has been changed by someone else.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
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 based on the provided contract id. Raised with _ERR_CONTRACT_HAS_BEEN_CHANGED if the contract has been changed by someone else.
See Also:
AbstratECTargetableCommand#validateParameters()