public class URLtoBusinessObjectDocumentUtility
extends java.lang.Object
This utility class provides a system service to perform the transformation between URL and Business Object Document. This utility is created to be used by Web applications to load the configuration that defines how a URL request can be transformed to a business object document and perform that transformation. This utility class can be used in any Web application that would like to define the transformation of a URL to business object document through configuration instead of programatically.
It is strongly recommend that the web application that is leveraging this utility to provide a mechanism that the base code that is using this utility can be overriden to use the map based methods of the client API.
Modifier and Type | Method and Description |
---|---|
BusinessObjectDocumentType |
createBusinessObjectDocument(commonj.sdo.DataObject documentRoot,
java.lang.String urlObject,
java.lang.String verb,
java.util.Map requestParameters)
This method contstructs the Business Object Document for the specified URL client object.
|
java.util.Map |
createResponseMap(commonj.sdo.DataObject businessObjectDocument,
java.lang.String urlObject)
This method creates the response map that represents the responding business object document.
|
static URLtoBusinessObjectDocumentUtility |
getInstance(javax.servlet.http.HttpServletRequest servletRequest)
This method returns a unique instance of the URL to Business Object Document
utility that has been defined and configured in the application.
|
static URLtoBusinessObjectDocumentUtility |
getInstance(javax.servlet.ServletContext servletContext)
This method returns a unique instance of the URL to Business Object Document
utility that has been defined and configured in the application.
|
java.lang.String |
getLocalizedCommonException(java.lang.String errorCode,
java.util.Locale locale)
This method gets a localized common message for client errors that are treated as exceptions.
|
java.lang.String |
getLocalizedCommonException(java.lang.String errorCode,
java.lang.Object[] parameters,
java.util.Locale locale)
This method gets a localized common message for client errors that are treated as exceptions.
|
java.lang.String[] |
getMediatedReasonCode(java.lang.String clientObject,
java.lang.String property,
java.lang.String reasonCode,
java.util.Locale locale)
This method returns the mediated message and client object property associated with the specified
reason code.
|
java.lang.String[] |
getMediatedReasonCode(java.lang.String clientObject,
java.lang.String property,
java.lang.String reasonCode,
java.lang.Object[] parameters,
java.util.Locale locale)
This method returns the mediated message and client object property associated with the specified
reason code.
|
void |
load(java.io.InputStream inputStream)
This method loads the configuration that defines the URL to Business Object Document
mediation.
|
static URLtoBusinessObjectDocumentUtility |
newInstance()
This method returns a new instance of the URL to Business Object Document
utility.
|
void |
reset()
This method resets the configuration of the URL to Business Object Document
utility.
|
void |
setApplicationErrorResourceBundle(java.lang.String bundle)
This method sets the base resource bundle for common exceptions.
|
void |
setExtensionApplicationErrorResourceBundle(java.lang.String bundle)
This method sets the extension resource bundle for common exceptions.
|
java.lang.String |
toString()
This method returns the string representation of the object for debugging purposes.
|
public static URLtoBusinessObjectDocumentUtility getInstance(javax.servlet.ServletContext servletContext)
servletContext
- The servlet context where the utility should be obtained from.public static URLtoBusinessObjectDocumentUtility getInstance(javax.servlet.http.HttpServletRequest servletRequest)
servletRequest
- The servlet request where the utility should be obtained from.public static URLtoBusinessObjectDocumentUtility newInstance()
public java.lang.String toString()
toString
in class java.lang.Object
public void reset()
public void load(java.io.InputStream inputStream) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
inputStream
- The configuration that defines the noun configuration.org.xml.sax.SAXException
- A problem parsing the configuration.java.io.IOException
- A problem reading the configuration.javax.xml.parsers.ParserConfigurationException
- A problem parsing the configuration.public java.lang.String[] getMediatedReasonCode(java.lang.String clientObject, java.lang.String property, java.lang.String reasonCode, java.util.Locale locale)
clientObject
- The name of the client object.property
- The known property of the client object to resolve.reasonCode
- The reason code to mediate.locale
- The locale of the message.public java.lang.String[] getMediatedReasonCode(java.lang.String clientObject, java.lang.String property, java.lang.String reasonCode, java.lang.Object[] parameters, java.util.Locale locale)
clientObject
- The name of the client object.property
- The known property of the client object to resolve.reasonCode
- The reason code to mediate.parameters
- The reasons that is associated with the reason code.locale
- The locale of the message.public BusinessObjectDocumentType createBusinessObjectDocument(commonj.sdo.DataObject documentRoot, java.lang.String urlObject, java.lang.String verb, java.util.Map requestParameters) throws java.lang.Exception
documentRoot
- The parent container of the business object document. This parent
allows the creation of the business object document.urlObject
- The URL client object.verb
- The verb of the business object document.requestParameters
- The URL parameters specified in the URL request. This map will contain
a String as the key and a String array as the value.java.lang.Exception
- There is a problem building the business object document where parameters
specified are invalid or other issues. These exceptions are typically application errors because
of invalid input.public java.util.Map createResponseMap(commonj.sdo.DataObject businessObjectDocument, java.lang.String urlObject) throws java.lang.Exception
businessObjectDocument
- The response business object document.urlObject
- The name of the URL client object.java.lang.Exception
- There is a problem building the business object document where parameters
specified are invalid or other issues. These exceptions are typically application errors because
of invalid input.public void setApplicationErrorResourceBundle(java.lang.String bundle)
bundle
- The base resource bundle for common exceptions.public void setExtensionApplicationErrorResourceBundle(java.lang.String bundle)
bundle
- The extension resource bundle for common extentions.public java.lang.String getLocalizedCommonException(java.lang.String errorCode, java.util.Locale locale)
errorCode
- The errorCode of the client error.locale
- The locale for the message. If the locale is null the default locale is used.public java.lang.String getLocalizedCommonException(java.lang.String errorCode, java.lang.Object[] parameters, java.util.Locale locale)
errorCode
- The errorCode of the client error.parameters
- The message parameters that can be substituted in the message.locale
- The locale for the message. If the locale is null the default locale is used.