com.ebasetech.xi.api
Interface XmlResourceBase

All Superinterfaces:
Element, Resource, java.io.Serializable
All Known Subinterfaces:
IntegrationResource, WebServiceResource, XmlResource

public interface XmlResourceBase
extends Resource

XmlResourceBase represents the base interface for all resources based around Xml documents.

Further documentation.

Since:
V4.4

Method Summary
 void call()
          Calls the default adapter specified on the XML or Integration Resource.
 void call(java.lang.String adapterName)
          Calls the adapter specified by adapterName on the XML or Integration Resource.
 void fetch()
          Transfers any non-tabular field data from the resource to mapped form fields.
 org.w3c.dom.Document getDocument(java.lang.String documentName)
          Returns Document object from the resource based on a given name
 void setDocument(java.lang.String documentName, java.lang.Object document)
          Set a document from external API.
 void update()
          Transfers any non-tabular field data from mapped form fields to the resource.
 
Methods inherited from interface com.ebasetech.xi.api.Resource
isDebug, setDebug
 
Methods inherited from interface com.ebasetech.xi.api.Element
getElementName, getElementType
 

Method Detail

call

void call()
          throws com.ebasetech.xi.exceptions.FormRuntimeException
Calls the default adapter specified on the XML or Integration Resource. Note that different adapters support different methods and not all adapters support this method.

Before the call request is processed, the update() method is called internally - this transfers any non-tabular field data to the resource from mapped form fields . After the call request is processed, the fetch() method is called internally - this transfers any non-tabular field data from the resource to mapped form fields.

If the resource is mapped to tables in the form, resource data must be updated prior to invoking this method; this is done using the updateTable() method on all relevant tables. Similarly, any tables resulting from the call should be fetched after invoking this method using the fetchTable() method.

Further documentation.

Throws:
com.ebasetech.xi.exceptions.FormRuntimeException - if any error occurs during execution
Since:
V4.4
See Also:
call(String)

call

void call(java.lang.String adapterName)
          throws com.ebasetech.xi.exceptions.FormRuntimeException
Calls the adapter specified by adapterName on the XML or Integration Resource. Note that different adapters support different methods and not all adapters support this method.

Before the call request is processed, the update() method is called internally - this transfers any non-tabular field data to the resource from mapped form fields . After the call request is processed, the fetch() method is called internally - this transfers any non-tabular field data from the resource to mapped form fields.

If the resource is mapped to tables in the form, resource data must be updated prior to invoking this method; this is done using the updateTable() method on all relevant tables. Similarly, any tables resulting from the call should be fetched after invoking this method using the fetchTable() method.

Further documentation.

Javascript example (call a web service):

 resources.XML1.call("REMOTE_CALL_ADAPTER");
 

Parameters:
adapterName - the adapter to be called
Throws:
com.ebasetech.xi.exceptions.FormRuntimeException - if any error occurs during execution
Since:
V4.4
See Also:
call()

fetch

void fetch()
           throws com.ebasetech.xi.exceptions.FormRuntimeException
Transfers any non-tabular field data from the resource to mapped form fields. Note that fetch() is invoked automatically by many adapters when they are invoked via call(), read() or write().

Further documentation.

Throws:
com.ebasetech.xi.exceptions.FormRuntimeException - if any error occurs during execution
Since:
V4.4

update

void update()
            throws com.ebasetech.xi.exceptions.FormRuntimeException
Transfers any non-tabular field data from mapped form fields to the resource. Note that update() is invoked automatically by many adapters when they are invoked via call(), read() or write().

Further documentation.

Throws:
com.ebasetech.xi.exceptions.FormRuntimeException - if any error occurs during execution
Since:
V4.4

setDocument

void setDocument(java.lang.String documentName,
                 java.lang.Object document)
                 throws com.ebasetech.xi.exceptions.FormRuntimeException
Set a document from external API. Accepts any of:

Further documentation.

Javascript example:

 // Create XML structure
 var languages = <languages type="dynamic">
                  <lang>JavaScript</lang>
                  <lang>Python</lang>
                 </languages>;
 // set the document 
 resources.LANGUAGES_XML.setDocument("languages", languages);
 

Parameters:
documentName - The name of the document within the XML Resource to be set.
document - The document object to be set. Accepts XML Beans, String, org.w3c.dom.Document or any other object where toString() is invoked.
Throws:
com.ebasetech.xi.exceptions.FormRuntimeException - if any error occurs during execution
Since:
V4.4
See Also:
Document, getDocument()

getDocument

org.w3c.dom.Document getDocument(java.lang.String documentName)
                                 throws com.ebasetech.xi.exceptions.FormRuntimeException
Returns Document object from the resource based on a given name

Further documentation.

Javascript example:

 // Create XML structure
 resources.LANGUAGES_XML.read();
 var languages = resources.LANGUAGES_XML.getDocument("languages");
 if(languages != null)
 {
      //append another language
      var languageXml = new XML(languages);
      var languages = languageXml.languages;
      var groovy = "Groovy";
      //add Groovy to list of languages
      languages.appendChild(<lang>{groovy}</lang>);
      resources.LANGUAGES_XML.write();
 }
 

Returns:
Document within the resource using the a given documentName. Returns null if no document is bound to the documentName.
Throws:
com.ebasetech.xi.exceptions.FormRuntimeException - if any error occurs during execution
Since:
V4.4
See Also:
Document, setDocument()