Delete Activity. GlueJdbcDelete Class는
"delete from emp where empno=?" 와 같은 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 :
==>
binding(web) :
List args = new ArrayList();
args.add(((String[])ctx.get("EMPNO"))[0]);
GlueParameter param = new GlueParameter(args);
(NonUI) :
List args = new ArrayList();
args.add(ctx.get("EMPNO"));
GlueParameter param = new GlueParameter(args);
- case 2 : Looping 처리. (Web)
==>
binding : String[] checked = ctx.get("chk");
List args = new ArrayList();
for(int i=0, iz=checked.length; i param = new GlueParameter(args);
- case 3 : Looping 처리. (NonUI)
==>
binding : List list = (ArrayList)ctx.get("dataList");
for(int i=0, iz=list.size(); i param = new GlueParameter(args);
..
}
- case 4 :
==>
binding(web) :
Map args = new HashMap();
args.put("empno", ((String[])ctx.get("EMPNO"))[0]);
GlueParameter
- case 5 : Looping 처리. (Web)
==>
binding : String[] checked = ctx.get("chk");
for(int i=0, iz=checked.length; i param = new GlueParameter(args);
..
}
- case 6 : Looping 처리. (NonUI)
==>
binding : List list = (ArrayList)ctx.get("dataList");
for(int i=0, iz=checked.length; i param = new GlueParameter(args);
..
}
Property 설정- dao : (필수) applicationContext.xml의 DAO id.
- sql-key : (필수) xxx-query.glue_sql의 query id
- param-count : (선택) Binding 할 개수 (delete emp where empno=?)의 "?" 수
- param#(param0,param1...) : (선택) Binding Value ("?"와 순서 일치 하여야 함)
- param-bindings : (선택) binding에 사용되는 값과 Mapping 되는 Key( bindName=ctxName[|bindName=ctxName] ).
ctx의 key가 binding variable name과 같은 경우 생략(대소문자 구분).
ctxName 은 Context의 Key이며, 가 있다면 "dataList" 의 map의 Key.
- chk-name : (선택) 화면의 CheckBox ID(HttpRequest의 parameter name).
와 같이 "chk" 가 선언 되어 있다면,
의 value 값에 따라 Looping 처리를 한다.
chk의 value는 0,1,2...,n 으로 부여되며 checked 된 값만 Context에 담긴다.
- list-key : (선택) SQL 문에 Binding 할 Data Context Key.
와 같이 "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 ] : _deleteCnt
Query File : {name}-query.glue_sql
delete from emp where empno=?
]]>
delete from emp where empno=:empno
]]>
Field Summary
Fields inherited from class com.poscoict.glueframework.biz.activity.GlueActivity
Sub Class에서 반드시 구현하여야 하는 Abstract Method 이며 이 Method는 F/W에서 호출한다. 결과 값은 GlueContext에 담아서 다음 Activity 또는 F/W에 전달하게 된다. 필요한 모든 Data는
GlueContext에서 호출하여 사용하게 된다.