Quantcast
Channel: Deke Smith » Set Value Service
Viewing all articles
Browse latest Browse all 2

Appending values to collections within Process Management orchestrations

$
0
0

Within the Process Management module for ADEP Document Services or LiveCycle, values returned from services, if not explicitly XML or primitives, are Java-based. These values, like XML in orchestrations, can be created, modified and deleted using the Set Value service or by using BeanScript within the Execute Script service.

Manipulating Java objects within BeanScript is very similar to how it works in Java. However, setting Java objects in the Set Value service can be very different. It uses XPath as its language. Values for XML behave as described within the W3C XPath specification. In addition, associating schema with XML supports functionality to add values to XML that fit a very specific object model. Though XPath is meant for querying XML, it has been purposed for setting and editing the Java elements within orchestrations as well.

There are many differences in the way Java objects are treated within the Set Value service’s XPath than XML or primitives behave. One difference is in the way items are added to collections within Java objects.

First, to create a collection, a variable must be set to be a new, empty, collection:

/process_data/myList = empty-list()

To append an item to an already existing collection, set the collection to be equal that value you wish to append:

/process_data/myList = empty-list()
/process_data/myList = "a" // collection is now ["a"]
/process_data/myList = "b" // collection is now ["a","b"]
/process_data/myList = "c" // collection is now ["a","b","c"]

To reset the value of the list, do not set it to a different collection. This only appends the collection to the existing list:

/process_data/myList = empty-list()
/process_data/myList = "a" // myList is ["a"]
/process_data/list2 = empty-list()
/process_data/list2 = "b" // list2 is ["b"]
/process_data/myList = /process_data/list2 // myList is ["a",["b"]]

To replace the value of a varible with a new list, first set the list to null:

/process_data/myList = empty-list()
/process_data/myList = "a" // myList is ["a"]
/process_data/list2 = empty-list()
/process_data/list2 = "b" // list2 is ["b"]
/process_data/myList = null
/process_data/myList = /process_data/list2 // myList is ["b"]

One big implication of this is, whenever a collection variable is set to the result of a service, if that variable is not empty the result is appended to the collection. This is sometimes desired, but can cause problems if not expected.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images