Changes for page Development-Audit Trails
Last modified by Theodore Petrosky on 2013/06/17 13:31
From version 17.1
edited by smmccraw
on 2007/07/08 09:45
on 2007/07/08 09:45
Change comment:
There is no comment for this version
To version 15.1
edited by Quinton Dolan
on 2007/07/12 20:24
on 2007/07/12 20:24
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. smmccraw1 +XWiki.qdolan - Content
-
... ... @@ -10,30 +10,30 @@ 10 10 11 11 If I was going to log every change to every object, some typical hints are that if you subclass EOEditingContext, then prior to any saveChanges() operation you can get a list of the inserted/deleted/changed objects (you have to call processRecentChanges() first). If I was designing this, I'd make all my EOF objects have a common superclass/interface that implemented something like: 12 12 13 -{{ panel}}13 +{{code}} 14 14 15 - 16 - 17 - 15 +auditTrailChanged() 16 +auditTrailInsert() 17 +auditTrailDelete() 18 18 19 -{{/ panel}}19 +{{/code}} 20 20 21 21 Then on a class-by-class basis I could decide what to do. That could include inserting additional objects, etc. Like an object could compare itself to its snapshot if it had changed and it could record the old and new values to a generic object that stored AuditTrail(class name, primary key of object, username, timestamp, attribute, old value (string), new value(string)). 22 22 23 23 In psuedo code: 24 24 25 -{{ panel}}25 +{{code}} 26 26 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 27 +override saveChanges() 28 + self.processRecentChanges() 29 + foreach obj (self.changedObjects) 30 + obj.auditTrailChanged() 31 + foreach obj (self.insertedObjects) 32 + obj.auditTrailChanged() 33 + foreach obj (self.deletedObjects) 34 + obj.auditTrailChanged() 35 + super.saveChanges() 36 36 37 -{{/ panel}}37 +{{/code}} 38 38 39 39 Category:WebObjects