7 Replies Latest reply on Oct 10, 2008 5:47 AM by Ronald van Kuijk

    Id of process starter

    Alexei Kildishev Newbie

      Hi,

      how can I get ActorId of Actor, which created(started) some ProcessIntstance?

        • 1. Re: Id of process starter
          Ronald van Kuijk Master

          declare a swimlane on the start-task and that will be filled with the actor-id that started the process (presuming you set the actor initially, as does the jbpm web console)

          • 2. Re: Id of process starter
            Alexei Kildishev Newbie

            Thx for answer first of all.

            I tried such way. But it's not working.

            <process-definition xmlns="" name="todo">
             <swimlane name='initiator'>
             <assignment actor-id="#{actor.id}"/>
             </swimlane>
            
             <start-state name="Start">
             <task name= 'taskforinitiator' swimlane='initiator'/>
             <transition to="UserProcessNum"></transition>
             </start-state>
            
            
             <task-node name="todo">
             <task name="todo" description="#{todoList.description}">
             <assignment actor-id="#{actor.id}"/>
             </task>
             <transition to="done"></transition>
             </task-node>
            
             <decision name="UserProcessNum">
             <handler class="org.jboss.decisiontest.UserProcessNumHandler"> </handler>
             <transition to="todo" name="ok"></transition>
             <transition to="done" name="2much"></transition>
             </decision>
            
            
             <end-state name="done"></end-state>
            
            
            </process-definition>


            public class UserProcessNumHandler implements DecisionHandler {
             public String decide(ExecutionContext ec){
            String acId = ec.getProcessInstance().getTaskMgmtInstance().getSwimlaneInstance("initiator").getActorId();
             return "ok";
            
             }
            }
            


            And result is...
            19:25:53,208 FATAL [application] org.jbpm.graph.def.DelegationException
            javax.faces.el.EvaluationException: org.jbpm.graph.def.DelegationException
             at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
             at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
             at javax.faces.component.UICommand.broadcast(UICommand.java:383)
             at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
             at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
             at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
             at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
             at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
             at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
             at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
             at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
             at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
             at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
             at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
             at java.lang.Thread.run(Thread.java:619)
            Caused by: org.jbpm.graph.def.DelegationException
             at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:387)
             at org.jbpm.graph.def.GraphElement.raiseException(GraphElement.java:378)
             at org.jbpm.graph.node.Decision.execute(Decision.java:148)
             at org.jbpm.graph.def.Node.enter(Node.java:319)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
             at org.jbpm.graph.def.Node_$$_javassist_419.enter(Node_$$_javassist_419.java)
             at org.jbpm.graph.def.Transition.take(Transition.java:151)
             at org.jbpm.graph.def.Node.leave(Node.java:394)
             at org.jbpm.graph.node.StartState.leave(StartState.java:70)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
             at org.jbpm.graph.def.Node_$$_javassist_419.leave(Node_$$_javassist_419.java)
             at org.jbpm.graph.exe.Token.signal(Token.java:195)
             at org.jbpm.graph.exe.Token.signal(Token.java:140)
             at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:271)
             at org.jboss.seam.bpm.BusinessProcess.afterCreateProcess(BusinessProcess.java:147)
             at org.jboss.seam.bpm.BusinessProcess.createProcess(BusinessProcess.java:122)
             at org.jboss.decisiontest.TodoList.createTodo(TodoList.java:27)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
             at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
             at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
             at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:49)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
             at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
             at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
             at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
             at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
             at org.jboss.decisiontest.TodoList_$$_javassist_4.createTodo(TodoList_$$_javassist_4.java)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
             at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
             at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
             at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
             at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
             at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
             at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
             ... 46 more
            Caused by: java.lang.NullPointerException
             at org.jboss.decisiontest.UserProcessNumHandler.decide(UserProcessNumHandler.java:19)
             at org.jbpm.graph.node.Decision.execute(Decision.java:88)
             ... 96 more
            


            • 3. Re: Id of process starter
              Ronald van Kuijk Master

              you cannot have an assignment in it.... just leave it empty and set the actor id with the api on the jbpm context when starting a process

              • 4. Re: Id of process starter
                Alexei none Apprentice

                 

                "kukeltje" wrote:
                you cannot have an assignment in it.... just leave it empty and set the actor id with the api on the jbpm context when starting a process


                Would You please clear that for me. Do You mean, that I cannot use assignment statement inside swimlane

                <swimlane name="initiator">
                
                 <assignment actor-id="#{actor.id}"/>
                
                </swimlane>
                


                or I cannot use swimlane in start task

                <start-state name="Start">
                 <task name= 'taskforinitiator' swimlane='initiator'/>
                 <transition to="UserProcessNum"></transition>
                </start-state>
                


                or I should care about injecting Actor instance into JBPMContext before starting the process?

                • 5. Re: Id of process starter
                  Ronald van Kuijk Master

                  not in the swimlane used in thae start task.

                  Yes, you should set the actor id yourself

                  • 6. Re: Id of process starter
                    Alexei Kildishev Newbie

                    thx for help =)

                    Now it's working. But I used processcontext variable instead of swimlane and ActorId...

                    • 7. Re: Id of process starter
                      Ronald van Kuijk Master

                      that is a completely different solution, but of course can be done if you want it