[jboss-user] [jBPM] - Re: Find Tasks by Candidate-Group Name

Shannon Sumner do-not-reply at jboss.com
Fri Oct 8 16:14:37 EDT 2010


Shannon Sumner [http://community.jboss.org/people/shannonsumner] created the discussion

"Re: Find Tasks by Candidate-Group Name"

To view the discussion, visit: http://community.jboss.org/message/565625#565625

--------------------------------------------------------------
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));
 
    }
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/565625#565625]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101008/c3fb5903/attachment-0001.html 


More information about the jboss-user mailing list