6 Replies Latest reply on Aug 9, 2012 7:53 AM by Maciej Swiderski

    How to update the process variable instances values dynamically in audit logs.

    Lingaiah Sundari Newbie

      Hi All,

       

          I have the below requirement. And not able to find out the solution .

       

          In process flow,  I have two different navigationa to end the process .

        1).End the process depending on the in put value  and update the status in  process params.

        2). Create the Human tasks and update the status in same process params .

       

          The initial params values while starting the process are stored in the audit logs. And able to retrieve.

       

            The subsequent updated param value is not updated in the audit logs , Even though The same  updated param value is available in

      WorkflowProcessInstance instance.

        Please help me  , Thanks in Advance.

      -Regards,

      Lingaiah.S.

       

                                                                                                         

        • 1. Re: How to update the process variable instances values dynamically in audit logs.
          Maciej Swiderski Master

          Could you elaborate little bit more on this and what is the issue? Is it that variable is not updated in BAM tables....

           

          Would be perfect if you could provide a test case for it.

           

          HTH

          • 2. Re: How to update the process variable instances values dynamically in audit logs.
            Lingaiah Sundari Newbie

            Hi Maciej Swiderski,

             

               Thank you very much.

              

                I would like to update the process params in audit logs ( VariableInstanceLog)  , While starting the process the initial param value is inserted into audit logs , but in process update of the same param in the action script  or drools, the reset value is not updated in the audit logs.

             

               My aim is to update the process status in  the VariableInstanceLog audit log . I am using H2 in memory database, I am not sure any costraint with data base.

             

             

              While starting the process the initial param value is inserted into data base , but changed  param value  in progress process is not updated in audit log.

             

             

               I' have started the process using below code:  in middle of the process the param value is changed but it is not updated in the audit log end of the process. But the changed value is availabke

            in WorkflowProcessInstance instance.

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

            if (action.equals("CreateProcess"

            )) {

             

            UserTransaction ut = (UserTransaction)

            new InitialContext().lookup( "java:comp/UserTransaction"

            );

            ut.begin();

             

             

            new JPAWorkingMemoryDbLogger (ksession

            );

             

            KnowledgeRuntimeLoggerFactory.newConsoleLogger(

            ksession

            );

             

             

            ksession.getWorkItemManager().registerWorkItemHandler("Log", new

            SystemOutWorkItemHandler());

             

             

            ksession

            .getWorkItemManager().registerWorkItemHandler(

             

            "Email", new EmailWorkItemHandler("20.139.68.11","86400","lsundari","Shiva@2012"

            ));

             

             

            //ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());

             

            CustomerProfile customerProfile =

            new CustomerProfile(request.getParameter("fName"),request.getParameter("lName"),Integer.parseInt(request.getParameter("age")),Integer.parseInt(request.getParameter("aLimit")),Integer.parseInt(request.getParameter("mSalary")),request.getParameter("eMail"),"TODO","TODO"

            );

            Map<String, Object> params =

            new

            HashMap<String, Object>();

            params.put(

            "customerProfile"

            , customerProfile);

            params.put(

            "employee", "lingaiah"

            );

            params.put(

            "reason", "CC Review Process"

            );

             

             

             

             

            ksession.startProcess("com.sample.bpmn.creditcardissueprocess"

            ,params);

            Thread.sleep(200);

             

            ksession

            .fireAllRules();

            Thread.sleep(200);

            ut.commit();

             

            //logger.dispose();

             

             

              

              

            • 3. Re: How to update the process variable instances values dynamically in audit logs.
              Maciej Swiderski Master

              Thanks for explanation. Could you please share the code that does the variable manipulation (script task, rule)?

               

              Cheers

              • 4. Re: How to update the process variable instances values dynamically in audit logs.
                Lingaiah Sundari Newbie

                Hi Maciej Swiderski ,

                 

                    Thank you very much.

                 

                   Code :  used MVEL   - >Updated param  customerProfile.cardIssueStatus  , Customet profile object is added to Map params while starting the process.

                  

                System.out.println(

                " In pre Processor : customerProfile.appliedLimit -> " + customerProfile.appliedLimit );

                 

                 

                 

                 

                 

                 

                 

                 

                 

                if

                 

                (customerProfile.appliedLimit > 30000) {

                customerProfile.accessCreditCardService =

                true

                ;

                }

                else

                {

                customerProfile.cardIssueStatus =

                " Credit Card Issue process is suspended due to applied limit is < 30K , Logged the status and sent eMail "

                ;

                }

                 

                System.out.println(

                " In pre Processor : customerProfile.accessCreditCardService -> "

                + customerProfile.accessCreditCardService );

                System.out.println(

                " In pre Processor : customerProfile.cardIssueStatus -> "

                + customerProfile.cardIssueStatus );

                System.out.println(

                "\n"

                );

                 

                  

                   I am attaching the source code while editing the discussion.

                 

                 

                -Regards,

                Lingaiah.S

                • 5. Re: How to update the process variable instances values dynamically in audit logs.
                  Lingaiah Sundari Newbie

                  Hi

                   

                  I have attached the total source code while editing discussion  - > jbpm5webexample.zip

                   

                  Regards,

                   

                  Lingaiah.S

                  • 6. Re: How to update the process variable instances values dynamically in audit logs.
                    Maciej Swiderski Master

                    if you are changing the variable in for instance script task make sure you set it as process variable to replace the old value otherwise it is only valid within scope of the task that is manipulating it.

                     

                    HTH