Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Process Manager (Stardust) » Find process instances having 2 data and a specific activity in hibernated state
Find process instances having 2 data and a specific activity in hibernated state [message #854910] Tue, 24 April 2012 10:58 Go to next message
Robert Emsbach is currently offline Robert Emsbach
Messages: 117
Registered: October 2011
Location: Singapore
Senior Member

We have a requirement as described below:
Tender period is the process in our application and has company and fund in process data. On UI user selects company and fund and we need to find all process instances having selected company and fund in process data AND the process having a certain activity in hibernated state. We need this information from IPP database.

In our current implementations a method first gets all the Tener period process instances for selected company and fund. We then iterate over all instances found and use an ActivityInstanceQuery to get hibernated activities. We need to optimize this code to improve performance.

Please let me know if you need more information.
Re: Find process instances having 2 data and a specific activity in hibernated state [message #854915 is a reply to message #854910] Tue, 24 April 2012 10:59 Go to previous message
Robert Emsbach is currently offline Robert Emsbach
Messages: 117
Registered: October 2011
Location: Singapore
Senior Member

As I understand your requirements it can be achieve with this single query, assuming that you make the third data a descriptor:


public class AiQuery {

      public static void main(String[] args) {

            ServiceFactory sf = ServiceFactoryLocator.get("motu", "motu");

            QueryService qs = sf.getQueryService();

            ActivityInstanceQuery aiq = ActivityInstanceQuery
                        .findInStateHavingData("Hibernation", "HibernatedActivity",
                                    "Data1", "daat1", ActivityInstanceState.Hibernated);

            aiq.where(DataFilter.isEqual("Data2", "daat2"));
            aiq.setPolicy(DescriptorPolicy.WITH_DESCRIPTORS);
            
            ActivityInstances ais = qs.getAllActivityInstances(aiq);

            for (Iterator iterator = ais.iterator(); iterator.hasNext();) {
                  ActivityInstance ai = (ActivityInstance) iterator.next();
                  ProcessInstanceDetails piD = (ProcessInstanceDetails) ai.getProcessInstance();
                  
                  System.out.println("AI: " + ai.getOID() + " PI: " + ai.getProcessInstance().getOID() + " Data3:" + piD.getDescriptorValue("Data3"));
            }
            sf.close();

      }
}

Previous Topic:Using DataFilter IN on ActivityInstanceQuery
Next Topic:NullPointerException when bootstrapping engine. Unable to login
Goto Forum:
  


Current Time: Tue Sep 02 23:59:37 GMT 2014

Powered by FUDForum. Page generated in 0.02103 seconds