SlideShare uma empresa Scribd logo
1 de 8
Baixar para ler offline
Ease Your Effort of Putting
 Data into History Table

           ALBERT KUO
     ALBERT_KUO@CHT.COM.TW
Scenario
                     2

            違章事實代碼檔維護



違章事實代碼資料




  NIG015W         NIG015W
 違章事實代          新增/刪除/修
 碼檔維護           改/查詢/列印
                              As user maintains violation fact code,
                              system should keep its modification history.


 NIG015P                    1.違章事實代碼檔[NIGT038]
違章事實代碼                      2.違章事實代碼異動記錄檔[NIGU038]
 對照表
AS-IS
                                               3


                 Spring                    Nig005Controller                 Nig005Service
1   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
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       NiguxxxDao




1.       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.
How to do it?
                           5

 1. Open Nigt038DaoImpl
 2. Autowired Nigu038Dao


 3. Overwrite create method
 4. Overwrite delete method
 5. Overwrite update method
Overwrite create method
                                                                  6




Copy entity
attributes to
  Nigu038



                 Set PK values
                to Nigu038PK


                                  Set
                             Nigu038PK to
                             Nigu038’s id
                               attribute


                                            Create data to
                                             Nigu038 via
                                            Nigu038Dao



                                                             Create data to
                                                               Nigt038
Overwrite delete method
                                                                 7

  Retrieve
existing 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
Overwrite update method
                                                                8

  Retrieve
existing 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

Mais conteúdo relacionado

Mais de Guo Albert

OCEJPA(1Z0-898) Preparation Tips
OCEJPA(1Z0-898) Preparation TipsOCEJPA(1Z0-898) Preparation Tips
OCEJPA(1Z0-898) Preparation Tips
Guo Albert
 
JPA lifecycle events practice
JPA lifecycle events practiceJPA lifecycle events practice
JPA lifecycle events practice
Guo Albert
 
How to avoid check style errors
How to avoid check style errorsHow to avoid check style errors
How to avoid check style errors
Guo Albert
 
NIG系統報表開發指南
NIG系統報表開發指南NIG系統報表開發指南
NIG系統報表開發指南
Guo Albert
 
A Short Intorduction to JasperReports
A Short Intorduction to JasperReportsA Short Intorduction to JasperReports
A Short Intorduction to JasperReports
Guo Albert
 
Apply Template Method Pattern in Report Implementation
Apply Template Method Pattern in Report ImplementationApply Template Method Pattern in Report Implementation
Apply Template Method Pattern in Report Implementation
Guo Albert
 
Utilize Commons BeansUtils to do copy object
Utilize Commons BeansUtils to do copy objectUtilize Commons BeansUtils to do copy object
Utilize Commons BeansUtils to do copy object
Guo Albert
 
Apply my eclipse to do entity class generation
Apply my eclipse to do entity class generationApply my eclipse to do entity class generation
Apply my eclipse to do entity class generation
Guo Albert
 
Nig project setup quickly tutorial
Nig project setup quickly tutorialNig project setup quickly tutorial
Nig project setup quickly tutorial
Guo Albert
 
Spring JDBCTemplate
Spring JDBCTemplateSpring JDBCTemplate
Spring JDBCTemplate
Guo Albert
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC Framework
Guo Albert
 
Toms introtospring mvc
Toms introtospring mvcToms introtospring mvc
Toms introtospring mvc
Guo Albert
 
Spring db-access mod03
Spring db-access mod03Spring db-access mod03
Spring db-access mod03
Guo Albert
 
Spring bean mod02
Spring bean mod02Spring bean mod02
Spring bean mod02
Guo Albert
 
Spring 2.x 中文
Spring 2.x 中文Spring 2.x 中文
Spring 2.x 中文
Guo Albert
 
Overview chap1
Overview chap1Overview chap1
Overview chap1
Guo Albert
 
Aspect oriented programming_with_spring
Aspect oriented programming_with_springAspect oriented programming_with_spring
Aspect oriented programming_with_spring
Guo Albert
 

Mais de Guo Albert (20)

OCEJPA(1Z0-898) Preparation Tips
OCEJPA(1Z0-898) Preparation TipsOCEJPA(1Z0-898) Preparation Tips
OCEJPA(1Z0-898) Preparation Tips
 
JPA lifecycle events practice
JPA lifecycle events practiceJPA lifecycle events practice
JPA lifecycle events practice
 
XDate - a modern java-script date library
XDate -  a modern java-script date libraryXDate -  a modern java-script date library
XDate - a modern java-script date library
 
How to avoid check style errors
How to avoid check style errorsHow to avoid check style errors
How to avoid check style errors
 
NIG系統報表開發指南
NIG系統報表開發指南NIG系統報表開發指南
NIG系統報表開發指南
 
A Short Intorduction to JasperReports
A Short Intorduction to JasperReportsA Short Intorduction to JasperReports
A Short Intorduction to JasperReports
 
Apply Template Method Pattern in Report Implementation
Apply Template Method Pattern in Report ImplementationApply Template Method Pattern in Report Implementation
Apply Template Method Pattern in Report Implementation
 
Utilize Commons BeansUtils to do copy object
Utilize Commons BeansUtils to do copy objectUtilize Commons BeansUtils to do copy object
Utilize Commons BeansUtils to do copy object
 
Apply my eclipse to do entity class generation
Apply my eclipse to do entity class generationApply my eclipse to do entity class generation
Apply my eclipse to do entity class generation
 
Nig project setup quickly tutorial
Nig project setup quickly tutorialNig project setup quickly tutorial
Nig project setup quickly tutorial
 
Spring JDBCTemplate
Spring JDBCTemplateSpring JDBCTemplate
Spring JDBCTemplate
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC Framework
 
Toms introtospring mvc
Toms introtospring mvcToms introtospring mvc
Toms introtospring mvc
 
Spring db-access mod03
Spring db-access mod03Spring db-access mod03
Spring db-access mod03
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Spring bean mod02
Spring bean mod02Spring bean mod02
Spring bean mod02
 
Spring 2.x 中文
Spring 2.x 中文Spring 2.x 中文
Spring 2.x 中文
 
Overview chap1
Overview chap1Overview chap1
Overview chap1
 
Aspect oriented programming_with_spring
Aspect oriented programming_with_springAspect oriented programming_with_spring
Aspect oriented programming_with_spring
 
SLF4J+Logback
SLF4J+LogbackSLF4J+Logback
SLF4J+Logback
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

Ease Your Effort of Putting Data into History Table

  • 1. Ease Your Effort of Putting Data into History Table ALBERT KUO ALBERT_KUO@CHT.COM.TW
  • 2. Scenario 2 違章事實代碼檔維護 違章事實代碼資料 NIG015W NIG015W 違章事實代 新增/刪除/修 碼檔維護 改/查詢/列印 As user maintains violation fact code, system should keep its modification history. NIG015P 1.違章事實代碼檔[NIGT038] 違章事實代碼 2.違章事實代碼異動記錄檔[NIGU038] 對照表
  • 3. AS-IS 3 Spring Nig005Controller Nig005Service 1 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. 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 NiguxxxDao 1. 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. How to do it? 5  1. Open Nigt038DaoImpl  2. Autowired Nigu038Dao  3. Overwrite create method  4. Overwrite delete method  5. Overwrite update method
  • 6. Overwrite create method 6 Copy entity attributes 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. Overwrite delete method 7 Retrieve existing 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. Overwrite update method 8 Retrieve existing 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