com.poscoict.glueframework.biz.activity.mybatis
Class GlueMybatisDelete

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

public class GlueMybatisDelete
extends GlueActivity<GlueContext>

Delete Mybatis Activity. GlueMybatisDelete Class는 SQL delete statement를 수행 하는 Activity 이다. Web화면과 NonUI 공통으로 사용되고 Binding Parameter Type은 Web인 경우 String []의 {0}번째로 Binding 하고 Web이 아닌 경우는 해당 Object를 Binding 한다. 여기서 chk-name이 있는 경우 Web의 CheckBox에 Check 된 수만큼 반복 하고 없는 경우는 Context에서 바로 String[] 로 get하여 Binding 한다. NonUI의 경우 Data Type이 String[]가 아닌 경우 바로 해당 Object로 Binding 한다.

 사용 예
 
 - case 1
 
 <activity name="Delete" class="com.poscoict.glueframework.biz.activity.mybatis.GlueMybatisDelete">
     <property name="dao" value="testdao" />
     <property name="sql-key" value="emp.delete" />
     <property name="param-bindings" value="empno=EMPNO" />
     <property name="result-key" value="deleteCnt" />
     <transition name="success" value="Find" />
 </activity>
 ==> 
      binding(web) : 
              Map args = new HashMap();
              args.put("empno", ((String[])ctx.get("EMPNO"))[0]);
              PosParameter<Map> param = new PosParameter<Map>(args);
           (NonUI) : 
              Map args = new HashMap();
              args.put("empno", ctx.get("EMPNO"));
              GlueParameter<Map> param = new GlueParameter<Map>(args);
 
 
 - case 2
 
 <activity name="Delete" class="com.poscoict.glueframework.biz.activity.mybatis.GlueMybatisDelete">
     <property name="dao" value="testdao" />
     <property name="sql-key" value="emp.delete" />
     <property name="param-bindings" value="empno=EMPNO" />
     <property name="result-key" value="deleteCnt" />
     <property name="chk-name" value="chk" />
     <transition name="success" value="Find" />
 </activity>
 ==> 
      binding : String[] checked = ctx.get("chk");
              for(int i=0, iz=checked.length; i<iz; i++){
                  Map args = new HashMap();
                  args.put("empno", ((String[])ctx.get("EMPNO"))[Integer.parseInt(checked[i])]);
                  GlueParameter<Map> param = new GlueParameter<Map>(args);
                  ..
              }
 
 
 - case 3
 
 <activity name="Delete" class="com.poscoict.glueframework.biz.activity.mybatis.GlueMybatisDelete">
     <property name="dao" value="testdao" />
     <property name="sql-key" value="emp.delete" />
     <property name="param-bindings" value="empno=EMPNO" />
     <property name="result-key" value="deleteCnt" />
     <property name="list-key" value="dataList" />
     <transition name="success" value="Find" />
 </activity>
 ==> 
      binding : List list = (ArrayList)ctx.get("dataList");
              for(int i=0, iz=checked.length; i<iz; i++){
                  Map args = new HashMap();
                  args.put("empno", ((Map)list.get(i)).get("EMPNO"));
                  GlueParameter<Map> param = new GlueParameter<Map>(args);
                  ..
              }
 
 
 
 Property 설정
 - dao : (필수) applicationContext.xml의 DAO id.
 - sql-key : (필수) mybatis의 query id
 - param-bindings : (선택) binding에 사용되는 값과 Mapping 되는 Key( bindName=ctxName[|bindName=ctxName] ). 
         ctxName 은 Context의 Key이며, < property name="list-key" value="dataList" / >가 있다면 "dataList" 의 map의 Key.
 - chk-name : (선택) 화면의 CheckBox ID(HttpRequest의 parameter name).
         < property name="chk-name" value="chk" / > 와 같이 "chk" 가 선언 되어 있다면, < input type="checkbox" name="chk" >의 value 값에 따라 Looping 처리를 한다.
         chk의 value는 0,1,2...,n 으로 부여되며 checked 된 값만 Context에 담긴다. 
 - list-key : (선택) SQL 문에 Binding 할 Data Context Key.
         < property name="list-key" value="dataList" / > 와 같이 "dataList" 가 선언 되어 있다면, 이전 Activity에서 List < Map >  구조의 Data를 생성해서 Context에 담는다.
         [ sample java code ]
         List dataList = new ArrayList();
         Map data1 = new HashMap();
         data1.put("EMPNO","1111");
         dataList.add(data1);
         Map data2 = new HashMap();
         data2.put("EMPNO","2222");
         dataList.add(data2);
         ctx.put("dataList",dataList);
 - result-key : (선택) Context에 담기는 Query 수행 결과(수정 record 수) Key.
         [ default ] : {sql-key}_deleteCnt
 


Field Summary
 
Fields inherited from class com.poscoict.glueframework.biz.activity.GlueActivity
dynamicProperties, logger
 
Constructor Summary
GlueMybatisDelete()
           
 
Method Summary
 String runActivity(GlueContext ctx)
          Sub Class에서 반드시 구현하여야 하는 Abstract Method 이며 이 Method는 F/W에서 호출한다.
 
Methods inherited from class com.poscoict.glueframework.biz.activity.GlueActivity
commitTransaction, getDao, getEventList, getName, getProperty, getPropertyNames, getTransition, 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

GlueMybatisDelete

public GlueMybatisDelete()
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 를 실행함.
 


Copyright © 2013–2014 POSCO ICT SW제품기술팀. All rights reserved.