7 Replies Latest reply on Sep 7, 2006 9:30 AM by Tom Baeyens

    implementing undo

    Tom Baeyens Master

      Someone wanted my ideas about how to start implementing undo in jBPM. So here goes:

      1) add a method in the LoggingSession called undo. The method should take a time (java.util.Date) to which the process should be rolled back. That method should first do a query on the database for all undoable process logs (that are not already undone) between now and the given date.

      That list of logs should be iterated in reverse order. On each processLog, an undo method should be called and the processLog should be marked as undone.

      In a first development iteration, you should focus on the rewinding the Node- and TransitionLogs so that the token is put back into the right location. The second thing would be undoing of the process variables. And then Task instances can be undone.

      2) The method undo should be added to ProcessLog

      3) An UndoableProcessLog should be created that allows users to add a log to a process execution with custom undo behaviour. This is to enable users to undo updates in their own domain model data.

      4) An interface UndoableActionHandler should be created that allows users to write undoable actions. jBPM could detect this with reflection and mark the ActionProcessLog as undoable.

      See also the related jira issue: http://jira.jboss.com/jira/browse/JBPM-589

      regards, tom.