How must i handle a celebration where

  1. User A Is Editing a Doc
  2. User B Begins editing exactly the same Doc
  3. User B Saves
  4. User A Saves - Should fail but what must i handle it? Telling the consumer the page(or entity) continues to be saved by another person does not appear enough. The consumer ought to know which area of the document/fields happen to be transformed and see if he wish to retry the save or otherwise.
    • If it is just short fields, I believe I'm able to do a comparison - what is an ideal way to check old &lifier new values inside a area?
    • If it is a lengthy text document, how do i make a move just like a diff? Or how then must i handle this? Just telling the consumer someone saved the document after you have opened up it doesn't appear enough?

In many programs it turns it really is enough to merely tell the consumer the save unsuccessful because of another user upgrading exactly the same data. This really is known as optimistic concurrency: basically, you think that no conflicts will occur, and also you handle the problem in which a conflict does occur simply by rejecting another write operation on a single data.

Anything beyond that's custom programming. Your suggestion of offering a diff is specific for your domain. Whether it's about editing text documents you should use standard diff documents. Prior to going this route however, request yourself be it well worth investing enough time on...

Note sure that language you would like this however in Java I personally use xstream to serialize the item into xml after which diff the XMLs using to determine what transformed.

For those who have just a few organizations and employ cases you'll be able to escape by applying all this behavior by hand and just make use of the diff engine to check the large blobs of text.