com.poscoict.glueframework.biz.activity
Class GlueJdbcNativeRun

java.lang.Object
  extended by com.poscoict.glueframework.biz.activity.GlueActivity<GlueContext>
      extended by com.poscoict.glueframework.biz.activity.GlueJdbcNativeRun

public class GlueJdbcNativeRun
extends GlueActivity<GlueContext>

dao¸¦ ÅëÇؼ­ PL/SQL¸¦ ½ÇÇàÇϰųª, SQLÀ» ½ÇÇàÇÏ´Â Activity. º» Activity¿¡¼­´Â ÁÖ¾îÁø Á¤º¸(table name ¶Ç´Â procedure name)¸¦ ÀÌ¿ëÇؼ­ ½ÇÇàÇÏ°íÀÚ ÇÏ´Â ¹®ÀåÀ» ¸¸µç´Ù.
- {call procedure_name(:arg,:arg)} ÇüÅÂÀÇ ÇÁ·Î½ÃÀú ½ÇÇà ¹®Àå
- select * from table_name where constraint_column=? ÇüÅÂÀÇ sql ¹®Àå

 Activity Property
 
 - dao : (Çʼö) applicationContext.xmlÀÇ DAO id.
 
 - sql-key : (Çʼö) xxx-query.glue_sqlÀÇ query id 
        À¯Çü¿¡ ¸Â´Â query¸¦ ÁöÁ¤ÇØ¾ß Çϸç, query ½ÇÇà°á°ú¿¡ µû¶ó Statement ½ÇÇà ±¸¹®ÀÌ ¸¸µé¾îÁü.
        sqlÀº named query¿©¾ß Çϸç, :table_name, :object_name, :package_name, :owner¸¸ named parameter·Î »ç¿ëÇÑ´Ù. 
        ex) oracle ÀÇ °æ¿ì ´ÙÀ½ 3°¡Áö À¯Çü¿¡ ¸Â´Â SQL¸¦ »ý¼ºÇϴµ¥ »ç¿ëµÊ.
            1. procedure ½ÇÇà
                -> {call package.procedure(:arg, :arg, ...)}
            2. package ½ÇÇà
                -> {call procedure(:arg, :arg, ...)}
            3. table Á¤ÀÇ Á¤º¸¿¡ ±â¹ÝÇÑ sql ½ÇÇà
                -> select * from table where column_pk = ? and ...
                -> insert into table(column, ...) values (?, ...)
                -> delete from table where column_pk = ? and ...
                -> update talbe set column=?, ... where column_pk = ? and ...
 
 - procedure-name : (Çʼö) ½ÇÇàÇÏ°íÀÚ ÇÏ´Â PL/SQL ÇÁ·Î½ÃÀú ¶Ç´Â ÆÐÅ°Áö À̸§. table-name °ú °°ÀÌ »ç¿ëÇÒ ¼ö ¾øÀ½.
             sql-key¿¡ ÇØ´çÇÏ´Â query¸¦ ½ÇÇàÇÑ °á°úÇ׸ñ(oracle.procedure.arguments, oracle.package.arguments Âü°í)
              - Çʼö : NAME, DATA_TYPE, IN_OUT Ç׸ñÀ» Æ÷ÇÔÇؾßÇÔ.
              - ¼±Åà : SECOND_NAME Ç׸ñÀº nameÀ» °¡°øÇÑ °ªÀÓ.
             sql»óÀÇ :package_name °ú :object_name ÀÇ °ªÀ¸·Î »ç¿ëµÊ.
              - aaa.bbb ÇüÅÂÀÏ°æ¿ì °æ¿ì :package_nameÀ¸·Î aaa ¸¦ :object_name¿¡´Â bbb ¸¦ ±× °ªÀ¸·Î bindÇÔ.
              - ccc ÇüÅÂÀÏ °æ¿ì :object_name ¿¡ ccc ¸¦ ±× °ªÀ¸·Î bindÇÔ.
             ½ÇÇà°á°ú´Â IN/OUT °ú OUT À¯Çü¿¡ ´ëÇØ.. {argument_name}_result ·Î GlueContext¿¡ ´ã±è.
 
 - table-name : (Çʼö) table ¸í. procedure-name °ú °°ÀÌ »ç¿ëÇÒ ¼ö ¾øÀ½.
             sql-key¿¡ ÇØ´çÇÏ´Â query¸¦ ½ÇÇàÇÑ °á°ú Ç׸ñ(oracle.table.primary.key Âü°í) 
               - Çʼö NAME, DATA_TYPE, CONSTRAINT_TYPE À» Æ÷ÇÔÇؾßÇÔ.
               - ¼±Åà : NULLABLE Ç׸ñÀº sql ½ÇÇà½Ã bindµÇ´Â °ªÀÇ null checkÇØ´ç Ç׸ñÀÎÁö ÆÇ´ÜÇÔ..
             sql»óÀÇ :table_name ÀÇ °ªÀ¸·Î »ç¿ëµÊ.
 
 - table-sql : (¼±ÅÃ) sql ó¸® À¯Çü. default´Â selectÀÓ. 
             - select : PK(UK)¸¦ Á¶°ÇÀ¸·Î select ¼öÇà. Á¶È¸ °á°ú´Â {table-name}_resultList À¸·Î GlueContext¿¡ ´ã±è.
             - insert : insert ¼öÇà. µî·Ï °á°ú´Â {table-name}_result ·Î GlueContext¿¡ ´ã±è.
             - update : PK(UK)¸¦ Á¶°ÇÀ¸·Î update ¼öÇà. ¼öÁ¤ °á°ú´Â {table-name}_result ·Î GlueContext¿¡ ´ã±è.
             - delete : PK(UK)¸¦ Á¶°ÇÀ¸·Î delete ¼öÇà. »èÁ¦ °á°ú´Â {table-name}_result ·Î GlueContext¿¡ ´ã±è.
             - save : PK(UK)¸¦ Á¶°ÇÀ¸·Î select ¼öÇàÇÏ°í ±× °á°ú µû¶ó insert or update ¼öÇà. ÀúÀå °á°ú´Â {table-name}_result ·Î GlueContext¿¡ ´ã±è.
             - desert : delete and insert ¼öÇà. µî·Ï °á°ú´Â {table-name}_result ·Î GlueContext¿¡ ´ã±è.
             
 - owner : (¼±ÅÃ) : owner Á¤º¸.. 
             oarcle »ç¿ë½Ã sql-key¿¡ ÇØ´çÇÏ´Â query¿¡¼­
             user_arguments°¡ ¾Æ´Ñ all_arguments¸¦ »ç¿ëÇÒ °æ¿ì owner Á¤º¸¸¦ ÁöÁ¤ÇÒ ¼ö ÀÖÀ½.
             sql»óÀÇ :owner ÀÇ °ªÀ¸·Î »ç¿ëµÊ.
  
 - name-bindings : (¼±ÅÃ) mapping Á¤º¸·Î name=ctxKey[|name=ctxKey...] ÇüÅÂÀÓ. 
            parocedure-nameÀÌ »ç¿ëµÈ °æ¿ì´Â argumentName=ctxKey|argumentName=ctxKey Àǹ̷Π»ç¿ëÇÔ
            table-nameÀÌ »ç¿ëµÈ °æ¿ì´Â columnName=ctxKey|columnName=ctxKey Àǹ̷Π»ç¿ëÇÔ.
 
 - name-values : (¼±ÅÃ) mapping Á¤º¸·Î name=constants[|name=constants...] ÇüÅÂÀÓ. 
            parocedure-nameÀÌ »ç¿ëµÈ °æ¿ì´Â argumentName=constant|argumentName=constant Àǹ̷Π»ç¿ëÇÔ
            table-nameÀÌ »ç¿ëµÈ °æ¿ì´Â columnName=constants|columnName=constants Àǹ̷Π»ç¿ëÇÔ.
            - null °ªÀÏ °æ¿ì 'name' ¸¸ ÀÔ·Â ÇÒ °Í
            - empty string ÀÏ °æ¿ì 'name=' ¸¸ ÀÔ·Â ÇÒ °Í
            - space ÀÏ °æ¿ì 'name= ' ¸¸ ÀÔ·Â ÇÒ °Í
                 ==>  'a|b=|c= |d=value' ÇüÅ°¡ µÉ °ÍÀÓ. 
            name-bindings¿Í name-valuesÀÇ ¿ì¼±¼øÀ§´Â name-values ¸¦ ¿ì¼±À¸·Î ÇÔ.
 
 - chk-name : (¼±ÅÃ) È­¸éÀÇ CheckBox ID(HttpRequestÀÇ parameter name).
            String[] ÇüÅÂÀÇ data·Î index °ªÀ» °®´Â´Ù. 
 
 - list-key : (¼±ÅÃ) Binding ÇÒ Data Context Key.
            List < Map < String >, < Object > > ÇüÅÂÀÇ data.
 
 
 
 ¿¹Á¦
 »ç¿ë ¿¹# 1
 - oracle procedure ½ÇÇà : {call proc1( )}
 
     <activity name="RunProcedure" class="com.poscoict.glueframework.biz.activity.GlueJdbcNativeRun">
         <property name="dao" value="testdao" />
         <property name="sql-key" value="oracle.procedure.arguments" />
         <property name="procedure-name" value="proc1" />
         <transition name="success" value="end" />
     </activity>
 
 
 »ç¿ë ¿¹# 2
 - oracle procedure ½ÇÇà : {call proc2( :P_INPUT1,:P_INPUT2 )}
 
     <activity name="RunProcedure" class="com.poscoict.glueframework.biz.activity.GlueJdbcNativeRun">
         <property name="dao" value="testdao" />
         <property name="sql-key" value="oracle.procedure.arguments" />
         <property name="procedure-name" value="proc2" />
         <transition name="success" value="end" />
     </activity>
 
 
 »ç¿ë ¿¹# 3
 - oracle package ½ÇÇà : {call biz1.sub1( )}
 
     <activity name="RunPackage" class="com.poscoict.glueframework.biz.activity.GlueJdbcNativeRun">
         <property name="dao" value="testdao" />
         <property name="sql-key" value="oracle.package.arguments" />
         <property name="procedure-name" value="biz1.sub1" />
         <transition name="success" value="end" />
     </activity>
 
 
 »ç¿ë ¿¹# 4
 - oracle package ½ÇÇà : {call biz1.sub2( :P_INPUT1,:P_INPUT2 )}
 
     <activity name="RunPackage" class="com.poscoict.glueframework.biz.activity.GlueJdbcNativeRun">
         <property name="dao" value="testdao" />
         <property name="sql-key" value="oracle.package.arguments" />
         <property name="procedure-name" value="biz1.sub2" />
         <transition name="success" value="end" />
     </activity>
 
 
 »ç¿ë ¿¹# 5
 - oracle package ½ÇÇà : {call biz1.sub2( :P_INPUT1,:P_OUTPUT )}
 
     <activity name="RunPackage" class="com.poscoict.glueframework.biz.activity.GlueJdbcNativeRun">
         <property name="dao" value="testdao" />
         <property name="sql-key" value="oracle.package.arguments" />
         <property name="procedure-name" value="biz1.sub2" />
         <property name="name-bindings" value="P_INPUT1=a|P_OUTPUT=result" />
         <transition name="success" value="end" />
     </activity>
 
 
 
 Âü°í : {name}-query.glue_sql
 
     <query id="oracle.procedure.arguments" desc="" resultType="" isNamed="true">
         <![CDATA[
     select a.OBJECT_ID, b.ARGUMENT_NAME as NAME, b.DATA_TYPE, b.IN_OUT, b.ARGUMENT_NAME||'abc' as SECOND_NAME
     from (select OBJECT_ID 
           from USER_OBJECTS 
           where OBJECT_NAME=:object_name ) a
     left outer join (select OBJECT_ID, ARGUMENT_NAME, DATA_TYPE, IN_OUT, SEQUENCE
                      from USER_ARGUMENTS 
                      where PACKAGE_NAME is null and OBJECT_NAME=:object_name ) b on a.OBJECT_ID=b.OBJECT_ID
     order by SEQUENCE
         ]]>
     </query>
     <query id="oracle.package.arguments" desc="" resultType="" isNamed="true">
         <![CDATA[
     select ARGUMENT_NAME as NAME, DATA_TYPE, IN_OUT
     from USER_ARGUMENTS
     where PACKAGE_NAME=:package_name
       and OBJECT_NAME=:object_name  
     order by SEQUENCE
         ]]>
     </query>
     <query id="oracle.table.primary.key" desc="" resultType="" isNamed="true">
         <![CDATA[
     select A.COLUMN_NAME as NAME, A.DATA_TYPE, B.CONSTRAINT_TYPE, C.CONSTRAINT_TYPE as NULLABLE 
     from ( select COLUMN_NAME, DATA_TYPE, COLUMN_ID 
            from USER_TAB_COLUMNS
            where TABLE_NAME=:table_name ) A
     left outer join ( select B1.COLUMN_NAME, B2.CONSTRAINT_TYPE
                       from ( select COLUMN_NAME, CONSTRAINT_NAME 
                              from USER_CONS_COLUMNS
                              where TABLE_NAME=:table_name ) B1
                       inner join (select CONSTRAINT_NAME, CONSTRAINT_TYPE
                                   from USER_CONSTRAINTS
                                   where TABLE_NAME=:table_name
                                     and CONSTRAINT_TYPE='P' ) B2
                       on B1.CONSTRAINT_NAME=B2.CONSTRAINT_NAME ) B
     on A.COLUMN_NAME = B.COLUMN_NAME
     left outer join ( select C1.COLUMN_NAME, C2.CONSTRAINT_TYPE
                       from ( select COLUMN_NAME, CONSTRAINT_NAME 
                              from USER_CONS_COLUMNS
                              where TABLE_NAME=:table_name ) C1
                       inner join (select CONSTRAINT_NAME, CONSTRAINT_TYPE
                                   from USER_CONSTRAINTS
                                   where TABLE_NAME=:table_name
                                     and CONSTRAINT_TYPE='C' ) C2
                       on C1.CONSTRAINT_NAME=C2.CONSTRAINT_NAME ) C
     on A.COLUMN_NAME = C.COLUMN_NAME
         ]]>
     </query>
 
 
 Âü°í : 'oracle.procedure.arguments' ½ÇÇà°á°ú
 
     --------------------------------------------------
     |OBJECT_ID|NAME     |DATA_TYPE|IN_OUT|SECOND_NAME|
     |{proc1}  |         |         |IN    |           |
     |{proc2}  |P_INPUT1 |VARCHAR2 |IN    |INPUT1     |
     |{proc2}  |P_INPUT2 |NUMBER   |IN/OUT|INPUT2     |
     |{proc2}  |P_OUTPUT |NUMBER   |OUT   |OUTPUT     |
     --------------------------------------------------
 
 
 Âü°í : 'oracle.package.arguments' ½ÇÇà°á°ú
 
     ----------------------------------------------------
     |OBJECT_ID  |NAME     |DATA_TYPE|IN_OUT|SECOND_NAME|
     |{biz1.sub1}|         |         |IN    |           |
     |{biz1.sub2}|P_INPUT1 |VARCHAR2 |IN    |INPUT1     |
     |{biz1.sub2}|P_INPUT2 |NUMBER   |IN/OUT|INPUT2     |
     |{biz1.sub2}|P_OUTPUT |NUMBER   |OUT   |OUTPUT     |
     ----------------------------------------------------
 
 
 Âü°í : Java Code (Custom)
 
     List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
     Map<String, Object> data1 = new HashMap<String, Object>();
     data1.put("EMPNO","1111");
     data1.put("ENAME","name1");
     data1.put("SAL","1000");
     dataList.add(data1);
     Map<String, Object> data2 = new HashMap<String, Object>();
     data2.put("EMPNO","1112");
     data2.put("ENAME","name2");
     data2.put("SAL","1100");
     dataList.add(data2);
     ctx.put("dataList",dataList);
 
 


Field Summary
 
Fields inherited from class com.poscoict.glueframework.biz.activity.GlueActivity
dynamicProperties, logger
 
Constructor Summary
GlueJdbcNativeRun()
           
 
Method Summary
static void main(String[] args)
           
 String runActivity(GlueContext ctx)
          Sub Class¿¡¼­ ¹Ýµå½Ã ±¸ÇöÇÏ¿©¾ß ÇÏ´Â Abstract Method À̸ç ÀÌ Method´Â F/W¿¡¼­ È£ÃâÇÑ´Ù.
 
Methods inherited from class com.poscoict.glueframework.biz.activity.GlueActivity
commitTransaction, commitTransaction, getDao, getEventList, getName, getProperty, getPropertyNames, getTransition, rollbackTransaction, rollbackTransaction, setEventList, setName, setProperty, setTransition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlueJdbcNativeRun

public GlueJdbcNativeRun()
Method Detail

runActivity

public String runActivity(GlueContext ctx)
Description copied from class: GlueActivity
Sub Class¿¡¼­ ¹Ýµå½Ã ±¸ÇöÇÏ¿©¾ß ÇÏ´Â Abstract Method À̸ç ÀÌ Method´Â F/W¿¡¼­ È£ÃâÇÑ´Ù. °á°ú °ªÀº GlueContext¿¡ ´ã¾Æ¼­ ´ÙÀ½ Activity ¶Ç´Â F/W¿¡ Àü´ÞÇÏ°Ô µÈ´Ù. ÇÊ¿äÇÑ ¸ðµç Data´Â GlueContext¿¡¼­ È£ÃâÇÏ¿© »ç¿ëÇÏ°Ô µÈ´Ù.

Specified by:
runActivity in class GlueActivity<GlueContext>
Parameters:
ctx - GlueContext
Returns:
String Á¤»óÀûÀ̸é "success"¸¦ Return ÇÏ°í ºñÁ¤»ó 󸮸¦ ¿øÇϸé "failure"¸¦ Return ÇÑ´Ù.
 ¿¹) 
 <transition name="success" value="BizLogic"/>
 <transition name="failure" value="ErrorHandle"/>
 ==> return "success"À̸é BizLogic Activity ¸¦ ½ÇÇàÇÔ.
 

main

public static void main(String[] args)


Copyright © 2013–2017 POSCO ICT. All rights reserved.