-
15. Re: IdentityService implementation
swiderski.maciej Jun 7, 2010 2:30 PM (in response to mwohlf)I partly agree with you, API should be kept as simple as possible
But assigning tasks to no existig users will in fact result in possible troubles with finding these tasks, which will result in maintenance issues. This is the case especially when assignment is evaluated on runtime based on user input.
According to jira, it was intended to have such validation.
About reassigning task in case all of the appointed users are not available should be (in my opinion) be an administration issue. If you design it to have assignment be done on a group level you could have always an option to add new user to one of the groups.
That's my two cents.
-
16. Re: IdentityService implementation
herbst Jun 8, 2010 3:14 AM (in response to herbst)Hello,
I see your point that it is/should not be part of the api, but my only goal is to check if a user/group is allowed to interact with the current task. So what do I have to do in order to get from a given task the candidate-users/-group ? I have not seen a entry in my database.
-
17. Re: IdentityService implementation
mwohlf Jun 8, 2010 3:31 AM (in response to herbst)hi Sebastian,
did you try something like this:
Set<ParticipationImpl> participations = task.getAllParticipants();
for (ParticipationImpl participation : participations) {
System.out.println(
"type: " + participation.getType()
+ " user: " + participation.getUserId()
+ " group: " + participation.getGroupId());
} -
18. Re: IdentityService implementation
walterjs Jun 8, 2010 3:42 AM (in response to mwohlf)This is what I use the populate the dropdown in my reassignment screen:
Get the participations like Michael suggested or through an hql query and then loop through the them to find the users:
for (Participation participation : participations) {
if (participation.getUserId() != null) {
users.add(participation.getUserId());
}
else if (participation.getGroupId() != null) {
List<User> groupUsers = noTxCmdService.execute(new FindUsersInGroupCmd(participation.getGroupId()));
if (groupUsers != null) {
for (User groupUser : groupUsers) {
users.add(groupUser.getId());
}
}
}
}FindUsersInGroupCmd:
public List<User> execute(Environment environment) {
IdentitySession identitySession = environment.get(IdentitySession.class);
return identitySession.findUsersByGroup(groupId);
}Hope this helps
Walter
-
19. Re: IdentityService implementation
herbst Jun 8, 2010 4:26 AM (in response to herbst)Hello,
thanks to all of you for your great help !
Just to complete the discussion I'm adding the code use to get the candidate-groups/-users:
List<Participation> participations = TaskService().getTaskParticipations(task.getId()); for (Participation participation : participations) { System.out.println( "type: " + participation.getType() + " user: " + participation.getUserId() + " group: " + participation.getGroupId()); }
It's nearly the same as mentioned before.
Thanks a lot
Sebastian Herbst
-
20. IdentityService implementation
dhamaris May 3, 2011 9:06 AM (in response to herbst)Hi, I have the problem of null IdentityService, how did you solve it? I don't see what did you change in the end, in jbpm.cfg.xml or in applicationContext-process.xml, to make it work...
I'm using jbpm 4.4
Thanks
Dámaris.