public abstract class TelesalesRequest extends java.lang.Object implements ITelesalesRequestHandler
Modifier and Type | Field and Description |
---|---|
protected org.w3c.dom.Element | applicationAreaElement_
applicationAreaElement_ contains the request document's ApplicationArea element.
|
protected org.w3c.dom.Element | commerceAreaElement_
commerceArea contains the request document's CommerceArea element.
|
protected org.w3c.dom.Element | dataAreaElement_
dataAreaElement_ contains the request document's DataArea element.
|
static char | DEFAULT_MASK_CHAR
Used as the default masking agent for maskRequestBod and maskResponseBod.
|
protected org.w3c.dom.Document | document_
document_ contains the document that is being processed.
|
protected org.w3c.dom.Element | getElement_
getElement_ contains the request document's Get element.
|
protected TelesalesModelManager | model_
Model manager instance.
|
static java.lang.String | NAME_SPACE_AND_TAG_LOCAL_NAME_SEPARATOR
Constant for separator of name space and tag name.
|
static java.lang.String | NODE_SEPARATOR_SLASH
Constant for node separator.
|
protected org.w3c.dom.Element | returnCriteriaElement_
returnCriteriaElement_ contains the request document's ReturnCriteria element.
|
protected org.w3c.dom.Element | rootElement_
rootElement_ contains the request document's root element.
|
protected org.w3c.dom.Element | senderElement_
senderElement_ contains the request document's Sender element.
|
protected TelesalesServiceRequest | serviceRequest_
serviceRequest_ contains the service request object.
|
Constructor and Description |
---|
TelesalesRequest()
Creates a new request handler.
|
Modifier and Type | Method and Description |
---|---|
protected org.w3c.dom.Element | createApplicationAreaElement()
This method builds the ApplicationArea element.
|
protected org.w3c.dom.Element | createCommerceAreaElement(org.w3c.dom.Element parentElement)
This method builds the CommerceArea element and adds it as a child of the specified parent element.
|
protected org.w3c.dom.Element | createDataAreaElement()
This method is called to build the DataArea element.
|
protected org.w3c.dom.Element | createDocumentElementNS(java.lang.String nameSpace, org.w3c.dom.Element parentElement, java.lang.String elementName)
This is a convenience method that creates a new element for the request document.
|
protected org.w3c.dom.Element | createDocumentElementNS(java.lang.String nameSpace, org.w3c.dom.Element parentElement, java.lang.String elementName, java.lang.String value)
This is a convenience method that creates a new element for the request document.
|
protected org.w3c.dom.Element | createGetElement()
This method builds the Get element and adds it as a child of the DataArea element.
|
protected org.w3c.dom.Element | createOADocumentElement(org.w3c.dom.Element parentElement, java.lang.String elementName)
This is a convenience method that creates a new OA element for the request document.
|
protected org.w3c.dom.Element | createOADocumentElement(org.w3c.dom.Element parentElement, java.lang.String elementName, java.lang.String value)
This is a convenience method that creates a new OA element for the request document.
|
protected org.w3c.dom.Element | createReturnCriteriaElement()
This method builds the ReturnCriteria element and adds it as a child of the Get element.
|
protected void | createRootElementNS(java.lang.String nameSpace, java.lang.String rootElementName)
This method creates a new request BOD document and the root element.
|
protected org.w3c.dom.Element | createSelectExpressionElement(java.lang.String fieldName, java.lang.String searchType, java.lang.String value)
This method builds the SelectExpression element and adds it as a child of the ReturnCriteria element.
|
protected org.w3c.dom.Element | createSenderElement()
This method is called to build the Sender element.
|
protected org.w3c.dom.Element | createUserDataElement(org.w3c.dom.Element parentElement, ModelObject modelObject)
This method constructs the UserData element from the user data properties in the specified model object.
|
protected org.w3c.dom.Element | createWCDocumentElement(org.w3c.dom.Element parentElement, java.lang.String elementName)
This is a convenience method that creates a new WC element for the request document.
|
protected org.w3c.dom.Element | createWCDocumentElement(org.w3c.dom.Element parentElement, java.lang.String elementName, java.lang.String value)
This is a convenience method that creates a new WC element for the request document.
|
protected void | createWCRootElement(java.lang.String rootElementName)
This is a convenient method to create a new WC request BOD document and the root element.
|
protected void | findNodeListWithLocalName(org.w3c.dom.Node aNode, java.lang.String astrName, java.util.Vector nodeList)
This method helps to find all the corresponding Node with the given name in the Document.
|
protected org.w3c.dom.Element | getChildElement(org.w3c.dom.Element parentElement, java.lang.String localTagName)
This is a convenience method that returns the first child element of the specified element with the specified tag name.
|
protected java.util.ArrayList | getChildElements(org.w3c.dom.Element parentElement, java.lang.String localTagName)
This is a convenience method that returns a list of child elements that have the specified name.
|
protected java.lang.String | getChildElementValue(org.w3c.dom.Element parentElement, java.lang.String tagName)
This is a convenience method that returns any text that is contained within the specified parent element.
|
protected java.lang.String | getElementValue(org.w3c.dom.Element element)
This is a convenience method that returns the child text for the specified element.
|
protected java.lang.String | getEnvironment()
This method returns the environment of the request BOD(Business Object Document).
|
com.ibm.commerce.telesales.core.IErrorHandler | getErrorHandler()
Returns the error handler associated with the request class.
|
protected java.lang.String | getLanguage()
This method returns the language of the request BOD(Business Object Document).
|
java.lang.Object | getRequest()
This method returns the request message.
|
protected abstract org.w3c.dom.Document | getRequestBod()
This method builds the request Business Object Document (BOD) used to execute a Commerce command.
|
protected java.lang.String[] | getRequestNodePathsToMask()
This method allows the implementor to return request node paths which need to be masked before logging.
|
protected abstract Session | getResponseData()
This method returns the com.ibm.commerce.telesales.model.Session databean.
|
protected java.lang.String[] | getResponseNodePathsToMask()
This method allows the implementor to return response node paths which need to be masked before logging.
|
protected TelesalesRequestStatus | getResponseStatus()
This method returns the status of the service request.
|
protected java.lang.String | getRevision()
This method returns default revision number of the request BOD(Business Object Document).
|
protected java.lang.String | getServiceRequestContext()
This method returns the service request context.
|
protected java.lang.String | getStoreId()
This method retrieves the store identifier associated with this request.
|
protected java.lang.String | getTagNameWithoutNameSpace(java.lang.String astrName)
This method retrieves the local name of the given tag name.
|
protected TelesalesProperties | getTelesalesProperties()
This method returns the TelesalesProperties properties used by this request handler.
|
protected java.lang.String | getVersion()
This method retrieves the version number of the request BOD(Business Object Document).
|
protected abstract java.lang.String | getXSDFileName()
This abstract method returns the schema file name used by this request handler.
|
TelesalesRequestStatus | handleError(TelesalesServicesException ex)
This method handles the exception that is thrown.
|
TelesalesRequestStatus | handleResponse(java.lang.Object response)
This method handles the response.
|
void | init(TelesalesServiceRequest serviceRequest)
This method initializes the request handler.
|
protected org.w3c.dom.Document | maskRequestBod(org.w3c.dom.Document bod)
This method allows the implementor to mask sensitive values within the request BOD XML prior to logging.
|
protected org.w3c.dom.Document | maskResponseBod(org.w3c.dom.Document bod)
This method allows the implementor to mask sensitive values within the response BOD XML prior to logging.
|
static java.lang.String | maskValue(java.lang.String sensitiveValue, char mask)
This utility replaces the sensitive string with the masked character '*'.
|
void | setErrorHandler(com.ibm.commerce.telesales.core.IErrorHandler errorHandler)
This method sets the error handler associated with a request class.
|
protected void | setRootElementAttributes(org.w3c.dom.Element rootElement)
This method is used to set attributes for the root element.
|
protected void | setServiceRequestContext(java.lang.String context)
This method sets the service request context.
|
protected void | setTelesalesProperties(TelesalesProperties properties)
This method sets the TelesalesProperties used by this request handler.
|
protected void | unmarshallApplicationArea(Session databean, org.w3c.dom.Element applicationAreaElement)
This method unmarshalls the ApplicationArea element and stores data in the specified databean.
|
protected TelesalesRequestStatus | unmarshallBODFailure(org.w3c.dom.Element bodFailureElement)
This method unmarshalls the BODFailure element and constructs an instance of TelesalesRequestStatus.
|
protected TelesalesRequestStatus | unmarshallBODSuccess(org.w3c.dom.Element bodSuccessElement)
This method unmarshalls the BODSuccess element and constructs an instance of TelesalesRequestStatus.
|
protected abstract void | unmarshallResponseBod(org.w3c.dom.Document bod)
This method unmarshalls the response Business Object Document (BOD) returned by the executed Commerce command.
|
protected void | unmarshallShow(org.w3c.dom.Element showElement)
This method unmarshalls the Show element's attributes only.
|
protected org.w3c.dom.Element | unmarshallUserData(ModelObject modelObject, org.w3c.dom.Element userDataElement)
This method unmarshalls the UserData element and sets the name/value pairs as properties on the specified model object.
|
protected abstract void | updateModel(java.lang.Object databean)
This method allows the request handler to update the model ( com.ibm.commerce.telesales.model.TelesalesModelManager) prior to the UI being notified of the completion of the service request.
|
public static final char DEFAULT_MASK_CHAR
public static final java.lang.String NAME_SPACE_AND_TAG_LOCAL_NAME_SEPARATOR
public static final java.lang.String NODE_SEPARATOR_SLASH
protected TelesalesServiceRequest serviceRequest_
protected TelesalesModelManager model_
protected org.w3c.dom.Document document_
When the request document is being built, this variable contains the request document. It is initialized by the createRootElementNS() method.
When the response document is being parsed, this variable contains the response document. It is initialized before the unmarshallResponseBod method is called.
The convenience methods in this class that create and locate elements refer to this variable.
protected org.w3c.dom.Element rootElement_
protected org.w3c.dom.Element applicationAreaElement_
protected org.w3c.dom.Element senderElement_
protected org.w3c.dom.Element dataAreaElement_
protected org.w3c.dom.Element commerceAreaElement_
protected org.w3c.dom.Element getElement_
protected org.w3c.dom.Element returnCriteriaElement_
public void init(TelesalesServiceRequest serviceRequest)
Subclasses may override.
public java.lang.Object getRequest()
public TelesalesRequestStatus handleResponse(java.lang.Object response)
protected TelesalesProperties getTelesalesProperties()
protected void setTelesalesProperties(TelesalesProperties properties)
protected java.lang.String getStoreId()
protected java.lang.String getServiceRequestContext()
protected void setServiceRequestContext(java.lang.String context)
protected abstract org.w3c.dom.Document getRequestBod()
Subclasses must override this method to construct the actual BOD.
protected org.w3c.dom.Document maskRequestBod(org.w3c.dom.Document bod)
The default implementation does nothing and returns null to indicate no masking was needed. Any class that overrides this method should return null to indicate no masking was needed.
protected org.w3c.dom.Document maskResponseBod(org.w3c.dom.Document bod)
The default implementation does nothing and returns null to indicate no masking was needed. Any class that overrides this method should return null to indicate no masking was needed.
public static java.lang.String maskValue(java.lang.String sensitiveValue, char mask)
protected abstract Session getResponseData()
protected TelesalesRequestStatus getResponseStatus()
protected abstract void updateModel(java.lang.Object databean)
protected abstract void unmarshallResponseBod(org.w3c.dom.Document bod)
protected void unmarshallApplicationArea(Session databean, org.w3c.dom.Element applicationAreaElement)
<oa:ApplicationArea> <oa:Sender> <oa:LogicalId>COMMERCE</oa:LogicalId> <oa:Component>Logon</oa:Component> <oa:Task>LogonOperatorResponse</oa:Task> <oa:Confirmation>0</oa:Confirmation> </oa:Sender> <oa:CreationDateTime>2004-06-28T11:29:27</oa:CreationDateTime> <oa:Signature qualifyingAgency=""/> <oa:BODId>2004-06-28T11:29:27[wcsadmin]client1</oa:BODId> <oa:UserArea/> </oa:ApplicationArea>
protected void unmarshallShow(org.w3c.dom.Element showElement)
<wc:DataArea> <oa:Show confirm="Always" numSearchResults="2" resultSetSize="5"> <!-- GenericGet.setCurrentNumOfRecords(2) GenericGet.setTotalNumOfRecords(5) --> </wc:DataArea>
protected TelesalesRequestStatus unmarshallBODFailure(org.w3c.dom.Element bodFailureElement)
<BODFailure> <ErrorMessage> <Description>An error has occurred.</Description> <!-- stored in TelesalesRequestStatus.setMessage --> <ReasonCode>2030</ReasonCode> <!-- stored in TelesalesRequestStatus.setCode --> </ErrorMessage> </BODFailure>
protected TelesalesRequestStatus unmarshallBODSuccess(org.w3c.dom.Element bodSuccessElement)
<BODSuccess> <WarningMessage> <Description/> <!-- stored in TelesalesRequestStatus.setMessage --> <ReasonCode>0000</ReasonCode> <!-- stored in TelesalesRequestStatus.setCode --> </WarningMessage> </BODSuccess>
protected org.w3c.dom.Element unmarshallUserData(ModelObject modelObject, org.w3c.dom.Element userDataElement)
The following is a sample UserData element:
<UserData> <UserDataField name="height">300</UserDataField> <UserDataField name="width">100</UserDataField> </UserData>
protected org.w3c.dom.Element createApplicationAreaElement()
This method requires that a property called "username" exists in the TelesalesProperties object that was passed to this data access object.
The following is a sample ApplicationArea element that indicates how the element is constructed:
<oa:ApplicationArea> <oa:Sender> <!-- created by the createSenderElement method --> . . . </oa:Sender> <oa:CreationDateTime>2004-08-11T08:09:15</oa:CreationDateTime> <!-- current time --> <oa:Signature qualifyingAgency=""/> <oa:BODId>2004-08-11T08:09:15[wcsadmin]client1</oa:BODId> <!-- time/userid/hostname --> <oa:UserArea/> </oa:ApplicationArea>
protected org.w3c.dom.Element createDataAreaElement()
The following is a sample DataArea element:
<DataArea> . . </DataArea>
protected org.w3c.dom.Element createCommerceAreaElement(org.w3c.dom.Element parentElement)
The following sample indicates the structure of the CommerceArea element and how it is constructed:
<CommerceArea> <StoreId>10001</StoreId> <!-- "store.id" TelesalesProperties property --> </CommerceArea>
protected org.w3c.dom.Element createSenderElement()
The following is a sample Sender element:
<oa:Sender> . . </oa:Sender>
protected org.w3c.dom.Element createUserDataElement(org.w3c.dom.Element parentElement, ModelObject modelObject)
The following is a sample UserData element:
<UserData> <UserDataField name="height">300</UserDataField> <UserDataField name="width">100</UserDataField> </UserData>
protected org.w3c.dom.Element createGetElement()
The following sample indicates the structure of the Get element and how it is constructed:
<Get> <ReturnCriteria> <!-- created by createReturnCriteriaElement --> . . </ReturnCriteria> </Get>
protected org.w3c.dom.Element createReturnCriteriaElement()
The following sample indicates the structure of the ReturnCriteria element and how it is constructed:
<ReturnCriteria startIndex="0" maxThreshold="12" expressionLanguage="XPath"> <SelectExpression/> <!-- created by createSelectExpressionElement, one for each find criteria entry --> <SelectExpression/> </ReturnCriteria>
protected org.w3c.dom.Element createSelectExpressionElement(java.lang.String fieldName, java.lang.String searchType, java.lang.String value)
The following sample indicates the structure of the SelectExpression element and how it is constructed:
<SelectExpression name="LastName" searchType="IgnoreCaseBegin">Smith</SelectExpression>
protected java.lang.String getVersion()
protected java.lang.String getRevision()
protected java.lang.String getLanguage()
protected java.lang.String getEnvironment()
protected abstract java.lang.String getXSDFileName()
protected void createRootElementNS(java.lang.String nameSpace, java.lang.String rootElementName)
The following is a sample root element:
<ProcessLogon environment="Test" lang="en-US" revision="8.1.0" version="8.1" xmlns:wc="http://www.ibm.com/WebsphereCommerce/Telesales/oagis" <!-- created by the <code>setRootElementAttributes</code> method --> xmlns:oa="http://www.openapplications.org/oagis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/WebsphereCommerce/Telesales/oagis ../BODs/ProcessLogon.xsd"> <oa:ApplicationArea> <!-- created by the <code>createApplicationAreaElement</code> method --> . . </oa:ApplicationArea> <DataArea> <!-- created by the <code>createDataAreaElement</code> method --> . . </DataArea> </ProcessLogon>
protected void createWCRootElement(java.lang.String rootElementName)
protected void setRootElementAttributes(org.w3c.dom.Element rootElement)
The following example shows the attributes set.
<wc:GetCustomer environment="Test" lang="en-US" revision="8.1.0" version="8.1" xsi:schemaLocation="http://www.ibm.com/WebsphereCommerce/Telesales/oagis ../BODs/GetCustomer.xsd" >
protected org.w3c.dom.Element createDocumentElementNS(java.lang.String nameSpace, org.w3c.dom.Element parentElement, java.lang.String elementName, java.lang.String value)
protected org.w3c.dom.Element createOADocumentElement(org.w3c.dom.Element parentElement, java.lang.String elementName, java.lang.String value)
protected org.w3c.dom.Element createWCDocumentElement(org.w3c.dom.Element parentElement, java.lang.String elementName, java.lang.String value)
protected org.w3c.dom.Element createDocumentElementNS(java.lang.String nameSpace, org.w3c.dom.Element parentElement, java.lang.String elementName)
protected org.w3c.dom.Element createOADocumentElement(org.w3c.dom.Element parentElement, java.lang.String elementName)
protected org.w3c.dom.Element createWCDocumentElement(org.w3c.dom.Element parentElement, java.lang.String elementName)
protected java.lang.String getElementValue(org.w3c.dom.Element element)
protected org.w3c.dom.Element getChildElement(org.w3c.dom.Element parentElement, java.lang.String localTagName)
protected java.lang.String getChildElementValue(org.w3c.dom.Element parentElement, java.lang.String tagName)
protected java.util.ArrayList getChildElements(org.w3c.dom.Element parentElement, java.lang.String localTagName)
protected void findNodeListWithLocalName(org.w3c.dom.Node aNode, java.lang.String astrName, java.util.Vector nodeList)
protected java.lang.String getTagNameWithoutNameSpace(java.lang.String astrName)
This method assumes that the Namespace is a prefix of the given tag name. The character ':' is the separater between the Namespace and the actual tag name. For example, the name space of the given tag name oa:OrderItem is oa, and OrderItem is the tag name returned by this method.If ':' does not exist, it will check for '/' to remove the extra node name from string like showOrder/dataArea/.. then it will remove like dataArea/...
If the separator ':' is not found in the input string it will check for '/' and if '/' is not found in the input string astrName, the original input string is returned.
protected java.lang.String[] getRequestNodePathsToMask()
The default implementation does nothing and returns null to indicate no request node paths require masking.
protected java.lang.String[] getResponseNodePathsToMask()
The default implementation does nothing and returns null to indicate no response note paths require masking.
public com.ibm.commerce.telesales.core.IErrorHandler getErrorHandler()
public void setErrorHandler(com.ibm.commerce.telesales.core.IErrorHandler errorHandler)
public TelesalesRequestStatus handleError(TelesalesServicesException ex)