MenuManager.java 30 KB

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