Interface XmlResourceBase
- All Known Subinterfaces:
IntegrationResource
,WebServiceResource
,XmlResource
public interface XmlResourceBase extends Resource
XmlResourceBase
represents the base interface for all resources based around Xml documents.
- Since:
- V4.4
-
Method Summary
Modifier and Type Method Description void
call()
Calls the default adapter specified on the XML or Integration Resource.void
call(java.lang.String adapterName)
Calls the adapter specified byadapterName
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 namevoid
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.Element
getElementName, getElementType
-
Method Details
-
call
void call() throws com.ebasetech.xi.exceptions.FormRuntimeExceptionCalls 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, thefetch()
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 thefetchTable()
method.- 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.FormRuntimeExceptionCalls the adapter specified byadapterName
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, thefetch()
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 thefetchTable()
method.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.FormRuntimeExceptionTransfers 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().- Throws:
com.ebasetech.xi.exceptions.FormRuntimeException
- if any error occurs during execution- Since:
- V4.4
-
update
void update() throws com.ebasetech.xi.exceptions.FormRuntimeExceptionTransfers 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().- 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.FormRuntimeExceptionSet a document from external API. Accepts any of:- an Xbeans XMLObject
- String
- org.w3c.Document
- any other object (invokes toString() )
Example 1: (shows XML object)
// Create XML structure var languagesObj =
Example 2: (shows XML String)<languages type="dynamic"> <lang>JavaScript</lang> <lang>Python</lang> </languages>
; // set the document resources.LANGUAGES_XML.setDocument("languages", languagesObj.toXMLString());// 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);- 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,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.FormRuntimeExceptionReturns Document object from the resource based on a given nameJavascript 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()
-