views:

189

answers:

1

Hi All,

I have an application that allows different users to update some data that is then published to a website. The application uses JPA as a persistence layer. I now want to add a bit of workflow management to this scenario so that when users with junior roles update data, it is not directly published but rather waits for a senior user to come along and approve the update. While the update is unapproved the original data should remain visible.

Ideally, the senior user should be able to reject an update and the junior user will see that is was rejected and edit the update accordingly.

The question is, what is a good pattern for creating such a scenario?

The part that I am having trouble wrapping my mind around is how to represent the changed data without duplicating every entity that I have. And what about multiple changes to the data before an approval?

I considered the command pattern since it allows a type of undo. I am wondering if anyone has had experience with a similar scenario and has any advice to offer?

I should point out that I am aware of some tools like JBPM which is a workflow engine but I was hoping to avoid the complications of integrating such tools into the existing architecture. I would appreciate it if someone points out that using such a tool will yield more productivity in the end.

Thanks

+1  A: 

Yes, I absolutely think what you are doing in that scenario is starting different business processes. Using tools like JBPM or drools-flow (which you should take a look) not only express exactly your problem but lets you have a visual approach of the flow of your application through the designers they provide. You can use what makes your application work as documentation directly.

diega