Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Stardust/Knowledge Base/API/JavaAPICookbook/Querying Activity Instance List"

m (List Activity Instance)
m (Getting all Activity instances having a certain state, belonging to a certain Department)
Line 3: Line 3:
 
==== Getting all Activity instances having a certain state, belonging to a certain Department  ====
 
==== Getting all Activity instances having a certain state, belonging to a certain Department  ====
  
(Versions: 6.0.3)<br>  
+
<br>  
 
In certain scenarios you want to get all Activity instances having a certain state, belonging to a certain Department. The modelid, participantId, departmentId in the example are sample ids it will vary from case to case  
 
In certain scenarios you want to get all Activity instances having a certain state, belonging to a certain Department. The modelid, participantId, departmentId in the example are sample ids it will vary from case to case  
  

Revision as of 03:24, 7 June 2013

List Activity Instance

Getting all Activity instances having a certain state, belonging to a certain Department


In certain scenarios you want to get all Activity instances having a certain state, belonging to a certain Department. The modelid, participantId, departmentId in the example are sample ids it will vary from case to case

String modelId = "aModelId";
String participantId = "aParticipantId";
String departmentId = "aDeparmentId";
ParticipantInfo participantInfo = getQueryService().getParticipant(participantId);
if (participantInfo instanceof OrganizationInfo) {
     OrganizationInfo organizationInfo = (OrganizationInfo) participantInfo;
     if (organizationInfo.isDepartmentScoped()) {
        Department department = getQueryService().findDepartment(null,
               departmentId, (OrganizationInfo) participantInfo);
         participantInfo = ParticipantInfoUtil.newModelParticipantInfo(
               modelId, participantId, department);
     }
}
 ActivityInstanceQuery query = ActivityInstanceQuery.findAll();
 query.getFilter().add(ActivityStateFilter.PENDING);
 query.getFilter().add(PerformingParticipantFilter.forParticipant(participantInfo));
 ActivityInstance aInstance = getQueryService().findFirstActivityInstance(query);

Back to the top