com.poscoict.glueframework.biz.activity
Class GlueJdbcNativeRun
java.lang.Object
com.poscoict.glueframework.biz.activity.GlueActivity<GlueContext>
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( )}
»ç¿ë ¿¹# 2
- oracle procedure ½ÇÇà : {call proc2( :P_INPUT1,:P_INPUT2 )}
»ç¿ë ¿¹# 3
- oracle package ½ÇÇà : {call biz1.sub1( )}
»ç¿ë ¿¹# 4
- oracle package ½ÇÇà : {call biz1.sub2( :P_INPUT1,:P_INPUT2 )}
»ç¿ë ¿¹# 5
- oracle package ½ÇÇà : {call biz1.sub2( :P_INPUT1,:P_OUTPUT )}
Âü°í : {name}-query.glue_sql
Âü°í : '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
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 |
GlueJdbcNativeRun
public GlueJdbcNativeRun()
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 ÇÑ´Ù.
¿¹)
==> return "success"À̸é BizLogic Activity ¸¦ ½ÇÇàÇÔ.
main
public static void main(String[] args)
Copyright © 2013–2018 POSCO ICT. All rights reserved.