4 Replies Latest reply on Aug 12, 2009 5:08 AM by kukeltje

    Availability of 'initiating participant' as variable?

    kukeltje

      I was wondering if the initiating actor is available somewhere, in the pvm e.g. as a java principle or whatever. This is needed to be able to have a 'start event' and a user task after that where the user task is assigned to the initiating participant.

        • 1. Re: Availability of 'initiating participant' as variable?
          tom.baeyens

          for now, you can create a static thread local somewhere in the bpmn code for this.

          public static ThreadLocal authenticatedUserId = new ThreadLocal();
          


          try {
           authenticatedUserId.set("johndoe");
           executionService.startProcessInstanceByKey("ICL");
          } finally {
           authenticatedUserId.set(null);
          }
          


          then in the start event you can access that thread local directly. i'll integrate functionality like that in the pvm, but it is not yet there.

          • 2. Re: Availability of 'initiating participant' as variable?
            kukeltje

            I know this 'trick', but I think the issue is that the server side part of the console should do something like this. It does not help if I do it in the bpmn part. Sure, for the testcases etc it helps. I'll definately do this.

            But the method:

            public ProcessInstanceRef newInstance(String definitionId, Map<String, Object> processVars)
             {
             Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
            
             try
             {
             ExecutionService execService = this.processEngine.getExecutionService();
             Execution exec = execService.startProcessInstanceById(definitionId);
             execService.setVariables(exec.getId(), processVars);
            
             return ModelAdaptor.adoptExecution((ExecutionImpl)exec);
             }
             finally{
             env.close();
             }
             }
            


            in ProcessManagementImpl in the console-integration project should get this as a argument from the calling class which is in the bpm-console. So it needs an adaption in there to (soag) , which should be done in sync.

            • 3. Re: Availability of 'initiating participant' as variable?
              tom.baeyens

              yes. good point. console currently doesn't pass the authenticated userId to the engine operations.

              https://jira.jboss.org/jira/browse/JBPM-2482

              • 4. Re: Availability of 'initiating participant' as variable?
                kukeltje

                It does pass them on for task related calls from what I've seen. But the other operations need them to, certainly if you want to have the actor for auditing reasons.