atg.svc.clicktoconnect
Class C2CWebServiceParser

java.lang.Object
  extended by atg.svc.clicktoconnect.C2CWebServiceParser

public class C2CWebServiceParser
extends java.lang.Object

This class deals with making a call to the eStara webService API and parsing the XML into a bean which is returned.


Field Summary
static java.lang.String CLASS_VERSION
           
protected  C2CTools mC2CTools
           
protected  java.lang.String mWebServiceResponseClassName
           
 
Constructor Summary
C2CWebServiceParser()
          Constructs an instance of C2CWebServiceParser
 
Method Summary
 java.lang.String createWebServiceURL(java.lang.String pWebServiceURL, java.lang.String pUsername, java.lang.String pPassword, java.lang.String pUserTelephoneNumber)
          Returns the fully qualified URL to make the call to the eStara web service.
 C2CTools getC2CTools()
          Returns a reference to the click to connect tools component.
 java.lang.String getC2CWebServiceResponseClassName()
          Returns the property webServiceResponseClassName
static org.w3c.dom.Document getDocument(javax.xml.parsers.DocumentBuilder documentBuilder, java.lang.String urlString)
          Returns an XML document from the given URL.
static java.lang.String getElementValue(org.w3c.dom.Node elem)
          Returns an element value
 java.util.Map<java.lang.String,java.lang.String> getTagAttributeNameToPropertyNameMap()
           
 java.util.Map<java.lang.String,java.lang.String> getTagNameToPropertyNameMap()
          Returns the tagNameToPropertyNameMap
 C2CWebServiceResponse parse(java.lang.String pWebServiceURL, java.lang.String pUsername, java.lang.String pPassword, java.lang.String pUserTelephoneNumber)
          Parses an exposed eStara web service API into a C2CWebServiceResponse bean.
 void setC2CTools(C2CTools pTools)
          Sets the component C2CTools.
 void setC2CWebServiceResponseClassName(java.lang.String pWebServiceResponseClassName)
          Sets the property WebServiceResponseClassName.
 void setTagAttributeNameToPropertyNameMap(java.util.Map<java.lang.String,java.lang.String> pTagNameToPropertyNameMap)
          Sets the tag attribute to property name map.
 void setTagNameToPropertyNameMap(java.util.Map<java.lang.String,java.lang.String> pTagNameToPropertyNameMap)
          Sets the Tag name to property name map
 C2CWebServiceResponse writeXMLToBean(org.w3c.dom.Node node, C2CWebServiceResponse webServiceResponse)
          Writes node and all child nodes into the C2CWebServiceResponse bean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION

mC2CTools

protected C2CTools mC2CTools

mWebServiceResponseClassName

protected java.lang.String mWebServiceResponseClassName
Constructor Detail

C2CWebServiceParser

public C2CWebServiceParser()
Constructs an instance of C2CWebServiceParser

Method Detail

getC2CTools

public C2CTools getC2CTools()
Returns a reference to the click to connect tools component.

Returns:
The C2CTools component.

setC2CTools

public void setC2CTools(C2CTools pTools)
Sets the component C2CTools.


setC2CWebServiceResponseClassName

public void setC2CWebServiceResponseClassName(java.lang.String pWebServiceResponseClassName)
Sets the property WebServiceResponseClassName.


getC2CWebServiceResponseClassName

public java.lang.String getC2CWebServiceResponseClassName()
Returns the property webServiceResponseClassName

Returns:
The value of the property WebServiceResponseClassName.

getTagNameToPropertyNameMap

public java.util.Map<java.lang.String,java.lang.String> getTagNameToPropertyNameMap()
Returns the tagNameToPropertyNameMap

Returns:
Map of Tag Names to Properties

setTagNameToPropertyNameMap

public void setTagNameToPropertyNameMap(java.util.Map<java.lang.String,java.lang.String> pTagNameToPropertyNameMap)
Sets the Tag name to property name map

Parameters:
pTagNameToPropertyNameMap - The new Mapping of Tag Attribute Names to Property Names

getTagAttributeNameToPropertyNameMap

public java.util.Map<java.lang.String,java.lang.String> getTagAttributeNameToPropertyNameMap()
Returns:
Map of tag attribute to property names

setTagAttributeNameToPropertyNameMap

public void setTagAttributeNameToPropertyNameMap(java.util.Map<java.lang.String,java.lang.String> pTagNameToPropertyNameMap)
Sets the tag attribute to property name map.

Parameters:
pTagNameToPropertyNameMap - The new Mapping of Tag Attribute Names to Property Names

parse

public C2CWebServiceResponse parse(java.lang.String pWebServiceURL,
                                   java.lang.String pUsername,
                                   java.lang.String pPassword,
                                   java.lang.String pUserTelephoneNumber)
                            throws C2CException
Parses an exposed eStara web service API into a C2CWebServiceResponse bean.

Parameters:
pWebServiceURL - the URL where the webService XML is contained
pUsername - the account username required to access this resource
pPassword - the account password required to access this resource
pUserTelephoneNumber - the telephone number for which the information is to be retrieved for
Returns:
a C2CWebServiceResponse object containing the parsed data
Throws:
C2CException

createWebServiceURL

public java.lang.String createWebServiceURL(java.lang.String pWebServiceURL,
                                            java.lang.String pUsername,
                                            java.lang.String pPassword,
                                            java.lang.String pUserTelephoneNumber)
Returns the fully qualified URL to make the call to the eStara web service.

Parameters:
pWebServiceURL - The URL to the exposed eStara web service API
pUsername - The username of the eStara Webcare account
pPassword - The password for the eStara Webcare account
pUserTelephoneNumber - The caller ID of the customer making the telephone call.
Returns:
A String containing the web service URL containing the associated parameters to make the call to the eStara web service

getDocument

public static org.w3c.dom.Document getDocument(javax.xml.parsers.DocumentBuilder documentBuilder,
                                               java.lang.String urlString)
Returns an XML document from the given URL.

Parameters:
documentBuilder - Used to obtain a Document from an XML resource
urlString - The URL including the username, password and telephone number required to perform the lookup to the exposed eStara web service API
Returns:
a Document object containing the XML document, otherwise null.

getElementValue

public static final java.lang.String getElementValue(org.w3c.dom.Node elem)
Returns an element value

Parameters:
elem - element (XML tag Value)
Returns:
Element value otherwise empty String

writeXMLToBean

public C2CWebServiceResponse writeXMLToBean(org.w3c.dom.Node node,
                                            C2CWebServiceResponse webServiceResponse)
Writes node and all child nodes into the C2CWebServiceResponse bean

Parameters:
node - XML node from from XML tree from which the output should start
Returns:
C2CWebServiceResponse bean