1 Reply Latest reply on Apr 19, 2013 7:24 PM by roxy1987

    Possible Bug: querying nodeInstanceLog by processId and nodeId does not work

      i am trying to query nodeinstance log table to find current "state"of process. as required i have configured JpaProcessInstanceDbLog and all node transitions entries are properly logged in nodeinstance Table

       

      i am using code:

       

                for(NodeInstance node :wflowProcessInstance.getNodeInstances()){

                      List<NodeInstanceLog> nodeInstanceLogList = log.findNodeInstances(instance.getId(), String.valueOf(node.getId()));

                      if(nodeInstanceLogList.size()==1){

                          return node.getNodeName();

                      }

                 }

       

      log.findNodeInstances(instance.getId(), String.valueOf(node.getId())); ---------------------------- does not return anything though there are entires in database tables and it generates correct sql query.

       

       

      BUT if i try:

       

      List<NodeInstanceLog> stored= log.findNodeInstances(instance.getId()); ----------------------------- returns all rows correctly.

       

      can someone help ?.

        • 1. Re: Possible Bug: querying nodeInstanceLog by processId and nodeId does not work
          roxy1987

          If you want to find out the state of the process, you can get it from the ProcessInstanceLog object.

           

          But may be by state, you mean the current node in the process which is active.

          In your code though, how do you get the "wflowProcessInstance" ???

           

          Anyway. You could use the following code.

           

          Process process = kbase.getProcess(processDefId);

          List<NodeInstanceLog> nodeInstanceLogList;
          for (Node node : ((WorkflowProcessImpl) process).getNodes())
          {
              nodeInstanceLogList = JPAProcessInstanceDbLog.findNodeInstances(processInstId, NumberFormat.getNumberInstance().format(node.getId()));
              if(nodeInstanceLogList.size() == 1)
              {

                    //add the node to the list, as there may be more than one node active.

              }

          }