Class TransformersFacade


  • public final class TransformersFacade
    extends java.lang.Object

    Class that provides methods for transform input and output parameters related to @Firma, TS@ and eVisor web services.

    Project:

    Library for the integration with the services of @Firma, eVisor and TS@.

    Version:
    1.1, 18/04/2022.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String generateXml​(java.util.Map<java.lang.String,​java.lang.Object> parameters, java.lang.String service, java.lang.String version)
      Method that obtains a String with XML format used to invoke a web service from a map of parameters.
      java.lang.String generateXml​(java.util.Map<java.lang.String,​java.lang.Object> parameters, java.lang.String service, java.lang.String method, java.lang.String version)
      Method that obtains a String with XML format used to invoke a web service from a map of parameters.
      static TransformersFacade getInstance()
      Method that obtains the unique instance of the class.
      java.lang.String getParserParameterValue​(java.lang.String parameterName)
      Method that obtains the value of a element defined of parserParameters.properties file.
      org.w3c.dom.Document getParserTemplateByRequestType​(java.lang.String serviceReq, java.lang.String method, java.lang.String version)
      Method that obtains a XML document with the template of the parser for a response of a web service.
      org.w3c.dom.Document getXmlRequestFileByRequestType​(java.lang.String serviceReq, java.lang.String method, java.lang.String type, java.lang.String version)
      Method that obtains a XML document with the template of a request or a response of a web service.
      java.util.Map<java.lang.String,​java.lang.Object> parseResponse​(java.lang.String response, java.lang.String service, java.lang.String version)
      Method that processes a XML response to generate a map with the contained elements.
      java.util.Map<java.lang.String,​java.lang.Object> parseResponse​(java.lang.String response, java.lang.String service, java.lang.String method, java.lang.String version)
      Method that processes a XML response to generate a map with the contained elements.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getInstance

        public static TransformersFacade getInstance()
        Method that obtains the unique instance of the class.
        Returns:
        the unique instance of the class.
      • getXmlRequestFileByRequestType

        public org.w3c.dom.Document getXmlRequestFileByRequestType​(java.lang.String serviceReq,
                                                                   java.lang.String method,
                                                                   java.lang.String type,
                                                                   java.lang.String version)
                                                            throws TransformersException
        Method that obtains a XML document with the template of a request or a response of a web service.
        Parameters:
        serviceReq - Parameter that represents the web service name.
        method - Parameter that represents the name of the method associated to the web service.
        type - Parameter that represents the template type. The allowed values are:
        • request: Request template.
        • response: Response template.
        version - Parameter that represents the version of the web service.
        Returns:
        the generated XML document.
        Throws:
        TransformersException - If the method fails.
      • getParserTemplateByRequestType

        public org.w3c.dom.Document getParserTemplateByRequestType​(java.lang.String serviceReq,
                                                                   java.lang.String method,
                                                                   java.lang.String version)
                                                            throws TransformersException
        Method that obtains a XML document with the template of the parser for a response of a web service.
        Parameters:
        serviceReq - Parameter that represents the web service name.
        method - Parameter that represents the name of the method associated to the web service.
        version - Parameter that represents the version of the web service.
        Returns:
        the generated XML document.
        Throws:
        TransformersException - If the method fails.
      • generateXml

        public java.lang.String generateXml​(java.util.Map<java.lang.String,​java.lang.Object> parameters,
                                            java.lang.String service,
                                            java.lang.String version)
                                     throws TransformersException
        Method that obtains a String with XML format used to invoke a web service from a map of parameters.
        Parameters:
        parameters - Map with the input parameters related to the XML request of the web service.
        service - Parameter that represents the web service name.
        version - Parameter that represents the version of the web service.
        Returns:
        the generated XML String.
        Throws:
        TransformersException - If the method fails.
      • generateXml

        public java.lang.String generateXml​(java.util.Map<java.lang.String,​java.lang.Object> parameters,
                                            java.lang.String service,
                                            java.lang.String method,
                                            java.lang.String version)
                                     throws TransformersException
        Method that obtains a String with XML format used to invoke a web service from a map of parameters.
        Parameters:
        parameters - Map with the input parameters related to the XML request of the web service.
        service - Parameter that represents the web service name.
        method - Parameter that represents the name of the method associated to the web service.
        version - Parameter that represents the version of the web service.
        Returns:
        the generated XML String.
        Throws:
        TransformersException - If the method fails.
      • parseResponse

        public java.util.Map<java.lang.String,​java.lang.Object> parseResponse​(java.lang.String response,
                                                                                    java.lang.String service,
                                                                                    java.lang.String version)
                                                                             throws TransformersException
        Method that processes a XML response to generate a map with the contained elements.
        Parameters:
        response - Parameter that represents the XML response of a web service.
        service - Parameter that represents the web service name.
        version - Parameter that represents the version of the web service.
        Returns:
        a map from the elements defined inside of the XML response.
        Throws:
        TransformersException - If the method fails.
      • parseResponse

        public java.util.Map<java.lang.String,​java.lang.Object> parseResponse​(java.lang.String response,
                                                                                    java.lang.String service,
                                                                                    java.lang.String method,
                                                                                    java.lang.String version)
                                                                             throws TransformersException
        Method that processes a XML response to generate a map with the contained elements.
        Parameters:
        response - Parameter that represents the XML response of a web service.
        service - Parameter that represents the web service name.
        method - Parameter that represents the name of the method associated to the web service.
        version - Parameter that represents the version of the web service.
        Returns:
        a map from the elements defined inside of the XML response.
        Throws:
        TransformersException - If the method fails.
      • getParserParameterValue

        public java.lang.String getParserParameterValue​(java.lang.String parameterName)
        Method that obtains the value of a element defined of parserParameters.properties file.
        Parameters:
        parameterName - Parameter that represents the key of the element to obtain.
        Returns:
        the value of the element by the key.