public Object execute(Environment environment) throws Exception {
Session session = environment.get(Session.class);
if (taskDbid!=null) {
TaskImpl task = (TaskImpl) session.get(TaskImpl.class, taskDbid);
if (task==null) {
throw new JbpmException("task "+taskDbid+" was not found");
}
Set<ParticipationImpl> participations = new HashSet<ParticipationImpl>(task.getParticipations());
for (ParticipationImpl participation : participations) {
boolean userMatch = userId!=null ? userId.equals(participation.getUserId()) : false;
boolean groupMatch = groupId!=null ? groupId.equals(participation.getGroupId()) : false;
if ( ( userMatch || groupMatch )
&& participation.getType().equals(participationType)
) {
task.removeParticipant(participation);
}
}
}
return null;