Thanks Michael - this is what I came up with ...
/**
* Gets the unassigned tasks by group.
*
* @param strGroupId
* the str group id
* @return the unassigned tasks by group
*/
private List<Task> getUnassignedTasksByGroup(final String strGroupId)
{
final ParamCommand<List<Task>> paramCommand = new ParamCommand<List<Task>>()
{
private static final long serialVersionUID = 1L;
@SuppressWarnings("unchecked")
public final List<Task> execute(final Environment environment)
{
DbSessionImpl dbSessionImpl = environment
.get(DbSessionImpl.class);
Session session = dbSessionImpl.getSession();
return session
.createQuery(
" select participation.task from "
+ ParticipationImpl.class
.getName()
+ " participation "
+ " join participation.task as task "
+ " where participation.groupId = :groupId"
+ " and task.assignee is null ")
.setParameter("groupId", params.get("strGroupId"))
.list();
}
};
return processEngine.execute(paramCommand.setParam("strGroupId",
strGroupId));
}
/**
* Gets the workgroup tasks by group.
*
* @param strGroupId
* the str group id
* @return the workgroup tasks by group
*/
private List<Task> getWorkgroupTasksByGroup(final String strGroupId)
{
final ParamCommand<List<Task>> paramCommand = new ParamCommand<List<Task>>()
{
private static final long serialVersionUID = 1L;
@SuppressWarnings("unchecked")
public final List<Task> execute(final Environment environment)
{
DbSessionImpl dbSessionImpl = environment
.get(DbSessionImpl.class);
Session session = dbSessionImpl.getSession();
return session
.createQuery(
" select participation.task from "
+ ParticipationImpl.class
.getName()
+ " participation "
+ " join participation.task as task "
+ " where participation.groupId = :groupId"
+ " and task.assignee is not null ")
.setParameter("groupId", params.get("strGroupId"))
.list();
}
};
return processEngine.execute(paramCommand.setParam("strGroupId",
strGroupId));
}