Applying Worklist Filter

This tutorial helps you to create and apply worklist filter from the Portal Configuration.

Using this example, you can:

Creating a Model

Download the Support Case model. You can find the example source code as well as the complete model in the following ZIP file in folder support-case:

You need to extend the example model with the following elements:

Creating a Filter Provider Java File

Create the java file named

By creating the filter provider, you can control the viewing of worklist of a particular location or role. For more information, please refer to chapter Configuring Worklists in the Infinity Portal documentation.

Note you can specify the filter based on your requirement. The following is the sample code snippet to create the class:

package org.eclipse.stardust.examples.filter;

import java.util.Iterator;
import java.util.List;

import org.eclipse.stardust.ui.web.viewscommon.beans.SessionContext;
import org.eclipse.stardust.ui.web.viewscommon.common.provider.AbstractFilterProvider;
import org.eclipse.stardust.engine.api.query.DataFilter;
import org.eclipse.stardust.engine.api.query.FilterAndTerm;
import org.eclipse.stardust.engine.api.query.FilterOrTerm;
import org.eclipse.stardust.engine.api.query.Query;
import org.eclipse.stardust.engine.api.runtime.Grant;
import org.eclipse.stardust.engine.api.runtime.User;

public class LocationFilter extends AbstractFilterProvider
   private static final long serialVersionUID = 1L;

   /* (non-Javadoc)
    * @see org.eclipse.stardust.ui.web.client.common.spi.IFilterProvider#applyFilter(org.eclipse.stardust.engine.api.query.Query)
   public void applyFilter(Query query)
      System.out.println("Applying Filter Provider - LocationFilter.applyFilter()");
      User user = SessionContext.findSessionContext().getUser();
      boolean puneCenter = false;
      boolean mumbaiCenter = false;

      List<Grant> grants = (List<Grant>) user.getAllGrants();
      Iterator<Grant> iterator = grants.iterator();
      while (iterator.hasNext())
         Grant grant =;

         if (grant.getId().equalsIgnoreCase("PuneCenter"))
            puneCenter = true;

         if (grant.getId().equalsIgnoreCase("MumbaiCenter"))
            mumbaiCenter = true;

      System.out.println("puneCenter = " + puneCenter + ":: mumbaiCenter = " + mumbaiCenter);
      if (puneCenter && mumbaiCenter)
         FilterOrTerm filter = query.getFilter().addOrTerm();
         filter.add("SupportCaseData", "Location", "%Pune%", false));
         filter.add("SupportCaseData", "Location", "%Mumbai%", false));
      else if (puneCenter)
         FilterAndTerm filter = query.getFilter().addAndTerm();
         filter.add("SupportCaseData", "Location", "%Pune%", false));
      else if (mumbaiCenter)
         FilterAndTerm filter = query.getFilter().addAndTerm();
         filter.add("SupportCaseData", "Location", "%Mumbai%", false));
         System.out.println("NOT Applying any Filter");

Adding the Java File

Add the file in the src folder of the project in which you have added the Support Case model. Make sure that the file is under the package called org.eclipse.stardust.examples.filter.

Working in Infinity Process Platform Portal and Applying the Filter

Perform the following steps:

  1. Deploy your model
  2. Login with user motu
  3. Create three users named Croft Lara, Doodle Duck and Cityman Frank and assign them as follows:

    Worklist - Filter Provider
    Figure: Role assignments

  4. Start five processes of Support Case Management Process and enter location as Pune, Mumbai and Delhi in each process.
  5. Specify the following filter in the Configuration View and click Save:

    The following screenshot displays the filter provider details:

    Worklist - Filter Provider
    Figure: Worklist Configuration

  6. Login with user Croft Lara and open her worklist. Note that Croft Lara can see activities with location Pune.
  7. Login with user Doodle Duck and open his worklist. Note that Doodle Duck can see activities with location Mumbai.
  8. Login with user Cityman Frank and open his worklist. Note that Cityman Frank can see activities of both the locations that is Pune and Mumbai. Also, none of the three users can see activities with location Delhi. The user motu can view all activities.

In case both roles are assigned to one user and only puneCenter=org.eclipse.stardust.examples.filter.LocationFilter is applied then that user can see the activities of the location Pune.