Commit 97837b8e authored by mchaudhari's avatar mchaudhari

add two Acc_Filt an Def_Filt column in brow window and update them


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@95286 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8616efa0
package ibase.webitm.ejb.sys; package ibase.webitm.ejb.sys;
import java.io.*; import java.io.*;
import java.sql.*; import java.sql.*;
import java.util.*; import java.util.*;
import java.lang.*; import java.lang.*;
import javax.ejb.*; import javax.ejb.*;
import org.w3c.dom.*; import org.w3c.dom.*;
import javax.xml.parsers.*; import javax.xml.parsers.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import ibase.webitm.utility.*; import ibase.webitm.utility.*;
import ibase.system.config.*; import ibase.system.config.*;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.TransIDGenerator; import ibase.webitm.utility.TransIDGenerator;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import javax.xml.transform.*; import javax.xml.transform.*;
import javax.xml.transform.dom.*; import javax.xml.transform.dom.*;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerConfigurationException;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3 @Stateless // added for ejb3
public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , UserRightsPrcRemote // SessionBean public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , UserRightsPrcRemote // SessionBean
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
CommonConstants commonConstants = new CommonConstants(); CommonConstants commonConstants = new CommonConstants();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
Connection conn = null; Connection conn = null;
HashMap userRightsMap = null; HashMap userRightsMap = null;
HashMap winNameMap = null; HashMap winNameMap = null;
HashMap menuNameMap = null; HashMap menuNameMap = null;
String profileId = null; String profileId = null;
String processStr = null; String processStr = null;
/*public void ejbCreate() throws RemoteException, CreateException /*public void ejbCreate() throws RemoteException, CreateException
{ {
} }
public void ejbRemove() public void ejbRemove()
{ {
} }
public void ejbActivate() public void ejbActivate()
{ {
} }
public void ejbPassivate() public void ejbPassivate()
{ {
}*/ }*/
public String process() throws RemoteException,ITMException public String process() throws RemoteException,ITMException
{ {
return ""; return "";
} }
public String getData(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException public String getData(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException
{ {
String rtrStr = ""; String rtrStr = "";
Document headerDom = null; Document headerDom = null;
Document detailDom = null; Document detailDom = null;
try try
{ {
System.out.println("xmlString ["+xmlString+"]"); System.out.println("xmlString ["+xmlString+"]");
System.out.println("xmlString2 ["+xmlString2+"]"); System.out.println("xmlString2 ["+xmlString2+"]");
System.out.println("windowName ["+windowName+"]"); System.out.println("windowName ["+windowName+"]");
System.out.println("xtraParams ["+xtraParams+"]"); System.out.println("xtraParams ["+xtraParams+"]");
if(xmlString != null && xmlString.trim().length()!=0 ) if(xmlString != null && xmlString.trim().length()!=0 )
{ {
headerDom = genericUtility.parseString(xmlString); headerDom = genericUtility.parseString(xmlString);
} }
if(xmlString2 != null && xmlString2.trim().length()!=0) if(xmlString2 != null && xmlString2.trim().length()!=0)
{ {
detailDom = genericUtility.parseString(xmlString2); detailDom = genericUtility.parseString(xmlString2);
} }
rtrStr = getData(headerDom, detailDom, windowName, xtraParams); rtrStr = getData(headerDom, detailDom, windowName, xtraParams);
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("Exception :UserRightsEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":"); System.out.println("Exception :UserRightsEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
throw new ITMException(e); throw new ITMException(e);
} }
return rtrStr; return rtrStr;
} }
public String getData(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException public String getData(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
{ {
Statement stmt = null; Statement stmt = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
//StringBuffer retTabSepStrBuff = new StringBuffer(); //StringBuffer retTabSepStrBuff = new StringBuffer();
StringBuffer retTabSepStrBuff = new StringBuffer("<?xml version = \"1.0\"?>"); StringBuffer retTabSepStrBuff = new StringBuffer("<?xml version = \"1.0\"?>");
retTabSepStrBuff.append("<DocumentRoot>"); retTabSepStrBuff.append("<DocumentRoot>");
retTabSepStrBuff.append("<description>").append("Datawindow Root").append("</description>"); retTabSepStrBuff.append("<description>").append("Datawindow Root").append("</description>");
retTabSepStrBuff.append("<group0>"); retTabSepStrBuff.append("<group0>");
retTabSepStrBuff.append("<description>").append("Group0 description").append("</description>"); retTabSepStrBuff.append("<description>").append("Group0 description").append("</description>");
retTabSepStrBuff.append("<Header0>"); retTabSepStrBuff.append("<Header0>");
String userId = null; String userId = null;
Object date = null; Object date = null;
String sql = ""; String sql = "";
String errCode = ""; String errCode = "";
String errString = ""; String errString = "";
String resultString = ""; String resultString = "";
String curUserId = "", curProfileId = ""; String curUserId = "", curProfileId = "";
//String profileId =null; //String profileId =null;
double quantity = 0.0,pendingQty = 0.0; double quantity = 0.0,pendingQty = 0.0;
int count = 0, usrLev = 0; int count = 0, usrLev = 0;
String tApplication = null; String tApplication = null;
String key = null; String key = null;
String tWinName = null; String tWinName = null;
String tMenuName = null; String tMenuName = null;
String sqlStr = ""; String sqlStr = "";
try try
{ {
if(conn == null) if(conn == null)
{ {
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver = null; connDriver = null;
} }
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId");
profileId = genericUtility.getColumnValue("profile_id", headerDom); profileId = genericUtility.getColumnValue("profile_id", headerDom);
//System.out.println("profileId ::- "+ profileId); //System.out.println("profileId ::- "+ profileId);
// 24/03/12 manoharan get the current logged in user and show only the menus for which the current user has rights // 24/03/12 manoharan get the current logged in user and show only the menus for which the current user has rights
curUserId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); curUserId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("Current userid curUserId ["+ curUserId + "] profileId [" + profileId + "]"); System.out.println("Current userid curUserId ["+ curUserId + "] profileId [" + profileId + "]");
if (curUserId == null || curUserId.trim().length() == 0) if (curUserId == null || curUserId.trim().length() == 0)
{ {
retTabSepStrBuff.append(" \t"); retTabSepStrBuff.append(" \t");
/* //LEVEL_1 /* //LEVEL_1
retTabSepStrBuff.append(" \t"); retTabSepStrBuff.append(" \t");
//LEVEL_2 //LEVEL_2
retTabSepStrBuff.append(" \t"); retTabSepStrBuff.append(" \t");
//LEVEL_3 //LEVEL_3
retTabSepStrBuff.append(" \t"); retTabSepStrBuff.append(" \t");
//LEVEL_4 //LEVEL_4
retTabSepStrBuff.append(" \t"); retTabSepStrBuff.append(" \t");
//LEVEL_5 //LEVEL_5
retTabSepStrBuff.append(" \t"); retTabSepStrBuff.append(" \t");
//DESCR //DESCR
retTabSepStrBuff.append(" \t"); retTabSepStrBuff.append(" \t");
//RIGHTS //RIGHTS
retTabSepStrBuff.append(" \t"); retTabSepStrBuff.append(" \t");
//WIN_NAME //WIN_NAME
retTabSepStrBuff.append(" \t"); retTabSepStrBuff.append(" \t");
retTabSepStrBuff.append(" ").append("\t"); retTabSepStrBuff.append(" ").append("\t");
retTabSepStrBuff.append("\n"); retTabSepStrBuff.append("\n");
*/ */
retTabSepStrBuff.append("</Header0>"); retTabSepStrBuff.append("</Header0>");
retTabSepStrBuff.append("</group0>"); retTabSepStrBuff.append("</group0>");
retTabSepStrBuff.append("</DocumentRoot>"); retTabSepStrBuff.append("</DocumentRoot>");
resultString = retTabSepStrBuff.toString(); resultString = retTabSepStrBuff.toString();
} }
else else
{ {
sql = " select profile_id,usr_lev from users where code = ?"; sql = " select profile_id,usr_lev from users where code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,curUserId); pstmt.setString(1,curUserId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
curProfileId = rs.getString("profile_id"); curProfileId = rs.getString("profile_id");
usrLev = rs.getInt("usr_lev"); usrLev = rs.getInt("usr_lev");
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
System.out.println("Current curProfileId ["+ curProfileId + "] usrLev [" + usrLev + "]"); System.out.println("Current curProfileId ["+ curProfileId + "] usrLev [" + usrLev + "]");
//////////////// ////////////////
//If profile Id is blank or doesnt exist in the User_Rights table then prompt error //If profile Id is blank or doesnt exist in the User_Rights table then prompt error
//String profileSql = " select count(*) " + //String profileSql = " select count(*) " +
// " from user_rights " + // " from user_rights " +
// " where profile_id = '" + profileId + "' " ; // " where profile_id = '" + profileId + "' " ;
String profileSql = " select count(1) " + String profileSql = " select count(1) " +
" from gencodes " + " from gencodes " +
" where fld_name = 'PROFILE_ID' and fld_value = '" + profileId + "' " ; " where fld_name = 'PROFILE_ID' and fld_value = '" + profileId + "' " ;
int profileCount = 0; int profileCount = 0;
System.out.println("ProfileSql :: " + profileSql); System.out.println("ProfileSql :: " + profileSql);
PreparedStatement pProfileStmt = null; PreparedStatement pProfileStmt = null;
ResultSet profileRs = null; ResultSet profileRs = null;
pProfileStmt = conn.prepareStatement(profileSql); pProfileStmt = conn.prepareStatement(profileSql);
profileRs = pProfileStmt.executeQuery(); profileRs = pProfileStmt.executeQuery();
if(profileRs.next()) if(profileRs.next())
{ {
profileCount = profileRs.getInt(1); profileCount = profileRs.getInt(1);
System.out.println("Profile Count = " + profileCount); System.out.println("Profile Count = " + profileCount);
} }
profileRs.close(); profileRs.close();
profileRs = null; profileRs = null;
pProfileStmt.close(); pProfileStmt.close();
pProfileStmt = null; pProfileStmt = null;
/////////////// ///////////////
if(profileCount == 0) if(profileCount == 0)
{ {
errString = itmDBAccessEJB.getErrorString("","PNOTEXIST","","",conn); errString = itmDBAccessEJB.getErrorString("","PNOTEXIST","","",conn);
return errString; return errString;
} }
userRightsMap = new HashMap(); userRightsMap = new HashMap();
winNameMap = new HashMap(); winNameMap = new HashMap();
menuNameMap = new HashMap(); menuNameMap = new HashMap();
// Change in query by mahesh on 16-06-2014 Add USER_RIGHTS.ACC_FILT and USER_RIGHTS.DEF_FILT columns.
sqlStr = " SELECT ITM2MENU.APPLICATION, " + sqlStr = " SELECT ITM2MENU.APPLICATION, " +
" ITM2MENU.LEVEL_1, " + " ITM2MENU.LEVEL_1, " +
" ITM2MENU.LEVEL_2, " + " ITM2MENU.LEVEL_2, " +
" ITM2MENU.LEVEL_3, " + " ITM2MENU.LEVEL_3, " +
" ITM2MENU.LEVEL_4, " + " ITM2MENU.LEVEL_4, " +
" ITM2MENU.LEVEL_5, " + " ITM2MENU.LEVEL_5, " +
" ITM2MENU.WIN_NAME, " + " ITM2MENU.DESCR, USER_RIGHTS.RIGHTS, COALESCE(USER_RIGHTS.ACC_FILT,' ') AS ACC_FILT, COALESCE(USER_RIGHTS.DEF_FILT,' ') AS DEF_FILT , ITM2MENU.WIN_NAME" +
" ITM2MENU.DESCR, " + " FROM ITM2MENU LEFT OUTER JOIN USER_RIGHTS ON USER_RIGHTS.PROFILE_ID = ? " +
" (SELECT USER_RIGHTS.RIGHTS FROM USER_RIGHTS " + " AND USER_RIGHTS.APPLICATION = ITM2MENU.APPLICATION "+
" WHERE USER_RIGHTS.PROFILE_ID = ? " + " AND USER_RIGHTS.MENU_ROW = ITM2MENU.LEVEL_1 "+
" AND USER_RIGHTS.APPLICATION = ITM2MENU.APPLICATION " + " AND USER_RIGHTS.MENU_COL = ITM2MENU.LEVEL_2 "+
" AND USER_RIGHTS.MENU_ROW = ITM2MENU.LEVEL_1 " + " AND USER_RIGHTS.MENU_SUBCOL = ITM2MENU.LEVEL_3 "+
" AND USER_RIGHTS.MENU_COL = ITM2MENU.LEVEL_2 " + " AND USER_RIGHTS.LEVEL_4 = ITM2MENU.LEVEL_4 "+
" AND USER_RIGHTS.MENU_SUBCOL = ITM2MENU.LEVEL_3 " + " AND USER_RIGHTS.LEVEL_5 = ITM2MENU.LEVEL_5 " ;
" AND USER_RIGHTS.LEVEL_4 = ITM2MENU.LEVEL_4 " + if (usrLev > 0 )
" AND USER_RIGHTS.LEVEL_5 = ITM2MENU.LEVEL_5 " + {
" ) AS RIGHTS " + sqlStr = sqlStr + " where exists (select 1 from user_rights u "
" FROM ITM2MENU " ; + " where u.profile_id in ('" + curProfileId + "','" + profileId + "') "
if (usrLev > 0 ) + " and u.application = ITM2MENU.application "
{ + " and u.menu_row = ITM2MENU.level_1 "
sqlStr = sqlStr + " where exists (select 1 from user_rights u " + " and u.menu_col = ITM2MENU.level_2 "
+ " where u.profile_id in ('" + curProfileId + "','" + profileId + "') " + " and u.menu_subcol = ITM2MENU.level_3 "
+ " and u.application = ITM2MENU.application " + " and u.level_4 = ITM2MENU.level_4 "
+ " and u.menu_row = ITM2MENU.level_1 " + " and u.level_5 = ITM2MENU.level_5)" ;
+ " and u.menu_col = ITM2MENU.level_2 " }
+ " and u.menu_subcol = ITM2MENU.level_3 " sqlStr = sqlStr + " ORDER BY ITM2MENU.APPLICATION, ITM2MENU.LEVEL_1, ITM2MENU.LEVEL_2, ITM2MENU.LEVEL_3, ITM2MENU.LEVEL_4, ITM2MENU.LEVEL_5 ";
+ " and u.level_4 = ITM2MENU.level_4 "
+ " and u.level_5 = ITM2MENU.level_5) " ;
} pstmt = conn.prepareStatement(sqlStr);
sqlStr = sqlStr + " ORDER BY ITM2MENU.APPLICATION, ITM2MENU.LEVEL_1, ITM2MENU.LEVEL_2, ITM2MENU.LEVEL_3, ITM2MENU.LEVEL_4, ITM2MENU.LEVEL_5 "; pstmt.setString(1,profileId);
//System.out.println("The getData sql is:-"+ sqlStr);
rs = pstmt.executeQuery();
pstmt = conn.prepareStatement(sqlStr); while (rs.next())
pstmt.setString(1,profileId); {
//System.out.println("The getData sql is:-"+ sqlStr); tApplication = rs.getString(1);
rs = pstmt.executeQuery();
while (rs.next()) if(tApplication != null)
{ key = tApplication + ":" + rs.getInt(2) + ":" + rs.getInt(3) + ":" + rs.getInt(4)
+ ":" + rs.getInt(5) + ":" + rs.getInt(6);
tApplication = rs.getString(1);
// 14/03/14 manoharan to avoid link names
if(tApplication != null) tWinName = rs.getString("WIN_NAME");
key = tApplication + ":" + rs.getInt(2) + ":" + rs.getInt(3) + ":" + rs.getInt(4) tWinName = (tWinName==null?"":tWinName);
+ ":" + rs.getInt(5) + ":" + rs.getInt(6); if (tWinName.indexOf("/ibase/") > -1)
{
// 14/03/14 manoharan to avoid link names continue;
tWinName = rs.getString("WIN_NAME"); }
tWinName = (tWinName==null?"":tWinName);
if (tWinName.indexOf("/ibase/") > -1) retTabSepStrBuff.append("<Detail2>");
{ //APPLICATION
continue; //retTabSepStrBuff.append(tApplication==null?"":rs.getString(1)).append("\t");
} retTabSepStrBuff.append("<application>").append("<![CDATA[" + (rs.getString("APPLICATION")==null?"":rs.getString("APPLICATION")) +"]]>").append("</application>");
retTabSepStrBuff.append("<Detail2>"); //LEVEL_1
//APPLICATION //retTabSepStrBuff.append(rs.getInt(2)).append("\t");
//retTabSepStrBuff.append(tApplication==null?"":rs.getString(1)).append("\t"); retTabSepStrBuff.append("<level_1>").append("<![CDATA[" + rs.getInt("LEVEL_1") +"]]>").append("</level_1>");
retTabSepStrBuff.append("<application>").append("<![CDATA[" + (rs.getString("APPLICATION")==null?"":rs.getString("APPLICATION")) +"]]>").append("</application>");
//LEVEL_2
//LEVEL_1 //retTabSepStrBuff.append(rs.getInt(3)).append("\t");
//retTabSepStrBuff.append(rs.getInt(2)).append("\t"); retTabSepStrBuff.append("<level_2>").append("<![CDATA[" + rs.getInt("LEVEL_2") +"]]>").append("</level_2>");
retTabSepStrBuff.append("<level_1>").append("<![CDATA[" + rs.getInt("LEVEL_1") +"]]>").append("</level_1>");
//LEVEL_3
//LEVEL_2 //retTabSepStrBuff.append(rs.getInt(4)).append("\t");
//retTabSepStrBuff.append(rs.getInt(3)).append("\t"); retTabSepStrBuff.append("<level_3>").append("<![CDATA[" + rs.getInt("LEVEL_3") +"]]>").append("</level_3>");
retTabSepStrBuff.append("<level_2>").append("<![CDATA[" + rs.getInt("LEVEL_2") +"]]>").append("</level_2>");
//LEVEL_4
//LEVEL_3 //retTabSepStrBuff.append(rs.getInt(5)).append("\t");
//retTabSepStrBuff.append(rs.getInt(4)).append("\t"); retTabSepStrBuff.append("<level_4>").append("<![CDATA[" + rs.getInt("LEVEL_4") +"]]>").append("</level_4>");
retTabSepStrBuff.append("<level_3>").append("<![CDATA[" + rs.getInt("LEVEL_3") +"]]>").append("</level_3>");
//LEVEL_5
//LEVEL_4 //retTabSepStrBuff.append(rs.getInt(6)).append("\t");
//retTabSepStrBuff.append(rs.getInt(5)).append("\t"); retTabSepStrBuff.append("<level_5>").append("<![CDATA[" + rs.getInt("LEVEL_5") +"]]>").append("</level_5>");
retTabSepStrBuff.append("<level_4>").append("<![CDATA[" + rs.getInt("LEVEL_4") +"]]>").append("</level_4>");
//DESCR
//LEVEL_5 tMenuName = rs.getString("DESCR");
//retTabSepStrBuff.append(rs.getInt(6)).append("\t"); //retTabSepStrBuff.append(rs.getString(8)==null?"":rs.getString(8)).append("\t");
retTabSepStrBuff.append("<level_5>").append("<![CDATA[" + rs.getInt("LEVEL_5") +"]]>").append("</level_5>"); retTabSepStrBuff.append("<descr>").append("<![CDATA[" + (rs.getString("DESCR")==null?"":rs.getString("DESCR")) +"]]>").append("</descr>");
//RIGHTS
//DESCR //retTabSepStrBuff.append(rs.getString(9)==null?"":rs.getString(9)).append("\t");
tMenuName = rs.getString("DESCR"); retTabSepStrBuff.append("<rights>").append("<![CDATA[" + (rs.getString("RIGHTS")==null?" ":rs.getString("RIGHTS")) +"]]>").append("</rights>");
//retTabSepStrBuff.append(rs.getString(8)==null?"":rs.getString(8)).append("\t");
retTabSepStrBuff.append("<descr>").append("<![CDATA[" + (rs.getString("DESCR")==null?"":rs.getString("DESCR")) +"]]>").append("</descr>"); // Added by mahesh on 16-06-2014
//RIGHTS retTabSepStrBuff.append("<acc_filt>").append("<![CDATA[" + rs.getString("ACC_FILT") +"]]>").append("</acc_filt>");
//retTabSepStrBuff.append(rs.getString(9)==null?"":rs.getString(9)).append("\t"); retTabSepStrBuff.append("<def_filt>").append("<![CDATA[" + rs.getString("DEF_FILT") +"]]>").append("</def_filt>");
retTabSepStrBuff.append("<rights>").append("<![CDATA[" + (rs.getString("RIGHTS")==null?"":rs.getString("RIGHTS")) +"]]>").append("</rights>"); // End of code added by mahesh
//WIN_NAME //WIN_NAME
tWinName = rs.getString("WIN_NAME"); tWinName = rs.getString("WIN_NAME");
//retTabSepStrBuff.append(rs.getString(7)==null?"":rs.getString(7)).append("\t"); //retTabSepStrBuff.append(rs.getString(7)==null?"":rs.getString(7)).append("\t");
retTabSepStrBuff.append("<win_name>").append("<![CDATA[" + (rs.getString("WIN_NAME")==null?"":rs.getString("WIN_NAME")) +"]]>").append("</win_name>"); retTabSepStrBuff.append("<win_name>").append("<![CDATA[" + (rs.getString("WIN_NAME")==null?"":rs.getString("WIN_NAME")) +"]]>").append("</win_name>");
//retTabSepStrBuff.append(" ").append("\t"); //retTabSepStrBuff.append(" ").append("\t");
//retTabSepStrBuff.append("\n"); //retTabSepStrBuff.append("\n");
retTabSepStrBuff.append("</Detail2>"); retTabSepStrBuff.append("</Detail2>");
System.out.println("Key getdata function ["+key+"]"); System.out.println("Key getdata function ["+key+"]");
System.out.println("rights in function ["+ rs.getString("RIGHTS") +"]"); System.out.println("rights in function ["+ rs.getString("RIGHTS") +"]");
userRightsMap.put(key, rs.getString("RIGHTS")); userRightsMap.put(key, rs.getString("RIGHTS"));
if(tWinName != null && tWinName.trim().length() > 2) if(tWinName != null && tWinName.trim().length() > 2)
winNameMap.put(key, tWinName.trim().substring(2, tWinName.trim().length())); winNameMap.put(key, tWinName.trim().substring(2, tWinName.trim().length()));
menuNameMap.put(key, tMenuName); menuNameMap.put(key, tMenuName);
}//while }//while
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
retTabSepStrBuff.append("</Header0>"); retTabSepStrBuff.append("</Header0>");
retTabSepStrBuff.append("</group0>"); retTabSepStrBuff.append("</group0>");
retTabSepStrBuff.append("</DocumentRoot>"); retTabSepStrBuff.append("</DocumentRoot>");
} }
// end 24/03/12 manoharan // end 24/03/12 manoharan
}//try }//try
catch (SQLException e) catch (SQLException e)
{ {
System.out.println("SQLException ::" + sqlStr + e.getMessage() + ":"); System.out.println("SQLException ::" + sqlStr + e.getMessage() + ":");
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);// added by akhilesh on 31/oct/12 throw new ITMException(e);// added by akhilesh on 31/oct/12
} }
catch(Exception ex) catch(Exception ex)
{ {
System.out.println("Exception []::" + ex.getMessage()); System.out.println("Exception []::" + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex);// added by akhilesh on 31/oct/12 throw new ITMException(ex);// added by akhilesh on 31/oct/12
} }
finally finally
{ {
try try
{ {
if(rs != null){rs.close();// added by akhilesh on 08/nov/12 if(rs != null){rs.close();// added by akhilesh on 08/nov/12
rs = null;} rs = null;}
if(pstmt != null){pstmt.close();// added by akhilesh on 08/nov/12 if(pstmt != null){pstmt.close();// added by akhilesh on 08/nov/12
pstmt = null;} pstmt = null;}
if(conn != null){conn.close();// added by akhilesh on 08/nov/12 if(conn != null){conn.close();// added by akhilesh on 08/nov/12
conn = null;} conn = null;}
} }
catch(Exception e){ catch(Exception e){
throw new ITMException(e);// added by akhilesh on 31/oct/12 throw new ITMException(e);// added by akhilesh on 31/oct/12
} }
} }
resultString = retTabSepStrBuff.toString(); resultString = retTabSepStrBuff.toString();
return resultString; return resultString;
}//getData() }//getData()
//process() //process()
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException
{ {
String retStr = ""; String retStr = "";
Document detailDom = null; Document detailDom = null;
Document headerDom = null; Document headerDom = null;
System.out.println("xmlString2-->"+ xmlString2); System.out.println("xmlString2-->"+ xmlString2);
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
try try
{ {
System.out.println("xmlString ["+xmlString+"]"); System.out.println("xmlString ["+xmlString+"]");
System.out.println("xmlString2 ["+xmlString2+"]"); System.out.println("xmlString2 ["+xmlString2+"]");
System.out.println("windowName ["+windowName+"]"); System.out.println("windowName ["+windowName+"]");
System.out.println("xtraParams ["+xtraParams+"]"); System.out.println("xtraParams ["+xtraParams+"]");
if(xmlString != null && xmlString.trim().length()!=0) if(xmlString != null && xmlString.trim().length()!=0)
{ {
headerDom = genericUtility.parseString(xmlString); headerDom = genericUtility.parseString(xmlString);
} }
if(xmlString2 != null && xmlString2.trim().length()!=0) if(xmlString2 != null && xmlString2.trim().length()!=0)
{ {
detailDom = genericUtility.parseString(xmlString2); detailDom = genericUtility.parseString(xmlString2);
} }
retStr = process(headerDom, detailDom, windowName, xtraParams); retStr = process(headerDom, detailDom, windowName, xtraParams);
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("Exception :UserRightsEJB :process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":"); System.out.println("Exception :UserRightsEJB :process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
return retStr; return retStr;
} }
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
{ {
processStr = null; processStr = null;
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
Connection conn = null; Connection conn = null;
PreparedStatement pInsertStmt = null; PreparedStatement pInsertStmt = null;
PreparedStatement pUpdateStmt = null; PreparedStatement pUpdateStmt = null;
PreparedStatement pDeleteStmt = null; PreparedStatement pDeleteStmt = null;
PreparedStatement pSelectStmt = null;// added by akhilesh on 31/oct/12 PreparedStatement pSelectStmt = null;// added by akhilesh on 31/oct/12
Statement stmt = null; Statement stmt = null;
ResultSet rs = null; ResultSet rs = null;
java.sql.Timestamp orderDate = new java.sql.Timestamp(System.currentTimeMillis()); java.sql.Timestamp orderDate = new java.sql.Timestamp(System.currentTimeMillis());
java.sql.Timestamp udfDate = null; java.sql.Timestamp udfDate = null;
String returnString = ""; String returnString = "";
//Declaring fields of the table User_Rights //Declaring fields of the table User_Rights
String profileId = null; String profileId = null;
String application = null; String application = null;
String level1 = null, level2 = null, level3 = null, level4 = null, level5 = null; String level1 = null, level2 = null, level3 = null, level4 = null, level5 = null;
String menuName = null; String menuName = null;
String rights = null; String rights = null;
String accFilt = null; String accFilt = null;
String defFilt = null; String defFilt = null;
String objName = null; String objName = null;
String winName = null; String winName = null;
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
String childNodeName = ""; String childNodeName = "";
String rightChar = ""; String rightChar = "";
boolean bDetailFound = false; boolean bDetailFound = false;
int parentNodeListLength = 0; int parentNodeListLength = 0;
int childNodeListLength = 0, insertCount =0, updateCount =0, deleteCount = 0; int childNodeListLength = 0, insertCount =0, updateCount =0, deleteCount = 0;
String delSql = ""; String delSql = "";
profileId = genericUtility.getColumnValue("profile_id", headerDom); profileId = genericUtility.getColumnValue("profile_id", headerDom);
System.out.println("profileId..............."+profileId); System.out.println("profileId..............."+profileId);
String batchInesertSql = "INSERT INTO USER_RIGHTS ( PROFILE_ID, APPLICATION, MENU_ROW, MENU_COL, MENU_SUBCOL, LEVEL_4, LEVEL_5, MENU_NAME, RIGHTS, OBJ_NAME)" String batchInesertSql = "INSERT INTO USER_RIGHTS ( PROFILE_ID, APPLICATION, MENU_ROW, MENU_COL, MENU_SUBCOL, LEVEL_4, LEVEL_5, MENU_NAME, RIGHTS, OBJ_NAME, ACC_FILT, DEF_FILT)"
+ " VALUES ( '" + profileId + "' , ?, ?, ?, ?, ?, ?, ?, ?,? )"; + " VALUES ( '" + profileId + "' , ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ? )";
System.out.println("Insert Sql :: " + batchInesertSql); System.out.println("Insert Sql :: " + batchInesertSql);
String batchUpdateSql = "UPDATE USER_RIGHTS SET " + String batchUpdateSql = "UPDATE USER_RIGHTS SET " +
" RIGHTS = ?, " + " RIGHTS = ?, " +
" OBJ_NAME = ? " + " OBJ_NAME = ?, " +
" WHERE PROFILE_ID = '" + profileId + "' " + " ACC_FILT = ?, " +
" AND APPLICATION = ? " + " DEF_FILT = ? " +
" AND MENU_ROW = ? " + " WHERE PROFILE_ID = '" + profileId + "' " +
" AND MENU_COL = ? " + " AND APPLICATION = ? " +
" AND MENU_SUBCOL = ? " + " AND MENU_ROW = ? " +
" AND LEVEL_4 = ? " + " AND MENU_COL = ? " +
" AND LEVEL_5 = ? "; " AND MENU_SUBCOL = ? " +
" AND LEVEL_4 = ? " +
String batchDeleteSql = " DELETE FROM USER_RIGHTS " + " AND LEVEL_5 = ? ";
" WHERE PROFILE_ID = '" + profileId + "' " +
" AND APPLICATION = ? " + String batchDeleteSql = " DELETE FROM USER_RIGHTS " +
" AND MENU_ROW = ? " + " WHERE PROFILE_ID = '" + profileId + "' " +
" AND MENU_COL = ? " + " AND APPLICATION = ? " +
" AND MENU_SUBCOL = ? " + " AND MENU_ROW = ? " +
" AND LEVEL_4 = ? " + " AND MENU_COL = ? " +
" AND LEVEL_5 = ? "; " AND MENU_SUBCOL = ? " +
" AND LEVEL_4 = ? " +
String searchKey = null; " AND LEVEL_5 = ? ";
int operation = 0;
String searchKey = null;
try int operation = 0;
{
try
{
if(conn == null)
{
connDriver = new ConnDriver(); if(conn == null)
conn = connDriver.getConnectDB("DriverITM"); {
conn.setAutoCommit(false); connDriver = new ConnDriver();
connDriver = null; conn = connDriver.getConnectDB("DriverITM");
pInsertStmt = conn.prepareStatement(batchInesertSql); conn.setAutoCommit(false);
pUpdateStmt = conn.prepareStatement(batchUpdateSql); connDriver = null;
pDeleteStmt = conn.prepareStatement(batchDeleteSql); pInsertStmt = conn.prepareStatement(batchInesertSql);
} pUpdateStmt = conn.prepareStatement(batchUpdateSql);
////////////////////////////////////////////////////////////////////// pDeleteStmt = conn.prepareStatement(batchDeleteSql);
// 08/10/13 manoharan re initialise if necessary }
//System.out.print("winNameMap before ["+ winNameMap + "]"); //////////////////////////////////////////////////////////////////////
//System.out.print("menuNameMap before [" + menuNameMap + "]"); // 08/10/13 manoharan re initialise if necessary
menuNameMap = null; //System.out.print("winNameMap before ["+ winNameMap + "]");
winNameMap = null; //System.out.print("menuNameMap before [" + menuNameMap + "]");
userRightsMap = null; menuNameMap = null;
winNameMap = null;
if (userRightsMap == null) userRightsMap = null;
{
userRightsMap = new HashMap(); if (userRightsMap == null)
} {
if (winNameMap == null) userRightsMap = new HashMap();
{ }
winNameMap = new HashMap(); if (winNameMap == null)
} {
if (menuNameMap == null) winNameMap = new HashMap();
{ }
menuNameMap = new HashMap(); if (menuNameMap == null)
populateMap(headerDom, detailDom, xtraParams); {
} menuNameMap = new HashMap();
populateMap(headerDom, detailDom, xtraParams); populateMap(headerDom, detailDom, xtraParams);
System.out.print("winNameMap after ["+ winNameMap + "]"); }
System.out.print("menuNameMap after [" + menuNameMap + "]"); populateMap(headerDom, detailDom, xtraParams);
// end 08/10/13 manoharan //////////////////////////////////////////////////////////////////// System.out.print("winNameMap after ["+ winNameMap + "]");
System.out.print("menuNameMap after [" + menuNameMap + "]");
// end 08/10/13 manoharan ////////////////////////////////////////////////////////////////////
parentNodeList = detailDom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
System.out.println("ParentNodeListLength....::- "+parentNodeListLength); parentNodeList = detailDom.getElementsByTagName("Detail2");
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++) parentNodeListLength = parentNodeList.getLength();
{ System.out.println("ParentNodeListLength....::- "+parentNodeListLength);
operation = 0; for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
parentNode = parentNodeList.item(selectedRow); {
childNodeList = parentNode.getChildNodes(); operation = 0;
childNodeListLength = childNodeList.getLength(); parentNode = parentNodeList.item(selectedRow);
System.out.println("ChildNodeListLength.........:-"+ childNodeListLength); childNodeList = parentNode.getChildNodes();
for (int childRow = 0; childRow < childNodeListLength; childRow++) childNodeListLength = childNodeList.getLength();
{ System.out.println("ChildNodeListLength.........:-"+ childNodeListLength);
for (int childRow = 0; childRow < childNodeListLength; childRow++)
childNode = childNodeList.item(childRow); {
childNodeName = childNode.getNodeName();
childNode = childNodeList.item(childRow);
if (childNodeName.equals("application")) childNodeName = childNode.getNodeName();
{
if (childNode.getFirstChild() != null) // **************** if (childNodeName.equals("application"))
{ {
application = (childNode.getFirstChild().getNodeValue()).trim(); if (childNode.getFirstChild() != null) // ****************
System.out.println("APPLICATION:::::["+ application+"]"); {
} application = (childNode.getFirstChild().getNodeValue()).trim();
System.out.println("APPLICATION:::::["+ application+"]");
} }
if (childNodeName.equals("level_1")) }
{
if (childNode.getFirstChild() != null) // **************** if (childNodeName.equals("level_1"))
{ {
level1 = (childNode.getFirstChild().getNodeValue()).trim(); if (childNode.getFirstChild() != null) // ****************
System.out.println("level1:::::"+ level1); {
} level1 = (childNode.getFirstChild().getNodeValue()).trim();
System.out.println("level1:::::"+ level1);
} }
if (childNodeName.equals("level_2"))
{ }
if (childNode.getFirstChild() != null) // **************** if (childNodeName.equals("level_2"))
{ {
level2 = (childNode.getFirstChild().getNodeValue()).trim(); if (childNode.getFirstChild() != null) // ****************
} {
System.out.println("level2:::::"+ level2); level2 = (childNode.getFirstChild().getNodeValue()).trim();
} }
System.out.println("level2:::::"+ level2);
if (childNodeName.equals("level_3")) }
{
if (childNode.getFirstChild() != null) // **************** if (childNodeName.equals("level_3"))
{ {
level3 = (childNode.getFirstChild().getNodeValue()).trim(); if (childNode.getFirstChild() != null) // ****************
} {
System.out.println("level3:::::"+ level3); level3 = (childNode.getFirstChild().getNodeValue()).trim();
} }
if (childNodeName.equals("level_4")) System.out.println("level3:::::"+ level3);
{ }
if (childNode.getFirstChild() != null) // **************** if (childNodeName.equals("level_4"))
{ {
level4 = (childNode.getFirstChild().getNodeValue()).trim(); if (childNode.getFirstChild() != null) // ****************
} {
System.out.println("level_4:::::"+ level4); level4 = (childNode.getFirstChild().getNodeValue()).trim();
} }
if (childNodeName.equals("level_5")) System.out.println("level_4:::::"+ level4);
{ }
if (childNodeName.equals("level_5"))
if (childNode.getFirstChild() != null) // **************** {
{
if (childNode.getFirstChild() != null) // **************** if (childNode.getFirstChild() != null) // ****************
{ {
level5 = (childNode.getFirstChild().getNodeValue()).trim(); if (childNode.getFirstChild() != null) // ****************
} {
} level5 = (childNode.getFirstChild().getNodeValue()).trim();
System.out.println("level_5:::::" + level5); }
} }
System.out.println("level_5:::::" + level5);
if (childNodeName.equals("descr")) }
{
if (childNode.getFirstChild() != null) // **************** if (childNodeName.equals("descr"))
{ {
menuName = (childNode.getFirstChild().getNodeValue()).trim(); if (childNode.getFirstChild() != null) // ****************
System.out.println("menu_name:::"+ menuName); {
} menuName = (childNode.getFirstChild().getNodeValue()).trim();
System.out.println("menu_name:::"+ menuName);
} }
if (childNodeName.equals("rights")) }
{
/*if (childNode.getFirstChild() != null) // **************** if (childNodeName.equals("rights"))
{*/// commented by akhilesh on 31/oct/12 {
/*if (childNode.getFirstChild() != null) // ****************
// added by akhilesh on 31/oct/12 for validation rights {*/// commented by akhilesh on 31/oct/12
if (childNode.getFirstChild() != null )
{ // added by akhilesh on 31/oct/12 for validation rights
rights = (childNode.getFirstChild().getNodeValue()); if (childNode.getFirstChild() != null )
} {
else rights = (childNode.getFirstChild().getNodeValue());
{ }
rights =""; else
} {
} rights ="";
} }
//winName=this.genericUtility.getColumnValue("win_name", detailDom); }
winName = genericUtility.getColumnValueFromNode("win_name",detailDom.getElementsByTagName("Detail2").item(selectedRow));// added by akhilesh on 22/nov/12
// added by mahesh on 16-06-2014
System.out.println("windowName ::::"+ windowName); if (childNodeName.equals("acc_filt"))
System.out.println("rights and winName ::::"+ rights+""+winName); {
if (childNode.getFirstChild() != null )
if(winName.trim().length() > 2) {
{ accFilt = (childNode.getFirstChild().getNodeValue());
objName =winName.substring(2); }
} else
System.out.println("objName ::::"+ objName); {
// commented by manoharan 26/02/13 comma delimiter should not be there in the rights accFilt ="";
//added by akhilesh on 08/oct/12 }
//String rightStr[] = rights.split(","); }
//for(int i= 0 ; i<rightStr.length; i++) if (childNodeName.equals("def_filt"))
//{ {
ArrayList relArray = new ArrayList(); // added by akhilesh on 31/oct/12 if (childNode.getFirstChild() != null )
ArrayList relArray1 = new ArrayList(); // added by akhilesh on 07/nov/12 {
defFilt = (childNode.getFirstChild().getNodeValue());
String selectSql = "SELECT DISTINCT (RIGHTS_CHAR) FROM OBJ_LINKS WHERE OBJ_NAME = ?"; }
pSelectStmt =conn.prepareStatement(selectSql); else
pSelectStmt.setString(1,objName); {
rs = pSelectStmt.executeQuery(); defFilt ="";
while(rs.next()) }
{ }
relArray.add(rs.getString(1)); // end Of Code added by mahesh
} }
System.out.println("relArray and rights value 1 ["+relArray + "]"); //winName=this.genericUtility.getColumnValue("win_name", detailDom);
winName = genericUtility.getColumnValueFromNode("win_name",detailDom.getElementsByTagName("Detail2").item(selectedRow));// added by akhilesh on 22/nov/12
rs.close();
rs = null; System.out.println("windowName ::::"+ windowName);
pSelectStmt.close(); System.out.println("rights and winName ::::"+ rights+""+winName);
pSelectStmt = null;
if(winName.trim().length() > 2)
// added by akhilesh on 07/nov/12 {
String selectSql1 = "SELECT DISTINCT (RIGHTS_CHAR) FROM OBJ_ACTIONS WHERE OBJ_NAME = ?"; objName =winName.substring(2);
pSelectStmt =conn.prepareStatement(selectSql1); }
pSelectStmt.setString(1,objName); System.out.println("objName ::::"+ objName);
rs = pSelectStmt.executeQuery(); // commented by manoharan 26/02/13 comma delimiter should not be there in the rights
while(rs.next()) //added by akhilesh on 08/oct/12
{ //String rightStr[] = rights.split(",");
relArray.add(rs.getString(1)); //for(int i= 0 ; i<rightStr.length; i++)
} //{
relArray.add("V"); ArrayList relArray = new ArrayList(); // added by akhilesh on 31/oct/12
relArray.add("#"); ArrayList relArray1 = new ArrayList(); // added by akhilesh on 07/nov/12
relArray.add("$");
relArray.add("*"); String selectSql = "SELECT DISTINCT (RIGHTS_CHAR) FROM OBJ_LINKS WHERE OBJ_NAME = ?";
relArray.add("A"); // 11/10/13 manoharan y default add add/edit rights pSelectStmt =conn.prepareStatement(selectSql);
relArray.add("E");// 11/10/13 manoharan y default add add/edit rights pSelectStmt.setString(1,objName);
rs = pSelectStmt.executeQuery();
relArray.add("C"); //added by akhilesh on 26/JULY/2013 for Copy Transaction option while(rs.next())
relArray.add("M"); //added by akhilesh on 24/JULY/2013 for Comments option {
relArray.add(rs.getString(1));
relArray.add("T"); //added by akhilesh on 24/JULY/2013 for attachment option }
System.out.println("relArray and rights value 1 ["+relArray + "]");
relArray.add("B"); //added by Sanjaya on 27/Nov/2013[WS3GSUN010] for delete attachment on right basis
relArray.add("J"); //added by Sanjaya on 24/JULY/2013[WS3GSUN010] for delete attachment on right basis rs.close();
relArray.add("U"); //added by Sanjaya on 24/JULY/2013[WS3GSUN010] for delete attachment on right basis rs = null;
pSelectStmt.close();
System.out.println("relArray and rights value 2 ["+relArray + "]"); pSelectStmt = null;
rs.close(); // added by akhilesh on 07/nov/12
rs = null; String selectSql1 = "SELECT DISTINCT (RIGHTS_CHAR) FROM OBJ_ACTIONS WHERE OBJ_NAME = ?";
pSelectStmt.close(); pSelectStmt =conn.prepareStatement(selectSql1);
pSelectStmt = null; pSelectStmt.setString(1,objName);
//ended by akhilesh rs = pSelectStmt.executeQuery();
rightChar = ""; while(rs.next())
for (int iCtr = 0; iCtr < rights.trim().length(); iCtr++) {
{ relArray.add(rs.getString(1));
rightChar = rights.substring(iCtr,iCtr+1); }
System.out.println("iCtr [" + iCtr + "] relArray ["+relArray+" ] rightChar ["+ rightChar + "] rights [" + rights + "]"); relArray.add("V");
//if(!(relArray1.contains(rightStr[i]) || relArray.contains(rightStr[i]) || "*".equals(rightStr[i]) || "".equals(rightStr[i]))) relArray.add("#");
//if(!(relArray.contains(rightChar) || "*".equals(rightChar) || "".equals(rightChar) || "$".equals(rightChar) || "#".equals(rightChar) )) relArray.add("$");
if(!relArray.contains(rightChar)) relArray.add("*");
{ relArray.add("A"); // 11/10/13 manoharan y default add add/edit rights
System.out.println("r************"+relArray+""+rights); relArray.add("E");// 11/10/13 manoharan y default add add/edit rights
returnString="VTRIGHT";
returnString = itmDBAccessEJB.getErrorString("",returnString,"","",conn); relArray.add("C"); //added by akhilesh on 26/JULY/2013 for Copy Transaction option
return returnString; relArray.add("M"); //added by akhilesh on 24/JULY/2013 for Comments option
}
} relArray.add("T"); //added by akhilesh on 24/JULY/2013 for attachment option
//}
//ended by akhilesh relArray.add("B"); //added by Sanjaya on 27/Nov/2013[WS3GSUN010] for delete attachment on right basis
relArray.add("J"); //added by Sanjaya on 24/JULY/2013[WS3GSUN010] for delete attachment on right basis
relArray.add("U"); //added by Sanjaya on 24/JULY/2013[WS3GSUN010] for delete attachment on right basis
/*}commented by akhilesh on 31/oct/12
else System.out.println("relArray and rights value 2 ["+relArray + "]");
rights = null;*/
rs.close();
rs = null;
// 01/06/10 manoharan pSelectStmt.close();
if (level1 == null || level1.trim().length() == 0) pSelectStmt = null;
{ //ended by akhilesh
level1 = "0"; rightChar = "";
} for (int iCtr = 0; iCtr < rights.trim().length(); iCtr++)
if (level2 == null || level2.trim().length() == 0) {
{ rightChar = rights.substring(iCtr,iCtr+1);
level2 = "0"; System.out.println("iCtr [" + iCtr + "] relArray ["+relArray+" ] rightChar ["+ rightChar + "] rights [" + rights + "]");
} //if(!(relArray1.contains(rightStr[i]) || relArray.contains(rightStr[i]) || "*".equals(rightStr[i]) || "".equals(rightStr[i])))
if (level3 == null || level3.trim().length() == 0) //if(!(relArray.contains(rightChar) || "*".equals(rightChar) || "".equals(rightChar) || "$".equals(rightChar) || "#".equals(rightChar) ))
{ if(!relArray.contains(rightChar))
level3 = "0"; {
} System.out.println("r************"+relArray+""+rights);
if (level4 == null || level4.trim().length() == 0) returnString="VTRIGHT";
{ returnString = itmDBAccessEJB.getErrorString("",returnString,"","",conn);
level4 = "0"; return returnString;
} }
if (level5 == null || level5.trim().length() == 0) }
{ //}
level5 = "0"; //ended by akhilesh
}
// end 01/06/10 manoharan
searchKey = application + ":" + level1 + ":" + level2 + ":" + level3 + ":" + level4 + ":" + level5; /*}commented by akhilesh on 31/oct/12
// else
//get all submenu if found rights = null;*/
ArrayList subMenuList = null;
subMenuList = getAllSubMenu(application, Integer.parseInt(level1), Integer.parseInt(level2), Integer.parseInt(level3), Integer.parseInt(level4), Integer.parseInt(level5), conn); // 01/06/10 manoharan
if (level1 == null || level1.trim().length() == 0)
System.out.println("SubMenu List :: " + subMenuList.toString()); {
// level1 = "0";
}
//operation = searchUserRight(searchKey, rights); if (level2 == null || level2.trim().length() == 0)
//if(subMenuList != null) // 08/10/13 manoharan commented {
if(subMenuList != null && subMenuList.size() > 0) level2 = "0";
{ }
for(int index = 0; index < subMenuList.size(); index++) if (level3 == null || level3.trim().length() == 0)
{ {
String searchStr = null; level3 = "0";
searchStr = (String)subMenuList.get(index); }
objName = ""; if (level4 == null || level4.trim().length() == 0)
System.out.print("searchStr [" + searchStr +"]["+index+"]["+subMenuList.size() + "]"); {
//System.out.print("winNameMap ["+ winNameMap + "]"); level4 = "0";
//System.out.print("menuNameMap [" + menuNameMap + "]"); }
objName = (String)winNameMap.get(searchStr); if (level5 == null || level5.trim().length() == 0)
System.out.print("obj name @@@@@@@@@@@@"+objName+""+searchStr+""+index+""+subMenuList.size()); {
//Get parameters from searchStr level5 = "0";
StringTokenizer subMenuToken = new StringTokenizer(searchStr, ":"); }
// end 01/06/10 manoharan
if(subMenuToken.hasMoreTokens()) searchKey = application + ":" + level1 + ":" + level2 + ":" + level3 + ":" + level4 + ":" + level5;
application = subMenuToken.nextToken(); //
if(subMenuToken.hasMoreTokens()) //get all submenu if found
level1 = subMenuToken.nextToken(); ArrayList subMenuList = null;
if(subMenuToken.hasMoreTokens())
level2 = subMenuToken.nextToken(); subMenuList = getAllSubMenu(application, Integer.parseInt(level1), Integer.parseInt(level2), Integer.parseInt(level3), Integer.parseInt(level4), Integer.parseInt(level5), conn);
if(subMenuToken.hasMoreTokens())
level3 = subMenuToken.nextToken(); System.out.println("SubMenu List :: " + subMenuList.toString());
if(subMenuToken.hasMoreTokens()) //
level4 = subMenuToken.nextToken();
if(subMenuToken.hasMoreTokens()) //operation = searchUserRight(searchKey, rights);
level5 = subMenuToken.nextToken(); //if(subMenuList != null) // 08/10/13 manoharan commented
if(subMenuList != null && subMenuList.size() > 0)
menuName = (String)menuNameMap.get(searchStr); {
for(int index = 0; index < subMenuList.size(); index++)
System.out.println("SerarchStr = " + searchStr + " :: " + application + " : " + level1 + " : " + level2 + " : " + level3 + " : " + level4 + " : " + level5); {
// 01/06/10 manoharan String searchStr = null;
//operation = searchUserRight(searchStr, rights); searchStr = (String)subMenuList.get(index);
operation = searchUserRight(profileId, application,Integer.parseInt(level1),Integer.parseInt(level2),Integer.parseInt(level3),Integer.parseInt(level4),Integer.parseInt(level5),rights,conn); objName = "";
// end 01/06/10 manoharan System.out.print("searchStr [" + searchStr +"]["+index+"]["+subMenuList.size() + "]");
System.out.println("Operation ["+ operation +"]"); //System.out.print("winNameMap ["+ winNameMap + "]");
/* //System.out.print("menuNameMap [" + menuNameMap + "]");
1 - insert objName = (String)winNameMap.get(searchStr);
2 - update System.out.print("obj name @@@@@@@@@@@@"+objName+""+searchStr+""+index+""+subMenuList.size());
3 - delete //Get parameters from searchStr
*/ StringTokenizer subMenuToken = new StringTokenizer(searchStr, ":");
if(operation == 1 && rights.trim().length() > 0) if(subMenuToken.hasMoreTokens())
{ application = subMenuToken.nextToken();
//pInsertStmt.setString(1, profileId); if(subMenuToken.hasMoreTokens())
pInsertStmt.setString(1, application); level1 = subMenuToken.nextToken();
pInsertStmt.setInt(2, Integer.parseInt(level1)); if(subMenuToken.hasMoreTokens())
pInsertStmt.setInt(3, Integer.parseInt(level2)); level2 = subMenuToken.nextToken();
pInsertStmt.setInt(4, Integer.parseInt(level3)); if(subMenuToken.hasMoreTokens())
pInsertStmt.setInt(5, Integer.parseInt(level4)); level3 = subMenuToken.nextToken();
pInsertStmt.setInt(6, Integer.parseInt(level5)); if(subMenuToken.hasMoreTokens())
pInsertStmt.setString(7, menuName); level4 = subMenuToken.nextToken();
pInsertStmt.setString(8, rights.trim()); if(subMenuToken.hasMoreTokens())
pInsertStmt.setString(9, objName); level5 = subMenuToken.nextToken();
insertCount++;
pInsertStmt.addBatch(); menuName = (String)menuNameMap.get(searchStr);
}
else if(operation == 2) System.out.println("SerarchStr = " + searchStr + " :: " + application + " : " + level1 + " : " + level2 + " : " + level3 + " : " + level4 + " : " + level5);
{ // 01/06/10 manoharan
pUpdateStmt.setString(1, rights.trim()); //operation = searchUserRight(searchStr, rights);
//pUpdateStmt.setString(2, profileId); operation = searchUserRight(profileId, application,Integer.parseInt(level1),Integer.parseInt(level2),Integer.parseInt(level3),Integer.parseInt(level4),Integer.parseInt(level5),rights,conn);
pUpdateStmt.setString(2, objName); // end 01/06/10 manoharan
pUpdateStmt.setString(3, application); System.out.println("Operation ["+ operation +"]");
pUpdateStmt.setInt(4, Integer.parseInt(level1)); /*
pUpdateStmt.setInt(5, Integer.parseInt(level2)); 1 - insert
pUpdateStmt.setInt(6, Integer.parseInt(level3)); 2 - update
pUpdateStmt.setInt(7, Integer.parseInt(level4)); 3 - delete
pUpdateStmt.setInt(8, Integer.parseInt(level5)); */
updateCount++;
pUpdateStmt.addBatch(); if(operation == 1 && rights.trim().length() > 0)
} {
else if(operation == 3) //pInsertStmt.setString(1, profileId);
{ pInsertStmt.setString(1, application);
//pDeleteStmt.setString(1, profileId); pInsertStmt.setInt(2, Integer.parseInt(level1));
pDeleteStmt.setString(1, application); pInsertStmt.setInt(3, Integer.parseInt(level2));
pDeleteStmt.setInt(2, Integer.parseInt(level1)); pInsertStmt.setInt(4, Integer.parseInt(level3));
pDeleteStmt.setInt(3, Integer.parseInt(level2)); pInsertStmt.setInt(5, Integer.parseInt(level4));
pDeleteStmt.setInt(4, Integer.parseInt(level3)); pInsertStmt.setInt(6, Integer.parseInt(level5));
pDeleteStmt.setInt(5, Integer.parseInt(level4)); pInsertStmt.setString(7, menuName);
pDeleteStmt.setInt(6, Integer.parseInt(level5)); pInsertStmt.setString(8, rights.trim());
deleteCount++; pInsertStmt.setString(9, objName);
pDeleteStmt.addBatch(); // Added by mahesh on 16-06-2014
} pInsertStmt.setString(10, accFilt);
}//End of subMenuList iteration for loop pInsertStmt.setString(11, defFilt);
}//End of if subMenuList is not null insertCount++;
//} pInsertStmt.addBatch();
}//outer for }
else if(operation == 2)
if (insertCount > 0) {
{ pUpdateStmt.setString(1, rights.trim());
System.out.println("Before Delete Batch"); //pUpdateStmt.setString(2, profileId);
pInsertStmt.executeBatch(); pUpdateStmt.setString(2, objName);
System.out.println("After Insert Batch" ); // Added by mahesh on 16-06-2014
} pUpdateStmt.setString(3, accFilt);
pUpdateStmt.setString(4, defFilt);
if (updateCount > 0) // End of code added by mahesh
{ pUpdateStmt.setString(5, application);
System.out.println("Before Update Batch"); pUpdateStmt.setInt(6, Integer.parseInt(level1));
pUpdateStmt.executeBatch(); pUpdateStmt.setInt(7, Integer.parseInt(level2));
System.out.println("After Update Batch = "); pUpdateStmt.setInt(8, Integer.parseInt(level3));
} pUpdateStmt.setInt(9, Integer.parseInt(level4));
pUpdateStmt.setInt(10, Integer.parseInt(level5));
if (deleteCount > 0) updateCount++;
{ pUpdateStmt.addBatch();
System.out.println("Before Delete Batch"); }
pDeleteStmt.executeBatch(); else if(operation == 3)
System.out.println("After Delete Batch = "); {
} //pDeleteStmt.setString(1, profileId);
pDeleteStmt.setString(1, application);
conn.commit(); pDeleteStmt.setInt(2, Integer.parseInt(level1));
System.out.println("After Commit"); pDeleteStmt.setInt(3, Integer.parseInt(level2));
} pDeleteStmt.setInt(4, Integer.parseInt(level3));
catch(BatchUpdateException be) pDeleteStmt.setInt(5, Integer.parseInt(level4));
{ pDeleteStmt.setInt(6, Integer.parseInt(level5));
be.printStackTrace(); deleteCount++;
returnString = be.getMessage(); pDeleteStmt.addBatch();
System.out.println("BatchUpdateException :RunMRPPrcEJB: CreatePlanDemand(ADPElement)" + returnString); }
System.out.println("Detail Exception : " + be.getNextException()); }//End of subMenuList iteration for loop
throw new ITMException(be);// added by akhilesh on 31/oct/12 }//End of if subMenuList is not null
} //}
catch (SQLException ex) }//outer for
{
returnString = ex.getMessage(); if (insertCount > 0)
try{conn.rollback(); {
}catch(Exception e){ System.out.println("Before Delete Batch");
throw new ITMException(e);// added by akhilesh on 31/oct/12 pInsertStmt.executeBatch();
} System.out.println("After Insert Batch" );
ex.printStackTrace(); }
throw new ITMException(ex);// added by akhilesh on 31/oct/12 if (updateCount > 0)
} {
catch (Exception e) System.out.println("Before Update Batch");
{ pUpdateStmt.executeBatch();
returnString = e.getMessage(); System.out.println("After Update Batch = ");
try{ }
conn.rollback();
}catch(Exception ec){ if (deleteCount > 0)
throw new ITMException(ec);// added by akhilesh on 31/oct/12 {
} System.out.println("Before Delete Batch");
pDeleteStmt.executeBatch();
e.printStackTrace(); System.out.println("After Delete Batch = ");
throw new ITMException(e);// added by akhilesh on 31/oct/12 }
}
finally conn.commit();
{ System.out.println("After Commit");
try }
{ catch(BatchUpdateException be)
userRightsMap = null; {
winNameMap = null; be.printStackTrace();
menuNameMap = null; returnString = be.getMessage();
System.out.println("BatchUpdateException :RunMRPPrcEJB: CreatePlanDemand(ADPElement)" + returnString);
profileId = null; System.out.println("Detail Exception : " + be.getNextException());
throw new ITMException(be);// added by akhilesh on 31/oct/12
pInsertStmt.close(); }
pInsertStmt = null; catch (SQLException ex)
pUpdateStmt.close(); {
pUpdateStmt = null; returnString = ex.getMessage();
pDeleteStmt.close(); try{conn.rollback();
pDeleteStmt = null; }catch(Exception e){
throw new ITMException(e);// added by akhilesh on 31/oct/12
conn.close(); }
conn = null; ex.printStackTrace();
}catch(Exception e){ throw new ITMException(ex);// added by akhilesh on 31/oct/12
throw new ITMException(e);// added by akhilesh on 31/oct/12 }
} catch (Exception e)
//return returnString; {
} returnString = e.getMessage();
try{
if (returnString == null || returnString.trim().length() == 0) conn.rollback();
{ }catch(Exception ec){
System.out.println("errString is null************** "); throw new ITMException(ec);// added by akhilesh on 31/oct/12
returnString="VTCOMPL"; }
returnString = itmDBAccessEJB.getErrorString("",returnString,"","",conn);
return returnString; e.printStackTrace();
} throw new ITMException(e);// added by akhilesh on 31/oct/12
else }
{ finally
System.out.println("errString is not null ***************"); {
returnString="VTPRCERR"; try
returnString = itmDBAccessEJB.getErrorString("",returnString,"","",conn); {
return returnString; userRightsMap = null;
} winNameMap = null;
menuNameMap = null;
}//process()
profileId = null;
/* 1 - insert
2- update pInsertStmt.close();
3-delete pInsertStmt = null;
Searches HashMap for availability of rights for searchKey pUpdateStmt.close();
if Not Found and rights is not null then pUpdateStmt = null;
return 1 pDeleteStmt.close();
else if Found and rights is not null then pDeleteStmt = null;
return 2
else if Found and rights = null conn.close();
return 3 conn = null;
*/
// 01/06/10 manoharan }catch(Exception e){
int searchUserRight(String profileId, String application,int level1,int level2,int level3,int level4,int level5, String rights,Connection conn) throws Exception throw new ITMException(e);// added by akhilesh on 31/oct/12
{ }
//return returnString;
PreparedStatement pstmt = null; }
ResultSet rs = null;
String alreadyExists = "N"; if (returnString == null || returnString.trim().length() == 0)
String foundRights = null; {
int operation = -1; System.out.println("errString is null************** ");
String sql = " SELECT RIGHTS FROM USER_RIGHTS " returnString="VTCOMPL";
+ " WHERE PROFILE_ID = ? " returnString = itmDBAccessEJB.getErrorString("",returnString,"","",conn);
+ " AND APPLICATION = ? " return returnString;
+ " AND MENU_ROW = ? " }
+ " AND MENU_COL = ? " else
+ " AND MENU_SUBCOL = ? " {
+ " AND LEVEL_4 = ? " System.out.println("errString is not null ***************");
+ " AND LEVEL_5 = ? "; returnString="VTPRCERR";
try { returnString = itmDBAccessEJB.getErrorString("",returnString,"","",conn);
pstmt = conn.prepareStatement(sql); return returnString;
}
pstmt.setString(1,profileId); }//process()
pstmt.setString(2,application);
pstmt.setInt(3,level1); /* 1 - insert
pstmt.setInt(4,level2); 2- update
pstmt.setInt(5,level3); 3-delete
pstmt.setInt(6,level4); Searches HashMap for availability of rights for searchKey
pstmt.setInt(7,level5); if Not Found and rights is not null then
rs = pstmt.executeQuery(); return 1
if (rs.next()) else if Found and rights is not null then
{ return 2
foundRights = rs.getString(1); else if Found and rights = null
alreadyExists = "Y"; return 3
} */
rs.close(); // 01/06/10 manoharan
rs = null; int searchUserRight(String profileId, String application,int level1,int level2,int level3,int level4,int level5, String rights,Connection conn) throws Exception
pstmt.close(); {
pstmt = null;
//foundRights = (String) userRightsMap.get(searchKey); PreparedStatement pstmt = null;
System.out.println("Found rights in function before ["+foundRights+"] rights [" + rights +"] alreadyExists [" + alreadyExists + "]"); ResultSet rs = null;
if (foundRights != null && foundRights.trim().length() == 0) String alreadyExists = "N";
{ String foundRights = null;
foundRights = null; int operation = -1;
} String sql = " SELECT RIGHTS FROM USER_RIGHTS "
if (rights != null && rights.trim().length() == 0) + " WHERE PROFILE_ID = ? "
{ + " AND APPLICATION = ? "
rights = null; + " AND MENU_ROW = ? "
} + " AND MENU_COL = ? "
System.out.println("Found rights in function after ["+foundRights+"] rights [" + rights +"] alreadyExists [" + alreadyExists + "]"); + " AND MENU_SUBCOL = ? "
+ " AND LEVEL_4 = ? "
if( (foundRights == null || foundRights.trim().length() == 0) && (rights != null && rights.trim().length() > 0 ) && "N".equals(alreadyExists)) + " AND LEVEL_5 = ? ";
operation = 1; try {
else if(( (foundRights != null && foundRights.trim().length() > 0 ) && (rights != null && rights.trim().length() > 0 ) ) || ("Y".equals(alreadyExists) && (foundRights == null || foundRights.trim().length() == 0 ) && (rights != null && rights.trim().length() > 0 ) ) ) pstmt = conn.prepareStatement(sql);
operation = 2;
else if((foundRights != null && foundRights.trim().length() > 0 ) && (rights == null || rights.trim().length() == 0) && "Y".equals(alreadyExists))
operation = 3; pstmt.setString(1,profileId);
pstmt.setString(2,application);
System.out.println("Found rights in function operation [" + operation + "] foundRights ["+foundRights+"] rights [" + rights +"] alreadyExists [" + alreadyExists + "]"); pstmt.setInt(3,level1);
} pstmt.setInt(4,level2);
catch (Exception e) pstmt.setInt(5,level3);
{ pstmt.setInt(6,level4);
e.printStackTrace(); pstmt.setInt(7,level5);
throw new ITMException(e);// added by akhilesh on 31/oct/12 rs = pstmt.executeQuery();
} if (rs.next())
finally {
{ foundRights = rs.getString(1);
if (rs != null) alreadyExists = "Y";
{ }
rs.close(); rs.close();
rs = null; rs = null;
} pstmt.close();
if (pstmt != null) pstmt = null;
{ //foundRights = (String) userRightsMap.get(searchKey);
pstmt.close(); System.out.println("Found rights in function before ["+foundRights+"] rights [" + rights +"] alreadyExists [" + alreadyExists + "]");
pstmt = null; if (foundRights != null && foundRights.trim().length() == 0)
} {
foundRights = null;
} }
if (rights != null && rights.trim().length() == 0)
return operation; {
} rights = null;
// end 01/06/10 manoharan }
int searchUserRight(String searchKey, String rights) throws Exception System.out.println("Found rights in function after ["+foundRights+"] rights [" + rights +"] alreadyExists [" + alreadyExists + "]");
{
String foundRights = null; if( (foundRights == null || foundRights.trim().length() == 0) && (rights != null && rights.trim().length() > 0 ) && "N".equals(alreadyExists))
int operation = -1; operation = 1;
try { else if(( (foundRights != null && foundRights.trim().length() > 0 ) && (rights != null && rights.trim().length() > 0 ) ) || ("Y".equals(alreadyExists) && (foundRights == null || foundRights.trim().length() == 0 ) && (rights != null && rights.trim().length() > 0 ) ) )
operation = 2;
else if((foundRights != null && foundRights.trim().length() > 0 ) && (rights == null || rights.trim().length() == 0) && "Y".equals(alreadyExists))
operation = 3;
System.out.println("searchKey in function ["+searchKey+"]");
System.out.println("rights in function ["+rights+"]"); System.out.println("Found rights in function operation [" + operation + "] foundRights ["+foundRights+"] rights [" + rights +"] alreadyExists [" + alreadyExists + "]");
foundRights = (String) userRightsMap.get(searchKey); }
catch (Exception e)
System.out.println("Found rights in function ["+foundRights+"]"); {
e.printStackTrace();
if(foundRights == null && rights != null) throw new ITMException(e);// added by akhilesh on 31/oct/12
operation = 1; }
else if(foundRights != null && rights != null) finally
operation = 2; {
else if(foundRights != null && rights == null) if (rs != null)
operation = 3; {
} rs.close();
catch (Exception e) rs = null;
{ }
e.printStackTrace(); if (pstmt != null)
throw new ITMException(e);// added by akhilesh on 31/oct/12 {
} pstmt.close();
return operation; pstmt = null;
} }
private ArrayList getAllSubMenu(String application, int level1, int level2, int level3, int level4, int level5, Connection conn) throws Exception }
{
String tApplication = null; return operation;
String tKey = null; }
String tWinName = null; // end 01/06/10 manoharan
ArrayList subMenuList = new ArrayList(); int searchUserRight(String searchKey, String rights) throws Exception
PreparedStatement pstmt = null; {
ResultSet rs = null; String foundRights = null;
String parentKey = ""; int operation = -1;
int tLevel1 = 0; try {
int tLevel2 = 0;
int tLevel3 = 0;
int tLevel4 = 0;
int tLevel5 = 0; System.out.println("searchKey in function ["+searchKey+"]");
String tMenuName = null; System.out.println("rights in function ["+rights+"]");
foundRights = (String) userRightsMap.get(searchKey);
String gotUserRights = null;
System.out.println("Found rights in function ["+foundRights+"]");
String getSubMenuSql = " SELECT APPLICATION, LEVEL_1, LEVEL_2, LEVEL_3, LEVEL_4, LEVEL_5, WIN_NAME, DESCR FROM ITM2MENU " +
" where APPLICATION = '" + application + "' " + if(foundRights == null && rights != null)
" and ( level_1 = 0 or (level_1 <> 0 and (LEVEL_1 = " + level1 + " AND LEVEL_2 > 0))) " + operation = 1;
" and ( level_2 = 0 or (level_2 <> 0 and (LEVEL_2 = " + level2 + " AND LEVEL_3 > 0))) " + else if(foundRights != null && rights != null)
" and ( level_3 = 0 or ( level_3 <> 0 and (LEVEL_3 = " + level3 + " AND LEVEL_4 > 0))) " + operation = 2;
" and ( level_4 = 0 or ( level_4 <> 0 and (LEVEL_4 = " + level4 + " AND LEVEL_5 > 0))) " + else if(foundRights != null && rights == null)
" and WIN_NAME <> '-' " ; operation = 3;
}
System.out.println("Get All Sub Menu SQL :: " + getSubMenuSql); catch (Exception e)
{
parentKey = application + ":" + level1 + ":" + level2 + ":" + level3 + ":" + level4 + ":" + level5; e.printStackTrace();
throw new ITMException(e);// added by akhilesh on 31/oct/12
try }
{ return operation;
}
////////////////////////////////////////////////////////////////////// private ArrayList getAllSubMenu(String application, int level1, int level2, int level3, int level4, int level5, Connection conn) throws Exception
// 08/10/13 manoharan re initialise if necessary {
if (userRightsMap == null) String tApplication = null;
{ String tKey = null;
userRightsMap = new HashMap(); String tWinName = null;
} ArrayList subMenuList = new ArrayList();
if (winNameMap == null) PreparedStatement pstmt = null;
{ ResultSet rs = null;
winNameMap = new HashMap(); String parentKey = "";
} int tLevel1 = 0;
if (menuNameMap == null) int tLevel2 = 0;
{ int tLevel3 = 0;
menuNameMap = new HashMap(); int tLevel4 = 0;
} int tLevel5 = 0;
// end 08/10/13 manoharan //////////////////////////////////////////////////////////////////// String tMenuName = null;
pstmt = conn.prepareStatement(getSubMenuSql);
String gotUserRights = null;
rs = pstmt.executeQuery();
String getSubMenuSql = " SELECT APPLICATION, LEVEL_1, LEVEL_2, LEVEL_3, LEVEL_4, LEVEL_5, WIN_NAME, DESCR FROM ITM2MENU " +
while(rs.next()) " where APPLICATION = '" + application + "' " +
{ " and ( level_1 = 0 or (level_1 <> 0 and (LEVEL_1 = " + level1 + " AND LEVEL_2 > 0))) " +
tApplication = rs.getString(1); " and ( level_2 = 0 or (level_2 <> 0 and (LEVEL_2 = " + level2 + " AND LEVEL_3 > 0))) " +
tLevel1 = rs.getInt(2); " and ( level_3 = 0 or ( level_3 <> 0 and (LEVEL_3 = " + level3 + " AND LEVEL_4 > 0))) " +
tLevel2 = rs.getInt(3); " and ( level_4 = 0 or ( level_4 <> 0 and (LEVEL_4 = " + level4 + " AND LEVEL_5 > 0))) " +
tLevel3 = rs.getInt(4); " and WIN_NAME <> '-' " ;
tLevel4 = rs.getInt(5);
tLevel5 = rs.getInt(6); System.out.println("Get All Sub Menu SQL :: " + getSubMenuSql);
tWinName = rs.getString(7);
tKey = tApplication + ":" + tLevel1 + ":" + tLevel2 + ":" + tLevel3 + ":" + tLevel4 + ":" + tLevel5; parentKey = application + ":" + level1 + ":" + level2 + ":" + level3 + ":" + level4 + ":" + level5;
System.out.println("tKey [" + tKey + "] tWinName [" + tWinName + "]");
subMenuList.add(tKey); try
{
tMenuName = rs.getString(8);
if(!menuNameMap.containsKey(tKey))
menuNameMap.put(tKey, tMenuName); //////////////////////////////////////////////////////////////////////
// 08/10/13 manoharan re initialise if necessary
winNameMap.put(tKey, tWinName.trim().substring(2, tWinName.trim().length())); if (userRightsMap == null)
gotUserRights = (String) userRightsMap.get(tKey); {
if(gotUserRights == null || gotUserRights.trim().length() == 0){ userRightsMap = new HashMap();
gotUserRights = getUserRights(profileId, tApplication, tLevel1, tLevel2, tLevel3, tLevel4, tLevel5, conn); }
if(gotUserRights != null && gotUserRights.trim().length() > 0) if (winNameMap == null)
userRightsMap.put(tKey, gotUserRights); {
} winNameMap = new HashMap();
} }
if (menuNameMap == null)
rs.close(); {
rs = null; menuNameMap = new HashMap();
}
pstmt.close(); // end 08/10/13 manoharan ////////////////////////////////////////////////////////////////////
pstmt = null; pstmt = conn.prepareStatement(getSubMenuSql);
if(subMenuList.size() == 0) rs = pstmt.executeQuery();
{
while(rs.next())
{
// 08/10/13 manoharan in order to avoid nullpointer exception - get the win_name, menu_name and rights also and add to the corresponding map tApplication = rs.getString(1);
////////////////////////////////////////////////////////////////////////////////////////////// tLevel1 = rs.getInt(2);
//subMenuList.add(parentKey); // commented and following code added tLevel2 = rs.getInt(3);
System.out.println("parentKey [" + parentKey + "] no submenu found so adding parent key"); tLevel3 = rs.getInt(4);
getSubMenuSql = " SELECT APPLICATION, LEVEL_1, LEVEL_2, LEVEL_3, LEVEL_4, LEVEL_5, WIN_NAME, DESCR FROM ITM2MENU " + tLevel4 = rs.getInt(5);
" where APPLICATION = '" + application + "' " + tLevel5 = rs.getInt(6);
" and LEVEL_1 = " + level1 + " " + tWinName = rs.getString(7);
" and LEVEL_2 = " + level2 + " " + tKey = tApplication + ":" + tLevel1 + ":" + tLevel2 + ":" + tLevel3 + ":" + tLevel4 + ":" + tLevel5;
" and LEVEL_3 = " + level3 + " " + System.out.println("tKey [" + tKey + "] tWinName [" + tWinName + "]");
" and LEVEL_4 = " + level4 + " " + subMenuList.add(tKey);
" and WIN_NAME <> '-' " ;
tMenuName = rs.getString(8);
System.out.println("Get Menu SQL :: " + getSubMenuSql); if(!menuNameMap.containsKey(tKey))
menuNameMap.put(tKey, tMenuName);
pstmt = conn.prepareStatement(getSubMenuSql);
winNameMap.put(tKey, tWinName.trim().substring(2, tWinName.trim().length()));
rs = pstmt.executeQuery(); gotUserRights = (String) userRightsMap.get(tKey);
if(gotUserRights == null || gotUserRights.trim().length() == 0){
if(rs.next()) gotUserRights = getUserRights(profileId, tApplication, tLevel1, tLevel2, tLevel3, tLevel4, tLevel5, conn);
{ if(gotUserRights != null && gotUserRights.trim().length() > 0)
tApplication = rs.getString(1); userRightsMap.put(tKey, gotUserRights);
tLevel1 = rs.getInt(2); }
tLevel2 = rs.getInt(3); }
tLevel3 = rs.getInt(4);
tLevel4 = rs.getInt(5); rs.close();
tLevel5 = rs.getInt(6); rs = null;
tWinName = rs.getString(7);
tKey = tApplication + ":" + tLevel1 + ":" + tLevel2 + ":" + tLevel3 + ":" + tLevel4 + ":" + tLevel5; pstmt.close();
System.out.println("tKey [" + tKey + "] tWinName [" + tWinName + "]"); pstmt = null;
subMenuList.add(tKey);
if(subMenuList.size() == 0)
tMenuName = rs.getString(8); {
if(!menuNameMap.containsKey(tKey))
menuNameMap.put(tKey, tMenuName);
// 08/10/13 manoharan in order to avoid nullpointer exception - get the win_name, menu_name and rights also and add to the corresponding map
winNameMap.put(tKey, tWinName.trim().substring(2, tWinName.trim().length())); //////////////////////////////////////////////////////////////////////////////////////////////
gotUserRights = (String) userRightsMap.get(tKey); //subMenuList.add(parentKey); // commented and following code added
if(gotUserRights == null || gotUserRights.trim().length() == 0){ System.out.println("parentKey [" + parentKey + "] no submenu found so adding parent key");
gotUserRights = getUserRights(profileId, tApplication, tLevel1, tLevel2, tLevel3, tLevel4, tLevel5, conn); getSubMenuSql = " SELECT APPLICATION, LEVEL_1, LEVEL_2, LEVEL_3, LEVEL_4, LEVEL_5, WIN_NAME, DESCR FROM ITM2MENU " +
if(gotUserRights != null && gotUserRights.trim().length() > 0) " where APPLICATION = '" + application + "' " +
userRightsMap.put(tKey, gotUserRights); " and LEVEL_1 = " + level1 + " " +
} " and LEVEL_2 = " + level2 + " " +
} " and LEVEL_3 = " + level3 + " " +
" and LEVEL_4 = " + level4 + " " +
rs.close(); " and WIN_NAME <> '-' " ;
rs = null;
System.out.println("Get Menu SQL :: " + getSubMenuSql);
pstmt.close();
pstmt = null; pstmt = conn.prepareStatement(getSubMenuSql);
}
////////////////////////////////////////////////////////////////////////////////////////////// rs = pstmt.executeQuery();
if(rs.next())
} {
catch (Exception e) tApplication = rs.getString(1);
{ tLevel1 = rs.getInt(2);
e.printStackTrace(); tLevel2 = rs.getInt(3);
throw new ITMException(e);// added by akhilesh on 31/oct/12 tLevel3 = rs.getInt(4);
} tLevel4 = rs.getInt(5);
finally tLevel5 = rs.getInt(6);
{ tWinName = rs.getString(7);
if (rs != null) tKey = tApplication + ":" + tLevel1 + ":" + tLevel2 + ":" + tLevel3 + ":" + tLevel4 + ":" + tLevel5;
{ System.out.println("tKey [" + tKey + "] tWinName [" + tWinName + "]");
rs.close(); subMenuList.add(tKey);
rs = null;
} tMenuName = rs.getString(8);
if (pstmt != null) if(!menuNameMap.containsKey(tKey))
{ menuNameMap.put(tKey, tMenuName);
pstmt.close();
pstmt = null; winNameMap.put(tKey, tWinName.trim().substring(2, tWinName.trim().length()));
} gotUserRights = (String) userRightsMap.get(tKey);
if(gotUserRights == null || gotUserRights.trim().length() == 0){
} gotUserRights = getUserRights(profileId, tApplication, tLevel1, tLevel2, tLevel3, tLevel4, tLevel5, conn);
return subMenuList; if(gotUserRights != null && gotUserRights.trim().length() > 0)
} userRightsMap.put(tKey, gotUserRights);
}
private String getUserRights(String profileId, String application, int level1, int level2, int level3, int level4, int level5, Connection conn) throws Exception }
{
String userRightsSql = " select RIGHTS " + rs.close();
" from user_rights " + rs = null;
" where profile_id = '" + profileId + "' " +
" and APPLICATION = '" + application + "' " + pstmt.close();
" and MENU_ROW = " + level1 + pstmt = null;
" and MENU_COL = " + level2 + }
" and MENU_SUBCOL = " +level3 + //////////////////////////////////////////////////////////////////////////////////////////////
" and LEVEL_4 = " + level4 +
" and LEVEL_5 = " + level5;
}
String rights = null; catch (Exception e)
System.out.println("userRightsSql :: " + userRightsSql); {
e.printStackTrace();
String key = application + ":" + level1 + ":" + level2 + ":" + level3 + ":" + level4 + ":" + level5; throw new ITMException(e);// added by akhilesh on 31/oct/12
}
PreparedStatement pstmt = null; finally
ResultSet rs = null; {
try if (rs != null)
{ {
rs.close();
pstmt = conn.prepareStatement(userRightsSql); rs = null;
}
rs = pstmt.executeQuery(); if (pstmt != null)
{
if(rs.next()) pstmt.close();
{ pstmt = null;
rights = rs.getString(1); }
System.out.println("Key = " + key + " : Rights = " + rights);
} }
return subMenuList;
rs.close(); }
rs = null;
private String getUserRights(String profileId, String application, int level1, int level2, int level3, int level4, int level5, Connection conn) throws Exception
pstmt.close(); {
pstmt = null; String userRightsSql = " select RIGHTS " +
} " from user_rights " +
catch (Exception e) " where profile_id = '" + profileId + "' " +
{ " and APPLICATION = '" + application + "' " +
e.printStackTrace(); " and MENU_ROW = " + level1 +
throw new ITMException(e);// added by akhilesh on 31/oct/12 " and MENU_COL = " + level2 +
} " and MENU_SUBCOL = " +level3 +
finally " and LEVEL_4 = " + level4 +
{ " and LEVEL_5 = " + level5;
if (rs != null)
{ String rights = null;
rs.close(); System.out.println("userRightsSql :: " + userRightsSql);
rs = null;
} String key = application + ":" + level1 + ":" + level2 + ":" + level3 + ":" + level4 + ":" + level5;
if (pstmt != null)
{ PreparedStatement pstmt = null;
pstmt.close(); ResultSet rs = null;
pstmt = null; try
} {
} pstmt = conn.prepareStatement(userRightsSql);
return rights; rs = pstmt.executeQuery();
}
public void populateMap(Document headerDom, Document detailDom, String xtraParams) throws RemoteException,ITMException if(rs.next())
{ {
rights = rs.getString(1);
Statement stmt = null; System.out.println("Key = " + key + " : Rights = " + rights);
PreparedStatement pstmt = null; }
ResultSet rs = null;
//StringBuffer retTabSepStrBuff = new StringBuffer(); rs.close();
String userId = null; rs = null;
Object date = null;
String sql = ""; pstmt.close();
String errCode = ""; pstmt = null;
String errString = ""; }
String resultString = ""; catch (Exception e)
String curUserId = "", curProfileId = ""; {
e.printStackTrace();
//String profileId =null; throw new ITMException(e);// added by akhilesh on 31/oct/12
}
double quantity = 0.0,pendingQty = 0.0; finally
int count = 0, usrLev = 0; {
String tApplication = null; if (rs != null)
String key = null; {
String tWinName = null; rs.close();
String tMenuName = null; rs = null;
String sqlStr = ""; }
try if (pstmt != null)
{ {
if(conn == null) pstmt.close();
{ pstmt = null;
ConnDriver connDriver = new ConnDriver(); }
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false); }
connDriver = null;
} return rights;
}
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId"); public void populateMap(Document headerDom, Document detailDom, String xtraParams) throws RemoteException,ITMException
profileId = genericUtility.getColumnValue("profile_id", headerDom); {
//System.out.println("profileId ::- "+ profileId);
// 24/03/12 manoharan get the current logged in user and show only the menus for which the current user has rights Statement stmt = null;
curUserId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); PreparedStatement pstmt = null;
System.out.println("Current userid curUserId ["+ curUserId + "] profileId [" + profileId + "]"); ResultSet rs = null;
if (curUserId != null || curUserId.trim().length() > 0) //StringBuffer retTabSepStrBuff = new StringBuffer();
{ String userId = null;
Object date = null;
sql = " select profile_id,usr_lev from users where code = ?"; String sql = "";
pstmt = conn.prepareStatement(sql); String errCode = "";
pstmt.setString(1,curUserId); String errString = "";
rs = pstmt.executeQuery(); String resultString = "";
if(rs.next()) String curUserId = "", curProfileId = "";
{
curProfileId = rs.getString("profile_id"); //String profileId =null;
usrLev = rs.getInt("usr_lev");
} double quantity = 0.0,pendingQty = 0.0;
rs.close(); int count = 0, usrLev = 0;
rs = null; String tApplication = null;
pstmt.close(); String key = null;
pstmt = null; String tWinName = null;
String tMenuName = null;
System.out.println("Current curProfileId ["+ curProfileId + "] usrLev [" + usrLev + "]"); String sqlStr = "";
try
//////////////// {
//If profile Id is blank or doesnt exist in the User_Rights table then prompt error if(conn == null)
//String profileSql = " select count(*) " + {
// " from user_rights " + ConnDriver connDriver = new ConnDriver();
// " where profile_id = '" + profileId + "' " ; conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
String profileSql = " select count(1) " + connDriver = null;
" from gencodes " + }
" where fld_name = 'PROFILE_ID' and fld_value = '" + profileId + "' " ;
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId");
int profileCount = 0; profileId = genericUtility.getColumnValue("profile_id", headerDom);
System.out.println("ProfileSql :: " + profileSql); //System.out.println("profileId ::- "+ profileId);
// 24/03/12 manoharan get the current logged in user and show only the menus for which the current user has rights
PreparedStatement pProfileStmt = null; curUserId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
ResultSet profileRs = null; System.out.println("Current userid curUserId ["+ curUserId + "] profileId [" + profileId + "]");
if (curUserId != null || curUserId.trim().length() > 0)
pProfileStmt = conn.prepareStatement(profileSql); {
profileRs = pProfileStmt.executeQuery(); sql = " select profile_id,usr_lev from users where code = ?";
pstmt = conn.prepareStatement(sql);
if(profileRs.next()) pstmt.setString(1,curUserId);
{ rs = pstmt.executeQuery();
profileCount = profileRs.getInt(1); if(rs.next())
System.out.println("Profile Count = " + profileCount); {
} curProfileId = rs.getString("profile_id");
usrLev = rs.getInt("usr_lev");
profileRs.close(); }
profileRs = null; rs.close();
rs = null;
pProfileStmt.close(); pstmt.close();
pProfileStmt = null; pstmt = null;
///////////////
System.out.println("Current curProfileId ["+ curProfileId + "] usrLev [" + usrLev + "]");
if(profileCount == 0)
{ ////////////////
errString = itmDBAccessEJB.getErrorString("","PNOTEXIST","","",conn); //If profile Id is blank or doesnt exist in the User_Rights table then prompt error
//String profileSql = " select count(*) " +
} // " from user_rights " +
// " where profile_id = '" + profileId + "' " ;
userRightsMap = new HashMap();
winNameMap = new HashMap(); String profileSql = " select count(1) " +
menuNameMap = new HashMap(); " from gencodes " +
" where fld_name = 'PROFILE_ID' and fld_value = '" + profileId + "' " ;
sqlStr = " SELECT ITM2MENU.APPLICATION, " +
" ITM2MENU.LEVEL_1, " + int profileCount = 0;
" ITM2MENU.LEVEL_2, " + System.out.println("ProfileSql :: " + profileSql);
" ITM2MENU.LEVEL_3, " +
" ITM2MENU.LEVEL_4, " + PreparedStatement pProfileStmt = null;
" ITM2MENU.LEVEL_5, " + ResultSet profileRs = null;
" ITM2MENU.WIN_NAME, " +
" ITM2MENU.DESCR, " + pProfileStmt = conn.prepareStatement(profileSql);
" (SELECT USER_RIGHTS.RIGHTS FROM USER_RIGHTS " +
" WHERE USER_RIGHTS.PROFILE_ID = ? " + profileRs = pProfileStmt.executeQuery();
" AND USER_RIGHTS.APPLICATION = ITM2MENU.APPLICATION " +
" AND USER_RIGHTS.MENU_ROW = ITM2MENU.LEVEL_1 " + if(profileRs.next())
" AND USER_RIGHTS.MENU_COL = ITM2MENU.LEVEL_2 " + {
" AND USER_RIGHTS.MENU_SUBCOL = ITM2MENU.LEVEL_3 " + profileCount = profileRs.getInt(1);
" AND USER_RIGHTS.LEVEL_4 = ITM2MENU.LEVEL_4 " + System.out.println("Profile Count = " + profileCount);
" AND USER_RIGHTS.LEVEL_5 = ITM2MENU.LEVEL_5 " + }
" ) AS RIGHTS " +
" FROM ITM2MENU " ; profileRs.close();
if (usrLev > 0 ) profileRs = null;
{
sqlStr = sqlStr + " where exists (select 1 from user_rights u " pProfileStmt.close();
+ " where u.profile_id in ('" + curProfileId + "','" + profileId + "') " pProfileStmt = null;
+ " and u.application = ITM2MENU.application " ///////////////
+ " and u.menu_row = ITM2MENU.level_1 "
+ " and u.menu_col = ITM2MENU.level_2 " if(profileCount == 0)
+ " and u.menu_subcol = ITM2MENU.level_3 " {
+ " and u.level_4 = ITM2MENU.level_4 " errString = itmDBAccessEJB.getErrorString("","PNOTEXIST","","",conn);
+ " and u.level_5 = ITM2MENU.level_5) " ;
} }
sqlStr = sqlStr + " ORDER BY ITM2MENU.APPLICATION, ITM2MENU.LEVEL_1, ITM2MENU.LEVEL_2, ITM2MENU.LEVEL_3, ITM2MENU.LEVEL_4, ITM2MENU.LEVEL_5 ";
userRightsMap = new HashMap();
winNameMap = new HashMap();
pstmt = conn.prepareStatement(sqlStr); menuNameMap = new HashMap();
pstmt.setString(1,profileId);
//System.out.println("The getData sql is:-"+ sqlStr); sqlStr = " SELECT ITM2MENU.APPLICATION, " +
rs = pstmt.executeQuery(); " ITM2MENU.LEVEL_1, " +
while (rs.next()) " ITM2MENU.LEVEL_2, " +
{ " ITM2MENU.LEVEL_3, " +
" ITM2MENU.LEVEL_4, " +
tApplication = rs.getString(1); " ITM2MENU.LEVEL_5, " +
" ITM2MENU.WIN_NAME, " +
if(tApplication != null) " ITM2MENU.DESCR, " +
key = tApplication + ":" + rs.getInt(2) + ":" + rs.getInt(3) + ":" + rs.getInt(4) " (SELECT USER_RIGHTS.RIGHTS FROM USER_RIGHTS " +
+ ":" + rs.getInt(5) + ":" + rs.getInt(6); " WHERE USER_RIGHTS.PROFILE_ID = ? " +
" AND USER_RIGHTS.APPLICATION = ITM2MENU.APPLICATION " +
" AND USER_RIGHTS.MENU_ROW = ITM2MENU.LEVEL_1 " +
//DESCR " AND USER_RIGHTS.MENU_COL = ITM2MENU.LEVEL_2 " +
tMenuName = rs.getString(8); " AND USER_RIGHTS.MENU_SUBCOL = ITM2MENU.LEVEL_3 " +
" AND USER_RIGHTS.LEVEL_4 = ITM2MENU.LEVEL_4 " +
//WIN_NAME " AND USER_RIGHTS.LEVEL_5 = ITM2MENU.LEVEL_5 " +
tWinName = rs.getString(7); " ) AS RIGHTS " +
" FROM ITM2MENU " ;
userRightsMap.put(key, rs.getString(9)); if (usrLev > 0 )
if(tWinName != null && tWinName.trim().length() > 2) {
winNameMap.put(key, tWinName.trim().substring(2, tWinName.trim().length())); sqlStr = sqlStr + " where exists (select 1 from user_rights u "
+ " where u.profile_id in ('" + curProfileId + "','" + profileId + "') "
menuNameMap.put(key, tMenuName); + " and u.application = ITM2MENU.application "
}//while + " and u.menu_row = ITM2MENU.level_1 "
rs.close(); + " and u.menu_col = ITM2MENU.level_2 "
rs = null; + " and u.menu_subcol = ITM2MENU.level_3 "
pstmt.close(); + " and u.level_4 = ITM2MENU.level_4 "
pstmt = null; + " and u.level_5 = ITM2MENU.level_5) " ;
} }
// end 24/03/12 manoharan sqlStr = sqlStr + " ORDER BY ITM2MENU.APPLICATION, ITM2MENU.LEVEL_1, ITM2MENU.LEVEL_2, ITM2MENU.LEVEL_3, ITM2MENU.LEVEL_4, ITM2MENU.LEVEL_5 ";
}//try
catch (SQLException e)
{ pstmt = conn.prepareStatement(sqlStr);
System.out.println("SQLException ::" + sqlStr + e.getMessage() + ":"); pstmt.setString(1,profileId);
e.printStackTrace(); //System.out.println("The getData sql is:-"+ sqlStr);
throw new ITMException(e);// added by akhilesh on 31/oct/12 rs = pstmt.executeQuery();
} while (rs.next())
catch(Exception ex) {
{
System.out.println("Exception []::" + ex.getMessage()); tApplication = rs.getString(1);
ex.printStackTrace();
throw new ITMException(ex);// added by akhilesh on 31/oct/12 if(tApplication != null)
} key = tApplication + ":" + rs.getInt(2) + ":" + rs.getInt(3) + ":" + rs.getInt(4)
finally + ":" + rs.getInt(5) + ":" + rs.getInt(6);
{
try
{ //DESCR
if(rs != null){rs.close();// added by akhilesh on 08/nov/12 tMenuName = rs.getString(8);
rs = null;}
//WIN_NAME
if(pstmt != null){pstmt.close();// added by akhilesh on 08/nov/12 tWinName = rs.getString(7);
pstmt = null;}
userRightsMap.put(key, rs.getString(9));
if(conn != null){conn.close();// added by akhilesh on 08/nov/12 if(tWinName != null && tWinName.trim().length() > 2)
conn = null;} winNameMap.put(key, tWinName.trim().substring(2, tWinName.trim().length()));
} menuNameMap.put(key, tMenuName);
catch(Exception e){ }//while
throw new ITMException(e);// added by akhilesh on 31/oct/12 rs.close();
} rs = null;
} pstmt.close();
pstmt = null;
}//populateMap }
// end 24/03/12 manoharan
}//try
catch (SQLException e)
}//class {
System.out.println("SQLException ::" + sqlStr + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);// added by akhilesh on 31/oct/12
}
catch(Exception ex)
{
System.out.println("Exception []::" + ex.getMessage());
ex.printStackTrace();
throw new ITMException(ex);// added by akhilesh on 31/oct/12
}
finally
{
try
{
if(rs != null){rs.close();// added by akhilesh on 08/nov/12
rs = null;}
if(pstmt != null){pstmt.close();// added by akhilesh on 08/nov/12
pstmt = null;}
if(conn != null){conn.close();// added by akhilesh on 08/nov/12
conn = null;}
}
catch(Exception e){
throw new ITMException(e);// added by akhilesh on 31/oct/12
}
}
}//populateMap
}//class
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment