Commit 2473bf22 authored by manohar's avatar manohar

bugfixing removing rights not works properly


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91295 ce508802-f39f-4f6c-b175-0d175dae99d5
parent adcaf74f
......@@ -375,7 +375,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
boolean bDetailFound = false;
int parentNodeListLength = 0;
int childNodeListLength = 0;
int childNodeListLength = 0, insertCount =0, updateCount =0, deleteCount = 0;
String delSql = "";
profileId = genericUtility.getColumnValue("profile_id", headerDom);
......@@ -517,6 +517,29 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
rights = null;
}
}
// 01/06/10 manoharan
if (level1 == null || level1.trim().length() == 0)
{
level1 = "0";
}
if (level2 == null || level2.trim().length() == 0)
{
level2 = "0";
}
if (level3 == null || level3.trim().length() == 0)
{
level3 = "0";
}
if (level4 == null || level4.trim().length() == 0)
{
level4 = "0";
}
if (level5 == null || level5.trim().length() == 0)
{
level5 = "0";
}
// end 01/06/10 manoharan
searchKey = application + ":" + level1 + ":" + level2 + ":" + level3 + ":" + level4 + ":" + level5;
//
//get all submenu if found
......@@ -557,8 +580,10 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
menuName = (String)menuNameMap.get(searchStr);
System.out.println("SerarchStr = " + searchStr + " :: " + application + " : " + level1 + " : " + level2 + " : " + level3 + " : " + level4 + " : " + level5);
//
operation = searchUserRight(searchStr, rights);
// 01/06/10 manoharan
//operation = searchUserRight(searchStr, rights);
operation = searchUserRight(profileId, application,Integer.parseInt(level1),Integer.parseInt(level2),Integer.parseInt(level3),Integer.parseInt(level4),Integer.parseInt(level5),rights,conn);
// end 01/06/10 manoharan
System.out.println("Operation ["+ operation +"]");
/*
1 - insert
......@@ -577,7 +602,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
pInsertStmt.setString(7, menuName);
pInsertStmt.setString(8, rights.trim());
pInsertStmt.setString(9, objName);
insertCount++;
pInsertStmt.addBatch();
}
else if(operation == 2){
......@@ -590,7 +615,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
pUpdateStmt.setInt(6, Integer.parseInt(level3));
pUpdateStmt.setInt(7, Integer.parseInt(level4));
pUpdateStmt.setInt(8, Integer.parseInt(level5));
updateCount++;
pUpdateStmt.addBatch();
}
else if(operation == 3){
......@@ -601,24 +626,33 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
pDeleteStmt.setInt(4, Integer.parseInt(level3));
pDeleteStmt.setInt(5, Integer.parseInt(level4));
pDeleteStmt.setInt(6, Integer.parseInt(level5));
deleteCount++;
pDeleteStmt.addBatch();
}
}//End of subMenuList iteration for loop
}//End of if subMenuList is not null
}//outer for
if (insertCount > 0)
(
System.out.println("Before Delete Batch");
pInsertStmt.executeBatch();
System.out.println("After Insert Batch" );
}
if (updateCount > 0)
(
System.out.println("Before Update Batch");
pUpdateStmt.executeBatch();
System.out.println("After Update Batch = ");
}
if (deleteCount > 0)
(
System.out.println("Before Delete Batch");
pDeleteStmt.executeBatch();
System.out.println("After Delete Batch = ");
}
conn.commit();
System.out.println("After Commit");
......@@ -698,6 +732,57 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
else if Found and rights = null
return 3
*/
// 01/06/10 manoharan
int searchUserRight(String profileId, String application,int level1,int level2,int level3,int level4,int level5, String rights,Connection conn) throws Exception
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = " SELECT RIGHTS FROM USER_RIGHTS "
+ " WHERE PROFILE_ID = ? "
+ " AND APPLICATION = ? "
+ " AND MENU_ROW = ? "
+ " AND MENU_COL = ? "
+ " AND MENU_SUBCOL = ? "
+ " AND LEVEL_4 = ? "
+ " AND LEVEL_5 = ? ";
pstmt = conn.prepareStatement(sql);
String foundRights = null;
int operation = -1;
pstmt.setString(1,profileId);
pstmt.setString(2,application);
pstmt.setInt(3,level1);
pstmt.setInt(4,level2);
pstmt.setInt(5,level3);
pstmt.setInt(6,level4);
pstmt.setInt(7,level5);
rs = pstmt.executeQuery();
if (rs.next())
{
foundRights = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
//foundRights = (String) userRightsMap.get(searchKey);
System.out.println("Found rights in function ["+foundRights+"]");
if(foundRights == null && rights != null)
operation = 1;
else if(foundRights != null && rights != null)
operation = 2;
else if(foundRights != null && rights == null)
operation = 3;
return operation;
}
// end 01/06/10 manoharan
int searchUserRight(String searchKey, String rights)
{
System.out.println("searchKey in function ["+searchKey+"]");
......
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