cancel
Showing results for 
Search instead for 
Did you mean: 

Overriding Take Ownership functionality?

amanjure
Champ in-the-making
Champ in-the-making
Please see my process definition file.

The idea is I have an article and its submitted to a
1. either single content producer.. or a
2. pool of content producers..

when the user selects to submit it to a pool of content producers.. a particular content producer can "Take Ownership" of the article or assign some other Producer to it.  The assigning part works fine and the workflow is transitioned to the swimlane "singleproducer". what I want is when the content producers press Take Ownership.. I need the workflow to transition to the "singleproducer " swimlane too.. and its not happening currently..it just is stuck there in the same swimlane i.e "multipleproducers"

could anybody suggest me how I can manage to do that? following is my processdef.

thanks in advance

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="swwf:article">

    <swimlane name="initiator" />

    <start-state name="start">
        <task name="swwf:startArticleWorkflow" swimlane="initiator"></task>
        <transition name="" to="submit-article"></transition>
    </start-state>

    <swimlane name="submitarticle" />
   
    <task-node name="submit-article">
        <task name="swwf:submitArticleTask" swimlane="submitarticle"></task>
        <transition name="toMultipleProducers" to="multiple-producers"></transition>
        <transition name="toProducer" to="single-producer"></transition>
    </task-node>
       
    <swimlane name="multipleproducers">
        <assignment
            class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>#{people.getGroup('GROUP_cp')}</pooledactors>
        </assignment>
    </swimlane>
       
    <task-node name="multiple-producers">
        <task name="swwf:multipleProducers" swimlane="multipleproducers">
            <event type="task-end">
               <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                  <script>
                     <variable name="bpm_assignee" access="write"/>
                     <expression>
                        if (taskInstance.actorId != null)
                           people.getPerson(taskInstance.actorId);
                        else
                           person;
                     </expression>
                  </script>
               </action>
            </event>
        </task>
        <transition name="toProducer" to="single-producer"></transition>
    </task-node>  
       
    <swimlane name="singleproducer">
        <assignment
            class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{bpm_assignee}</actor>
        </assignment>
    </swimlane>

    <task-node name="single-producer">
        <task name="swwf:produceTask" swimlane="singleproducer" />
        <transition name="reject" to="returnToInitiator" />
        <transition name="sendToReviewers" to="validateIfThereAreReviewers" />
        <transition name="sendToProofing" to="proof" />
    </task-node>

    <task-node name="returnToInitiator">
        <task name="swwf:returnToInitiator" swimlane="initiator"></task>
    </task-node>

    <swimlane name="reviewers" />

    <!– This was added to return the task to the tray of the producer in case s/he doesnt
        select reviewers when hitting the send to reviewers button, TODO: find a way of sending
        a message to the user indicating what just happened.
    –>
    <decision name="validateIfThereAreReviewers">
        <transition name="reviewersNotProvided" to="single-producer">
            <condition>#{ swwf_assignees == void}</condition>
        </transition>
        <transition name="reviewersProvided" to="startReview">
            <condition>#{ swwf_assignees != void}</condition>
        </transition>
    </decision>


    <node name="startReview">
        <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
            <foreach>#{swwf_assignees}</foreach>
            <var>reviewer</var>
        </action>
        <transition name="" to="review" />
    </node>

    <task-node name="review">
        <task name="swwf:reviewTask">
            <assignment
                class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
                <actor>#{reviewer}</actor>
            </assignment>
        </task>
        <transition name="finished" to="single-producer" />
    </task-node>


    <swimlane name="editors">
        <assignment
            class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>#{people.getGroup('GROUP_ce')}</pooledactors>
        </assignment>
    </swimlane>

    <task-node name="proof">
        <task name="swwf:proofTask" swimlane="editors"></task>
        <transition name="reject" to="single-producer" />
        <transition name="finished" to="end" />
    </task-node>

    <end-state name="end"></end-state>
</process-definition>
6 REPLIES 6

davidc
Star Contributor
Star Contributor
Can I clarify you would like the workflow to automatically move to the next step when the user presses the 'Take Ownership' button.

Normally, the behaviour associated with this action is just to take ownership - i.e. the task will dissappear from the inbox of all others in the pool.

There isn't anyway to simply override this behaviour in the web client - certainly not via the process definition.

amanjure
Champ in-the-making
Champ in-the-making
yes you are right.
is there any other way to approach that problem..

i.e in one step.. you wither assign the workflow to a particular person.. and goes to next step.. or assign it to a pool and a person from the pool will assign to himself (or someone else) and then t goes to the next step in the logical flow?

davidc
Star Contributor
Star Contributor
There's a task assign event which can be hooked into within the process definition.

So, perhaps you can use that to automatically trigger the next step.

I suggest taking a look at the jBPM docs as they'll provide exactly how to do that.

amanjure
Champ in-the-making
Champ in-the-making
thanks david,

i'll look into it..

fif
Champ in-the-making
Champ in-the-making
Hello

Did you find how to trigger easily an action with the 'Take Ownership' button. ?
If yes, i would be interrested to see how you did it.


Thanks

jimcornmell
Champ in-the-making
Champ in-the-making
Did you find how to trigger easily an action with the 'Take Ownership' button. ?
If yes, i would be interrested to see how you did it.

I also would be interested.  I'm currently playing with the pooled tasks jsp files, and have gotten this far:

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>

<f:verbatim><CENTER><FONT SIZE="+3"></f:verbatim>
   <h:outputText value="No tasks found - Please try again later." rendered="#{empty WorkflowBean.pooledTasks}" />
   <f:verbatim></FONT><BR/><FONT SIZE="+2"></f:verbatim>
   <h:outputText value="In the mean time make sure your tasks are complete." rendered="#{empty WorkflowBean.pooledTasks}" />
   <f:verbatim></FONT></f:verbatim>
   
   <a:actionLink id="get-next-task" value="Get Next Task" image="/images/icons/get-next-job.png" showLink="false"
      actionListener="#{WorkflowBean.setupTaskDialog}" action="dialog:manageTask" rendered="#{not empty WorkflowBean.pooledTasks}" >
      <f:param name="id" value="#{r.id}" />
      <f:param name="type" value="#{r.type}" />
   </a:actionLink>
<f:verbatim></CENTER></f:verbatim>

but now I can't see which way to go.  Currently I'm thinking of adding some extending the javascript capabilities with some Java (as per http://wiki.alfresco.com/wiki/JavaScript_API#Adding_Custom_Script_APIs and http://wiki.alfresco.com/wiki/Adding_a_Custom_Dialog).  But this seems like a lot of work and overkill.

The ultimate aim is to just have a button which simply allows the user to grab the oldest task.  Rather than the current process which allows them to a) selectively pick jobs (our users tend to pick the easy ones Smiley Happy ) and b) then "Take Ownership".

I see a few people have asked this and similar questions.

Jim