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;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.*;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
......@@ -72,6 +71,8 @@ public class MessagesLevel extends ValidatorEJB implements MessagesLevelLocal, M
SimpleDateFormat simpleDateFormat = null;
java.util.Date chgDate = null;
java.util.Date toDate = null;
String chgUser="";
String sql="";
try
{
ConnDriver connDriver = new ConnDriver();
......@@ -107,42 +108,127 @@ public class MessagesLevel extends ValidatorEJB implements MessagesLevelLocal, M
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 (childNode.getFirstChild() == null)
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;
}
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", "VMMSGNULL", userId);
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
{
if (!editFlag.equalsIgnoreCase("Ee"))
{
int seriesCount = 0;
String id = genericUtility.getColumnValue("msg_no", dom);
String countSerSql = "SELECT COUNT(1) AS COUNT FROM messages WHERE msg_no = ?";
PreparedStatement pstmtSeriesCnt = conn.prepareStatement(countSerSql);
pstmtSeriesCnt.setString(1, id);
ResultSet rsCnt = pstmtSeriesCnt.executeQuery();
sql = null;
sql = "select count(1) count from messages_level where win_name = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, winName);
rs = pstmt.executeQuery();
System.out.println("countSerSql" + countSerSql);
if (rsCnt.next())
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
{
seriesCount = rsCnt.getInt("COUNT");
int a = 0;
String id1 = genericUtility.getColumnValue("profile_id", dom);
String id2 = genericUtility.getColumnValue("msg_no", dom);
String id3 = genericUtility.getColumnValue("win_name", dom);
sql = "SELECT COUNT(1) AS COUNT FROM messages_level WHERE profile_id = ? AND msg_no= ? AND win_name= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,id1);
pstmt.setString(2,id2);
pstmt.setString(3,id3);
rs = pstmt.executeQuery();
System.out.println("Sql" + sql);
if (rs.next()) {
a = rs.getInt("COUNT");
}
if (seriesCount == 0)
if (a > 0)
{
errString = getErrorString("id", "VMMSGNULL", userId);
errString = getErrorString("", "VMALEXTDB", chgUser);
break;
}
}
}
winName = null;
}
}
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