com.ibm.commerce.contract.commands
Class ContractExportCmdImpl

java.lang.Object
  |
  +--TradingAgreementExportBaseCmdImpl
        |
        +--com.ibm.commerce.contract.commands.ContractExportCmdImpl
All Implemented Interfaces:
AccCommand, ContractExportCmd, ControllerCommand, ECCommand

public class ContractExportCmdImpl
extends TradingAgreementExportBaseCmdImpl
implements ContractExportCmd

Exports the specified contract using the specified language ID to a XML file based on the specified encoding (WebSphere Commerce Business Edition only). The following EJBs are used within the default implementation: ContractAccessBean, TradingAgreementAccessBean, AttachmentAccessBean, LanguageAccessBean, ParticipantAccessBean, TermConditionDescriptionAccessBean, TradingDescriptionAccessBean, AccountAccessBean, TermConditionAccessBean.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASSNAME
          The name of this command.
static java.lang.String COPYRIGHT
          IBM copyright notice field.
 
Fields inherited from interface com.ibm.commerce.contract.commands. ContractExportCmd
defaultCommandClassName, NAME
 
Constructor Summary
ContractExportCmdImpl()
           
 
Method Summary
  AccessVector getResources()
          Gets the access vector accessed by this command.
 java.lang.String getUrl()
          Gets the redirection url to be called when the command completes successfully.
 void performExecute()
          Exports the specified contract.
 void setContractId(java.lang.Long contractId)
          Sets the ID of the contract to be exported.
 void setExportAllData(boolean wantsAll)
          Sets the exporting all data flag.
 void setFileName(java.lang.String astrFileName)
          Sets the XML file to which the contract will be exported.
 void setLangId(java.lang.Integer anLangId)
          Sets the language ID.
 void setRequestProperties( TypedProperty aRequestProperties)
          Sets the request properties.
 void setUrl(java.lang.String astrUrl)
          Sets the redirection URL to be called when the command completes successfully.
 void setXMLFileEncoding(java.lang.String encoding)
          Sets the encoding.
 void setXSDFileName(java.lang.String xsdName)
          Sets the XSD file name.
 void validateParameters()
          Validates the contract to check if it is in right state for the exporting process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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 this command.
See Also:
Constant Field Values
Constructor Detail

ContractExportCmdImpl

public ContractExportCmdImpl()
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 exported.
Specified by:
getResources in interface ECCommand
Returns:
AccessVector - a vector of resource action pairs
Throws:
ECException
See Also:
AbstractECTargetableCommand.getResources()

getUrl

public java.lang.String getUrl()
Gets the redirection url to be called when the command completes successfully.
Returns:
The redirect url string.

performExecute

public void performExecute()
                    throws ECException
Exports the specified contract.
Specified by:
performExecute in interface ECCommand
Throws:
ECException - Raised with message _ERR_UNSUPPORTED_ENCODING whenever an unsupported encode is found. Raised with message _ERR_IO_EXCEPTION whenever an IO problem occurred. Raised with message _ERR_EXPORT_CONTRACT if a problem occurred, but this command cannot determine the reason. Raised with message _ERR_CONTRACT_CMD_EXEC whenever one of the following exceptions occurs: javax.ejb.FinderException, javax.ejb.CreateException, java.rmi.RemoteException, and javax.naming.NamingException.
See Also:
AbstractECTargetableCommand.performExecute()

setContractId

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

setExportAllData

public void setExportAllData(boolean wantsAll)
Sets the exporting all data flag.
Specified by:
setExportAllData in interface ContractExportCmd
Parameters:
wantsAll - the flag to indicate if all the data will be exported. If the flag is set to true, the contract ID, term and condition IDs, time created, and the last updated time will be exported. otherwise, the information will not be exported.

setFileName

public void setFileName(java.lang.String astrFileName)
Sets the XML file to which the contract will be exported.
Specified by:
setFileName in interface ContractExportCmd
Parameters:
astrFileName - the name of the XML file

setLangId

public void setLangId(java.lang.Integer anLangId)
Sets the language ID.
Specified by:
setLangId in interface ContractExportCmd
Parameters:
anLangId - the language ID of the descriptions in the contract.

setRequestProperties

public void setRequestProperties(TypedProperty aRequestProperties)
                          throws ECApplicationException
Sets the request properties.
Specified by:
setRequestProperties in interface ControllerCommand
Parameters:
aRequestProperties - the request properties The mandatory name-value pairs are contractId, fileName, langId, xsdName, URL. The optional name-value parameters are xmlFileEncoding, all, tagName. If the xmlFileEncoding is not provided, the default value will be UTF-8. The default value for name "all" is set to true which means the ids, create time, update time will be exported to the specified xml file. If the tagName is not provided, when a contract is exported, the tag name of the contract will based on the default implementation. For example, a referral contract, the tag will be ReferralContract.
Throws:
ECApplicationException - Raised with message _ERR_MISSING_CMD_PARAMETER when any one of the required url parameters is missing. The required parameters are contractId, langId, fileName, URL, and xsdName. Raised with message InvalidParameterValueException whenever either the contradId or langId parameter has the bad format.
See Also:
ControllerCommand#setRequestProperties(TypedProperty)

setUrl

public void setUrl(java.lang.String astrUrl)
Sets the redirection URL to be called when the command completes successfully.
Specified by:
setUrl in interface ContractExportCmd
Parameters:
astrUrl - the redirection URL string

setXMLFileEncoding

public void setXMLFileEncoding(java.lang.String encoding)
Sets the encoding.
Specified by:
setXMLFileEncoding in interface ContractExportCmd
Parameters:
encoding - the encoding string

setXSDFileName

public void setXSDFileName(java.lang.String xsdName)
Sets the XSD file name.
Specified by:
setXSDFileName in interface ContractExportCmd
Parameters:
xsdName - The name of the XSD file which the contract xml should against for.

validateParameters

public void validateParameters()
                        throws ECException
Validates the contract to check if it is in right state for the exporting process.
Specified by:
validateParameters in interface ECCommand
Throws:
ECException - Raised with message _ERR_CONTRACT_OBJECT_NOT_FOUND if the specified contract cannot be found. Raised with message _ERR_WRONG_CONTRACT_STATE if the contract is in one of the following state: EC_STATE_DEPLOY_FAILED, EC_STATE_DEPLOY_IN_PROGRESS. see AbstratECTargetableCommand#validateParameters()