bea.com | products | dev2dev | support | askBEA |
![]() |
![]() |
|
![]() |
e-docs > WebLogic Platform > WebLogic Integration > BPM Topics > Programming BPM Client Apps > Using Value Objects |
Programming BPM Client Apps
|
Using Value Objects
This section explains how to access object data using business process management (BPM) value objects. It includes the following topics:
Introduction to Value Objects
Three BPM packages—com.bea.wlpi.common, com.bea.wlpi.common.security, and com.bea.eci.repository.helper—provide classes, or value objects, for obtaining object data at both definition and run time. For more information about each of these packages, see BPM API.
Each value object shares the following characteristics:
public boolean equals(Object obj)
public int compareTo(Object obj)
For more information about these classes, see the Sun Microsystems, Inc. Java Web site, available at the following URL:
http://java.sun.com
int java.util.Collections.binarySearch(List list, Object o)
can be used for rapidly searching a list that was sorted earlier, using the java.util.Collections.sort(List list) method.
Note: If the importing and exporting of data is supported, the object also implements the com.bea.wlpi.common.Publishable interface. For more information, see Publishing Workflow Objects.
The following table lists the value objects that can be used to access object data.
Creating Value Objects
To create a value object, use the associated constructor. Each of the BPM value objects described in the table Value Objects, provides one or more constructors for creating object data. The constructors for creating value objects are described in Value Object Summary.
For example, the following code creates an OrganizationInfo object, sets the organization ID to ORG1, and assigns the resulting object to organization.
OrganizationInfo organization = new OrganizationInfo("ORG1");
Using Value Objects to Access Object Data
Each BPM value object described in the table Value Objects provides various methods for accessing object data. The methods for getting and setting object data for each value object are described in Value Object Summary.
For example, the following code gets the organization ID for the specified OrganizationInfo object, organization.
String id = getOrgId(organization);
Sorting Value Objects
As described in Introduction to Value Objects, you can sort a list of value objects that implement the java.lang.Comparable interface using sort() methods available to the java.util.Collections class, as follows:
The first method enables you to sort a specified list of elements into ascending order based on the natural ordering of the elements, as described for java.lang.Comparable:
http://java.sun.com/j2se/1.3/docs/api/java/lang/Comparable.html
The second method enables you to sort a specified list of elements using a custom comparator that sorts on keys other than the default.
Note: The com.bea.wlpi.client.common.SortTableModel class provides a set of methods for sorting the value object data within a column of a JTable by clicking the column header. For more information, see the com.bea.wlpi.client.common.SortableTableModel Javadoc.
Example of Using a Value Object
This section provides an excerpt from the command-line worklist example showing how to use a value object to access task object data. It also demonstrates the use of the TaskInfo class methods to get a task name, template definition ID, instance ID, and task ID.
The get actions are highlighted in bold.
/* Any task assigned ? */
if( taskList.size( ) == 0 )
System.out.println( "\nNo task assigned" );
else
System.out.print( "\nAssigned Tasks:" );
/* Process the list to display the tasks */
for( int i = 0; i < taskList.size( ); i++ ) {
/* Retrieve an element from the list */
TaskInfo taskInfo = ( TaskInfo )taskList.get( i );
/* WLPI Public API Methods */
/* Retrieve and display a sub-set of available attributes */
System.out.println( "\n- Name: " + taskInfo.getName( ) );
System.out.println( " Template Definition ID: " +
taskInfo.getTemplateDefinitionId( ) );
System.out.println( " Workflow Instance ID: " +
taskInfo.getInstanceId( ) );
System.out.println( " Task ID: " + taskInfo.getTaskId( ) );
System.out.print( " Status: " + taskInfo.getStatus( ) );
/* Retrieve and display the task status */
if( taskInfo.getStatus( ) == taskInfo.STATUS_PENDING )
System.out.println( " (Pending)" );
else if( taskInfo.getStatus( ) == taskInfo.STATUS_COMPLETE )
System.out.println( " (Complete)" );
else if( taskInfo.getStatus( ) == taskInfo.STATUS_OVERDUE )
System.out.println( " (Overdue)" );
else if( taskInfo.getStatus( ) == taskInfo.STATUS_INACTIVE )
System.out.println( " (Inactive)" );
else
System.out.println( " (Unknown)" );
}
break;|
.
.
.
![]() |
![]() |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |