Featured Posts

Integrating GlassFish Application server with Apache... A typical production topology for GlassFish will be a front ending GlassFish with Apache for serving the static files. To integrate GlassFish Application Server with Apache web server follow the below...

Readmore

Some Java, JEE and WebSphere stuffs Rss

Querying human task based on custom property using EJB API

Posted by Albin Joseph | Posted in Websphere Process Server / Integration Developer | Posted on 22-08-2008

0

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
885 views

My last post talked about setting a custom attribute for a human task. Today I will be talking about querying the human task using EJB API based on the custom attribute. The complete code for querying the human task based on custom property is given below.

javax.naming.Context ctx = new javax.naming.InitialContext();
	Object result = ctx.lookup("com/ibm/task/api/HumanTaskManagerHome");
    com.ibm.task.api.HumanTaskManagerHome home = (com.ibm.task.api.HumanTaskManagerHome) javax.rmi.PortableRemoteObject.narrow(result,com.ibm.task.api.HumanTaskManagerHome.class);
    com.ibm.task.api.HumanTaskManager taskManager= home.create();
 
    com.ibm.task.api.QueryResultSet rst = taskManager.queryAll("TASK.TKIID","TASK_CPROP1.NAME='id' AND TASK_CPROP1.STRING_VALUE='1'", null,null,null,null);
 
 
    while(rst.next()){
    	System.out.println("Got Task ID "+rst.getString(1));
    }

In my code I have used the queryAll method for getting all the tasks for the user. The parameters for the queryAll method I used are, the select clause as the first parameter, where clause as the second parameter. Since I was selecting only Task Id, I used TASK.TKIID as my select clause. In the where clause TASK_CPROP1.NAME specifies the name of the custom attribute. For me the custom attribute name was id and TASK_CPROP1.STRING_VALUE specifies the value we are expecting for the custom property. When I created the task I entered 1 as the value for Id. The above query would return you the tasks with custom property name id and value 1.

  • Share/Bookmark

Read More

Write a comment