com.ibm.commerce.contract.commands
Class ContractSaveCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.contract.commands.ContractSaveCmdImpl
All Implemented Interfaces:
AccCommand, ContractSaveCmd, ControllerCommand, ECCommand, ECTargetableCommand, Protectable

public class ContractSaveCmdImpl
extends ControllerCommandImpl
implements ContractSaveCmd

Add a new contract or update an existing one which is in Draft state (WebSphere Commerce Business Edition only).


Field Summary
static java.lang.String CLASSNAME
           
static java.lang.String COPYRIGHT
           
 
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.ContractSaveCmd
defaultCommandClassName, NAME
 
Constructor Summary
ContractSaveCmdImpl()
           
 
Method Summary
 java.lang.Long getContractId()
          Return contract id
 java.lang.Integer getContractState()
          Return contract state
 TypedProperty getViewInputProperties()
          This method is called by the web controller to retrieve the request properties set by the setRequestProperties() method.
 boolean isInRightStateToUpdate()
          Check if the contract is in right state for updating action
 boolean isUpdate()
          Return if the action is update.
 void performExecute()
          Contains the actual business logic of the command It should be implemented by all the command writer.
 void setContractId(java.lang.Long contractId)
          Set the contract id parameter
 void setContractState(java.lang.Integer newContractState)
          Set the contract state parameter
 void setCurrentContractState(java.lang.Integer newContractState)
          Set the current contract state parameter
 void setLanguageId(java.lang.Integer newLangId)
          Set the language id parameter
 void setRequestProperties(TypedProperty aRequestProperties)
          The WebController calls this method before invoking the execute method in this command to set the request properties for this command.
 void setXML(java.lang.String xmlStirng)
          Set XML string of the contract to save
 void validateParameters()
          Performs server side parameter checking.
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

CLASSNAME

public static final java.lang.String CLASSNAME

COPYRIGHT

public static final java.lang.String COPYRIGHT
Constructor Detail

ContractSaveCmdImpl

public ContractSaveCmdImpl()
Method Detail

getContractId

public java.lang.Long getContractId()
Return contract id
Returns:
java.lang.Long

getContractState

public java.lang.Integer getContractState()
Return contract state
Returns:
java.lang.Integer

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

isInRightStateToUpdate

public boolean isInRightStateToUpdate()
Check if the contract is in right state for updating action

isUpdate

public boolean isUpdate()
Return if the action is update.

performExecute

public void performExecute()
                    throws ECException
Description copied from interface: ECCommand
Contains the actual business logic of the command It should be implemented by all the command writer.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

setContractId

public void setContractId(java.lang.Long contractId)
Set the contract id parameter
Parameters:
contractId - java.lang.Long

setContractState

public void setContractState(java.lang.Integer newContractState)
Set the contract state parameter
Parameters:
newContractState - java.lang.Integer

setCurrentContractState

public void setCurrentContractState(java.lang.Integer newContractState)
Set the current contract state parameter
Parameters:
newContractState - java.lang.Integer

setLanguageId

public void setLanguageId(java.lang.Integer newLangId)
Set the language id parameter
Parameters:
newLangId - java.lang.Integer

setRequestProperties

public void setRequestProperties(TypedProperty aRequestProperties)
                          throws ECApplicationException
Description copied from interface: ControllerCommand
The WebController calls this method before invoking the execute method in this command to set the request properties for this command. It is the responsibility of the implementer of the ControllerCommand to extract the required input parameters from the request properties and perform parameter checking.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Following copied from interface: com.ibm.commerce.command.ControllerCommand
Parameters:
requestProperties - com.ibm.commerce.datatype.TypedProperty
Throws:
com.ibm.commerce.exception.ECException. -  

setXML

public void setXML(java.lang.String xmlStirng)
Description copied from interface: ContractSaveCmd
Set XML string of the contract to save
Specified by:
setXML in interface ContractSaveCmd
Following copied from interface: com.ibm.commerce.contract.commands.ContractSaveCmd
Parameters:
xmlString - java.lang.String

validateParameters

public void validateParameters()
                        throws ECException
Description copied from interface: ECCommand
Performs server side parameter checking. This method replaces the checkParameters() method in a previous version of the code.

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -