Add the Business Process Choreographer Explorer list component to a JavaServer Faces (JSF) application to display a list of business process or human task objects.
Add the bpe:list tag to the <h:form> tag. The bpe:list tag must include a model attribute. Add bpe:column tags to the list tag to add the properties of the objects that are to appear in each of the rows in the list.
The following example shows how to add a list component to display task instances.
<h:form> <bpe:list model="#{TaskPool}"> <bpe:column name="name" action="taskInstanceDetails" /> <bpe:column name="state" /> <bpe:column name="kind" /> <bpe:column name="owner" /> <bpe:column name="originator" /> </bpe:list> </h:form>
The model attribute refers to a managed bean, TaskPool. The bean provides the list of Java objects over which the list iterates.
For the list component, this managed bean must have the com.ibm.bpe.jsf.BPCListHandler class.
The following example shows how to add the TaskPool managed bean to the configuration file.
<managed-bean> <managed-bean-name>TaskPool</managed-bean-name> <managed-bean-class>com.ibm.bpe.jsf.BPCListHandler</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property> <property-name>query</property-name> <value>#{TaskPoolQuery}</value> </managed-property> <managed-property> <property-name>type</property-name> <value>com.ibm.bpe.client.model.TaskInstanceBean</value> </managed-property> </managed-bean>
The example shows that TaskPool has a configurable query property. The value of the property refers to another managed bean, TaskPoolQuery. The TaskPool managed bean also has a type property. The value of this property refers to a class name. Use this property to establish type checking between the list handler and the query object.
The TaskPoolQuery object queries the properties of the Java objects. The TaskPoolQuerymanaged bean must implement the com.ibm.bpc.clientcore.Query interface. When the list handler refreshes its contents, it calls the execute method of the object. The call returns a list of Java objects. The getType method must return the class name of the returned Java objects.
The following example shows how to add the TaskPool managed bean to the configuration file.
public class MyTaskQuery implements Query { public List execute throws ClientException { // Examine the faces-config file for a managed bean “htmConnection”. // FacesContext ctx = FacesContext.getCurrentInstance(); Application app = ctx.getApplication(); ValueBinding htmVb = app.createValueBinding("#{htmConnection}"); htmConnection = (HTMConnection) htmVb.getValue(ctx); HumanTaskManagerService taskService = htmConnection.getHumanTaskManagerService(); // Then call the actual query method on the Human Task Manager service. // QueryResultSet queryResult = taskService.query( “DISTINCT TASK.TKIID, TASK.NAME, TASK.KIND, TASK.STATE, TASK.TYPE,” + “TASK.STARTED, TASK.ACTIVATED, TASK.DUE, TASK.EXPIRES, TASK.PRIORITY” , “TASK.KIND IN(101,102,105) AND TASK.STATE IN(2) AND WORK_ITEM.REASON IN (1)”, null, null, null); List applicationObjects = transformToTaskList ( queryResult ); return applicationObjects ; } private List transformToTaskList(QueryResultSet result) { ArrayList array = null; int entries = result.size(); array = new ArrayList( entries ); // Transforms each row in the QueryResultSet to a task instance beans. for (int i = 0; i < entries; i++) { result.next(); array.add( new TaskInstanceBean( result, connection )); } return array ; } }
Last updated: Mon Mar 27 18:04:06 2006
(c) Copyright IBM Corporation 2005.
This information center is powered by Eclipse technology (http://www.eclipse.org)