Executes a script. Java is the supported
scripting language for which BeanShell 1.3.0 is used as the implementation.
For information about writing Java code for BeanShell, go tohttp://www.beanshell.org.
The patExecContext object is implicitly available
to your script. This object provides access to the process data
model and is useful for manipulating data, such as variable values.
Although you can also use the Set Value service to manipulate data,
the executeScript operation is more flexible. For example, you can
use a for loop in a script to populate a list value
with documents when the number of documents is unknown until run
time.
The following example creates a map of URLs that are used to
call a custom web application.
//import the classes that the script references
import java.util.List;
import java.lang.String;
import java.util.Map;
import java.util.HashMap;
//get a list of file names that are stored in the process variable named files
List fileNames = patExecContext.getProcessDataListValue("/process_data/files");
//create a Map object for storing server URLs
Map outbound = new HashMap();
//get the URL of the web server, stored in the process variable named serverURL
String webServerRoot = patExecContext.getProcessDataStringValue("/process_data/@serverURL");
//for each file name, append the name to the URL as a parameter
//store the result in outbound
for (int i=0;i<fileNames.size();i++){
String currentFileName=(String)fileNames.get(i);
outbound.put(currentFileName, webServerRoot+"?doc="+ currentFileName);
}
//save the outbound map in the process variable named serverCalls
patExecContext.setProcessDataMapValue("/process_data/serverCalls",outbound);
For information about the General and Route Evaluation property
groups, see Common operation properties.