com.ibm.commerce.contract.commands
Class TradingAgreementImportBaseCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.ControllerCommandImpl
                    |
                    +--com.ibm.commerce.contract.commands.TradingAgreementImportBaseCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand
Direct Known Subclasses:
AccountImportCmdImpl, AccountSaveCmdImpl, ContractImportApprovedVersionCmdImpl, ContractImportDraftVersionCmdImpl, ContractSaveCmdImpl

public abstract class TradingAgreementImportBaseCmdImpl
extends ControllerCommandImpl
implements ControllerCommand

This is the base implementation of Contrat Import Commands

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.command. ECCommand
defaultCommandClassName
 
Constructor Summary
TradingAgreementImportBaseCmdImpl()
           
 
Method Summary
protected  java.lang.Long getAccountId()
          Gets the id of the account.
protected  java.lang.Long getContractId()
          Gets the id of the contract.
protected  org.w3c.dom.Document getDOMFromFile(java.lang.String XMLFileName, boolean validation, boolean xsd, java.lang.String entityPath)
          Gets the contract xml Document object from the specified xml file.
protected  org.w3c.dom.Document getDOMFromInputStream(java.io.InputStream xmlInputStream, boolean validation, boolean xsd, java.lang.String entityPath)
          Gets the contract xml Document object from the InputStream.
protected  java.util.Vector getElementsByTag(org.w3c.dom.Element pElement, java.lang.String tag)
          Gets all the elements which the tag name ends with the specified tag.
protected  boolean getXMLFlag()
          Gets the value of the xsd flag.
protected  void importContractNLDesc(org.w3c.dom.Element cntrDescElement)
          Imports a contract description based on the contract description element
protected  void importFfcNLDesc(org.w3c.dom.Element ffcDescElement)
          Imports a fulfillment center description based on the fulfillment center description element.
protected  void importStoreNLDesc(org.w3c.dom.Element storeDescElement)
          Imports a store description based on the store description element.
protected  java.lang.Long saveAccount(org.w3c.dom.Element accountElement, boolean actionFlag)
          Saves the account based on the account Element object.
protected  void saveContract(org.w3c.dom.Element contractElement, boolean actionFlag)
          Saves a contract based on the contract element
 void setXSDFlag(boolean xsdFlag)
          Sets the value of the xsd flag.
 
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, setRequestProperties, 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, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, performExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
 
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, setRequestProperties, 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, getResources, getStoreId, getUser, getUserId, performExecute, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
 

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

TradingAgreementImportBaseCmdImpl

public TradingAgreementImportBaseCmdImpl()
Method Detail

getAccountId

protected java.lang.Long getAccountId()
Gets the id of the account.
Returns:
the account id

getContractId

protected java.lang.Long getContractId()
Gets the id of the contract.
Returns:
the contract id

getXMLFlag

protected boolean getXMLFlag()
Gets the value of the xsd flag. true: XSD; false: DTD
Returns:
the xsd flag, true: XSD; false: DTD.

getDOMFromFile

protected org.w3c.dom.Document getDOMFromFile(java.lang.String XMLFileName,
                                              boolean validation,
                                              boolean xsd,
                                              java.lang.String entityPath)
                                       throws ECException
Gets the contract xml Document object from the specified xml file.
Parameters:
XMLFileName - The xml file name.
validation - If ture, do the xml validate, false no.
xsd - true if the file is xml schema based; false if the file is dtd based
entityPath - the paths of the xml schema files
Returns:
A Document object of the xml instance.
Throws:
ECException - Raised with message _ERR_FILE_NOT_FOUND if the contract xml file or the xsd file cannot be found. Raised with message _ERR_PARSE_XML_FILE if an error occurred when the parser parses the xml file. Raised with message _ERR_GENRIC_PARSE_XML_FILE if an error occurred when there is IO exception occurred.

getDOMFromInputStream

protected org.w3c.dom.Document getDOMFromInputStream(java.io.InputStream xmlInputStream,
                                                     boolean validation,
                                                     boolean xsd,
                                                     java.lang.String entityPath)
                                              throws ECException
Gets the contract xml Document object from the InputStream.
Parameters:
xmlInputStream - the InputStream object contain the contract xml instance
validation - If ture, do the xml validate, false no.
xsd - true if the file is xml schema based; false if the file is dtd based
entityPath - the paths of the xml schema files
Returns:
A Document object of the xml instance.
Throws:
ECException - Raised with message _ERR_PARSE_XML_FILE if an error occurred when the parser parses the input stream. Raised with message _ERR_GENRIC_PARSE_XML_FILE if an error occurred when there is IO exception occurred.

getElementsByTag

protected java.util.Vector getElementsByTag(org.w3c.dom.Element pElement,
                                            java.lang.String tag)
Gets all the elements which the tag name ends with the specified tag.
Parameters:
pElement - a xml element
tag - the tag name
Returns:
A vector contains the required elements.

importContractNLDesc

protected void importContractNLDesc(org.w3c.dom.Element cntrDescElement)
                             throws ECException
Imports a contract description based on the contract description element
Parameters:
cntrDescElement - The contract national language description Element object.
Throws:
ECException
See Also:
AddContractNLDescriptionCmdImpl

importStoreNLDesc

protected void importStoreNLDesc(org.w3c.dom.Element storeDescElement)
                          throws ECException
Imports a store description based on the store description element.
Parameters:
storeDescElement - the national language description of the store
Throws:
ECException
See Also:
AddStoreNLDescriptionCmdImpl#performExecute()

importFfcNLDesc

protected void importFfcNLDesc(org.w3c.dom.Element ffcDescElement)
                        throws ECException
Imports a fulfillment center description based on the fulfillment center description element.
Parameters:
ffcDescElement - the national language description of the fulfillment center
Throws:
ECException
See Also:
AddStoreNLDescriptionCmdImpl#performExecute()

saveAccount

protected java.lang.Long saveAccount(org.w3c.dom.Element accountElement,
                                     boolean actionFlag)
                              throws ECException
Saves the account based on the account Element object.
Parameters:
accountElement - the account Element object
actionFlag - the action of the account saving process. true: create false: update
Returns:
accountId the id of the created/updated account
Throws:
ECException
See Also:
SaveAccountCmdImpl

saveContract

protected void saveContract(org.w3c.dom.Element contractElement,
                            boolean actionFlag)
                     throws ECException
Saves a contract based on the contract element
Parameters:
contractElement - The Element object contains the contract information.
actionFlag - the action of the contract saving process. true: create false: update
Throws:
ECException
See Also:
CreateXSDContractCmdImpl, UpdateXSDContractCmdImpl

setXSDFlag

public void setXSDFlag(boolean xsdFlag)
Sets the value of the xsd flag. true: XSD; false: DTD
Parameters:
xsdFlag - the flag indicate it is xsd based or dtd based xml instance.