1 2 Previous Next 25 Replies Latest reply on Aug 30, 2010 10:29 PM by HuiSheng Xu

    History details

    Maciej Swiderski Master

      Hi,

       

      I am about to start work on history details and before I start want to collect your ideas and expectations on what shall be included. Here is a list of items that I identified (or was already defined in code/jira) and I find them required:

      • task assignment changes
      • start work on task
      • change priority of task
      • start of the process mainly user information (who did it)
      • signal wait state again, mainly user information (who did it)
      • variables updates, since history can be already enabled but it will keep the most recent value

       

      All of them will rely on provided user information, it will be secured when working with BPM console but if working though API it must be provided manually.

       

      Please share your thoughts so we could have the most complete solution with 4.5.

       

      Cheers,

      Maciej

        • 1. Re: History details
          HuiSheng Xu Master

          Hi Maciej,

           

          Glad to hear that you will work on this issue.  This will be a big important feature in jBPM-4.5.

           

          Here is some requirements that I met.

           

          1.need retrieve sub process instance and super process instance relationship from history

          2.need know the starter of a process instance

          3.retrive task name from history task. refer: https://jira.jboss.org/browse/JBPM-2896

          4.need query all of history tasks of a process instance.

           

          Cheers.

          • 2. Re: History details
            Michael Wohlfart Expert

            I have some requirement regarding the HistoryTaskImpl, basically this is what https://jira.jboss.org/browse/JBPM-2896 is all about, just want to sum it up here:

            • the duedate property in HistoryTaskImpl is handled in the constructor and copied over from TaskImpl, just having this mapped to a database field would be nice. Something along the line of adding <property name="duedate" column="DUEDATE_" type="timestamp" /> in jbm.history.hbm.xml  (and a setter and getter for this)
            • I would like to have the name of the task stored in the HistoryTaskImpl tabel too, it seems easy to implement, copy over in the contructor from TaskImpl and map to a database field.
            • I would like to be able to query all HistoryTasks for a certain ProcessInstance, I am not sure how this can be implemented in a smart way. There is a property "executionId" which might be helpfull for this but it seems this is not fully implemented yet, so I am open for any good ideas here

             

            thanks for looking into this

            • 3. Re: History details
              Michael Wohlfart Expert

              in HistoryProcessInstanceImpl i would like to have a setter for the key:

               

              public void setKey(String key) {
                    this.key = key;
              }

               

              i am assigning a business key after the process already started and is stored in the history table

              so having this method would simplify things for me. Since there is a setter for the state property

              too I don't think this is a big deal...

               

              cheers

              Michael

              • 4. Re: History details
                Maciej Swiderski Master

                Michael Wohlfart wrote:

                • I would like to be able to query all HistoryTasks for a certain ProcessInstance, I am not sure how this can be implemented in a smart way. There is a property "executionId" which might be helpfull for this but it seems this is not fully implemented yet, so I am open for any good ideas here

                I implemented that by joining HistoryTask with HistoryActivityInstance to narrow down for a particular process instance id. Since entire history is not yet finished I don't have complete solution, but if someone is interested I could extract this as a patch for a review.

                • 5. Re: History details
                  HuiSheng Xu Master

                  Hi Maciej,

                   

                  Many of our customers want to know how to get the previous/next activity of a process.  Part of this feature should be done by history service.  Could we support this feature in the next version?

                   

                  Regards.

                  • 6. Re: History details
                    Maciej Swiderski Master

                    Hi HuiSheng,

                     

                    if it comes to previous activity you can find them using already available HistoryActivityInstanceQuery. The only disadvantage is that you will get both already finished and active activities. What we could do here is to introduce new parameter to narrow down the search to finished activities only, so result will have all activities that the process has already completed.

                    What do you think about it?

                    • 7. Re: History details
                      HuiSheng Xu Master

                      Hi Maciej,

                       

                      I think it is enough for now.  And it would be better to provide related documents.

                      • 8. Re: History details
                        Maciej Swiderski Master

                        Hi guys,

                         

                        please take a look at follwoing jira issue and last comment JBPM-2398 and let me know what do you think

                         

                        Cheers

                        Maciej

                        • 9. Re: History details
                          Michael Wohlfart Expert

                          looks good to me,

                          do you need all those lazy="false" in jbpm.history.hbm.xml?

                          My tests run fine without them but I am using a different hibernate version :-/

                          • 10. Re: History details
                            Maciej Swiderski Master

                            In fact I set it to be able to get access to some information that are related to the detail, for example variable name when getting all variable updates. When I removed them and rerun the tests, following failed:

                             

                            Test set: org.jbpm.test.query.HistoryDetailQueryTest
                            -------------------------------------------------------------------------------
                            Tests run: 9, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.328 sec <<< FAILURE!
                            testHistoryVariable(org.jbpm.test.query.HistoryDetailQueryTest)  Time elapsed: 0.047 sec  <<< ERROR!
                            org.hibernate.LazyInitializationException: could not initialize proxy - no Session
                                at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:86)
                                at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:140)
                                at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
                                at org.jbpm.pvm.internal.history.model.HistoryVariableImpl_$$_javassist_39.getVariableName(HistoryVariableImpl_$$_javassist_39.java)
                                at org.jbpm.pvm.internal.history.model.HistoryVariableUpdateImpl.toString(HistoryVariableUpdateImpl.java:49)
                                at org.jbpm.test.query.HistoryDetailQueryTest.testHistoryVariable(HistoryDetailQueryTest.java:186)
                            

                             

                            After additional review it seems like it is required mainly for variable stuff since it uses persistent fields (to get variable name). Most likely is not required for others, the API is not too verbose in that matter.

                            • 11. Re: History details
                              Michael Wohlfart Expert

                              I don't have line 186 in my HistoryDetailQueryTest :-/

                              • 12. Re: History details
                                Maciej Swiderski Master

                                Yeap. my mistake forgot to include these tests in the patch. Here comes the link to updated patch:

                                https://jira.jboss.org/secure/attachment/12336598/history-detail-20100827.patch

                                 

                                I modified it a bit to leave only lazy='false' for variables.

                                 

                                Huge thanks for reviewing.

                                • 13. Re: History details
                                  Michael Wohlfart Expert

                                  great work, thanks a lot, can't wait to use the history stuff

                                   

                                  just to summarize the schema changes somewhere, we now have the following new fields in the database:

                                   

                                  JBPM4_EXECUTION.INITIATOR_

                                  JBPM4_HIST_PROCINST.INITIATOR_

                                  JBPM4_HIST_PROCINST.SUPERPROCID_

                                  JBPM4_HIST_TASK.NAME_

                                  JBPM4_HIST_TASK.DUEDATE_

                                  • 14. Re: History details
                                    Maciej Swiderski Master

                                    Thanks, similar summary is in jira as well.

                                     

                                    If no one will have objections I will commit it beginning of next week.

                                    1 2 Previous Next