| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
¡¡
|
¡¡
System Operation History Author: Chris Liao 2006/12/31
Table of Content ¡¡
Revision History
1. Requirements1.1. Restore dataWhen a new product is coming to user, system may be not stable during UAT period. Because users are not familiar with the work flow of the product, some mistaken operation will occur continually and some unavailable data will be created into DB. If a fatal mistake occurs in someday, users hope that all data can be restored to the time point before the error.
1.2. Record proofWe often heard that users quarrel with each other on answering for mistakes, so managers hope to find a way to record Database change in background. For this, user¡¯s operation history should be stored in DB, and then we query them from DB table.
2. Design2.1. Object List
2.2. Object Relationship
2.3. Object DetailØ FieldChange: An entity object and describe field change in DB tables and store two values for field, one is before changing and another is after changing.
Ø TableChange: An entity object and describe table change in DB
Ø ChangeProccessBean A process object to handle DB table: TB_Operation_History. This bean provides some methods to record data change in DB; these methods should be applied in your code.
Record SQL:
Insert into TB_Operation_History values ( tablename, operator, operation, operateDate, changeFieldList);,
Restore SQL 1: delete creation record
Delete from? where (?)
2: resore updated record
Update? set (? ) where (?)
3: restore deleted record
Insert into ?(?) values(?)
2.4. Sample Code1: Record create action
Insert into table_XXX (A1, A2, A3, A4) values (?, ?, ?, ?,?); ¡¡¡¡..// SQL execute
TableChange change = new TableChange(); change. addFieldChange(¡°A1¡±,¡±String¡±,¡±Current Value¡±,¡± Previous Value¡±); change. addFieldChange(¡°A2¡±,¡±String¡±,¡±Current Value¡±,¡± Previous Value¡±); change. addFieldChange(¡°A3¡±,¡±String¡±,¡±Current Value¡±,¡± Previous Value¡±); change. addFieldChange(¡°A4¡±,¡±String¡±,¡±Current Value¡±,¡± Previous Value¡±); ChangeProccessBean. handleCreate(change); ¡¡¡¡¡..
Note that: Delete action and update action are similar with this.
2: restore DB data
¡¡¡¡.. ChangeProccessBean. restore(date); ¡¡¡¡¡ 3. DatabaseTable Structure: TB_Operation_History
Date format of Field: ChangeFields ¡<fieldName:FieldType:preValue:curValue>;<fieldName:FieldType:preValue:curValue>...
|
![]() |
Copyright © 2006 . All Rights Reserved. |