Using the TWObjectFactory, TWObject and TWList classes

Several classes can be useful to you if you have an external Java application interacting with a Java integration step. These classes can instantiate business process Java objects and provide a means of working with those Java objects.

The following classes provide methods that are helpful to an external Java application working with a Java integration step in a business process. To use these methods you must include the psclnt.jar and svrcoreclnt.jar files in your build classpath. You can find these JAR files in the following path: install_root/BPM/Lombardi/lib. You should use the teamworks package for these classes. The article Implementing Java Integration components for IBM Business Process Manager presents an application using some of these methods.

TWObjectFactory class

This class' methods create the objects and lists (arrays) that your Java application can use.

Table 1. TWObjectFactory class methods
Methods with input and output parameters Description
VersioningContext getThreadVersioningContext() Gets the current thread's versioning context. A context encompasses a set of versioned objects.
void setThreadVersioningContext(VersioningContext) Sets the thread's versioning context.
TWObject createObject() Creates an object.
TWObject createObject(String) Creates an object of the specified type in the argument.
TWObject createPrototype() Creates a prototype of an object.
TWList createList() Creates a list. A list is an array.
TWList createList(String) Creates a List which will contain items of the type specified in the argument.
TWList createList(Collection) Creates a List containing the items in the collection argument.
TWObject createIndexedMapObject() Creates an indexed map object.

TWObject class

The methods in this class allow you to work with the properties of the objects.

Table 2. TWObject class methods
Methods with input and output parameters Description
String getTWClassName() Gets the class name of the object.
Set getPropertyNames() Gets the property names.
Object getPropertyValue(String) Retrieves the property value named in the argument.
void setPropertyValue(String, Object) Sets the property value named in the argument.
void setPropertyValue(Map) Sets the property value using a map to take the property from. A map contains a property value object keyed by a property name.
void removeProperty(String) Removes the property named in the argument.

TWList class

The methods in this class allow you to work with the values in a list (array).

Table 3. TWList class methods
Methods with input and output parameters Description
String getTWClassName() Gets the class name of the object.
int getArraySize() Gets the size of the array; that is, the number of elements in the array.
void addArrayData(Object) Adds an object to the array.
void addArrayData(int, Object) Assigns an object to the array at the index named in the argument.
Object getArrayData(int) Gets the object from the array at the index named in the argument.
void removeIndex(int) Removes the index identified in the argument.
boolean isEmptyArray() Specifies if the array has no elements.
List getUnmodifiableArray() Gets a read-only list.