cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti 5.15.1 query processes startable by group ??

sistemasmunicip
Champ in-the-making
Champ in-the-making
Hi, after some research in this forum and the web, I came to the conclusion that the method in Java API org.activiti.engine.repository.ProcessDefinitionQuery.startableByUser(String userId) should return the prcesses that could be started directly by the user (as defined in XML activiti:candidateStarterUsers="user1, user2") AND the processes that can be started by the groups that the user belongs to (XML activiti:candidateStarterGroups="group1" ). In fact, after checking the source code jar, it seems that it IS what the method should return. But I only get the processes that have the <activiti:candidateStarterUsers> defined, not the ones that my user belongs to.
Is this a bug? Am I doing something wrong?

XML:
<process id="Prueba_multi_instancia_v4" name="Prueba MI call ac con collection - V4" isExecutable="true" activiti:candidateStarterGroups="w_rentas_comercio_adm">

JAVA:
List<ProcessDefinition> listaProceso = repos.createProcessDefinitionQuery().startableByUser("my user").list();

The user is effectively linked to the group, checked in the Activiti Explorer and the database.

Any help will be appreciated.

As a side note - If I export from the explorer a deployed process' xml the activiti:candidateStarterUsers and activiti:candidateStarterUsers properties are not included. Double checked - importing and exporting several times with different process definitions.

Thanks in advance
Esteban
5 REPLIES 5

sistemasmunicip
Champ in-the-making
Champ in-the-making
UPDATE: Found a solution by deploying the processes with JAVA, the identity links to the groups are created on the database and repos.createProcessDefinitionQuery().startableByUser("my user").list(); gets the deployed process.

Any thoughts?

trademak
Star Contributor
Star Contributor
Yes, the startableByUser option gives back all process definitions that have listed the specific user or group that the user is part of. At least if you are using the default identity store in Activiti.

Best regards,

sistemasmunicip
Champ in-the-making
Champ in-the-making
Tijs: Thanks for your answer.
What started as a question for getting startable processes for a user derived on another problem, now confirmed. As I commented in my update, deploying the process via Activiti Java API, the identity links to the deployed process are created as it should. Using:
<java>
ProcessEngine pe = ActProcessEngine.getProcessEngine("prueba"); // custom ProcessEngine creator
String bpmnResourceName = "PATH TO XML";
     DeploymentBuilder db;
     try {
   db = pe.getRepositoryService().createDeployment().addInputStream("NAME OF PROCESS", new FileInputStream(new File(bpmnResourceName)));
   Deployment d = db.deploy();
  } catch (FileNotFoundException e) {
   e.printStackTrace();
  }
</java>

works great.
On the other side, if I import the same xml in Activiti Explorer and deploy it, the identity links are NOT created, As I said before, I checked it many times to confirm. I assumed the Activiti Explorer implements the same API on server side, so I tried this:
- importing the xml in Activiti Explorer
- editing on Activiti Editor
- saving
- exporting back from Activiti Explorer
- the exported xml DOES NOT include the candidate users or groups, even though those were included on the original and imported xml.

I can work it via java, It's more like a FYI
Greetings
Esteban

b_schnarr
Champ in-the-making
Champ in-the-making
I had exactly the Same issue. This is because the Activiti Modeler does not support identity links. Therefore, when you edit your process with the web modeler, the identity link Information will get lost.

But you can deploy the process with identity links inthe Activiti Explorer when you do the following:

Implement the process with Eclipse including identity links
Open Activiti Explorer and deploy the file under the administration section
After That, the identity links will be stored in the DB.

Therefore, you need to go from eclipse directly to the Import using the explorer, skipping the web modeler.

It would be great if the Activiti Modeler would support identity links as it already supports other Activiti specific components as well.
Activiti developers, is this feature on the roadmap?

Regards
Ben

sistemasmunicip
Champ in-the-making
Champ in-the-making
Ben: That's kind of what I'm doing now, generating diagrams with the Activiti Eclipse plugin and deploying with a Java class, not using the modeler.
Thanks for your answer
Esteban