task inbox search with multiple condition

Hello,

maybe someone can help us with the following issue?

We have a task inbox that should display only certain tasks by following conditions:

[b]Show Tasks when:

  1. currentUser != lastUser
    OR
  2. currentUser == lastUser AND processState == MODIFIED[/b]

We already implemented the getCurrentUser method, which works fine:

public java.lang.String getCurrentUser()  {
	return getFacesContext().getExternalContext().getUserPrincipal().getName();
}

So in the TaskSearchProviderBindings, we were able to display only the tasks, where lastUser <> currentUser
when we configure the TaskSearchProviderBindings as following

  1. currentUser != lastUser
private static final String[][] TASKSEARCHPROVIDER_PROPERTY_BINDINGS = new String[][] {
	...
	...
	{"#{taskSearchProvider.searchQuery.isLastUser.fieldBinding}", "#{currentTask.taskData.processData.lastUser}"},
	{"#{taskSearchProvider.searchQuery.isLastUser.operator}", "<>"},
	{"#{taskSearchProvider.searchQuery.isLastUser.value}", "#{activePageBean.currentUser}"},

Now we have to add the second condition, but we do not know how to achieve this in here:

  1. currentUser == lastUser AND processState == MODIFIED
...
	{"#{taskSearchProvider.searchQuery.isLastUser.fieldBinding}", "#{currentTask.taskData.processData.lastUser}"},
	{"#{taskSearchProvider.searchQuery.isLastUser.operator}", "="},
	{"#{taskSearchProvider.searchQuery.isLastUser.value}", "#{activePageBean.currentUser}"},
	AND
	{"#{taskSearchProvider.searchQuery.processState.fieldBinding}", "#{currentTask.taskData.processData.context.processState}"},
	{"#{taskSearchProvider.searchQuery.processState.operator}", "="},
	{"#{taskSearchProvider.searchQuery.processState.value}", "MODIFIED",

We tried it with a java method, but can’t get the method isTaskAccessible() working.

public boolean isTaskAccessible()
  {
	// Check if task is accessible by user on the following condition.
	// accessible:
	// currentUser != lastUser OR
	// currentUser == lastUser AND processState == MODIFIED

   	// is not working !!!
	String lastUser = getTaskSearchProvider().getTaskData().getProcessData().getLastUser();
	// is not working !!!
   	String processState = getTaskSearchProvider().getTaskData().getProcessData().getContext().getContext().getProcessState();

    if (!(getCurrentUser().equalsIgnoreCase(lastUser)))
      return true;
    else if (processState.equalsIgnoreCase("MODIFIED"))
      return true;
    else
      return false;
  }

The result of the method isTaskAccessible() is called in the following expression:


	{"#{taskSearchProvider.searchQuery.isTaskAccessible.fieldBinding}", "true"},
	{"#{taskSearchProvider.searchQuery.isTaskAccessible.operator}", "="},
	{"#{taskSearchProvider.searchQuery.isTaskAccessible.value}", "#{activePageBean.taskAccessible}"},

Best Regards,
Manuel

Have you thought of using Filter Rule Expressions? Have a look at the Task Engine User’s Guide and see if the section on Filter Rule Expressions might help.

Regards,
–mark