bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

Programming BPM Client Apps

 Previous Next Contents Index View as PDF  

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:

The following table lists the value objects that can be used to access object data.

Table 5-1 Value Objects  

Use This Value Object . . .

To access . . .

com.bea.wlpi.common.BusinessCalendarInfo

Business calendar data

com.bea.wlpi.common.EventKeyInfo

Event key data

com.bea.wlpi.common.InstanceInfo

Workflow instance data

com.bea.wlpi.common.OrganizationInfo

Organization data

com.bea.wlpi.common.security.PermissionInfo

Permission data

com.bea.wlpi.common.RepositoryFolderHelperInfo

XML repository folder data

com.bea.eci.repository.helper.RepositoryFolderInfo

XML repository folder data

com.bea.wlpi.common.RerouteInfo

Task rerouting data

com.bea.wlpi.common.RoleInfo

Role data

com.bea.wlpi.common.RolePermissionInfo

Role permission data

com.bea.wlpi.common.TaskInfo

Workflow task data

com.bea.wlpi.common.TemplateDefinitionInfo

Template definition data

com.bea.wlpi.common.TemplateInfo

Template data

com.bea.wlpi.common.UserInfo

User data

com.bea.wlpi.common.security.UserPermissionInfo

User permission data

com.bea.wlpi.common.VariableInfo

Variable data

com.bea.wlpi.common.VersionInfo

Version number data

com.bea.wlpi.common.XMLEntityHelperInfo

XML repository entity data

com.bea.eci.repository.helper.XMLEntityInfo

XML repository entity 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;|
.
.
.

 

Back to Top Previous Next