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

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

public class ContractTCCreateCmdImpl
extends ControllerCommandImpl
implements ContractTCCreateCmd

This is the default implementation of ContractTCCreateCmd (WebSphere Commerce Business Edition only). Create a terms and conditions based on the TermCondition element XML string to the specified contract. The contract has to be in Draft state. The following AccessBeans are used in this default implementation: ContractAccessBean, TermConditionDescriptionAccessBean, ParticipantAccessBean, OrderApprovalTCAccessBean, PriceTCMasterCatalogWithFilteringAccessBean, PriceTCPriceListWithOptionalAdjustmentAccessBean, PriceTCMasterCatalogWithOptionalAdjustmentAccessBean, PriceTCPriceListWithSelectiveAdjustmentAccessBean, ReferralInterfaceTCAccessBean, FulfillmentTCAccessBean, ObligationToBuyTCByAmountAccessBean, PaymentTCAccessBean, OrderTCOrderCommentAccessBean, OrderTCOrderItemPAttributeAccessBean, PriceTCCustomPriceListAccessBean, ProductSetTCCustomExclusionAccessBean, ProductSetTCCustomInclusionAccessBean, ProductSetTCExclusionAccessBean, ProductSetTCInclusionAccessBean, ReturnTCRefundPaymentMethodAccessBean, ReturnTCReturnChargeAccessBean, RightToBuyTCByAmountAccessBean, ShippingTCShipToAddressAccessBean, ShippingTCShippingChargeAccessBean, ShippingTCShippingModeAccessBean

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 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. ContractTCCreateCmd
defaultCommandClassName, NAME
 
Constructor Summary
ContractTCCreateCmdImpl()
           
 
Method Summary
 org.w3c.dom.Element getElement()
          Returns the term condition element.
  AccessVector getResources()
          Gets the access vector accessed by this command.
 void parseXMLElement(org.w3c.dom.Element anTCElement)
          Parses the term and condition element and gets the long description and the short description of the term and condition.
 void performExecute()
          The method creates the term and condition .
 void setContractId(java.lang.Long contractId)
          Sets the ID of the contract which the term and condition will be added to.
 void setElement(org.w3c.dom.Element anElement)
          Sets term and condition Element object.
 void setLanguageId(java.lang.Integer langId)
          Deprecated.  
 void setRequestProperties( TypedProperty aRequestProperties)
          Retrieves input parameters from the request properties.
 void setTcLongDescription(java.lang.String tcLongDescription)
          Deprecated.  
 void setTcReferenceNumber(java.lang.Long tcId)
          Deprecated.  
 void setTcReferenceNumber(java.lang.String tcIdStr)
          Deprecated.  
 void setTcShortDescription(java.lang.String tcShortDescription)
          Deprecated.  
 void setXMLEntityPath(java.lang.String path)
          Sets the XML entity path.
 void validateParameters()
          Checks if the contract object exists.
 
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 this command.
See Also:
Constant Field Values
Constructor Detail

ContractTCCreateCmdImpl

public ContractTCCreateCmdImpl()
Method Detail

getElement

public org.w3c.dom.Element getElement()
Returns the term condition element.
Returns:
the terms and conditions Element object

getResources

public AccessVector getResources()
                          throws ECException
Gets the access vector accessed by this command. The default implementation returns ContractAccessBean of the contract which the term and condition 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()

parseXMLElement

public void parseXMLElement(org.w3c.dom.Element anTCElement)
Parses the term and condition element and gets the long description and the short description of the term and condition.

performExecute

public void performExecute()
                    throws ECException
The method creates the term and condition .
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - Raised with message _ERR_RETRIEVE_STORE_ID if the store id cannot be retrived from the information provided in StoreRef element in one of the terms and conditions. Raised with message _ERR_RETRIEVE_POLICY_TYPE if the policy type cannot be retrived based on information in policy reference element. Raised with message _ERR_RETRIEVE_ORG_ID if an error occurred when retrieving the organization ID. Raised with message _ERR_RETRIEVE_USER_ID if an error occurred when retrieving the user ID. Raised with message _ERR_RETRIEVE_MEMBER_GROUP_ID if an error occurred when retrieving the member group ID. Raised with message _ERR_RETRIEVE_OPERATOR_ID if an error occurred when retrieving opeartor_id. The value of "operator" in "AttributeValue" element is incorrect. Raised with message _ERR_RETRIEVE_PATTRIBUTE_ID if an error occurred when retrieving pattribute_id. The value of "attributeName" in "AttributeDetail" element is incorrect. Raised with message _ERR_RETRIEVE_CATENTRY_ID if an error occurred when retrieving catentry_id. The information specified in "OrderTCOrderItemPAttribute" element is incorrect. Raised with message _ERR_RETRIEVE_POLICY_ID if an error occurred when retrieving policy_id. The information specified in the policy reference element is incorrect. Raised with message _ERR_RETRIEVE_FFMCENTER_ID if an error occurred when retrieving ffmcenter_id. The information specified in "FilfillmentCenterRef" element is incorrect. Raised with message _ERR_COLUMN_ACCESSBEANNAME_IN_PATTRIBUTE_NOT_POPULATED if an error occurred when retrieving personalization attribute value accessbean. Column accessbeanname in table pattribute is not populated correctly. Raised with message _ERR_PATTRIBUTE_NOT_REGISTERED_IN_TABLE_PATTRPROD_FOR_CATENTRY if an error occurred when validating whether catentry has the corresponding personalization attribute registered in table PattrProd. catentry_id and pattribute_id retrieved from OrderTCOrderItemPAttribute element should be registered in table PattrProd. Raised with message _ERR_TOO_MANY_FULFILLMENT_TC if a contract has more than three fulfillment centers defined in a term and condition. Raised with message _ERR_SAVE_TC_ATTR if an error occurred when saving the attribute of the term and condition to tcattr table. Raised with message _ERR_DUPLICATE_KEY_IN_PROCESSING_TC if a duplicate key error occurred when processing a term and condition. Raised with message _ERR_NUMBER_FORMAT_EXCEPTION if the provided lang ID in the description element cannot be converted to an Integer object. The error will be only occurred for DTD based (Version 5) element. Raised with message _ERR_CONTRACT_CMD_EXEC if any other types of errors occurred.
See Also:
AbstratECTargetableCommand#performExecute()

setContractId

public void setContractId(java.lang.Long contractId)
Sets the ID of the contract which the term and condition will be added to.
Parameters:
contractId - the contract ID

setElement

public void setElement(org.w3c.dom.Element anElement)
Sets term and condition Element object.
Parameters:
anElement - the term and condition Element object

setLanguageId

public void setLanguageId(java.lang.Integer langId)
Deprecated.  
Sets the language ID
Parameters:
langId - the language ID

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. The mandatory name-value pairs are XMLString, contractId. The optional name-value pair is path. The path parameter indicate the path of the DTD or XML schema files. The default value of the path parameter is specified in WebSphere Commerce instance XML file.
Throws:
ECApplicationException - Raised with message _ERR_MISSING_CMD_PARAMETER when contractId or the input XML string is missed.
See Also:
ControllerCommand#setRequestProperties(TypedProperty)

setTcLongDescription

public void setTcLongDescription(java.lang.String tcLongDescription)
Deprecated.  
Sets the long description of the term and condition
Parameters:
tcLongDescription - the term and condition long description string

setTcReferenceNumber

public void setTcReferenceNumber(java.lang.Long tcId)
Deprecated.  
Sets the ID of the term and condition
Parameters:
tcId - the ID of the term and condition in Long object

setTcReferenceNumber

public void setTcReferenceNumber(java.lang.String tcIdStr)
Deprecated.  
Sets the ID of the term and condition
Parameters:
tcIdStr - the ID of the term and condition in String object

setTcShortDescription

public void setTcShortDescription(java.lang.String tcShortDescription)
Deprecated.  
Sets the short description of the term and condition
Parameters:
tcShortDescription - the short description of the term and condition

setXMLEntityPath

public void setXMLEntityPath(java.lang.String path)
Sets the XML entity path.
Parameters:
path - the path where can find the DTD or XML Schema file(s)

validateParameters

public void validateParameters()
                        throws ECException
Checks if the contract object exists.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException - Raised with message _ERR_CONTRACT_OBJECT_NOT_FOUND if the contract cannot be found in the database based on the provided contract ID. Raised with message _ERR_WRONG_CONTRACT_STATE If the contract is not in Draft or Rejected state. Raised with message _ERR_GENRIC_PARSE_XML_FILE if an error occurred when parse the term and condition element. Raised with message _ERR_FINDER_EXCEPTION if the FinderException occurred. Raised with message _ERR_REMOTE_EXCEPTION if the RemoteException occurred. Raised with message _ERR_NAMING_EXCEPTION if the NamingException occurred. Raised with message _ERR_CREATE_EXCEPTION if the CreateException occurred.
See Also:
AbstractECTargetableCommand.validateParameters()