123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474 |
- /**
- * @(#)file CommCodeManager.java
- * @(#)author chj
- * @(#)version 1.0
- * @(#)date 2014-06-24
- * @(#)since JDK1.6
- *
- * Copyright (c) www.udapsoft.co.kr, Inc.
- */
- package kr.co.udapsoft.common.code;
- import kr.co.hsnc.common.base.WAFLogger;
- import kr.co.hsnc.common.sql.Row;
- import kr.co.hsnc.common.sql.RowImpl;
- import kr.co.hsnc.common.sql.RowSet;
- import kr.co.hsnc.common.sql.RowSetImpl;
- import kr.co.hsnc.common.sql.search.Search;
- import kr.co.hsnc.common.sql.search.SearchImpl;
- import kr.co.hsnc.common.util.ValueObject;
- import com.udapsoft.waf.common.ui.HTMLMaker;
- /**
- * 공통코드 DB 접근 Beans.
- *
- *
- * @version 1.0 2003-05-29
- * @author DaeJin Lee
- */
- public class CommCodeManager {
- private static String D_TABLE = "EBID_COM911T";
- /**
- * Select 태그 Method
- * @param group_cd 검색 조건
- * @param inputName Select name
- * @param sytleStr Select style
- * @param defaultOption Option Default Value
- * @param selectedValue Option Selected Value
- * @param eventStr
- * @return
- * @throws Exception
- */
- public static String getSelectCodeList(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue) throws Exception {
- return getSelectCodeList(group_cd, inputName, sytleStr, defaultOption, selectedValue, 10, "");
- }
- public static String getSelectCodeList(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, String eventStr) throws Exception {
- return getSelectCodeList(group_cd, inputName, sytleStr, defaultOption, selectedValue, 10, eventStr);
- }
- public static String getSelectCodeSearchList(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, String Search) throws Exception {
- return getSelectCodeList5(group_cd, inputName, sytleStr, defaultOption, selectedValue, 10, Search , "");
- }
- public static String getSelectCodeSearchList(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, String Search,String range) throws Exception {
- return getSelectCodeList5(group_cd, inputName, sytleStr, defaultOption, selectedValue, 10, Search, range);
- }
-
- /**
- * Select 태그 Method
- * @param group_cd 검색 조건
- * @param inputName Select name
- * @param sytleStr Select style
- * @param defaultOption Option Default Value
- * @param selectedValue Option Selected Value
- * @param eventStr
- * @return code name
- * @throws Exception
- */
- public static String getSelectCodeList2(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, String eventStr) throws Exception {
- return getSelectCodeList2(group_cd, inputName, sytleStr, defaultOption, selectedValue, 10, eventStr);
- }
- public static String getSelectCodeList3(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, String eventStr) throws Exception {
- return getSelectCodeList3(group_cd, inputName, sytleStr, defaultOption, selectedValue, 10, eventStr);
- }
- public static String getSelectCodeList4(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, String eventStr) throws Exception {
- return getSelectCodeList4(group_cd, inputName, sytleStr, defaultOption, selectedValue, 10, eventStr);
- }
-
- public static String getSelectCodeList(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, int size, String eventStr) throws Exception {
- return getSelectCodeList(group_cd, inputName, sytleStr, defaultOption, selectedValue, size, eventStr, "");
- }
- public static String getSelectCodeList2(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, int size, String eventStr) throws Exception {
- return getSelectCodeList2(group_cd, inputName, sytleStr, defaultOption, selectedValue, size, eventStr, "");
- }
- public static String getSelectCodeList3(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, int size, String eventStr) throws Exception {
- return getSelectCodeList3(group_cd, inputName, sytleStr, defaultOption, selectedValue, size, eventStr, "");
- }
- public static String getSelectCodeList4(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, int size, String eventStr) throws Exception {
- return getSelectCodeList4(group_cd, inputName, sytleStr, defaultOption, selectedValue, size, eventStr, "");
- }
-
- /**
- * 파라미터로 받은 공통코드의 코드목록을 select.js를 이용하는 HTML SELECT Tag로 리턴한다.
- * @param group_cd : 공통코드
- * @param inputName : SELECT Tag의 'name' 속성명
- * @return <code>String</code>
- * @throws Exception
- *
- */
-
- public static String getSelectCodeList(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, int size, String eventStr, String strClassNm) throws Exception {
- ValueObject rowObject = null;
- CommCodeManager commCodeManager = new CommCodeManager();
- RowSet commCodeRowSet = commCodeManager.getCodeRowSet(group_cd);
- /*
- * 수정. 황선재
- * 수정사항 : eventStr 인자 제거
- */
- return HTMLMaker.getSelectTag(commCodeRowSet, "CODE", "NAME", inputName, sytleStr, defaultOption, selectedValue, size, strClassNm, eventStr);
- }
- /**
- * 파라미터로 받은 공통코드의 코드목록을 select.js를 이용하는 HTML SELECT Tag로 리턴한다.
- * @param group_cd : 공통코드
- * @param inputName : SELECT Tag의 'code' 속성명
- * @return <code>String</code>
- * @throws Exception
- */
- public static String getSelectCodeList2(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, int size, String eventStr, String strClassNm) throws Exception {
- ValueObject rowObject = null;
- CommCodeManager commCodeManager = new CommCodeManager();
- RowSet commCodeRowSet = commCodeManager.getCodeRowSet2(group_cd);
- /*
- * 수정. 황선재
- * 수정사항 : eventStr 인자 제거
- */
- return HTMLMaker.getSelectTag2(commCodeRowSet, "CODE", "NAME", inputName, sytleStr, defaultOption, selectedValue, size, strClassNm);
- }
- /**
- * 파라미터로 받은 공통코드의 코드목록을 select.js를 이용하는 HTML SELECT Tag로 리턴한다.
- * @param group_cd : 공통코드
- * @param inputName : SELECT Tag의 'code' 속성명
- * @return <code>String</code>
- * @throws Exception
- */
- public static String getSelectCodeList3(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, int size, String eventStr, String strClassNm) throws Exception {
- ValueObject rowObject = null;
- CommCodeManager commCodeManager = new CommCodeManager();
- RowSet commCodeRowSet = commCodeManager.getCodeRowSet(group_cd);
- /*
- * 수정. 황선재
- * 수정사항 : eventStr 인자 제거
- */
- return HTMLMaker.getSelectTag(commCodeRowSet, "NAME", "NAME", inputName, sytleStr, defaultOption, selectedValue, size, strClassNm);
- }
- /**
- * 파라미터로 받은 공통코드의 코드목록을 select.js를 이용하는 HTML SELECT Tag로 리턴한다.
- * @param group_cd : 공통코드
- * @param inputName : SELECT Tag의 'code' 속성명
- * @return <code>String</code>
- * @throws Exception
- */
- public static String getSelectCodeList4(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, int size, String eventStr, String strClassNm) throws Exception {
- ValueObject rowObject = null;
- CommCodeManager commCodeManager = new CommCodeManager();
- RowSet commCodeRowSet = commCodeManager.getCodeRowSet3(group_cd);
- /*
- * 수정. 황선재
- * 수정사항 : eventStr 인자 제거
- */
- return HTMLMaker.getSelectTag(commCodeRowSet, "CODE", "NAME", inputName, sytleStr, defaultOption, selectedValue, size, strClassNm);
- }
-
- /**
- * 파라미터로 받은 공통코드의 코드목록을 select.js를 이용하는 HTML SELECT Tag로 리턴한다.
- * @param group_cd : 공통코드
- * @param inputName : SELECT Tag의 'name' 속성명
- * @return <code>String</code>
- * @throws Exception
- *
- */
- public static String getSelectCodeList5(String group_cd, String inputName, String sytleStr, String defaultOption, String selectedValue, int size, String Search, String range) throws Exception {
- ValueObject rowObject = null;
- CommCodeManager commCodeManager = new CommCodeManager();
- /**
- * Search : 쿼리에 검색 조건을 추가 합니다.
- * range : 정렬 방식을 추가 합니다.
- */
- RowSet commCodeRowSet = commCodeManager.getSearchCodeRowSet(group_cd,Search,range);
- return HTMLMaker.getSelectTag(commCodeRowSet, "CODE", "NAME", inputName, sytleStr, defaultOption, selectedValue, size, "", "");
- }
-
- /**
- * 파라미터로 받은 공통코드의 코드목록을 리턴한다.
- * @param commCode 공통코드
- * @return <code>RowSet</code>
- * @throws Exception
- */
- public static RowSet getCodeRowsetStatic(String group_cd){
-
- CommCodeManager commCodeManager = new CommCodeManager();
- RowSet commCodeRowSet = commCodeManager.getCodeRowSet(group_cd);
- return commCodeRowSet;
- }
-
- public RowSet getCodeRowSet(String group_cd) {
- Search search = new SearchImpl();
- RowSet rowSet = null;
- String sqlstr = "";
- try {
- sqlstr = " SELECT DETAILCD AS CODE ,DETAILNM AS NAME, SORT_NO AS SEQ \n"
- + " FROM " + D_TABLE + " \n"
- + " WHERE BASECD = ? \n"
- + " ORDER BY SORT_NO \n";
- search.setStatement(sqlstr);
- search.addParameter(group_cd);
- rowSet = search.execute();
- }
- catch(Exception e) {
- WAFLogger.error(this.getClass().getName() + " --> getCodeRowSet() : " + e.getMessage());
- WAFLogger.error("SQL : " + search.getStatement());
- WAFLogger.error(e);
- }
- finally {
- if( rowSet == null ) rowSet = new RowSetImpl();
-
- }
- return rowSet;
- }
-
- public RowSet getSearchCodeRowSet(String group_cd, String search_terms, String range) {
- Search search = new SearchImpl();
- RowSet rowSet = null;
- if(range=="")range = "SORT_NO";
- String sqlstr = "";
- try {
- sqlstr = " SELECT DETAILCD AS CODE ,DETAILNM AS NAME, SORT_NO AS SEQ \n"
- + " FROM " + D_TABLE + " \n"
- + " WHERE BASECD = ? \n"
- + search_terms
- + " ORDER BY "+range+" \n";
- search.setStatement(sqlstr);
- search.addParameter(group_cd);
- rowSet = search.execute();
- }
- catch(Exception e) {
- WAFLogger.error(this.getClass().getName() + " --> getCodeRowSet() : " + e.getMessage());
- WAFLogger.error("SQL : " + search.getStatement());
- WAFLogger.error(e);
- }
- finally {
- if( rowSet == null ) rowSet = new RowSetImpl();
-
- }
- return rowSet;
- }
-
-
- /**
- * 파라미터로 받은 공통코드의 코드목록을 리턴한다.
- * @param commCode 공통코드
- * @return <code>RowSet</code>
- * @throws Exception
- */
- public static RowSet getCodeRowsetStatic(String group_cd, String column, String code){
-
- CommCodeManager commCodeManager = new CommCodeManager();
- RowSet commCodeRowSet = commCodeManager.getCodeRowSet(group_cd, column, code);
- return commCodeRowSet;
- }
-
- public RowSet getCodeRowSet(String group_cd, String column, String code) {
-
- Search search = new SearchImpl();
- RowSet rowSet = null;
- String sqlstr = "";
- try {
-
- sqlstr = " SELECT DETAILCD, DETAILNM, CHG_CODE01, CHG_CODE02, CHG_CODE03, CHG_CODE04, CHG_CODE05, CHG_CODE06, REMARK, SORT_NO, DETAILSORTNM \n"
- + " FROM " + D_TABLE + " \n"
- + " WHERE BASECD = ? \n"
- + " AND "+column+" = ? \n"
- + " ORDER BY SORT_NO \n";
-
- search.setStatement(sqlstr);
- search.addParameter(group_cd);
- search.addParameter(code);
- rowSet = search.execute();
- }
- catch(Exception e) {
-
- WAFLogger.error(this.getClass().getName() + " --> getCodeRowSet() : " + e.getMessage());
- WAFLogger.error("SQL : " + search.getStatement());
- WAFLogger.error(e);
- }
- finally {
- if( rowSet == null ) rowSet = new RowSetImpl();
-
- }
- return rowSet;
- }
-
-
-
- /**
- * 파라미터로 받은 공통코드의 코드목록을 리턴한다.
- * @param commCode 공통코드
- * @return <code>RowSet</code>
- * @throws Exception
- */
- public RowSet getCodeRowSet2(String group_cd) {
- Search search = new SearchImpl();
- RowSet rowSet = null;
- String sqlstr = "";
- try {
- sqlstr = " SELECT DETAILCD AS CODE ,DETAILCD||': '||DETAILNM as name \n"
- + " FROM " + D_TABLE + " \n"
- + " WHERE BASECD = ? \n"
- + " ORDER BY SORT_NO \n";
- search.setStatement(sqlstr);
- search.addParameter(group_cd);
- rowSet = search.execute();
- }
- catch(Exception e) {
- WAFLogger.error(this.getClass().getName() + " --> getCodeRowSet() : " + e.getMessage());
- WAFLogger.error("SQL : " + search.getStatement());
- WAFLogger.error(e);
- }
- finally {
- if( rowSet == null ) rowSet = new RowSetImpl();
- return rowSet;
- }
- }
-
-
- /**
- * 파라미터로 받은 공통코드의 코드목록을 리턴한다.
- * @param commCode 공통코드
- * @return <code>RowSet</code>
- * @throws Exception
- */
- public RowSet getCodeRowSet3(String group_cd) {
- Search search = new SearchImpl();
- RowSet rowSet = null;
- String sqlstr = "";
- try {
- sqlstr = " SELECT DETAILNM || ';' || DETAILCD AS CODE, DETAILNM AS NAME \n"
- + " FROM " + D_TABLE + " \n"
- + " WHERE BASECD = ? \n"
- + " ORDER BY SORT_NO \n";
- search.setStatement(sqlstr);
- search.addParameter(group_cd);
- rowSet = search.execute();
- }
- catch(Exception e) {
- WAFLogger.error(this.getClass().getName() + " --> getCodeRowSet() : " + e.getMessage());
- WAFLogger.error("SQL : " + search.getStatement());
- WAFLogger.error(e);
- }
- finally {
- if( rowSet == null ) rowSet = new RowSetImpl();
- return rowSet;
- }
- }
- /**
- * 정렬방법 RowSet을 리턴
- * @return
- */
- public static RowSet getSortMethodRowSet() {
- String[] SORT_METHOD = {"순번", "코드명", "한글명", "영문명", "등록일시"};
- RowSet rowSet = new RowSetImpl();
- for( int i = 0 ; i < SORT_METHOD.length ; i++ ) {
- Row row = new RowImpl();
- row.addColumn("SEQ" , Integer.toString(i + 1));
- row.addColumn("NAME", SORT_METHOD[i]);
- rowSet.addRow(row);
- }
- return rowSet;
- }
- /**
- *
- * @param commCode
- * @return RowSet
- * @throws Exception
- */
- public static RowSet getCodeList(String commCode) throws Exception {
- CommCodeManager commCodeManager = new CommCodeManager();
- return commCodeManager.getCodeRowSet(commCode);
- }
-
- /**
- * 결재 후처리할 클레스를 넘겨준다.
- * @param signGB
- * @return Sign After Control Class
- * @throws Exception
- */
- public static String getSignClass(String signGB) throws Exception {
- CommCodeManager commCodeManager = new CommCodeManager();
- return commCodeManager.getSignAfterClass(signGB);
- }
- /**
- * 결재 후처리할 클레스를 넘겨준다.
- * @param signGB
- * @return
- */
- private String getSignAfterClass(String signGB) {
- Search search = new SearchImpl();
- RowSet rowSet = null;
- String sqlstr = "";
- String ret_val = "";
- try {
- sqlstr = " SELECT DETAILNM AS NAME \n"
- + " FROM " + D_TABLE + " \n"
- + " WHERE BASECD = 'DRAFT' \n"
- + " AND DETAILCD = ? \n";
-
- search.setStatement(sqlstr);
- search.addParameter(signGB);
- rowSet = search.execute();
- if(rowSet.size() > 0){
- ret_val = rowSet.getRow(0).get("NAME");
- }
- }
- catch(Exception e) {
- WAFLogger.error(this.getClass().getName() + " --> getCodeRowSet() : " + e.getMessage());
- WAFLogger.error("SQL : " + search.getStatement());
- WAFLogger.error(e);
- }
- return ret_val;
- }
-
-
- }
|