PotalMenuManager.java 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. /**
  2. * @(#)file MenuManager.java
  3. * @(#)author chj
  4. * @(#)version 1.0
  5. * @(#)date 2014-06-24
  6. * @(#)since JDK 1.6
  7. *
  8. * Copyright (c) www.udapsoft.co.kr, Inc.
  9. */
  10. package kr.co.udapsoft.common.menu;
  11. import java.util.Hashtable;
  12. import javax.servlet.http.HttpServletRequest;
  13. import kr.co.hsnc.common.base.WAFLogger;
  14. import kr.co.hsnc.common.logger.Logger;
  15. import kr.co.hsnc.common.sql.Row;
  16. import kr.co.hsnc.common.sql.RowSet;
  17. import kr.co.hsnc.common.sql.RowSetImpl;
  18. import kr.co.hsnc.common.sql.WAFConnection;
  19. import kr.co.hsnc.common.sql.WAFConnectionImpl;
  20. import kr.co.hsnc.common.sql.search.Search;
  21. import kr.co.hsnc.common.sql.search.SearchImpl;
  22. import kr.co.hsnc.common.sql.util.RowSetUtility;
  23. import kr.co.hsnc.common.util.ValueObject;
  24. import kr.co.hsnc.j2ee.waf.controller.web.util.WebKeys;
  25. public class PotalMenuManager {
  26. protected String USER_TABLE = "PUB0120T";
  27. protected String R_TABLE = "PUB0340T";
  28. protected String R_LIST_TABLE = "PUB0350T";
  29. protected String PGM_TABLE = "PUB0320T";
  30. protected String PGM_GR_TABLE = "PUB0310T";
  31. protected String PGM_LIST_TABLE = "PUB0300T";
  32. protected String PGM_SYS_TABLE = "PUB0390T";
  33. protected String PIS_CODE1 = "PI1";
  34. protected String PIS_CODE2 = "PI2";
  35. protected String HEI_CODE = "HEI";
  36. protected String HOUS_CODE = "HOS";
  37. protected WAFConnection conn = null;
  38. protected HttpServletRequest request = null;
  39. protected String USER_ID = "";
  40. protected String USE_SYSTEM = "";
  41. protected int SystemSize = 0;
  42. protected RowSet SystemRowSet = null;
  43. protected int MenuGroupSize = 0;
  44. protected RowSet MenuGroupRowSet = null;
  45. protected Hashtable SubMenuTable = null;
  46. protected String systemMenuScript = "Normal";
  47. protected String m_menu_screen = null; // EP를 통해서 foward 되는 URL
  48. public PotalMenuManager(HttpServletRequest request) {
  49. m_menu_screen = request.getParameter("menu_screen"); // via EP
  50. conn = new WAFConnectionImpl();
  51. this.request = request;
  52. this.SubMenuTable = new Hashtable();
  53. ValueObject user = (ValueObject)request.getSession().getAttribute(WebKeys.SIGNED_ON_USER);
  54. if( user != null ) {
  55. // 협력업체의 경우 계정테이블을 "PUB0220T" 로 교체
  56. if( !user.get("ACCT_CAT_CODE").equalsIgnoreCase("CORPORATION") ) return;
  57. USER_TABLE = "SUPP_CHARGE";
  58. R_LIST_TABLE = "SUPP_CHARGE";
  59. USER_ID = user.get("USER_ID");
  60. USE_SYSTEM = user.get("USE_SYSTEM");
  61. if(isValidSystem(user.get("USE_SYSTEM"))){
  62. USE_SYSTEM = user.get("USE_SYSTEM");
  63. }
  64. else{
  65. USE_SYSTEM = getValidSystem();
  66. user.set("USE_SYSTEM", USE_SYSTEM);
  67. }
  68. }
  69. // 실행금액 체크 루틴
  70. //if(user.get("USER_TYPE").equals("head"))
  71. //this.checkExePayment(user);
  72. this.SystemRowSet = getSystemRowSet();
  73. this.SystemSize = this.SystemRowSet == null ? 0 : this.SystemRowSet.size();
  74. if(m_menu_screen == null || m_menu_screen.equals("")) { // 기존소스
  75. if( USE_SYSTEM.equals("") && SystemRowSet != null && SystemSize > 0 ) {
  76. this.USE_SYSTEM = getSystemValue(0).get("SYSTEM_ID");
  77. }
  78. this.MenuGroupRowSet = getMenuGroupRowSet();
  79. this.MenuGroupSize = this.MenuGroupRowSet.size();
  80. for( int i = 0 ; i < MenuGroupSize ; i++ ) {
  81. String pgmGrID = MenuGroupRowSet.getRow(i).get("PGM_GR_ID");
  82. RowSet temp = getSubMenuRowSet(pgmGrID);
  83. temp = filterSubMenuRowSet(temp);
  84. SubMenuTable.put(Integer.toString(i), temp);
  85. }
  86. }
  87. else { // EP로 인해 추가된 부분 - 2006.10.27
  88. boolean bFound = false;
  89. for(int a = 0; a < SystemSize; a++) {
  90. this.USE_SYSTEM = getSystemValue(a).get("SYSTEM_ID");
  91. this.MenuGroupRowSet = getMenuGroupRowSet();
  92. this.MenuGroupSize = this.MenuGroupRowSet.size();
  93. for( int i = 0 ; i < MenuGroupSize ; i++ ) {
  94. String pgmGrID = MenuGroupRowSet.getRow(i).get("PGM_GR_ID");
  95. RowSet temp = getSubMenuRowSet(pgmGrID);
  96. temp = filterSubMenuRowSet(temp);
  97. for(int j = 0; j < temp.size(); j++) {
  98. if(temp.getRow(j).get("SCREEN_NAME").equals(m_menu_screen)) {
  99. bFound = true;
  100. break;
  101. }
  102. }
  103. SubMenuTable.put(Integer.toString(i), temp);
  104. }
  105. if(bFound) break;
  106. }
  107. if(! bFound) this.USE_SYSTEM = getSystemValue(0).get("SYSTEM_ID");
  108. }
  109. }
  110. public String getValidSystem(){
  111. Search search = new SearchImpl();
  112. RowSet rowSet = null;
  113. String sqlstr = "";
  114. try {
  115. sqlstr = "SELECT DISTINCT MIN(E.SYSTEM_ID) \n"
  116. + " FROM " + USER_TABLE + " A, \n"
  117. + " " + R_LIST_TABLE + " B, \n"
  118. + " PUB0340T C, \n"
  119. + " PUB0300T D, \n"
  120. + " PUB0320T E \n"
  121. + " WHERE A.USER_ID = B.USER_ID \n"
  122. + " AND B.RIGHT_ID = C.RIGHT_ID \n"
  123. + " AND C.RIGHT_ID = D.RIGHT_ID \n"
  124. + " AND D.PGM_ID = E.PGM_ID \n"
  125. + " AND A.USER_ID = " + this.USER_ID + " \n";
  126. search.setStatement(sqlstr);
  127. rowSet = search.execute();
  128. }
  129. catch(Exception e) {
  130. WAFLogger.error(this.getClass().getName() + " --> getSystemRowSet() : " + e.getMessage());
  131. WAFLogger.error("SQL : " + search.getStatement());
  132. WAFLogger.error(e);
  133. }
  134. finally {
  135. if( rowSet == null ) rowSet = new RowSetImpl();
  136. }
  137. return rowSet.getRow(0).get(0);
  138. }
  139. public boolean isValidSystem(String USE_SYSTEM){
  140. Search search = new SearchImpl();
  141. RowSet rowSet = null;
  142. String sqlstr = "";
  143. boolean returnVal = false;
  144. try {
  145. sqlstr = " SELECT COUNT(SYSTEM_ID) CNT \n"
  146. + " FROM PUB0390T \n"
  147. + " WHERE SYSTEM_ID = '"+USE_SYSTEM+"' \n"
  148. + " AND SYSTEM_CODE <> 'HEI' AND SYSTEM_CODE <> 'PI1' AND SYSTEM_CODE <> 'PI2' AND SYSTEM_CODE <> '"+HOUS_CODE+"' \n";
  149. search.setStatement(sqlstr);
  150. rowSet = search.execute();
  151. //2007.4.30 쿼리값이 없을때 에러나는 부분 수정
  152. if(rowSet.size()>0 && rowSet!=null){
  153. if(rowSet.getRow(0).getInt("CNT")>0) returnVal= true;
  154. }
  155. }
  156. catch(Exception e) {
  157. WAFLogger.error(this.getClass().getName() + " --> getSystemRowSet() : " + e.getMessage());
  158. WAFLogger.error("SQL : " + search.getStatement());
  159. WAFLogger.error(e);
  160. }
  161. finally {
  162. if( rowSet == null ) rowSet = new RowSetImpl();
  163. }
  164. return returnVal;
  165. }
  166. public String getSystemMenuScript(){
  167. return this.systemMenuScript;
  168. }
  169. public String getUseSystem() {
  170. return this.USE_SYSTEM;
  171. }
  172. public int getSystemSize() {
  173. return this.SystemSize;
  174. }
  175. public ValueObject getSystemValue(int index) {
  176. return RowSetUtility.getValueObject(SystemRowSet.getRow(index));
  177. }
  178. public int getMenuGroupSize() {
  179. return this.MenuGroupSize;
  180. }
  181. public ValueObject getMenuGroupValue(int index) {
  182. return RowSetUtility.getValueObject(MenuGroupRowSet.getRow(index));
  183. }
  184. public int getSubMenuRowSetSize(int index) {
  185. RowSet rowSet = ((RowSet)SubMenuTable.get(Integer.toString(index)));
  186. return rowSet.size();
  187. }
  188. public ValueObject getSubMenuRowValue(int index, int sub_index) {
  189. return RowSetUtility.getValueObject(((RowSet)SubMenuTable.get(Integer.toString(index))).getRow(sub_index));
  190. }
  191. public String getMenuGroupOnImages() {
  192. String temp = "";
  193. for( int i = 0 ; i < MenuGroupSize ; i++ ) {
  194. temp += "'" + MenuGroupRowSet.getRow(i).get("ON_IMAGE_PATH") + "' ";
  195. if( (i + 1) != MenuGroupSize ) temp += ", ";
  196. }
  197. return temp;
  198. }
  199. public String getMenuGroupOffImages() {
  200. String temp = "";
  201. for( int i = 0 ; i < MenuGroupSize ; i++ ) {
  202. temp += "'" + MenuGroupRowSet.getRow(i).get("OFF_IMAGE_PATH") + "' ";
  203. if( (i + 1) != MenuGroupSize ) temp += ", ";
  204. }
  205. return temp;
  206. }
  207. public int getSubMenuWidth(int menuGroupIndex) {
  208. int maxLength = 0;
  209. int defaultWidth = 130;
  210. int subRowSetSize = getSubMenuRowSetSize(menuGroupIndex);
  211. for( int j = 0 ; j < subRowSetSize ; j++ ) {
  212. String pgmName = getSubMenuRowValue(menuGroupIndex, j).get("PGM_NAME");
  213. byte[] bytePgmName = pgmName.getBytes();
  214. if( bytePgmName.length > maxLength )
  215. maxLength = bytePgmName.length;
  216. }
  217. // 기본크기는 130
  218. // 18 byte 이상이면 1byte당 6px씩 증가
  219. // 8 byte 이상이면 1byte당 8px씩 증가로 수정 2003.03.19
  220. if( maxLength > 18 ) {
  221. defaultWidth += (maxLength - 18) * 6;
  222. }
  223. return defaultWidth;
  224. }
  225. /*
  226. * 모든 메뉴보기추가
  227. */
  228. public ValueObject getMenuTitle(){
  229. RowSet rs = setMenuTitle();
  230. return RowSetUtility.getValueObject(rs.getRow(0));
  231. }
  232. public ValueObject[] getMenuData(int i){
  233. RowSet rs = setMenuData();
  234. ValueObject v[] = null;
  235. v = new ValueObject[rs.size()];
  236. for(int j = 0; j<rs.size(); j++){
  237. v[j] = RowSetUtility.getValueObject(rs.getRow(j));
  238. }
  239. return v;
  240. }
  241. /*my menu 보기
  242. */
  243. // public RowSet getMyMenuTitle(){
  244. // return gtMyMenuTitle();
  245. //
  246. // }
  247. private RowSet getSystemRowSet() {
  248. Search search = new SearchImpl();
  249. RowSet rowSet = null;
  250. String sqlstr = "";
  251. try {
  252. sqlstr = " SELECT B.* \n"
  253. + " FROM ( SELECT DISTINCT F.SYSTEM_ID, F.SYSTEM_CODE\n"
  254. + " FROM " + USER_TABLE + " A, \n"
  255. + " " + R_LIST_TABLE + " B, \n"
  256. + " " + R_TABLE + " C, \n"
  257. + " " + PGM_LIST_TABLE + " D, \n"
  258. + " " + PGM_TABLE + " E, \n"
  259. + " " + PGM_SYS_TABLE + " F \n"
  260. + " WHERE A.USER_ID = B.USER_ID \n"
  261. + " AND B.RIGHT_ID = C.RIGHT_ID \n"
  262. + " AND C.RIGHT_ID = D.RIGHT_ID \n"
  263. + " AND D.PGM_ID = E.PGM_ID \n"
  264. + " AND E.SYSTEM_ID = F.SYSTEM_ID " + "\n"
  265. + " AND A.USER_ID = '" + USER_ID + "' ) A, \n"
  266. + " " + PGM_SYS_TABLE + " B \n"
  267. + " WHERE A.SYSTEM_ID = B.SYSTEM_ID \n"
  268. + " ORDER BY B.SEQ \n";
  269. search.setStatement(sqlstr);
  270. rowSet = search.execute();
  271. }
  272. catch(Exception e) {
  273. WAFLogger.error(this.getClass().getName() + " --> getSystemRowSet() : " + e.getMessage());
  274. WAFLogger.error("SQL : " + search.getStatement());
  275. WAFLogger.error(e);
  276. }
  277. finally {
  278. if( rowSet == null ) rowSet = new RowSetImpl();
  279. return rowSet;
  280. }
  281. }
  282. /**
  283. * 프로그램 그룹 구성 데이터 조회
  284. * @return
  285. */
  286. private RowSet getMenuGroupRowSet() {
  287. Search search = new SearchImpl();
  288. RowSet rowSet = null;
  289. String sqlstr = "";
  290. try {
  291. sqlstr = " SELECT PGM_GR_SEQ, SYSTEM_ID, B.* \n"
  292. + " FROM ( SELECT D.PGM_GR_ID, MIN(PGM_GR_SEQ) AS PGM_GR_SEQ , E.SYSTEM_ID \n"
  293. + " FROM " + USER_TABLE + " A, \n"
  294. + " " + R_LIST_TABLE + " B, \n"
  295. + " " + R_TABLE + " C, \n"
  296. + " " + PGM_LIST_TABLE + " D, \n"
  297. + " " + PGM_TABLE + " E \n"
  298. + " WHERE A.USER_ID = B.USER_ID \n"
  299. + " AND B.RIGHT_ID = C.RIGHT_ID \n"
  300. + " AND C.RIGHT_ID = D.RIGHT_ID \n"
  301. + " AND D.PGM_ID = E.PGM_ID \n"
  302. // + " AND E.SYSTEM_ID IN ( ? , decode( ? , 0, ? ) ) \n" //외주,구매,공동도급 시스템일때만 전자결재 서브메뉴를 띄운다
  303. + " AND A.USER_ID = ? \n"
  304. + " GROUP BY PGM_GR_ID, E.SYSTEM_ID ) A, \n"
  305. + " " + PGM_GR_TABLE + " B \n"
  306. + " WHERE A.PGM_GR_ID = B.PGM_GR_ID \n"
  307. + " ORDER BY SYSTEM_ID, PGM_GR_SEQ \n" ;
  308. search.setStatement(sqlstr);
  309. // search.addParameter(USE_SYSTEM);
  310. // search.addParameter(USE_SYSTEM);
  311. // search.addParameter(USE_SYSTEM);
  312. search.addParameter(USER_ID);
  313. rowSet = search.execute();
  314. }
  315. catch(Exception e) {
  316. WAFLogger.error(this.getClass().getName() + " --> getMenuGroupRowSet() : " + e.getMessage());
  317. WAFLogger.error("SQL : " + search.getStatement());
  318. WAFLogger.error(e);
  319. }
  320. finally {
  321. if( rowSet == null ) rowSet = new RowSetImpl();
  322. return rowSet;
  323. }
  324. }
  325. private RowSet getSubMenuRowSet(String pgmGrID) {
  326. Search search = new SearchImpl();
  327. RowSet rowSet = null;
  328. String sqlstr = "";
  329. try {
  330. sqlstr = " SELECT D.GUBUN, E.* \n"
  331. + " FROM " + USER_TABLE + " A, \n"
  332. + " " + R_LIST_TABLE + " B, \n"
  333. + " " + R_TABLE + " C, \n"
  334. + " " + PGM_LIST_TABLE + " D, \n"
  335. + " " + PGM_TABLE + " E \n"
  336. + " WHERE A.USER_ID = B.USER_ID \n"
  337. + " AND B.RIGHT_ID = C.RIGHT_ID \n"
  338. + " AND C.RIGHT_ID = D.RIGHT_ID \n"
  339. + " AND D.PGM_ID = E.PGM_ID(+) \n"
  340. + " AND A.USER_ID = ? \n"
  341. + " AND D.PGM_GR_ID = ? \n";
  342. // + " AND ( E.SYSTEM_ID IN ( ? ) OR D.GUBUN = 'L' ) \n";
  343. sqlstr += " ORDER BY B.RIGHT_ID, D.PGM_GR_SEQ, D.PGM_SEQ \n" ;
  344. search.setStatement(sqlstr);
  345. search.addParameter(USER_ID);
  346. search.addParameter(pgmGrID);
  347. // search.addParameter(USE_SYSTEM);
  348. rowSet = search.execute();
  349. }
  350. catch(Exception e) {
  351. WAFLogger.error(this.getClass().getName() + " --> getSubMenuRowSet() : " + e.getMessage());
  352. WAFLogger.error("SQL : " + search.getStatement());
  353. WAFLogger.error(e);
  354. }
  355. finally {
  356. if( rowSet == null ) rowSet = new RowSetImpl();
  357. return rowSet;
  358. }
  359. }
  360. /**
  361. * 서브메뉴의 중복된 프로그램 필터링
  362. * @param temp
  363. * @return
  364. */
  365. private RowSet filterSubMenuRowSet(RowSet temp) {
  366. int size = temp.size();
  367. boolean isLined = false;
  368. ValueObject filterInfo = new ValueObject();
  369. RowSet rtnRowSet = new RowSetImpl();
  370. for( int i = 0 ; i < size ; i++ ) {
  371. Row row = temp.getRow(i);
  372. if( row.get("GUBUN").equals("L") ) {
  373. if( !isLined ) {
  374. rtnRowSet.addRow(row);
  375. }
  376. isLined = true;
  377. }
  378. else {
  379. if( filterInfo.get(row.get("PGM_ID")).equals("") ) {
  380. rtnRowSet.addRow(row);
  381. filterInfo.set(row.get("PGM_ID"), "EXIST");
  382. isLined = false;
  383. }
  384. }
  385. }
  386. return rtnRowSet;
  387. }
  388. /**
  389. * 프로그램명 리턴
  390. * @param screenName
  391. * @return
  392. */
  393. public static String getPgmName(String screenName) {
  394. Search search = new SearchImpl();
  395. String sqlstr = "";
  396. try {
  397. sqlstr = " SELECT PGM_NAME \n"
  398. + " FROM PUB0320T \n"
  399. + " WHERE SCREEN_NAME = ? \n" ;
  400. search.setStatement(sqlstr);
  401. search.addParameter(screenName);
  402. RowSet rowSet = search.execute();
  403. if( rowSet != null && rowSet.size() > 0 ) {
  404. return rowSet.getRow(0).get("PGM_NAME");
  405. }
  406. return "";
  407. }
  408. catch(Exception e) {
  409. WAFLogger.error("MenuManager --> getPgmName() : " + e.getMessage());
  410. WAFLogger.error("SQL : " + search.getStatement());
  411. WAFLogger.error(search.getParameters());
  412. WAFLogger.error(e);
  413. return "";
  414. }
  415. }
  416. /**
  417. * 메뉴 타이틀명
  418. * @param screenName
  419. * @return
  420. */
  421. private RowSet setMenuTitle() {
  422. Search search = new SearchImpl();
  423. RowSet rowSet = null;
  424. String sqlstr = "";
  425. try {
  426. sqlstr+= " SELECT MAX(DECODE(RN, 1, NAME||':'||SYSTEM_ID)) MENU1, \n";
  427. sqlstr+= " MAX(DECODE(RN, 2, NAME||':'||SYSTEM_ID)) MENU2, \n";
  428. sqlstr+= " MAX(DECODE(RN, 3, NAME||':'||SYSTEM_ID)) MENU3, \n";
  429. sqlstr+= " MAX(DECODE(RN, 4, NAME||':'||SYSTEM_ID)) MENU4, \n";
  430. sqlstr+= " MAX(DECODE(RN, 5, NAME||':'||SYSTEM_ID)) MENU5, \n";
  431. sqlstr+= " MAX(DECODE(RN, 6, NAME||':'||SYSTEM_ID)) MENU6 \n";
  432. sqlstr+= " FROM \n";
  433. sqlstr+= " ( \n";
  434. sqlstr+= " SELECT SYSTEM_ID,NAME, ROWNUM RN FROM PUB0390T \n";
  435. sqlstr+= " --WHERE SYSTEM_CODE <> 'PMC' \n";
  436. sqlstr+= " ORDER BY SYSTEM_ID \n";
  437. sqlstr+= " ) \n";
  438. search.setStatement(sqlstr);
  439. rowSet = search.execute();
  440. }
  441. catch(Exception e) {
  442. WAFLogger.error(this.getClass().getName() + " --> getMenuTitle() : " + e.getMessage());
  443. WAFLogger.error("SQL : " + search.getStatement());
  444. WAFLogger.error(e);
  445. }
  446. finally {
  447. if( rowSet == null ) rowSet = new RowSetImpl();
  448. return rowSet;
  449. }
  450. }
  451. /********************
  452. * 모든 메뉴보기 추가
  453. ********************/
  454. private RowSet setMenuData() {
  455. Search search = new SearchImpl();
  456. RowSet rowSet = null;
  457. String sqlstr = "";
  458. try {
  459. sqlstr+= " SELECT DECODE(A.RK, '1', 'G') AS GB, A.*, B.PGM_ID PGM_ID2 \n";
  460. sqlstr+= " FROM ( SELECT T2.PGM_GR_NAME, \n";
  461. sqlstr+= " T1.PGM_NAME, \n";
  462. sqlstr+= " T1.SCREEN_NAME, \n";
  463. sqlstr+= " T1.SYS_ID, \n";
  464. sqlstr+= " T1.NAME, \n";
  465. sqlstr+= " RANK () OVER (PARTITION BY T1.SYS_ID, NAME, PGM_GR_NAME ORDER BY T1.PGM_GR_ID, T1.PGM_SEQ) RK, \n";
  466. sqlstr+= " T1.PGM_ID \n";
  467. sqlstr+= " FROM (SELECT D.PGM_GR_SEQ, \n";
  468. sqlstr+= " D.PGM_SEQ, \n";
  469. sqlstr+= " D.PGM_GR_ID, \n";
  470. sqlstr+= " C.RIGHT_ID, \n";
  471. sqlstr+= " F.NAME, \n";
  472. sqlstr+= " F.SYSTEM_ID AS SYS_ID, \n";
  473. sqlstr+= " E.* \n";
  474. sqlstr+= " FROM PUB0340T C, -- '공통)권한' \n";
  475. sqlstr+= " PUB0300T D, -- '공통)프로그램 목록' \n";
  476. sqlstr+= " PUB0320T E, -- '공통)프로그램(화면정보)' \n";
  477. sqlstr+= " PUB0390T F \n";
  478. sqlstr+= " WHERE F.SYSTEM_ID = E.SYSTEM_ID \n";
  479. sqlstr+= " -- AND F.SYSTEM_CODE <> 'PMC' \n";
  480. sqlstr+= " AND C.RIGHT_ID = D.RIGHT_ID \n";
  481. sqlstr+= " AND D.PGM_ID = E.PGM_ID(+) \n";
  482. sqlstr+= " AND C.RIGHT_ID = '140' \n";
  483. sqlstr+= " AND D.GUBUN = 'P') T1, \n";
  484. sqlstr+= " PUB0310T T2 \n";
  485. sqlstr+= " WHERE T1.PGM_GR_ID = T2.PGM_GR_ID \n";
  486. sqlstr+= " ORDER BY T1.SYS_ID, T1.PGM_GR_SEQ, T1.PGM_GR_ID, T1.PGM_SEQ) A, \n";
  487. sqlstr+= " (SELECT T3.PGM_ID \n";
  488. sqlstr+= " FROM PUB0350T T1, \n";
  489. sqlstr+= " PUB0300T T2, \n";
  490. sqlstr+= " PUB0320T T3 \n";
  491. sqlstr+= " WHERE T1.USER_ID = '" + USER_ID + "' \n";
  492. sqlstr+= " AND T1.RIGHT_ID = T2.RIGHT_ID \n";
  493. sqlstr+= " AND T3.PGM_ID = T2.PGM_ID \n";
  494. sqlstr+= " -- AND T3.SYSTEM_CODE <> 'PMC' \n";
  495. sqlstr+= " ) B \n";
  496. sqlstr+= " WHERE A.PGM_ID = B.PGM_ID(+) \n";
  497. search.setStatement(sqlstr);
  498. //search.addParameter("");
  499. rowSet = search.execute();
  500. }
  501. catch(Exception e) {
  502. WAFLogger.error(this.getClass().getName() + " --> getMenuData() : " + e.getMessage());
  503. WAFLogger.error("SQL : " + search.getStatement());
  504. WAFLogger.error(e);
  505. }
  506. finally {
  507. if( rowSet == null ) rowSet = new RowSetImpl();
  508. return rowSet;
  509. }
  510. }
  511. /*mymenu 타이틀*/
  512. public RowSet getMyMenuTitle(String user) {
  513. Search search = new SearchImpl();
  514. RowSet rowSet = null;
  515. String sqlstr = "";
  516. try {
  517. sqlstr += " SELECT D.SYSTEM_CODE \n"
  518. + " , D.NAME \n"
  519. + " , D.SYSTEM_ID \n"
  520. + " , D.SEQ \n"
  521. + " FROM PUB0300T A , \n"
  522. + " PUB0320T B , \n"
  523. + " PUB0310T C , \n"
  524. + " PUB0390T D , \n"
  525. + " PUB0350T AUTH, \n"
  526. + " MYMENU MM \n"
  527. + " WHERE A.PGM_ID = B.PGM_ID \n"
  528. + " AND A.PGM_GR_ID = C.PGM_GR_ID \n"
  529. + " AND B.SYSTEM_ID = D.SYSTEM_ID \n"
  530. + " AND A.PGM_ID = MM.PGM_ID \n"
  531. + " AND A.RIGHT_ID = AUTH.RIGHT_ID \n"
  532. + " AND AUTH.USER_ID = MM.USER_ID \n"
  533. + " AND MM.USER_ID = ? \n"
  534. + " GROUP BY D.SYSTEM_CODE \n"
  535. + " , D.NAME \n"
  536. + " , D.SYSTEM_ID \n"
  537. + " , D.SEQ \n"
  538. + " ORDER BY D.SEQ \n" ;
  539. search.setStatement(sqlstr);
  540. search.addParameter(user);
  541. rowSet = search.execute();
  542. }
  543. catch(Exception e) {
  544. WAFLogger.error(this.getClass().getName() + " --> getMenuData() : " + e.getMessage());
  545. WAFLogger.error("SQL : " + search.getStatement());
  546. WAFLogger.error(e);
  547. }
  548. finally {
  549. if( rowSet == null ) rowSet = new RowSetImpl();
  550. return rowSet;
  551. }
  552. }
  553. /* mymanu 메뉴 불러오기
  554. *
  555. */
  556. public RowSet getMyMenuData(String user) {
  557. Search search = new SearchImpl();
  558. RowSet rowSet = null;
  559. String sqlstr = "";
  560. try {
  561. sqlstr += " SELECT A.PGM_ID \n"
  562. + " , B.SYSTEM_CODE \n"
  563. + " , D.NAME \n"
  564. + " , C.PGM_GR_NAME \n"
  565. + " , B.PGM_NAME \n"
  566. + " , B.SCREEN_NAME \n"
  567. + " FROM PUB0300T A , \n"
  568. + " PUB0320T B , \n"
  569. + " PUB0310T C , \n"
  570. + " PUB0390T D , \n"
  571. + " PUB0350T AUTH, \n"
  572. + " MYMENU MM \n"
  573. + " WHERE A.PGM_ID = B.PGM_ID(+) \n"
  574. + " AND A.PGM_GR_ID = C.PGM_GR_ID \n"
  575. + " AND B.SYSTEM_ID = D.SYSTEM_ID(+) \n"
  576. + " AND A.PGM_ID = MM.PGM_ID \n"
  577. + " AND A.RIGHT_ID = AUTH.RIGHT_ID \n"
  578. + " AND AUTH.USER_ID = MM.USER_ID \n"
  579. + " AND MM.USER_ID = ? \n"
  580. + " ORDER BY D.SEQ, A.PGM_GR_SEQ, A.PGM_SEQ \n" ;
  581. search.setStatement(sqlstr);
  582. search.addParameter(user);
  583. rowSet = search.execute();
  584. }
  585. catch(Exception e) {
  586. WAFLogger.error(this.getClass().getName() + " --> getMenuData() : " + e.getMessage());
  587. WAFLogger.error("SQL : " + search.getStatement());
  588. WAFLogger.error(e);
  589. }
  590. finally {
  591. if( rowSet == null ) rowSet = new RowSetImpl();
  592. return rowSet;
  593. }
  594. }
  595. /**
  596. * DB Instance Name 리턴
  597. * @return
  598. */
  599. public String getDBInstanceName() {
  600. Search search = new SearchImpl();
  601. String sqlstr = "";
  602. try {
  603. sqlstr = " SELECT INSTANCE_NAME FROM V$INSTANCE \n" ;
  604. search.setStatement(sqlstr);
  605. RowSet rowSet = search.execute();
  606. if( rowSet != null && rowSet.size() > 0 ) {
  607. return rowSet.getRow(0).get("INSTANCE_NAME");
  608. }
  609. return "InstanceName Query Error(NoRow)";
  610. }
  611. catch(Exception e) {
  612. Logger.err.println("MenuManager --> getDBInstanceName() : " + e.getMessage());
  613. Logger.err.println("SQL : " + search.getStatement());
  614. Logger.err.println(search.getParameters());
  615. Logger.err.println(e);
  616. return "InstanceName Query Error(Exception)";
  617. }
  618. }
  619. }