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

Stardust/Knowledge Base/API/JavaAPICookbook/Querying Activity Instance List

List Activity Instance

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

(Versions: 6.0.3)
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