Commit e4dd03e2 authored by sghate's avatar sghate

shital: updated GradeSiteLveTblIC Component.

GradeSiteLveTblIC.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205797 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3325f6e8
...@@ -9,7 +9,7 @@ import org.w3c.dom.Document; ...@@ -9,7 +9,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import java.rmi.RemoteException; import com.sybase.ejb.RemoteException;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
...@@ -80,6 +80,7 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo ...@@ -80,6 +80,7 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo
Connection conn = null; Connection conn = null;
String gradeCode = null; String gradeCode = null;
String siteCode = null; String siteCode = null;
String lveTblno = "";
ITMDBAccessEJB itmDbAcess = null; ITMDBAccessEJB itmDbAcess = null;
E12GenericUtility genericUtility = null; E12GenericUtility genericUtility = null;
...@@ -89,8 +90,6 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo ...@@ -89,8 +90,6 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo
try try
{ {
itmDbAcess = new ITMDBAccessEJB(); itmDbAcess = new ITMDBAccessEJB();
genericUtility = new E12GenericUtility(); genericUtility = new E12GenericUtility();
conn = getConnection(); conn = getConnection();
...@@ -125,35 +124,78 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo ...@@ -125,35 +124,78 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo
if("grade_code".equalsIgnoreCase(childNodeName)) if("grade_code".equalsIgnoreCase(childNodeName))
{ {
gradeCode = checkNull(genericUtility.getColumnValue("grade_code", dom)); gradeCode = checkNull(genericUtility.getColumnValue("grade_code", dom));
sql = "Select count(*) as cnt from grade where grade_code = ?"; if(gradeCode == null || gradeCode.trim().length() == 0)
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, gradeCode);
rs = pstmt.executeQuery();
if(rs.next())
{ {
cnt = rs.getInt("cnt"); errList.add("VEGRA2");
} errFields.add(childNodeName.toLowerCase());
System.out.println("cnt ..:: [" + cnt + "]");
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
} }
if(cnt == 0) else
{ {
errList.add("VMGRA1"); sql = "Select count(*) as cnt from grade where grade_code = ?";
errFields.add(childNodeName.toLowerCase()); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, gradeCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
System.out.println("cnt ..:: [" + cnt + "]");
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMGRA1");
errFields.add(childNodeName.toLowerCase());
}
else
{
gradeCode = checkNull(genericUtility.getColumnValue("grade_code", dom));
cnt = 0;
sql = "Select count(*) as cnt from GRADE_SITE_LVETBL where grade_code = ? and site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,gradeCode);
pstmt.setString(2,siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
System.out.println("cnt ..:: [" + cnt + "]");
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0 && !"E".equalsIgnoreCase(editFlag))
{
errList.add("VTINVSITE3");//Data Already Existed for Entered Site Code and grade Code in CADRE_SITE_LVETBL Table
errFields.add(childNodeName.toLowerCase());
}
}
} }
} }
if("site_code".equalsIgnoreCase(childNodeName)) if("site_code".equalsIgnoreCase(childNodeName))
{ {
siteCode = checkNull(genericUtility.getColumnValue("site_code", dom)); siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
if(siteCode == null || siteCode.trim().length() == 0)
{
errList.add("VMSITE1");
errFields.add(childNodeName.toLowerCase());
}
sql = "Select count(*) as cnt from site where site_code = ?"; sql = "Select count(*) as cnt from site where site_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode); pstmt.setString(1, siteCode);
...@@ -175,11 +217,81 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo ...@@ -175,11 +217,81 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo
} }
if(cnt == 0) if(cnt == 0)
{ {
errList.add("VMSITE1"); errList.add("VTINVSITE4");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else
{
siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
cnt = 0;
sql = "Select count(*) as cnt from GRADE_SITE_LVETBL where grade_code = ? and site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, gradeCode);
pstmt.setString(2, siteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
System.out.println("cnt ..:: [" + cnt + "]");
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0 && !"E".equalsIgnoreCase(editFlag))
{
errList.add("VTINVSITE3");//Data Already Existed for Entered Site Code and grade Code in CADRE_SITE_LVETBL Table
errFields.add(childNodeName.toLowerCase());
}
}
} }
} else if ("leave_tblno".equalsIgnoreCase(childNodeName))
{
lveTblno = checkNull(genericUtility.getColumnValue("leave_tblno", dom));
System.out.println("lve_tblno IS::" +lveTblno);
if(lveTblno == null || lveTblno.trim().length() == 0)
{
errList.add("VTINVLEAVE");
errFields.add(childNodeName.toLowerCase());
}
else
{
cnt = 0;
sql = "Select count(*) as cnt from GENCODES where FLD_VALUE = ? and FLD_NAME = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,lveTblno);
pstmt.setString(2,"LVE_TBLNO");
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
System.out.println("cnt for leave table ::::::::"+cnt);
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0 )
{
errList.add("VTINVLEAV1");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
break; break;
} }
} }
...@@ -417,14 +529,18 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo ...@@ -417,14 +529,18 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo
} }
private String errorType(Connection conn, String errorCode) throws ITMException { private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = ""; String msgType = "";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
try { try
if (conn == null) { {
if (conn == null)
{
System.out.println("Connection is null"); System.out.println("Connection is null");
} else { } else
{
System.out.println("Connection is not null"); System.out.println("Connection is not null");
} }
...@@ -446,7 +562,8 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo ...@@ -446,7 +562,8 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} catch (Exception ex) }
catch (Exception ex)
{ {
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex); throw new ITMException(ex);
...@@ -465,7 +582,8 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo ...@@ -465,7 +582,8 @@ public class GradeSiteLveTblIC extends ValidatorEJB implements GradeSiteLveTblLo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} catch (Exception e) }
catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
......
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