SlideShare una empresa de Scribd logo
1 de 19
Descargar para leer sin conexión
eGovFrame Training Book II



       eGovFrame Center
             2012
Table of contents

 I    DI(Dependency Injection), IoC(Inversion of Control)
II    AOP (Aspect Oriented Programming)
III   MVC (Model, View, Controller) pattern concept
IV    Programming Procedure based on eGovFrame
V     Common component concept




                                                            Page l   2
DI(Dependency Injection), IoC(Inversion of Control)                        Composition of eGovFrame


Change the flow of control between classes and reducing dependence(Ease
of maintainability)

                               public class MovieLister{
                                 public void list() {
                                   MovieFinder finder = new MovieFinderImpl();
                                 }
                               }           When change Impl class, need to change Lister as well




                                public class MovieLister{
                                 public void list() {
                                        MovieFinder finder = Assember.getBean("movieFinder");
                                    }
                                }                 Assembler manages dependency




                                                                                                Page l   3
AOP (Aspect Oriented Programming)(1/2)           Composition of eGovFrame



 AOP is a programming paradigm which aims to increase
 modularity by allowing the separation of cross-cutting concerns.
 Separate add-on services (ex: logging, security, exception, etc)
 that are repeated in a number of biz logic code in an information
 system as Aspect. Make that a separate module and maintain a
 program with configuration files.
 When changes occur in additional functions(add-ons), simply by
 changing Aspect, the change can be reflected to the biz logic code
 and the maintenance of the code will be much easier.
 Improve readability as removing duplicated code in business logic.


                                                                  Page l   4
AOP (Aspect Oriented Programming)(2/2)                                           Composition of eGovFrame

     Aspect: A modularization of a concern that cuts across multiple objects
     Join point: A point during the execution of a program, such as the execution of a method or the
     handling of an exception
     Advice: Action taken by an aspect at a particular join point
     Pointcut: A predicate that matches join points. Advice is associated with a pointcut expression and
     runs at any join point matched by the pointcut (for example, the execution of a method with a
     certain name)
     Weaving: Linking aspects with other application types or objects to create an advised object

                                 Core Concerns
                                                                    Core Concerns                 Crosscutting
                                                                       Module                   Concerns Module

                       Credit       Deposit      Calculating           Credit
                                                                      Transfer        Weaving      Security
                      Transfer      Withdraw      interest
            Logging
                                                                      Deposit
  Cross                                                               Withdraw
 cutting   Security                                                                                Logging
Concerns                                                             Calculating
           Transaction                                                interest



                         [ Separating Aspect]                                        [ Weaving]


                                                                                                              Page l   5
Object Relational Mapping(ORM)                                                                  Composition of eGovFrame


ORM does not use SQL in source code, instead, directly maps java classes to the
columns of the table or runs and handles SQL in the form of XML
                                                    Full ORM (Hibernate)
                                                                                        DB Column –
                              Business Logic
                                                        Business Logic                   Java Class
                                                                                          Mapping
                                                                                                                       JDBC
       JDBC                        SQL
                                                                                          SQL MAP
                                                        Business Logic                 (Process SQL in
                                                                                      the form of XML)               DataBase
      DataBase                 Java-Mapping
                                                     Partial ORM (iBatis)


      Features                     General Development                                        ORM based
                       Need direct mapping java classes to the table    Developers can be processed directly in terms of object-
   Apply Mapping
                      columns                                          oriented
                      When SQL changes, directly modify source code     Can be applied only with modifications of the mapping
     Flexibility
                      and deploy                                       information
                                                                        Mapping information, XML, etc can be applied in the form
  Standard Pattern    No pattern
                                                                       of template
     DB Control       Directly control DB                              In case of Mapping, direct control can be difficult

  Technology in use   SQL                                              Persistence framework (Hibernate, iBatis)


                                                                                                                              Page l   6
Composition of eGovFrame
SQL Map Implementation Code Example


   • Separate SQL from business logic
   • Provide simple transaction control (Provide declarative transaction)
   • Provide a familiar SQL-based ORM model


 Statement st = null;
 ResultSet rs = null;
 try {
   st = con.createStatement();
                                                                    // Component
   StringBuffer query = new StringBuffer();
                                                   Separation of    List result =
                                                     business           ISqlManagement.getList(“sql.id”,”value”)
   query.append("n SELECT A.CHKLST_NO,     ");
   query.append("n       A.EVALFL_CD,  ");        logic and S
   query.append("n FROM PR_EVALIT_MB A      ");        QL
   query.append("n WHERE A.CHKLST_NO = '"
      + sChklstNo + "' ");
   query.append("n ORDER BY EVALIT_NO                enhance       // SqlMap.xml
                                                   productivity,    <select id=“id” resultclass =“hmap”>
   rs = st.executeQuery(st.toString());
                                                                       SELECT A.CHKLST_NO, A.EVALFL_CD FROM
   while(rs.next) {                                maintainabilit
                                                                    PR_EVALIT_MB A WHERE A.CHKLST_NO = #value#
      ...                                              y, and       ORDER BY EVALIT_NO
   }
                                                    reusability,    </select>
 } finally {
    try {rs.close();} catch (Exception e) {}
    try {st.close();} catch (Exception e) {}
 }




                                                                                                                   Page l   7
MVC   (Model, View, Controller)        pattern concept                  Composition of eGovFrame


 MVC is a software architecture, considered an architectural pattern used in software
 engineering.
 The MVC pattern isolates ‘domain logic’(the application logic for the user - model) from
 user interface (input and presentation - view), then the controller handles the input event
 from the user interface to process the request through the domain logic.
 It permits independent development, testing and maintenance of each.
 Especially, Spring MVC provides DispatcherServlet (*FrontController) that is designed
 to implement Presentation layer easier in MVC architecture

          Http Request
                          DispatcherServlet                          Controller

          Http Response



                                View                                   Model



                 [ Conceptual Sequence of MVC pattern with DispatcherServlet ]

                                                                                         Page l   8
Spring MVC Architecture                                                     Composition of eGovFrame


Spring's Web MVC framework is designed around a DispatcherServlet that
dispatches requests to handlers, with configurable handler mappings, view
resolution.


                        HandlerMapping
                                                              Controller
                                             Request                                    Model
                       Request   Contoller
                                                                                         (Biz
                                                        Model and           Model and
                                                                              View      Logic)
                                                          View
             Request
                           Dispatcher Servlet
                           (Front Controller)
            Response                                    Model and
                                                          View
                           View View Name    Response
                                                                                         DB
                                                                    View
                            View
                           Resolver                                 (JSP)




                                                                                                 Page l   9
Programming Procedure                                    based on eGovFrame (1/8)                  Programming Procedure


      Presentation Layer                                  Business Layer                         Data Access Layer


  HandlerMapping             Controller
                                                                                                                    DAO


                                                            Service Interface                    Spring Config.
Request           Dispatcher
                                                                                                    (ORM)
                   Servlet
                                                                                                                  SQL(XML)

          View                                                ServiceImpl
                      ViewResolver
          (JSP)


                                      Spring Config                             Spring Config                     DataBase
                                       (transaction)                             (datasource)



                    Data                  Value Object                            Value Object


                             Development                   Configuration
                             Spring Module



                                                                                                                       Page l   10
Programming Procedure   based on eGovFrame (2/8)   Programming Procedure

Output Screen




                                                                Page l   11
Programming Procedure                              based on eGovFrame (3/8)                Programming Procedure


Controller : Receive a request and call a service(biz logic)
Implement features such as data binding, forms processing, and muti-action, etc

   @Controller                                                           JSP      Controller    Service   DAO
   @SessionAttributes(types=SampleVO.class)
   public class EgovSampleController {
                                                                                                 VO       SQL
   /** SampleService */
   @Resource(name = "sampleService")
   private EgovSampleService sampleService;

   /**
    * Inquire post list. (pageing)
    * @param searchVO - SampleDefaultVO
    * @param model
    * @return "/sample/egovSampleList"
    * @exception Exception
    */
      @RequestMapping(value="/sample/egovSampleList.do")
      public String selectSampleList(@ModelAttribute("searchVO") SampleDefaultVO searchVO,
                                                           ModelMap model) throws Exception {

       List sampleList = sampleService.selectSampleList(searchVO);
       model.addAttribute("resultList", sampleList);

           return "/sample/egovSampleList";
       }
   }



                                                                                                          Page l   12
Programming Procedure                          based on eGovFrame (4/8)                 Programming Procedure


Service : Interface that declares methods for business functions

                                                                                        Service


                                                                JSP      Controller   ServiceImpl   DAO
        public interface EgovSampleService {
                                                                                         VO         SQL
        /**
         * Inquire post list.
         * @param searchVO – VO including search information
         * @return post list
         * @exception Exception
         */
           List selectSampleList(SampleDefaultVO searchVO) throws Exception;

        }




                                                                                                          Page l   13
Programming Procedure                        based on eGovFrame (5/8)                      Programming Procedure


ServiceImpl : Implementation class that implements methods that defined in a
service
                                                                                              Service


                                                                    JSP       Controller    ServiceImpl   DAO
       @Service("sampleService")
       public class EgovSampleServiceImpl extends AbstractServiceImpl implements               VO         SQL
           EgovSampleService {

       /** SampleDAO */
         @Resource(name="sampleDAO")
         private SampleDAO sampleDAO;

       /**
        * Inquire post list.
        * @param searchVO - VO including search information
        * @return post list
        * @exception Exception
        */
          public List selectSampleList(SampleDefaultVO searchVO) throws Exception {
            return sampleDAO.selectSampleList(searchVO);
          }
       }

       ※ Tip : In case of a ServiceImpl, AbstractServiceImpl must be extended



                                                                                                          Page l   14
Programming Procedure                                    based on eGovFrame (6/8)                                Programming Procedure

DAO : Process data transaction (support iBatis connection)
                                                                                      JSP         Controller          Service        DAO
        @Repository("sampleDAO")
        public class SampleDAO extends EgovAbstractDAO {                                                               VO            SQL

        /**
         * Inquire post list.
         * @param searchVO - VO including search information         Call EgovAbstractDAO’s list method to run iBatis
         * @return post list                                         Query ID
         * @exception Exception
         */
           public list<SampleVO> selectSampleList(SampleVO vo) throws Exception {
             return list("sampleDAO.selectSampleList_D", vo);
           }
        ※ Tip : In case of a DAO, EgovAbsractDAO must be extended.
Method Summary
int                delete(java.lang.String queryId, java.lang.Object parameterObject) : Execute delete SQL mapping.

java.lang.Object   insert(java.lang.String queryId, java.lang.Object parameterObject) : Execute Insert SQL mapping

java.util.List     list(java.lang.String queryId, java.lang.Object parameterObject) : Execute list SQL mapping
                   listWithPaging(java.lang.String queryId, java.lang.Object parameterObject, int pageIndex, int pageSize) : Execute sub range
java.util.List
                   list SQL mapping
java.lang.Object   selectByPk(java.lang.String queryId, java.lang.Object parameterObject) : select one result by PK

                   setSuperSqlMapClient(com.ibatis.sqlmap.client.SqlMapClient sqlMapClient) Execute configuration as receiving sqlMapClient
void
                   in the form of Annotation and calling setSqlMapClient method of super(SqlMapClientDaoSupport)

int                update(java.lang.String queryId, java.lang.Object parameterObject) : Execute update SQL mapping


                                                                                                                                       Page l    15
Programming Procedure                                    based on eGovFrame (7/8)                           Programming Procedure


iBatis SQL Map : Define SQL execution query
                                                                                          JSP      Controller    Service    DAO

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">         VO         SQL
  <sqlMap namespace="Sample">
  <typeAlias alias="egovMap" type="egovframework.rte.psl.dataaccess.util.EgovMap"/>
  <typeAlias alias="searchVO" type="egovframework.rte.sample.service.SampleDefaultVO"/>
  <resultMap id="sample" class="egovframework.rte.sample.service.SampleVO">
  <result property="id" column="id"/>
  <result property="name" column="name"/>
  <result property="description" column="description"/>
  <result property="useYn" column="use_yn"/>
  <result property="regUser" column="reg_user"/>
  </resultMap>
  <select id="sampleDAO.selectSampleList_D" parameterClass="searchVO" resultClass="egovMap“>
  SELECT
  ID, NAME, DESCRIPTION, USE_YN, REG_USER
  FROM SAMPLE
  WHERE 1=1
  <isEqual prepend="AND" property="searchCondition" compareValue="0">
  ID = #searchKeyword#
  </isEqual>
  <isEqual prepend="AND" property="searchCondition" compareValue="1">
  NAME LIKE '%' || #searchKeyword# || '%'
  </isEqual>
  ORDER BY ID DESC
  LIMIT #recordCountPerPage# OFFSET #firstIndex#
  </select>
  </sqlMap>




                                                                                                                           Page l   16
Programming Procedure                              based on eGovFrame (8/8)                Programming Procedure


VO : The object used for the purpose of data transfer between objects

                                                                            JSP   Controller   Service   DAO
       public class SampleVO extends SampleDefaultVO {

       private static final long serialVersionUID = 1753729060514530707L;
                                                                                                VO       SQL

       /** ID */
       private String id;

       /** Name */
       private String name;

       public String getId() {
       return id;
       }

       public void setId(String id) {
       this.id = id;
       }

       public String getName() {
       return name;
       }

       public void setName(String name) {
       this.name = name;
       }

       }




                                                                                                         Page l   17
Common Components
Common component concept



  A collection of reusable common modules in developing
  applications for e-Government projects

  An software unit that can run itself

  Example
    - Notice board, log-in, string validation check, etc




                                                           Page l   18
Page l   19

Más contenido relacionado

La actualidad más candente

The Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the CloudThe Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the CloudArun Gupta
 
Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...
Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...
Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...Arun Gupta
 
Java EE 7: Developing for the Cloud at Geecon, JEEConf, Johannesburg
Java EE 7: Developing for the Cloud at Geecon, JEEConf, JohannesburgJava EE 7: Developing for the Cloud at Geecon, JEEConf, Johannesburg
Java EE 7: Developing for the Cloud at Geecon, JEEConf, JohannesburgArun Gupta
 
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012Arun Gupta
 
1006 Z2 Intro Complete
1006 Z2 Intro Complete1006 Z2 Intro Complete
1006 Z2 Intro CompleteHenning Blohm
 
The Java EE 7 Platform: Developing for the Cloud (FISL 12)
The Java EE 7 Platform: Developing for the Cloud  (FISL 12)The Java EE 7 Platform: Developing for the Cloud  (FISL 12)
The Java EE 7 Platform: Developing for the Cloud (FISL 12)Arun Gupta
 
Understanding
Understanding Understanding
Understanding Arun Gupta
 
Java EE Technical Keynote at JavaOne Latin America 2011
Java EE Technical Keynote at JavaOne Latin America 2011Java EE Technical Keynote at JavaOne Latin America 2011
Java EE Technical Keynote at JavaOne Latin America 2011Arun Gupta
 
Java EE 7 at JAX London 2011 and JFall 2011
Java EE 7 at JAX London 2011 and JFall 2011Java EE 7 at JAX London 2011 and JFall 2011
Java EE 7 at JAX London 2011 and JFall 2011Arun Gupta
 
WebLogic 12c Developer Deep Dive at Oracle Develop India 2012
WebLogic 12c Developer Deep Dive at Oracle Develop India 2012WebLogic 12c Developer Deep Dive at Oracle Develop India 2012
WebLogic 12c Developer Deep Dive at Oracle Develop India 2012Arun Gupta
 
(ATS3-PLAT01) Recent developments in Pipeline Pilot
(ATS3-PLAT01) Recent developments in Pipeline Pilot(ATS3-PLAT01) Recent developments in Pipeline Pilot
(ATS3-PLAT01) Recent developments in Pipeline PilotBIOVIA
 
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011Arun Gupta
 
Summer training java
Summer training javaSummer training java
Summer training javaArshit Rai
 
N(i)2 technical architecture 2.0 (v1 1)
N(i)2 technical architecture 2.0 (v1 1)N(i)2 technical architecture 2.0 (v1 1)
N(i)2 technical architecture 2.0 (v1 1)kvz
 
GIDS 2012: Java Message Service 2.0
GIDS 2012: Java Message Service 2.0GIDS 2012: Java Message Service 2.0
GIDS 2012: Java Message Service 2.0Arun Gupta
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_eeYogesh Bindwal
 
Summer training java
Summer training javaSummer training java
Summer training javaArshit Rai
 
Jfokus 2012: PaaSing a Java EE Application
Jfokus 2012: PaaSing a Java EE ApplicationJfokus 2012: PaaSing a Java EE Application
Jfokus 2012: PaaSing a Java EE ApplicationArun Gupta
 
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudTDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudArun Gupta
 

La actualidad más candente (20)

The Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the CloudThe Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the Cloud
 
Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...
Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...
Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...
 
Java EE 7: Developing for the Cloud at Geecon, JEEConf, Johannesburg
Java EE 7: Developing for the Cloud at Geecon, JEEConf, JohannesburgJava EE 7: Developing for the Cloud at Geecon, JEEConf, Johannesburg
Java EE 7: Developing for the Cloud at Geecon, JEEConf, Johannesburg
 
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
 
1006 Z2 Intro Complete
1006 Z2 Intro Complete1006 Z2 Intro Complete
1006 Z2 Intro Complete
 
The Java EE 7 Platform: Developing for the Cloud (FISL 12)
The Java EE 7 Platform: Developing for the Cloud  (FISL 12)The Java EE 7 Platform: Developing for the Cloud  (FISL 12)
The Java EE 7 Platform: Developing for the Cloud (FISL 12)
 
Understanding
Understanding Understanding
Understanding
 
Java EE Technical Keynote at JavaOne Latin America 2011
Java EE Technical Keynote at JavaOne Latin America 2011Java EE Technical Keynote at JavaOne Latin America 2011
Java EE Technical Keynote at JavaOne Latin America 2011
 
Java EE 7 at JAX London 2011 and JFall 2011
Java EE 7 at JAX London 2011 and JFall 2011Java EE 7 at JAX London 2011 and JFall 2011
Java EE 7 at JAX London 2011 and JFall 2011
 
WebLogic 12c Developer Deep Dive at Oracle Develop India 2012
WebLogic 12c Developer Deep Dive at Oracle Develop India 2012WebLogic 12c Developer Deep Dive at Oracle Develop India 2012
WebLogic 12c Developer Deep Dive at Oracle Develop India 2012
 
(ATS3-PLAT01) Recent developments in Pipeline Pilot
(ATS3-PLAT01) Recent developments in Pipeline Pilot(ATS3-PLAT01) Recent developments in Pipeline Pilot
(ATS3-PLAT01) Recent developments in Pipeline Pilot
 
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
 
Summer training java
Summer training javaSummer training java
Summer training java
 
Oracle History #5
Oracle History #5Oracle History #5
Oracle History #5
 
N(i)2 technical architecture 2.0 (v1 1)
N(i)2 technical architecture 2.0 (v1 1)N(i)2 technical architecture 2.0 (v1 1)
N(i)2 technical architecture 2.0 (v1 1)
 
GIDS 2012: Java Message Service 2.0
GIDS 2012: Java Message Service 2.0GIDS 2012: Java Message Service 2.0
GIDS 2012: Java Message Service 2.0
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_ee
 
Summer training java
Summer training javaSummer training java
Summer training java
 
Jfokus 2012: PaaSing a Java EE Application
Jfokus 2012: PaaSing a Java EE ApplicationJfokus 2012: PaaSing a Java EE Application
Jfokus 2012: PaaSing a Java EE Application
 
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudTDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
 

Similar a 01.egovFrame Training Book II

MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011MongoDB
 
03.egovFrame Runtime Environment Training Book
03.egovFrame Runtime Environment Training Book03.egovFrame Runtime Environment Training Book
03.egovFrame Runtime Environment Training BookChuong Nguyen
 
MongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring DataMongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring DataChris Richardson
 
Roma introduction and concepts
Roma introduction and conceptsRoma introduction and concepts
Roma introduction and conceptsLuca Garulli
 
Spring basics for freshers
Spring basics for freshersSpring basics for freshers
Spring basics for freshersSwati Bansal
 
Modular Java EE in the Cloud
Modular Java EE in the CloudModular Java EE in the Cloud
Modular Java EE in the CloudBert Ertman
 
Framework Engineering
Framework EngineeringFramework Engineering
Framework EngineeringYoungSu Son
 
Gnizr Architecture (for developers)
Gnizr Architecture (for developers)Gnizr Architecture (for developers)
Gnizr Architecture (for developers)hchen1
 
Oracle - Programatica2010
Oracle - Programatica2010Oracle - Programatica2010
Oracle - Programatica2010Agora Group
 
[S lide] java_sig-spring-framework
[S lide] java_sig-spring-framework[S lide] java_sig-spring-framework
[S lide] java_sig-spring-frameworkptlong96
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repositorynobby
 
An Automatic Approach to Translate Use Cases to Sequence Diagrams
An Automatic Approach to Translate Use Cases to Sequence DiagramsAn Automatic Approach to Translate Use Cases to Sequence Diagrams
An Automatic Approach to Translate Use Cases to Sequence DiagramsMohammed Misbhauddin
 
Visualizing content in metadata stores
Visualizing content in metadata storesVisualizing content in metadata stores
Visualizing content in metadata storesXavier Llorà
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity FrameworkDoncho Minkov
 
SSTC-2012 BenKBovée 2933a_Backup Slides 26-Apr 1130-1300 Track1
SSTC-2012 BenKBovée 2933a_Backup Slides 26-Apr 1130-1300 Track1SSTC-2012 BenKBovée 2933a_Backup Slides 26-Apr 1130-1300 Track1
SSTC-2012 BenKBovée 2933a_Backup Slides 26-Apr 1130-1300 Track1Benton "Ben" Bovée
 
DB2 for i 7.1 - Whats New?
DB2 for i 7.1 - Whats New?DB2 for i 7.1 - Whats New?
DB2 for i 7.1 - Whats New?COMMON Europe
 

Similar a 01.egovFrame Training Book II (20)

MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011
 
03.egovFrame Runtime Environment Training Book
03.egovFrame Runtime Environment Training Book03.egovFrame Runtime Environment Training Book
03.egovFrame Runtime Environment Training Book
 
Introducing spring
Introducing springIntroducing spring
Introducing spring
 
MongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring DataMongoDB for Java Developers with Spring Data
MongoDB for Java Developers with Spring Data
 
Roma introduction and concepts
Roma introduction and conceptsRoma introduction and concepts
Roma introduction and concepts
 
Spring basics for freshers
Spring basics for freshersSpring basics for freshers
Spring basics for freshers
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Uml3
Uml3Uml3
Uml3
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Modular Java EE in the Cloud
Modular Java EE in the CloudModular Java EE in the Cloud
Modular Java EE in the Cloud
 
Framework Engineering
Framework EngineeringFramework Engineering
Framework Engineering
 
Gnizr Architecture (for developers)
Gnizr Architecture (for developers)Gnizr Architecture (for developers)
Gnizr Architecture (for developers)
 
Oracle - Programatica2010
Oracle - Programatica2010Oracle - Programatica2010
Oracle - Programatica2010
 
[S lide] java_sig-spring-framework
[S lide] java_sig-spring-framework[S lide] java_sig-spring-framework
[S lide] java_sig-spring-framework
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
 
An Automatic Approach to Translate Use Cases to Sequence Diagrams
An Automatic Approach to Translate Use Cases to Sequence DiagramsAn Automatic Approach to Translate Use Cases to Sequence Diagrams
An Automatic Approach to Translate Use Cases to Sequence Diagrams
 
Visualizing content in metadata stores
Visualizing content in metadata storesVisualizing content in metadata stores
Visualizing content in metadata stores
 
ADO.NET Entity Framework
ADO.NET Entity FrameworkADO.NET Entity Framework
ADO.NET Entity Framework
 
SSTC-2012 BenKBovée 2933a_Backup Slides 26-Apr 1130-1300 Track1
SSTC-2012 BenKBovée 2933a_Backup Slides 26-Apr 1130-1300 Track1SSTC-2012 BenKBovée 2933a_Backup Slides 26-Apr 1130-1300 Track1
SSTC-2012 BenKBovée 2933a_Backup Slides 26-Apr 1130-1300 Track1
 
DB2 for i 7.1 - Whats New?
DB2 for i 7.1 - Whats New?DB2 for i 7.1 - Whats New?
DB2 for i 7.1 - Whats New?
 

Más de Chuong Nguyen

HO CHI MINH CITY ECONOMIC FORUM HEF 2023 ENG FINAL - v1.pdf
HO CHI MINH CITY ECONOMIC FORUM  HEF 2023 ENG FINAL - v1.pdfHO CHI MINH CITY ECONOMIC FORUM  HEF 2023 ENG FINAL - v1.pdf
HO CHI MINH CITY ECONOMIC FORUM HEF 2023 ENG FINAL - v1.pdfChuong Nguyen
 
DIỄN ĐÀN KINH TẾ TP. HỒ CHÍ MINH HEF 2023 VN FINAL Vietnamese Version.pdf
DIỄN ĐÀN KINH TẾ TP. HỒ CHÍ MINH HEF 2023 VN FINAL Vietnamese Version.pdfDIỄN ĐÀN KINH TẾ TP. HỒ CHÍ MINH HEF 2023 VN FINAL Vietnamese Version.pdf
DIỄN ĐÀN KINH TẾ TP. HỒ CHÍ MINH HEF 2023 VN FINAL Vietnamese Version.pdfChuong Nguyen
 
2. THAM LUAN 02 - BO KH_CN Đánh giá sự phát triển của hệ sinh thái khởi nghi...
2. THAM LUAN 02 - BO KH_CN  Đánh giá sự phát triển của hệ sinh thái khởi nghi...2. THAM LUAN 02 - BO KH_CN  Đánh giá sự phát triển của hệ sinh thái khởi nghi...
2. THAM LUAN 02 - BO KH_CN Đánh giá sự phát triển của hệ sinh thái khởi nghi...Chuong Nguyen
 
2. THAM LUAN 02 - BO KH_CN EN - Đánh giá sự phát triển của hệ sinh thái khởi ...
2. THAM LUAN 02 - BO KH_CN EN - Đánh giá sự phát triển của hệ sinh thái khởi ...2. THAM LUAN 02 - BO KH_CN EN - Đánh giá sự phát triển của hệ sinh thái khởi ...
2. THAM LUAN 02 - BO KH_CN EN - Đánh giá sự phát triển của hệ sinh thái khởi ...Chuong Nguyen
 
1. SO KHCN - VIE Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - Viet...
1. SO KHCN - VIE Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - Viet...1. SO KHCN - VIE Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - Viet...
1. SO KHCN - VIE Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - Viet...Chuong Nguyen
 
03.THAM LUAN - Hệ sinh thái khởi nghiệp sáng tạo Queensland, Úc English
03.THAM LUAN - Hệ sinh thái khởi nghiệp sáng tạo Queensland, Úc English03.THAM LUAN - Hệ sinh thái khởi nghiệp sáng tạo Queensland, Úc English
03.THAM LUAN - Hệ sinh thái khởi nghiệp sáng tạo Queensland, Úc EnglishChuong Nguyen
 
4.THAM LUAN - HAN QUOC-VN Kinh nghiệm từ Hàn Quốc VI
4.THAM LUAN - HAN QUOC-VN Kinh nghiệm từ Hàn Quốc VI4.THAM LUAN - HAN QUOC-VN Kinh nghiệm từ Hàn Quốc VI
4.THAM LUAN - HAN QUOC-VN Kinh nghiệm từ Hàn Quốc VIChuong Nguyen
 
4. THAM LUAN - HAN QUOC - Kinh nghiệm từ Hàn Quốc EN
4. THAM LUAN - HAN QUOC - Kinh nghiệm từ Hàn Quốc EN4. THAM LUAN - HAN QUOC - Kinh nghiệm từ Hàn Quốc EN
4. THAM LUAN - HAN QUOC - Kinh nghiệm từ Hàn Quốc ENChuong Nguyen
 
1. SO KHCN - ENG - Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - EN...
1. SO KHCN - ENG - Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - EN...1. SO KHCN - ENG - Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - EN...
1. SO KHCN - ENG - Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - EN...Chuong Nguyen
 
The role of Innovation Ecosystem in supporting Startups go global [Mr. Yi Cha...
The role of Innovation Ecosystem in supporting Startups go global [Mr. Yi Cha...The role of Innovation Ecosystem in supporting Startups go global [Mr. Yi Cha...
The role of Innovation Ecosystem in supporting Startups go global [Mr. Yi Cha...Chuong Nguyen
 
DNES Google IO ext 2022 Báo cáo Hệ sinh thái khởi nghiệp đổi mới sáng tạo Việ...
DNES Google IO ext 2022 Báo cáo Hệ sinh thái khởi nghiệp đổi mới sáng tạo Việ...DNES Google IO ext 2022 Báo cáo Hệ sinh thái khởi nghiệp đổi mới sáng tạo Việ...
DNES Google IO ext 2022 Báo cáo Hệ sinh thái khởi nghiệp đổi mới sáng tạo Việ...Chuong Nguyen
 
DNES - Thành đoàn - Chính sách hỗ trợ khởi nghiệp tại TP Đà Nẵng 2022
DNES - Thành đoàn - Chính sách hỗ trợ khởi nghiệp tại TP Đà Nẵng 2022DNES - Thành đoàn - Chính sách hỗ trợ khởi nghiệp tại TP Đà Nẵng 2022
DNES - Thành đoàn - Chính sách hỗ trợ khởi nghiệp tại TP Đà Nẵng 2022Chuong Nguyen
 
Z0gravity Giải pháp quản lý dự án và quản lý danh mục dự án đầu tư - 2021
Z0gravity Giải pháp quản lý dự án và quản lý danh mục dự án đầu tư - 2021Z0gravity Giải pháp quản lý dự án và quản lý danh mục dự án đầu tư - 2021
Z0gravity Giải pháp quản lý dự án và quản lý danh mục dự án đầu tư - 2021Chuong Nguyen
 
Dnes introduction Vietnam version 2021
Dnes introduction Vietnam version 2021Dnes introduction Vietnam version 2021
Dnes introduction Vietnam version 2021Chuong Nguyen
 
DNES profile - introduction 2021 English version
DNES profile - introduction 2021 English versionDNES profile - introduction 2021 English version
DNES profile - introduction 2021 English versionChuong Nguyen
 
INVIETNAM - DANANG - HOI AN - TRAVEL GUIDE
INVIETNAM - DANANG - HOI AN - TRAVEL GUIDEINVIETNAM - DANANG - HOI AN - TRAVEL GUIDE
INVIETNAM - DANANG - HOI AN - TRAVEL GUIDEChuong Nguyen
 
Kiên tâm qua khủng hoảng - Chiến đấu và chiến thắng COVID-19
Kiên tâm qua khủng hoảng - Chiến đấu và chiến thắng COVID-19Kiên tâm qua khủng hoảng - Chiến đấu và chiến thắng COVID-19
Kiên tâm qua khủng hoảng - Chiến đấu và chiến thắng COVID-19Chuong Nguyen
 
Vietnam in the digital era 2020
Vietnam in the digital era 2020Vietnam in the digital era 2020
Vietnam in the digital era 2020Chuong Nguyen
 
Customer experience and loyalty
Customer experience and loyaltyCustomer experience and loyalty
Customer experience and loyaltyChuong Nguyen
 
Quan ly trai nghiem khach hang nielsen
Quan ly trai nghiem khach hang  nielsenQuan ly trai nghiem khach hang  nielsen
Quan ly trai nghiem khach hang nielsenChuong Nguyen
 

Más de Chuong Nguyen (20)

HO CHI MINH CITY ECONOMIC FORUM HEF 2023 ENG FINAL - v1.pdf
HO CHI MINH CITY ECONOMIC FORUM  HEF 2023 ENG FINAL - v1.pdfHO CHI MINH CITY ECONOMIC FORUM  HEF 2023 ENG FINAL - v1.pdf
HO CHI MINH CITY ECONOMIC FORUM HEF 2023 ENG FINAL - v1.pdf
 
DIỄN ĐÀN KINH TẾ TP. HỒ CHÍ MINH HEF 2023 VN FINAL Vietnamese Version.pdf
DIỄN ĐÀN KINH TẾ TP. HỒ CHÍ MINH HEF 2023 VN FINAL Vietnamese Version.pdfDIỄN ĐÀN KINH TẾ TP. HỒ CHÍ MINH HEF 2023 VN FINAL Vietnamese Version.pdf
DIỄN ĐÀN KINH TẾ TP. HỒ CHÍ MINH HEF 2023 VN FINAL Vietnamese Version.pdf
 
2. THAM LUAN 02 - BO KH_CN Đánh giá sự phát triển của hệ sinh thái khởi nghi...
2. THAM LUAN 02 - BO KH_CN  Đánh giá sự phát triển của hệ sinh thái khởi nghi...2. THAM LUAN 02 - BO KH_CN  Đánh giá sự phát triển của hệ sinh thái khởi nghi...
2. THAM LUAN 02 - BO KH_CN Đánh giá sự phát triển của hệ sinh thái khởi nghi...
 
2. THAM LUAN 02 - BO KH_CN EN - Đánh giá sự phát triển của hệ sinh thái khởi ...
2. THAM LUAN 02 - BO KH_CN EN - Đánh giá sự phát triển của hệ sinh thái khởi ...2. THAM LUAN 02 - BO KH_CN EN - Đánh giá sự phát triển của hệ sinh thái khởi ...
2. THAM LUAN 02 - BO KH_CN EN - Đánh giá sự phát triển của hệ sinh thái khởi ...
 
1. SO KHCN - VIE Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - Viet...
1. SO KHCN - VIE Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - Viet...1. SO KHCN - VIE Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - Viet...
1. SO KHCN - VIE Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - Viet...
 
03.THAM LUAN - Hệ sinh thái khởi nghiệp sáng tạo Queensland, Úc English
03.THAM LUAN - Hệ sinh thái khởi nghiệp sáng tạo Queensland, Úc English03.THAM LUAN - Hệ sinh thái khởi nghiệp sáng tạo Queensland, Úc English
03.THAM LUAN - Hệ sinh thái khởi nghiệp sáng tạo Queensland, Úc English
 
4.THAM LUAN - HAN QUOC-VN Kinh nghiệm từ Hàn Quốc VI
4.THAM LUAN - HAN QUOC-VN Kinh nghiệm từ Hàn Quốc VI4.THAM LUAN - HAN QUOC-VN Kinh nghiệm từ Hàn Quốc VI
4.THAM LUAN - HAN QUOC-VN Kinh nghiệm từ Hàn Quốc VI
 
4. THAM LUAN - HAN QUOC - Kinh nghiệm từ Hàn Quốc EN
4. THAM LUAN - HAN QUOC - Kinh nghiệm từ Hàn Quốc EN4. THAM LUAN - HAN QUOC - Kinh nghiệm từ Hàn Quốc EN
4. THAM LUAN - HAN QUOC - Kinh nghiệm từ Hàn Quốc EN
 
1. SO KHCN - ENG - Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - EN...
1. SO KHCN - ENG - Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - EN...1. SO KHCN - ENG - Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - EN...
1. SO KHCN - ENG - Xây dựng Đà nẵng thành trung tâm khởi nghiệp sáng tạo - EN...
 
The role of Innovation Ecosystem in supporting Startups go global [Mr. Yi Cha...
The role of Innovation Ecosystem in supporting Startups go global [Mr. Yi Cha...The role of Innovation Ecosystem in supporting Startups go global [Mr. Yi Cha...
The role of Innovation Ecosystem in supporting Startups go global [Mr. Yi Cha...
 
DNES Google IO ext 2022 Báo cáo Hệ sinh thái khởi nghiệp đổi mới sáng tạo Việ...
DNES Google IO ext 2022 Báo cáo Hệ sinh thái khởi nghiệp đổi mới sáng tạo Việ...DNES Google IO ext 2022 Báo cáo Hệ sinh thái khởi nghiệp đổi mới sáng tạo Việ...
DNES Google IO ext 2022 Báo cáo Hệ sinh thái khởi nghiệp đổi mới sáng tạo Việ...
 
DNES - Thành đoàn - Chính sách hỗ trợ khởi nghiệp tại TP Đà Nẵng 2022
DNES - Thành đoàn - Chính sách hỗ trợ khởi nghiệp tại TP Đà Nẵng 2022DNES - Thành đoàn - Chính sách hỗ trợ khởi nghiệp tại TP Đà Nẵng 2022
DNES - Thành đoàn - Chính sách hỗ trợ khởi nghiệp tại TP Đà Nẵng 2022
 
Z0gravity Giải pháp quản lý dự án và quản lý danh mục dự án đầu tư - 2021
Z0gravity Giải pháp quản lý dự án và quản lý danh mục dự án đầu tư - 2021Z0gravity Giải pháp quản lý dự án và quản lý danh mục dự án đầu tư - 2021
Z0gravity Giải pháp quản lý dự án và quản lý danh mục dự án đầu tư - 2021
 
Dnes introduction Vietnam version 2021
Dnes introduction Vietnam version 2021Dnes introduction Vietnam version 2021
Dnes introduction Vietnam version 2021
 
DNES profile - introduction 2021 English version
DNES profile - introduction 2021 English versionDNES profile - introduction 2021 English version
DNES profile - introduction 2021 English version
 
INVIETNAM - DANANG - HOI AN - TRAVEL GUIDE
INVIETNAM - DANANG - HOI AN - TRAVEL GUIDEINVIETNAM - DANANG - HOI AN - TRAVEL GUIDE
INVIETNAM - DANANG - HOI AN - TRAVEL GUIDE
 
Kiên tâm qua khủng hoảng - Chiến đấu và chiến thắng COVID-19
Kiên tâm qua khủng hoảng - Chiến đấu và chiến thắng COVID-19Kiên tâm qua khủng hoảng - Chiến đấu và chiến thắng COVID-19
Kiên tâm qua khủng hoảng - Chiến đấu và chiến thắng COVID-19
 
Vietnam in the digital era 2020
Vietnam in the digital era 2020Vietnam in the digital era 2020
Vietnam in the digital era 2020
 
Customer experience and loyalty
Customer experience and loyaltyCustomer experience and loyalty
Customer experience and loyalty
 
Quan ly trai nghiem khach hang nielsen
Quan ly trai nghiem khach hang  nielsenQuan ly trai nghiem khach hang  nielsen
Quan ly trai nghiem khach hang nielsen
 

01.egovFrame Training Book II

  • 1. eGovFrame Training Book II eGovFrame Center 2012
  • 2. Table of contents I DI(Dependency Injection), IoC(Inversion of Control) II AOP (Aspect Oriented Programming) III MVC (Model, View, Controller) pattern concept IV Programming Procedure based on eGovFrame V Common component concept Page l 2
  • 3. DI(Dependency Injection), IoC(Inversion of Control) Composition of eGovFrame Change the flow of control between classes and reducing dependence(Ease of maintainability) public class MovieLister{ public void list() { MovieFinder finder = new MovieFinderImpl(); } } When change Impl class, need to change Lister as well public class MovieLister{ public void list() { MovieFinder finder = Assember.getBean("movieFinder"); } } Assembler manages dependency Page l 3
  • 4. AOP (Aspect Oriented Programming)(1/2) Composition of eGovFrame AOP is a programming paradigm which aims to increase modularity by allowing the separation of cross-cutting concerns. Separate add-on services (ex: logging, security, exception, etc) that are repeated in a number of biz logic code in an information system as Aspect. Make that a separate module and maintain a program with configuration files. When changes occur in additional functions(add-ons), simply by changing Aspect, the change can be reflected to the biz logic code and the maintenance of the code will be much easier. Improve readability as removing duplicated code in business logic. Page l 4
  • 5. AOP (Aspect Oriented Programming)(2/2) Composition of eGovFrame Aspect: A modularization of a concern that cuts across multiple objects Join point: A point during the execution of a program, such as the execution of a method or the handling of an exception Advice: Action taken by an aspect at a particular join point Pointcut: A predicate that matches join points. Advice is associated with a pointcut expression and runs at any join point matched by the pointcut (for example, the execution of a method with a certain name) Weaving: Linking aspects with other application types or objects to create an advised object Core Concerns Core Concerns Crosscutting Module Concerns Module Credit Deposit Calculating Credit Transfer Weaving Security Transfer Withdraw interest Logging Deposit Cross Withdraw cutting Security Logging Concerns Calculating Transaction interest [ Separating Aspect] [ Weaving] Page l 5
  • 6. Object Relational Mapping(ORM) Composition of eGovFrame ORM does not use SQL in source code, instead, directly maps java classes to the columns of the table or runs and handles SQL in the form of XML Full ORM (Hibernate) DB Column – Business Logic Business Logic Java Class Mapping JDBC JDBC SQL SQL MAP Business Logic (Process SQL in the form of XML) DataBase DataBase Java-Mapping Partial ORM (iBatis) Features General Development ORM based Need direct mapping java classes to the table Developers can be processed directly in terms of object- Apply Mapping columns oriented When SQL changes, directly modify source code Can be applied only with modifications of the mapping Flexibility and deploy information Mapping information, XML, etc can be applied in the form Standard Pattern No pattern of template DB Control Directly control DB In case of Mapping, direct control can be difficult Technology in use SQL Persistence framework (Hibernate, iBatis) Page l 6
  • 7. Composition of eGovFrame SQL Map Implementation Code Example • Separate SQL from business logic • Provide simple transaction control (Provide declarative transaction) • Provide a familiar SQL-based ORM model Statement st = null; ResultSet rs = null; try { st = con.createStatement(); // Component StringBuffer query = new StringBuffer(); Separation of List result = business ISqlManagement.getList(“sql.id”,”value”) query.append("n SELECT A.CHKLST_NO, "); query.append("n A.EVALFL_CD, "); logic and S query.append("n FROM PR_EVALIT_MB A "); QL query.append("n WHERE A.CHKLST_NO = '" + sChklstNo + "' "); query.append("n ORDER BY EVALIT_NO enhance // SqlMap.xml productivity, <select id=“id” resultclass =“hmap”> rs = st.executeQuery(st.toString()); SELECT A.CHKLST_NO, A.EVALFL_CD FROM while(rs.next) { maintainabilit PR_EVALIT_MB A WHERE A.CHKLST_NO = #value# ... y, and ORDER BY EVALIT_NO } reusability, </select> } finally { try {rs.close();} catch (Exception e) {} try {st.close();} catch (Exception e) {} } Page l 7
  • 8. MVC (Model, View, Controller) pattern concept Composition of eGovFrame MVC is a software architecture, considered an architectural pattern used in software engineering. The MVC pattern isolates ‘domain logic’(the application logic for the user - model) from user interface (input and presentation - view), then the controller handles the input event from the user interface to process the request through the domain logic. It permits independent development, testing and maintenance of each. Especially, Spring MVC provides DispatcherServlet (*FrontController) that is designed to implement Presentation layer easier in MVC architecture Http Request DispatcherServlet Controller Http Response View Model [ Conceptual Sequence of MVC pattern with DispatcherServlet ] Page l 8
  • 9. Spring MVC Architecture Composition of eGovFrame Spring's Web MVC framework is designed around a DispatcherServlet that dispatches requests to handlers, with configurable handler mappings, view resolution. HandlerMapping Controller Request Model Request Contoller (Biz Model and Model and View Logic) View Request Dispatcher Servlet (Front Controller) Response Model and View View View Name Response DB View View Resolver (JSP) Page l 9
  • 10. Programming Procedure based on eGovFrame (1/8) Programming Procedure Presentation Layer Business Layer Data Access Layer HandlerMapping Controller DAO Service Interface Spring Config. Request Dispatcher (ORM) Servlet SQL(XML) View ServiceImpl ViewResolver (JSP) Spring Config Spring Config DataBase (transaction) (datasource) Data Value Object Value Object Development Configuration Spring Module Page l 10
  • 11. Programming Procedure based on eGovFrame (2/8) Programming Procedure Output Screen Page l 11
  • 12. Programming Procedure based on eGovFrame (3/8) Programming Procedure Controller : Receive a request and call a service(biz logic) Implement features such as data binding, forms processing, and muti-action, etc @Controller JSP Controller Service DAO @SessionAttributes(types=SampleVO.class) public class EgovSampleController { VO SQL /** SampleService */ @Resource(name = "sampleService") private EgovSampleService sampleService; /** * Inquire post list. (pageing) * @param searchVO - SampleDefaultVO * @param model * @return "/sample/egovSampleList" * @exception Exception */ @RequestMapping(value="/sample/egovSampleList.do") public String selectSampleList(@ModelAttribute("searchVO") SampleDefaultVO searchVO, ModelMap model) throws Exception { List sampleList = sampleService.selectSampleList(searchVO); model.addAttribute("resultList", sampleList); return "/sample/egovSampleList"; } } Page l 12
  • 13. Programming Procedure based on eGovFrame (4/8) Programming Procedure Service : Interface that declares methods for business functions Service JSP Controller ServiceImpl DAO public interface EgovSampleService { VO SQL /** * Inquire post list. * @param searchVO – VO including search information * @return post list * @exception Exception */ List selectSampleList(SampleDefaultVO searchVO) throws Exception; } Page l 13
  • 14. Programming Procedure based on eGovFrame (5/8) Programming Procedure ServiceImpl : Implementation class that implements methods that defined in a service Service JSP Controller ServiceImpl DAO @Service("sampleService") public class EgovSampleServiceImpl extends AbstractServiceImpl implements VO SQL EgovSampleService { /** SampleDAO */ @Resource(name="sampleDAO") private SampleDAO sampleDAO; /** * Inquire post list. * @param searchVO - VO including search information * @return post list * @exception Exception */ public List selectSampleList(SampleDefaultVO searchVO) throws Exception { return sampleDAO.selectSampleList(searchVO); } } ※ Tip : In case of a ServiceImpl, AbstractServiceImpl must be extended Page l 14
  • 15. Programming Procedure based on eGovFrame (6/8) Programming Procedure DAO : Process data transaction (support iBatis connection) JSP Controller Service DAO @Repository("sampleDAO") public class SampleDAO extends EgovAbstractDAO { VO SQL /** * Inquire post list. * @param searchVO - VO including search information Call EgovAbstractDAO’s list method to run iBatis * @return post list Query ID * @exception Exception */ public list<SampleVO> selectSampleList(SampleVO vo) throws Exception { return list("sampleDAO.selectSampleList_D", vo); } ※ Tip : In case of a DAO, EgovAbsractDAO must be extended. Method Summary int delete(java.lang.String queryId, java.lang.Object parameterObject) : Execute delete SQL mapping. java.lang.Object insert(java.lang.String queryId, java.lang.Object parameterObject) : Execute Insert SQL mapping java.util.List list(java.lang.String queryId, java.lang.Object parameterObject) : Execute list SQL mapping listWithPaging(java.lang.String queryId, java.lang.Object parameterObject, int pageIndex, int pageSize) : Execute sub range java.util.List list SQL mapping java.lang.Object selectByPk(java.lang.String queryId, java.lang.Object parameterObject) : select one result by PK setSuperSqlMapClient(com.ibatis.sqlmap.client.SqlMapClient sqlMapClient) Execute configuration as receiving sqlMapClient void in the form of Annotation and calling setSqlMapClient method of super(SqlMapClientDaoSupport) int update(java.lang.String queryId, java.lang.Object parameterObject) : Execute update SQL mapping Page l 15
  • 16. Programming Procedure based on eGovFrame (7/8) Programming Procedure iBatis SQL Map : Define SQL execution query JSP Controller Service DAO <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> VO SQL <sqlMap namespace="Sample"> <typeAlias alias="egovMap" type="egovframework.rte.psl.dataaccess.util.EgovMap"/> <typeAlias alias="searchVO" type="egovframework.rte.sample.service.SampleDefaultVO"/> <resultMap id="sample" class="egovframework.rte.sample.service.SampleVO"> <result property="id" column="id"/> <result property="name" column="name"/> <result property="description" column="description"/> <result property="useYn" column="use_yn"/> <result property="regUser" column="reg_user"/> </resultMap> <select id="sampleDAO.selectSampleList_D" parameterClass="searchVO" resultClass="egovMap“> SELECT ID, NAME, DESCRIPTION, USE_YN, REG_USER FROM SAMPLE WHERE 1=1 <isEqual prepend="AND" property="searchCondition" compareValue="0"> ID = #searchKeyword# </isEqual> <isEqual prepend="AND" property="searchCondition" compareValue="1"> NAME LIKE '%' || #searchKeyword# || '%' </isEqual> ORDER BY ID DESC LIMIT #recordCountPerPage# OFFSET #firstIndex# </select> </sqlMap> Page l 16
  • 17. Programming Procedure based on eGovFrame (8/8) Programming Procedure VO : The object used for the purpose of data transfer between objects JSP Controller Service DAO public class SampleVO extends SampleDefaultVO { private static final long serialVersionUID = 1753729060514530707L; VO SQL /** ID */ private String id; /** Name */ private String name; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } Page l 17
  • 18. Common Components Common component concept A collection of reusable common modules in developing applications for e-Government projects An software unit that can run itself Example - Notice board, log-in, string validation check, etc Page l 18
  • 19. Page l 19