-
1. Re: Getting the List of Subprocesses deployed
kukeltje Jan 6, 2010 5:15 PM (in response to jbpm42user)1 of 1 people found this helpfulI've been looking a little into this, but every thing is way out of api usage. So you are completely on your own regarding support.
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(processInstance.getProcessDefinitionId()).uniqueResult(); Map<String, Activity> am = ((ProcessDefinitionImpl)pd).getActivitiesMap(); Set<String> as = am.keySet(); for (String string : as) { Activity a = am.get(string); if (a.getType().equals("sub-process")) { System.out.println( ((SubProcessActivity)((ActivityImpl)a).getActivityBehaviour()).....); // no option to get the sub-process-key } }
In the end, there are methods missing on SubProcessActivity to get the sub-process-key, so you can not display it, or check if it is deployed at all.
-
2. Re: Getting the List of Subprocesses deployed
jbpm42user Jan 6, 2010 6:37 PM (in response to kukeltje)Thanks Ronald. This was so helpful!!! I just tested the code and works fine for me.... -
3. Re: Getting the List of Subprocesses deployed
kukeltje Jan 6, 2010 7:09 PM (in response to jbpm42user)huh??? But you can't get to the sub process name... that is what you wanted right? So I'm very curious as how this was helpful -
4. Re: Getting the List of Subprocesses deployed
jbpm42user Jan 6, 2010 7:45 PM (in response to kukeltje)I just changed the code to:
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(processInstance.getProcessDefinitionId()).uniqueResult();
Map<String, Activity> am = ((ProcessDefinitionImpl)pd).getActivitiesMap();
Set<String> as = am.keySet();
for (String string : as) {
Activity a = am.get(string);
if (a.getType().equals("sub-process")) {
System.out.println(a.getName()); // no option to get the sub-process-key
}
if (a.getType().equals("task")) {
System.out.println(a.getName()); // no option to get the sub-process-key
}
}We need to get the sub process name or the DBID and this code gets me both. So we need the name to map it to the UI element.
-
5. Re: Getting the List of Subprocesses deployed
kukeltje Jan 6, 2010 8:21 PM (in response to jbpm42user)This does not give you the sub process name, it gives you the sub-process node name. The real process is a different attribute (see the code of SubProcessImpl in the source. But if you keep them manually the same, it does kind of work.
But keep in mind... NO guarantees that this keeps working in future versions, since you use non-api things.