Ease Your Effort of Putting Data into History Table           ALBERT KUO     ALBERT_KUO@CHT.COM.TW
Scenario                     2            違章事實代碼檔維護違章事實代碼資料  NIG015W         NIG015W 違章事實代          新增/刪除/修 碼檔維護          ...
AS-IS                                               3                 Spring                    Nig005Controller          ...
TO-BE                                                           4                           Spring                     Nig...
How to do it?                           5 1. Open Nigt038DaoImpl 2. Autowired Nigu038Dao 3. Overwrite create method 4....
Overwrite create method                                                                  6Copy entityattributes to  Nigu03...
Overwrite delete method                                                                 7  Retrieveexisting data          ...
Overwrite update method                                                                8  Retrieveexisting data           ...
Upcoming SlideShare
Loading in …5
×

Ease Your Effort of Putting Data into History Table

1,701 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,701
On SlideShare
0
From Embeds
0
Number of Embeds
503
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ease Your Effort of Putting Data into History Table

  1. 1. Ease Your Effort of Putting Data into History Table ALBERT KUO ALBERT_KUO@CHT.COM.TW
  2. 2. Scenario 2 違章事實代碼檔維護違章事實代碼資料 NIG015W NIG015W 違章事實代 新增/刪除/修 碼檔維護 改/查詢/列印 As user maintains violation fact code, system should keep its modification history. NIG015P 1.違章事實代碼檔[NIGT038]違章事實代碼 2.違章事實代碼異動記錄檔[NIGU038] 對照表
  3. 3. AS-IS 3 Spring Nig005Controller Nig005Service1 request Dispatcher Servlet 2 Nig010Controller Nig010Service 3 Nig015Service Nig015Controller 7 6 Nig020Controller Nig020Service response View NigXXXController NigxxxService Apache Tiles 4 5 Nigt038Dao Nigu038Dao Nigt039Dao Nigu039Dao NigtxxxDao NiguxxxDao
  4. 4. TO-BE 4 Spring Nig005Controller Nig005Service 1 request Dispatcher Servlet 2 Nig010Controller Nig010Service 3 Nig015Controller Nig015Service 6 7 Nig020Controller Nig020Service response View NigXXXController NigxxxService Apache Tiles 4 Nigt038Dao Nigu038Dao Nigt039Dao Nigu039Dao 5 NigtxxxDao NiguxxxDao1. Service class can simply focus on business logic and more clean.2. Service class does not need to care about if it should write data into history table or not.
  5. 5. How to do it? 5 1. Open Nigt038DaoImpl 2. Autowired Nigu038Dao 3. Overwrite create method 4. Overwrite delete method 5. Overwrite update method
  6. 6. Overwrite create method 6Copy entityattributes to Nigu038 Set PK values to Nigu038PK Set Nigu038PK to Nigu038’s id attribute Create data to Nigu038 via Nigu038Dao Create data to Nigt038
  7. 7. Overwrite delete method 7 Retrieveexisting data Copy values to Nigu038 Set PK values to Nigu038PK Set Nigu038PK to Nigu038’s id attribute Create data to Nigu038 via Nigu038Dao Create data to Nigt038
  8. 8. Overwrite update method 8 Retrieveexisting data Copy values to Nigu038 Set PK values to Nigu038PK Set Nigu038PK to Nigu038’s id attribute Create data to Nigu038 via Nigu038Dao Create data to Nigt038

×