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.
Stardust/Knowledge Base/API/JavaAPICookbook/Querying Activity Instance List
< Stardust | Knowledge Base
Revision as of 03:24, 7 June 2013 by Monika.funke.sungard.com (Talk | contribs) (→Getting all Activity instances having a certain state, belonging to a certain Department)
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);