com.ibm.commerce.contract.commands
Class ContractAttachmentAddCmdImpl

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

public class ContractAttachmentAddCmdImpl
extends ControllerCommandImpl
implements ContractAttachmentAddCmd

Adds an attachment to the contract. If the attachment does not exist, the command will add the attachment first (WebSphere Commerce Business Edition only). The following AccessBeans are used in this default implementation: ContractAccessBean, TradingAttachmentRelationAccessBean, AttachmentAccessBean

See Also:
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. ContractAttachmentAddCmd
defaultCommandClassName, NAME
 
Constructor Summary
ContractAttachmentAddCmdImpl()
          Constructor for ContractAttachmentAddCmdImpl.
 
Method Summary
  AccessVector getResources()
          Gets the access vector accessed by this command.
 void performExecute()
          The method adds the attachment to the specified contract.
 void setMimeType(java.lang.String mimeType)
          Sets the MIME type of the attachment.
 void setMimeTypeEncoding(java.lang.String mimeTypeEncoding)
          Sets the MIME type encoding of the attachment.
 void setRequestProperties( TypedProperty aRequestProperties)
          Retrieves input parameters from the request properties.
 void setTradingId(java.lang.Long newInTradingId)
          Sets the ID of the trading agreement to which the attachment will be added.
 void setURI(java.lang.String newIstrURI)
          Sets URI of the attachment.
 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, 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

ContractAttachmentAddCmdImpl

public ContractAttachmentAddCmdImpl()
Constructor for ContractAttachmentAddCmdImpl.
Method Detail

getResources

public AccessVector getResources()
                          throws ECException
Gets the access vector accessed by this command. The default implementation returns ContractAccessBean of the contract which the attachment will be added to.
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 adds the attachment to the specified contract.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - Raised with message _ERR_DUPLICATED_ATTACHMENT_URL if the relationship between the trading agreement and the specified attachment already exists.
See Also:
AbstractECTargetableCommand.performExecute()

setMimeType

public void setMimeType(java.lang.String mimeType)
Sets the MIME type of the attachment.
Specified by:
setMimeType in interface ContractAttachmentAddCmd
Parameters:
mimeType - the MIME type fo the attachment

setMimeTypeEncoding

public void setMimeTypeEncoding(java.lang.String mimeTypeEncoding)
Sets the MIME type encoding of the attachment.
Specified by:
setMimeTypeEncoding in interface ContractAttachmentAddCmd
Parameters:
mimeTypeEncoding - the MIME type encoding of the attachment

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 contractId or url is missed from the URL. Raised with message _ERR_NUMBER_FORMAT_EXCEPTION if the parameter(s) provided from the URL do not match their types.
See Also:
ControllerCommandImpl.setRequestProperties(TypedProperty)

setTradingId

public void setTradingId(java.lang.Long newInTradingId)
Sets the ID of the trading agreement to which the attachment will be added.
Specified by:
setTradingId in interface ContractAttachmentAddCmd
Parameters:
newInTradingId - ID of the trading agreement

setURI

public void setURI(java.lang.String newIstrURI)
Sets URI of the attachment.
Specified by:
setURI in interface ContractAttachmentAddCmd
Parameters:
newIstrURI - the attachment URI

validateParameters

public void validateParameters()
                        throws ECException
Validates the contract to check if it is in right state for this process.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException - Raised with message _ERR_WRONG_CONTRACT_STATE if the contract is not in either Draft or Rejected state. Raised with message _ERR_CONTRACT_OBJECT_NOT_FOUND if the contract cannot be found based on the provided contract ID. Raised with message _ERR_DIDNT_LOGON if the user did not logon to WebSphere Commerce.
See Also:
AbstractECTargetableCommand.validateParameters()