Stardust/Knowledge Base/API/JavaAPICookbook/Querying Workflow and Runtime

From Eclipsepedia

< Stardust‎ | Knowledge Base
Revision as of 11:03, 25 June 2013 by (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Getting all Users having a certain role, belonging to a certain Organization or Department

(Versions: 6.0.3)
This example gets the ServiceFactory from the SessionContext (usage in a JSF backing bean). Outside the session the runtime ServiceFactoryLocator should be used (ServiceFactoryLocator.get("user","password",...)).

import ag.carnot.web.jsf.common.beans.SessionContext;
import ag.carnot.workflow.model.ParticipantInfo;
import ag.carnot.workflow.query.ParticipantAssociationFilter;
import ag.carnot.workflow.query.UserQuery;
import ag.carnot.workflow.query.Users;
import ag.carnot.workflow.runtime.QueryService;
public static Users getUserListForParticipant(String participantId){
  SessionContext sessionContext = SessionContext.findSessionContext();
  QueryService qsService = sessionContext.getServiceFactory().getQueryService();
  ParticipantInfo pInfo = qsService.getParticipant(participantId);
  UserQuery query = new UserQuery();
  Users users = qsService.getAllUsers(query);
  return users;