-
Notifications
You must be signed in to change notification settings - Fork 1
Documents
A document is a concept in webMethods that groups data associated to an entity or group.
A document consists of entries. An entry is a key/value pair. For instance, a document representing a product may have the following entries:
- manufacturer: ACME
- name: Wonder Washing Machine
- active: true
- releaseYear: 2016
In the first entry, the key is manufacturer and the value is ACME.
In wmboost-data, the main interface is Document
, which represents an Integration Server document.
Data in Document
instances are internally backed by com.wm.data.IData
instances because that's what Integration Server expects. Having said that, for typical implementations, you'll hardly need to access IData
or IDataUtil
methods.
In order to get a Document
instance you may wrap an existing IData
instance. You would typically do that when implementing a custom Integration Server Java service, such as the following:
import au.com.innodev.wmboost.data.preset.Documents;
// ...
public static final void myService(IData pipeline) throws ServiceException {
Document pipeDoc = Documents.wrap(pipeline);
// do something with the document
}
You may also create a new document with code like this:
Document doc1 = Documents.create();
// do something with the document
Document
contains methods to:
- retrieve the value for an entry
- set the value for an entry
- determine whether an entry with a given key exists
- get keys
- get all entries
- remove an entry
- clear all entries
The following example shows how webMethods could store the product document shown previously:
In this example, all entry values are stored as strings.
Integration Server also supports object types, which include specific types such as Boolean and Integer. In addition, lists are also possible.
In a programming language, one would typically prefer more specific types, such as a boolean for the active entry. However, in certain integration flows, it's not uncommon for certain entry values to be stored as strings even when the value could be conceptually considered a boolean or a number. URL query parameters, text files and XML values are some cases where entries would originate as a string.
In your flow service implementation, wmboost-data makes it easy to use the most appropriate Java type (such as Boolean) even if the value is stored as another type (such as String).