Creating and usage of User/Groups in Java

Hi all,

for a testapplication i need to create users. My application is just for a universitytask. Since i´m new to camunda developement there could be a better way to solve my problem. Feel free to show me other ways but i´m very restricted altering the process. The following is my approach.

Process:
The Process starts through an incoming request(form). An ServiceTask now matches the request with service providers that provide the certain service and returns a LinkedList of posible providers as a variable. The next Service Task starts Process Instances of another Process called “Apply-Process”. Each Process Instance is delegated to a certain service Provider using the LinkedList*.

*I don´t think it´s possible to delegate a Process instance to a User. But it should be possible to start the process -> get the ProcessInstance -> call the taskservice -> get a certain task -> forward it to a certrain user

Problem:
As i said, this process is a Demo and it should run on any device that starts it. I will reinject data(for example service provider data into a database) everytime the service is started as a hard reset.

  1. To do it consistently i also want to create the users every time i start the engine.
  2. I need to bind a task in another ProcessInstance not knowning its ID to a User that has to be created while running the Process.

Approach: Use IdentityService.newUser("serviceProvider##") & save to create users.
Use IdentityService.newGroup("serviceProviders") to create group.
Use IdentityService.createMembership("serviceProvider##", "serviceProviders") to append user to the group
Use processEngine(), ProcessInstance and taskService to glue a user to a task

is this right? is it enough?

Thanks for help.

Hi @s0561355,

have a look into the invoice example: https://github.com/camunda/camunda-bpm-platform/blob/master/examples/invoice/src/main/java/org/camunda/bpm/example/invoice/DemoDataGenerator.java

You can generate Users or Groups in a JavaDelegate or ExecutionListener as well.

Cheers, Ingo

1 Like

Thanks! That´ll be helpfull:grinning: