IdentityService is used to manage users and groups in Activiti. Now, let's see a demo for working with users. To implement IdentityService, we have to follow the ensuing steps:
ProcessEngine processEngine = ProcessEngineConfiguration .createStandaloneProcessEngineConfiguration() .setJdbcDriver("com.mysql.jdbc.Driver") .setJdbcUrl("jdbc:mysql://localhost:3306/activiti_book") .setJdbcPassword("root").setJdbcUsername("root") .buildProcessEngine(); IdentityService identityService=processEngine.getIdentityService(); List<Group> partofuser =identityService.createGroupQuery().groupMember("gonzo").list(); System.out.println("Gonzo is a part of following group"); for(Group partofuse:partofuser) { System.out.println("Group name:"+partofuse.getName()); }
Gonzo is a part of following group Group name:Management Group name:Marketing Group name:Sales Group name:User
We learned about IdentityService. Now, we are able to manage users and groups using IdentityService. We saw how to find a user's group using the group
query, which is a part of IdentityService.
HistoryService is used to get historical data from the Activiti Engine, such as the following:
So, with the help of HistoryService, we can generate reports for the business process and identify the efficiency of the business process execution.