Commit eff47596 authored by agaikwad's avatar agaikwad

Changes made in ejb for Messages_Level


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97316 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 813f90fb
...@@ -6,7 +6,6 @@ import javax.ejb.Stateless; ...@@ -6,7 +6,6 @@ import javax.ejb.Stateless;
import ibase.system.config.ConnDriver; import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -72,6 +71,8 @@ public class MessagesLevel extends ValidatorEJB implements MessagesLevelLocal, M ...@@ -72,6 +71,8 @@ public class MessagesLevel extends ValidatorEJB implements MessagesLevelLocal, M
SimpleDateFormat simpleDateFormat = null; SimpleDateFormat simpleDateFormat = null;
java.util.Date chgDate = null; java.util.Date chgDate = null;
java.util.Date toDate = null; java.util.Date toDate = null;
String chgUser="";
String sql="";
try try
{ {
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
...@@ -107,41 +108,126 @@ public class MessagesLevel extends ValidatorEJB implements MessagesLevelLocal, M ...@@ -107,41 +108,126 @@ public class MessagesLevel extends ValidatorEJB implements MessagesLevelLocal, M
childNodeValue = childNode.getFirstChild().getNodeValue(); childNodeValue = childNode.getFirstChild().getNodeValue();
} }
if (childNodeName.equalsIgnoreCase("msg_no")) if (childNodeName.equalsIgnoreCase("profile_id"))
{ {
String profileId = genericUtility.getColumnValue("profile_id", dom);
profileId = profileId == null ? "" : profileId.trim();
if (profileId.length() == 0) {
errString = getErrorString("profile_id", "VMPFINO", userId);
break;
}
else
{
sql = null;
sql = "select count(1) count from messages_level where profile_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, profileId);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) {
errString = getErrorString("profile_id", "VMPFIV", userId);
break;
}
}
profileId = null;
}
if (childNode.getFirstChild() == null) else if (childNodeName.equalsIgnoreCase("msg_no")) {
String msgNo = genericUtility.getColumnValue("msg_no", dom);
msgNo = msgNo == null ? "" : msgNo.trim();
if (msgNo.length() == 0)
{ {
errString = getErrorString("msg_no", "VMMSGNO", userId); errString = getErrorString("msg_no", "VMMSGNULL", userId);
break; break;
} }
else
{
// if (!editFlag.equalsIgnoreCase("E"))
//{
sql = null;
sql = "select count(1) count from messages where msg_no = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, msgNo);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) {
errString = getErrorString("msg_no", "VMMSGNO", userId);
break;
}
// }
}
msgNo = null;
}
else if (childNodeName.equalsIgnoreCase("win_name")) {
String winName = genericUtility.getColumnValue("win_name", dom);
winName = winName == null ? "" : winName.trim();
if (winName.length() == 0) {
errString = getErrorString("win_name", "VMWNMNO", userId);
break;
}
else else
{ {
if (!editFlag.equalsIgnoreCase("Ee")) sql = null;
sql = "select count(1) count from messages_level where win_name = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, winName);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) {
errString = getErrorString("win_name", "VMWINNMIV", userId);
break;
}
else
{ {
int seriesCount = 0; int a = 0;
String id = genericUtility.getColumnValue("msg_no", dom); String id1 = genericUtility.getColumnValue("profile_id", dom);
String countSerSql = "SELECT COUNT(1) AS COUNT FROM messages WHERE msg_no = ?"; String id2 = genericUtility.getColumnValue("msg_no", dom);
PreparedStatement pstmtSeriesCnt = conn.prepareStatement(countSerSql); String id3 = genericUtility.getColumnValue("win_name", dom);
pstmtSeriesCnt.setString(1, id); sql = "SELECT COUNT(1) AS COUNT FROM messages_level WHERE profile_id = ? AND msg_no= ? AND win_name= ? ";
ResultSet rsCnt = pstmtSeriesCnt.executeQuery(); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,id1);
pstmt.setString(2,id2);
pstmt.setString(3,id3);
rs = pstmt.executeQuery();
System.out.println("countSerSql" + countSerSql); System.out.println("Sql" + sql);
if (rsCnt.next()) if (rs.next()) {
{ a = rs.getInt("COUNT");
seriesCount = rsCnt.getInt("COUNT");
} }
if (seriesCount == 0) if (a > 0)
{ {
errString = getErrorString("id", "VMMSGNULL", userId);
errString = getErrorString("", "VMALEXTDB", chgUser);
break; break;
} }
} }
} }
winName = null;
} }
} }
break; break;
......
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