Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to undo RequestFactory update

Updating object through GWT RPC can easily be undone. We need to clone previous entity state in memory and apply it upon undo.

But when we use RequestFactory there is no concrete update operation. RequestFactory sends entity modifications to the server and updates repository entities itself. We cannot intercept update process.

How should I implement undo for updates made with RequestFactory?

like image 623
Andrey Minogin Avatar asked Jan 20 '12 14:01

Andrey Minogin


1 Answers

You should look into modifying your server-side data structures and tables. Incorporate a temporal or bitemporal model there. Don't bother trying to hold "old" states of entities in memory, or intercept them. Keep the prior states of entities intact with time fields. Undo means locating a prior version by timestamp, and making it current. You can do this across multiple entity types simultaneously as well.

  • 01:00 pizza A saved
  • 01:01 pizza A ingredients changed
  • 01:02 pizza A ingredients changed
  • 01:03 undo to 01:01

If you want to, you can periodically sweep your database and clean up old versions. The "append-only" style of temporal writes can yield performance benefits as well.

like image 61
Ross Judson Avatar answered Sep 21 '22 07:09

Ross Judson