Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Stardust/Knowledge Base/API/JavaAPICookbook/FetchingPIandAIHistoricalEvents"
< Stardust | Knowledge Base
(→) |
(→Purpose) |
||
Line 2: | Line 2: | ||
This article describes how to fetch Process Instance and Activity Instance related Historical Events like Time, Type and Details..etc, based on the defined Historical Event Policy. | This article describes how to fetch Process Instance and Activity Instance related Historical Events like Time, Type and Details..etc, based on the defined Historical Event Policy. | ||
− | <br | + | ==========<br>================ |
Activity Instance Historical Events: | Activity Instance Historical Events: | ||
Line 31: | Line 31: | ||
ProcessInstances pis = qs.getAllProcessInstances(piQuery); | ProcessInstances pis = qs.getAllProcessInstances(piQuery); | ||
− | + | for (Iterator iterator = pis.iterator(); iterator.hasNext();) { | |
− | + | ProcessInstance pi = (ProcessInstance) iterator.next(); | |
− | + | //log.info("PI: " + pi.getOID()); | |
− | + | ProcessInstanceDetails details = (ProcessInstanceDetails)pi; | |
− | + | List<HistoricalEvent> events = details.getHistoricalEvents(); | |
− | + | for (HistoricalEvent historicalEvent : events) { | |
− | + | System.out.println("PI:" + pi.getOID() + " Event time:" + historicalEvent.getEventTime()); | |
− | + | System.out.println("PI:" + pi.getOID() + " Event type:" + historicalEvent.getEventType()); | |
− | + | System.out.println("PI:" + pi.getOID() + " Event details :" + | |
+ | historicalEvent.getDetails()); | ||
} | } | ||
} | } | ||
</source> | </source> |
Revision as of 01:25, 11 April 2014
Purpose
This article describes how to fetch Process Instance and Activity Instance related Historical Events like Time, Type and Details..etc, based on the defined Historical Event Policy.
====
==========
Activity Instance Historical Events:
ProcessInstanceFilter filter = new ProcessInstanceFilter(piOID); //Pass in the Process instance OID ActivityInstanceQuery query = new ActivityInstanceQuery(); query.where(filter); query.setPolicy(HistoricalEventPolicy.ALL_EVENTS); query.orderBy(ActivityInstanceQuery.START_TIME); ActivityInstances actInstList = qs.getAllActivityInstances(query); for(ActivityInstance actInst: actInstList){ ActivityInstanceHistory actHistory = new ActivityInstanceHistory(actInst.getOID(), actInst.getActivity().getId(), actInst.getHistoricalEvents()); }
Process Instance Historical Events:
ProcessInstanceQuery piQuery = ProcessInstanceQuery.findAlive(); piQuery.setPolicy(HistoricalEventPolicy.ALL_EVENTS); ProcessInstances pis = qs.getAllProcessInstances(piQuery); for (Iterator iterator = pis.iterator(); iterator.hasNext();) { ProcessInstance pi = (ProcessInstance) iterator.next(); //log.info("PI: " + pi.getOID()); ProcessInstanceDetails details = (ProcessInstanceDetails)pi; List<HistoricalEvent> events = details.getHistoricalEvents(); for (HistoricalEvent historicalEvent : events) { System.out.println("PI:" + pi.getOID() + " Event time:" + historicalEvent.getEventTime()); System.out.println("PI:" + pi.getOID() + " Event type:" + historicalEvent.getEventType()); System.out.println("PI:" + pi.getOID() + " Event details :" + historicalEvent.getDetails()); } }