cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Assignment Handler and 2 arguments function

akakunin
Champ in-the-making
Champ in-the-making
Hi!

I'm trying to use custom assignment handler introduced in Activiti 5.0 final. So, I have task like this:

      <userTask id="usertask2" name="Review Asset"
         activiti:candidateGroups="${liferayGroups.getGroups(execution, &quot;Administrator&quot;)}">
         <extensionElements>
            <activiti:formProperty id="outputTransition" type="enum" required="true">
               <activiti:value id="Approve" label="Approve"/>
               <activiti:value id="Reject" label="Reject"/>
            </activiti:formProperty>
         </extensionElements>
      </userTask>


and I have bean like:

@Service("liferayGroups")
public class LiferayGroups {
   private static Log _log = LogFactoryUtil.getLog(LiferayGroups.class);
   
   public String getGroups(ExecutionImpl execution, String groups) {
      _log.info("Convet groups : " + groups);
                // some code here
        }
}

The thing is - I need execution context in my code to corrently process "groups" specified in the process definition.

My problem: process is not deployed at all - deploy() method return deployment - but no any process-definition related to it.
Wierd thing - there is nothing in logs - no any error or warn message.

I did some experiments - it looks like Activiti do not like 2 arguments in the function - if I'm using function with 1 argument like

activiti:candidateGroups="${liferayGroups.getGroups(&quot;Administrator&quot;)}"
or

activiti:candidateGroups="${liferayGroups.getGroups(execution)}"

everything deployed well.

So, is it possible to use more then 1 argument in custom handler? or - is it possible to access (somehow) excetion from custom assginment handler by other way then passing it as argument?
4 REPLIES 4

akakunin
Champ in-the-making
Champ in-the-making
Hi!
Also I tried to find any unit-test for custom assignment - to try to reproduce it via unit-test - but did not found Smiley Sad

akakunin
Champ in-the-making
Champ in-the-making
Hi!
I found unit-test in activiti-spring project and modified it to use method with two arguments. Everything working well - so, looks like problem somethere on my side.

akakunin
Champ in-the-making
Champ in-the-making
OK, found and was able to reproduce in unit-tests: it is working with activiti:assignee but not working with activiti:candidateGroup
Looks like these attributes processed by different way

frederikherema1
Star Contributor
Star Contributor
Alexey,

Can you attach the test-case (and context) that shows the exact problem?