public interface XmlResourceBase extends Resource
XmlResourceBase
represents the base interface for all resources based around Xml documents.
Modifier and Type | Method and Description |
---|---|
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.
|
getElementName, getElementType
void call() throws com.ebasetech.xi.exceptions.FormRuntimeException
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.
com.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during executioncall(String)
void call(java.lang.String adapterName) throws com.ebasetech.xi.exceptions.FormRuntimeException
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.
Javascript example (call a web service):
resources.XML1.call("REMOTE_CALL_ADAPTER");
adapterName
- the adapter to be calledcom.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during executioncall()
void fetch() throws com.ebasetech.xi.exceptions.FormRuntimeException
com.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during executionvoid update() throws com.ebasetech.xi.exceptions.FormRuntimeException
com.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during executionvoid setDocument(java.lang.String documentName, java.lang.Object document) throws com.ebasetech.xi.exceptions.FormRuntimeException
Example 1: (shows XML object)
// Create XML structure
var languagesObj = <languages type="dynamic">
<lang>JavaScript</lang>
<lang>Python</lang>
</languages>
;
// set the document
resources.LANGUAGES_XML.setDocument("languages", languagesObj.toXMLString());
Example 2: (shows XML String)
// Create XML structure
var languagesString = var languages = "<languages type=\"dynamic\"><lang>JavaScript</lang><lang>Python</lang></languages>";
;
// set the document
resources.LANGUAGES_XML.setDocument("languages", languagesString);
documentName
- The name of the document within the XML Resource to be set.document
- The document object to be set. Accepts XML Beans, String, Document
or any other object where toString() is invoked.com.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during executionDocument
,
getDocument()
org.w3c.dom.Document getDocument(java.lang.String documentName) throws com.ebasetech.xi.exceptions.FormRuntimeException
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(); }
com.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during executionDocument
,
setDocument()