[jbpm-users] [jBPM Users] - Re: Can't get pooled task instance list with jbpm & seam - p
achimh
do-not-reply at jboss.com
Mon Nov 23 05:03:37 EST 2009
Ok, I missed the "real answer" for my thread-problem :D
As the annotation do not work the provided seam-objects like pooledTaskInstanceList do not work either. Therefore I had to write a bean that provides this information. It could look like this:
| @Name("taskManager")
| @Stateless
| public class TaskManagerBean implements TaskManagerLocal {
|
| ...
|
| /** Stores the process engine instance. */
| private ProcessEngine processEngine = new Configuration().buildProcessEngine();
|
| /** Stores the user's identity. */
| @In
| private Identity identity;
|
| /** Stores a list of tasks that are assigned to the current user. */
| @DataModel
| private List<Task> assignedTasks;
|
| /** Stores the currently selected assigned Task. */
| @DataModelSelection(value = "assignedTasks")
| private Task assignedTask;
|
| /**
| * Stores a list of tasks that belong the groups the current user is member of and wait for an
| * assignment.
| */
| @DataModel
| private List<Task> groupTasks;
|
| /** Stores the currently selected assigned Task. */
| @DataModelSelection(value = "groupTasks")
| private Task groupTask;
|
| /**
| * Factory method to request the assigned tasks.
| */
| @Factory("assignedTasks")
| public void findAssignedTasks() {
| if (identity.isLoggedIn()) {
| assignedTasks = processEngine.getTaskService().findPersonalTasks(
| identity.getCredentials().getUsername());
| } else {
| assignedTasks = new ArrayList<Task>();
| }
| }
|
| /**
| * Factory method to request the group tasks.
| */
| @Factory("groupTasks")
| public void findGroupTasks() {
| if (identity.isLoggedIn()) {
| groupTasks = processEngine.getTaskService().findGroupTasks(
| identity.getCredentials().getUsername());
| } else {
| groupTasks = new ArrayList<Task>();
| }
| }
|
| public String assignGroupTask() {
| if (identity.isLoggedIn() && groupTask != null) {
| processEngine.getTaskService().assignTask(groupTask.getId(),
| identity.getCredentials().getUsername());
| return TASK_ASSIGNED;
| }
| return null;
| }
| }
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266991#4266991
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266991
More information about the jbpm-users
mailing list