[jboss-user] [JBoss jBPM] - Re: Assign a task to 2 users, how please?

webjavier do-not-reply at jboss.com
Wed Jan 17 11:48:12 EST 2007


Yes, the new list display the tasks pending of the group, but when i run a task of one of members of group just execute the task of the user that is logged and after this the another user when loggin don't see his task of the group.
I think this method only assign the task to first user that execute it.
public String assignTaskInstance(){
   	 long id = JsfHelper.getId("taskInstanceId");
   	 TaskInstance taskInst = taskMgmtSession.loadTaskInstance(id);
   	 taskInst.setActorId(userBean.getUserName());
   	 return "home";
     }

PD:Sorry with mi english.....

"alv21" wrote : i had same problem but i resolved it. There is no bugs in jBPM about group assignment, just websale example does not implement it.
  | talking about websale example, if you use "group(groupName)" in a task or swimlane assignment, and logging with some of groupName members you will not find any tasks in their tasklist. This is correct because in that tasklist (that of websale example) you will find only task assigned to user logged. If you want to see a tasklist with tasks assigned to user's group, you have to write in home.jsp another list table. See my example below:
  | 
  | 
  |   | <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
  |   | <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
  |   | 
  |   | <f:view>
  |   | 
  |   | <jsp:include page="header1.jsp" />
  |   | Home
  |   | <jsp:include page="header2.jsp" />
  |   | 
  |   | <b><h:messages /></b>
  |   | 
  |   | <h4>Tasklist assigned</h4>
  |   | <h:dataTable value="#{homeBean.taskInstances}" var="taskInstance" headerClass="tableheader" columnClasses="tablecell">
  |   |   <h:column >
  |   |     <f:facet name="header">
  |   |       <h:outputText value="Task Form Link" />
  |   |     </f:facet>
  |   |     <h:commandLink action="#{homeBean.selectTaskInstance}">
  |   |       <f:param name="taskInstanceId" value="#{taskInstance.id}"/>
  |   |       <h:outputText value="#{taskInstance.name}" />
  |   |     </h:commandLink>
  |   |   </h:column>
  |   |   <h:column>
  |   |     <f:facet name="header">
  |   |       <h:outputText value="Process" />
  |   |     </f:facet>
  |   |     <h:outputText value="#{taskInstance.taskMgmtInstance.taskMgmtDefinition.processDefinition.name}" />
  |   |   </h:column>
  |   |   <h:column>
  |   |     <f:facet name="header">
  |   |       <h:outputText value="Version" />
  |   |     </f:facet>
  |   |     <h:outputText value="#{taskInstance.taskMgmtInstance.taskMgmtDefinition.processDefinition.version}" />
  |   |   </h:column>
  |   | </h:dataTable> 
  |   | 
  |   | <!-- author Ciro -->
  |   | <h4>Tasklist assignable</h4>
  |   | <h:dataTable value="#{homeBean.pooledTaskInstances}" var="pooledTaskInstance" headerClass="tableheader" columnClasses="tablecell">
  |   |   <h:column >
  |   |     <f:facet name="header">
  |   |       <h:outputText value="Task Form Link" />
  |   |     </f:facet>
  |   |     <h:commandLink action="#{homeBean.assignTaskInstance}">
  |   |       <f:param name="taskInstanceId" value="#{pooledTaskInstance.id}"/>
  |   |       <h:outputText value="#{pooledTaskInstance.name}" />
  |   |     </h:commandLink>
  |   |   </h:column>
  |   |   <h:column>
  |   |     <f:facet name="header">
  |   |       <h:outputText value="Process" />
  |   |     </f:facet>
  |   |     <h:outputText value="#{pooledTaskInstance.taskMgmtInstance.taskMgmtDefinition.processDefinition.name}" />
  |   |   </h:column>
  |   |   <h:column>
  |   |     <f:facet name="header">
  |   |       <h:outputText value="Version" />
  |   |     </f:facet>
  |   |     <h:outputText value="#{pooledTaskInstance.taskMgmtInstance.taskMgmtDefinition.processDefinition.version}" />
  |   |   </h:column>
  |   | </h:dataTable> 
  |   | 
  |   | <h4>Start New Process Execution</h4>
  |   | 
  |   | ...
  |   | 
  |   | 
  | 
  | then write related methods in homeBean.java:
  | 
  | 
  |   | 
  |   | ...
  |   | 
  |   |   public List getTaskInstances() {
  |   | 	    return taskMgmtSession.findTaskInstances(userBean.getUserName());
  |   | 	  }
  |   |   
  |   |   //author Ciro
  |   |   public List getPooledTaskInstances() {
  |   |   	Session session=null;
  |   | 	String user = userBean.getUserName();
  |   | 	JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
  |   | 	session=jbpmContext.getSession();
  |   | 	Query query= session.createQuery("select membership.group.name " +
  |   | 	    	"from org.jbpm.identity.Membership as membership " +
  |   | 	    	 "where membership.user.name='"+user+"'");
  |   | 	List list=query.list();
  |   | 	List l;
  |   | 	if(!list.isEmpty())l=taskMgmtSession.findPooledTaskInstances(list);
  |   | 	else l=list;
  |   | 	return l;
  |   | 	  }
  |   | 
  |   |   public List getLatestProcessDefinitions() {
  |   |     return graphSession.findLatestProcessDefinitions();
  |   |   }
  |   | 
  |   |   /**
  |   |    * selects a task.
  |   |    */
  |   |   public String selectTaskInstance() {
  |   |     // Get the task instance id from request parameter
  |   |     long taskInstanceId = JsfHelper.getId("taskInstanceId");
  |   |     TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(taskInstanceId);
  |   |     taskBean.initialize(taskInstance);
  |   |     return "task";
  |   |   }
  |   | 
  |   |   //author Ciro
  |   |   public String assignTaskInstance(){
  |   | 	 long id = JsfHelper.getId("taskInstanceId");
  |   | 	 TaskInstance taskInst = taskMgmtSession.loadTaskInstance(id);
  |   | 	 taskInst.setActorId(userBean.getUserName());
  |   | 	 return "home";
  |   |   }
  |   |  
  |   | ...
  |   | 
  |   | 
  | 
  | regards,
  | Ciro

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4002918#4002918

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4002918



More information about the jboss-user mailing list