Commit 440c7200 authored by pchavan's avatar pchavan

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@203516 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 59aafa24
...@@ -130,40 +130,41 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo ...@@ -130,40 +130,41 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase(doc_key)) { if (childNodeName.equalsIgnoreCase(doc_key))
{
docKey = this.genericUtility.getColumnValue(doc_key, dom); docKey = checkNull(this.genericUtility.getColumnValue(doc_key, dom));
if("A".equalsIgnoreCase(editFlag)) if("A".equalsIgnoreCase(editFlag))
{ {
sql = "select count(*) from min_rate_history where doc_key= ? "; sql = "select count(*) from min_rate_history where doc_key= ? ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, docKey); pstmt.setString(1, docKey);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) { if (rs.next())
cnt = rs.getInt(1); {
} cnt = rs.getInt(1);
rs.close(); }
rs = null; rs.close();
pstmt.close(); rs = null;
pstmt = null; pstmt.close();
System.out.println("cnt value is :[" + cnt + "]"); pstmt = null;
System.out.println("cnt value is :[" + cnt + "]");
if (cnt>0)
{ if (cnt>0)
errCode = "VTKNET"; {
errList.add(errCode); errCode = "VTKNET";
errFields.add(childNodeName.toLowerCase()); errList.add(errCode);
} errFields.add(childNodeName.toLowerCase());
}
} }
} }
else if (childNodeName.equalsIgnoreCase("scheme_code")) { else if (childNodeName.equalsIgnoreCase("scheme_code"))
{
schemeCode = checkNull(this.genericUtility.getColumnValue("scheme_code", dom));
schemeCode = this.genericUtility.getColumnValue("scheme_code", dom); itemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom));
itemCode=this.genericUtility.getColumnValue("item_code", dom);
System.out.println("schemeCode : " +schemeCode); System.out.println("schemeCode : " +schemeCode);
if(schemeCode!=null && schemeCode.trim().length()>0 ) if(schemeCode!= null && schemeCode.trim().length() > 0 )
{ {
sql = "select count(*) from bom where bom_code =?"; sql = "select count(*) from bom where bom_code =?";
...@@ -181,40 +182,34 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo ...@@ -181,40 +182,34 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
pstmt = null; pstmt = null;
if(cnt==0) { if(cnt==0)
{
System.out.println("itemCode Testing : " +itemCode); System.out.println("itemCode Testing : " +itemCode);
sql= "select bom_code from item where item_code =?"; sql= "select count(*) from item where item_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, schemeCode); pstmt.setString(1, schemeCode);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
cnt = rs.getInt(1); cnt = rs.getInt(1);
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (cnt == 0) if (cnt == 0)
{ {
errCode = "VTSCHNO1"; errCode = "VTSCHNO1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} }
else if (childNodeName.equalsIgnoreCase("invoice_Id")) else if (childNodeName.equalsIgnoreCase("invoice_Id"))
{ {
invoiceId = genericUtility.getColumnValue("invoice_id", dom); invoiceId = checkNull(genericUtility.getColumnValue("invoice_id", dom));
System.out.println("INSIDE INVOICE ID[" + invoiceId + "]"); System.out.println("INSIDE INVOICE ID[" + invoiceId + "]");
if (invoiceId != null && invoiceId.trim().length() > 0) if (invoiceId != null && invoiceId.trim().length() > 0)
{ {
sql = "select count(*) from invoice where invoice_id = ? "; sql = "select count(*) from invoice where invoice_id = ? ";
...@@ -238,9 +233,9 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo ...@@ -238,9 +233,9 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
} }
} else if (childNodeName.equalsIgnoreCase("line_no")) } else if (childNodeName.equalsIgnoreCase("line_no"))
{ {
invoiceId = genericUtility.getColumnValue("invoice_id", dom); invoiceId = checkNull(genericUtility.getColumnValue("invoice_id", dom));
lineNo = genericUtility.getColumnValue("line_no", dom); lineNo = checkNull(genericUtility.getColumnValue("line_no", dom));
if (invoiceId != null && invoiceId.trim().length() > 0) if (invoiceId != null && invoiceId.trim().length() > 0)
{ {
sql = "select count(*) from invdet where invoice_id = ? and line_no= ? "; sql = "select count(*) from invdet where invoice_id = ? and line_no= ? ";
...@@ -263,46 +258,46 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo ...@@ -263,46 +258,46 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
System.out.println("Testing done"); System.out.println("Testing done");
} }
else if (childNodeName.equalsIgnoreCase("cust_code")) else if (childNodeName.equalsIgnoreCase("cust_code"))
{ {
System.out.println("Testing pending"); System.out.println("Testing pending");
custCode = genericUtility.getColumnValue("cust_code", dom); custCode = checkNull(genericUtility.getColumnValue("cust_code", dom));
if(custCode== null || custCode.trim().length() == 0) if(custCode== null || custCode.trim().length() == 0)
{ {
errCode = "VTMSG"; errCode = "VTMSG";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
if (custCode != null && custCode.trim().length() > 0)
{
sql = " SELECT COUNT(*) FROM customer WHERE cust_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0)
{
errCode = "VTINVCUST";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}
if (custCode != null && custCode.trim().length() > 0) {
sql = " SELECT COUNT(*) FROM customer WHERE cust_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0) {
errCode = "VTINVCUST";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} }
}
} }
else if (childNodeName.equalsIgnoreCase("item_code")) else if (childNodeName.equalsIgnoreCase("item_code"))
{ {
itemCode = genericUtility.getColumnValue("item_code", dom); itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
if ( itemCode == null || itemCode.trim().length() == 0) if ( itemCode == null || itemCode.trim().length() == 0)
{ {
errCode = "VTITMNUL"; errCode = "VTITMNUL";
...@@ -333,46 +328,39 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo ...@@ -333,46 +328,39 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} }
else if (childNodeName.equalsIgnoreCase("site_code")) else if (childNodeName.equalsIgnoreCase("site_code"))
{ {
siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
if ( siteCode== null || siteCode.trim().length() == 0)
siteCode = genericUtility.getColumnValue("site_code", dom); {
if ( siteCode== null || siteCode.trim().length() == 0) { errCode = "VTSITEEMT";
errCode = "VTSITEEMT"; errList.add(errCode);
errList.add(errCode); errFields.add(childNodeName.toLowerCase());
errFields.add(childNodeName.toLowerCase()); }
if (siteCode != null && siteCode.trim().length() > 0)
{
System.out.println(" INSITE SITE CODE VALIDATION ");
sql = " SELECT COUNT(1) FROM site WHERE site_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, siteCode.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
} }
rs.close();
rs = null;
pstmt.close();
if (siteCode != null && siteCode.trim().length() > 0) pstmt = null;
if (cnt == 0)
{ {
System.out.println(" INSITE SITE CODE VALIDATION "); errCode = "VTIVSITE";
sql = " SELECT COUNT(1) FROM site WHERE site_code = ? "; errList.add(errCode);
pstmt = conn.prepareStatement(sql); errFields.add(childNodeName.toLowerCase());
pstmt.setString(1, siteCode.trim());
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 0)
{
errCode = "VTIVSITE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} }
}
} }
} // end of for } // end of for
...@@ -382,9 +370,11 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo ...@@ -382,9 +370,11 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
cnt = 0; cnt = 0;
String errFldName = null; String errFldName = null;
System.out.println("errListSize [" + errListSize + "] errFields size [" + errFields.size() + "]"); System.out.println("errListSize [" + errListSize + "] errFields size [" + errFields.size() + "]");
if (errList != null && errListSize > 0) { if (errList != null && errListSize > 0)
{
for (cnt = 0; cnt < errListSize; cnt++) { for (cnt = 0; cnt < errListSize; cnt++)
{
errCode = errList.get(cnt); errCode = errList.get(cnt);
errFldName = errFields.get(cnt); errFldName = errFields.get(cnt);
System.out.println(" testing :errCode .:" + errCode); System.out.println(" testing :errCode .:" + errCode);
...@@ -398,7 +388,8 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo ...@@ -398,7 +388,8 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
errStringXml.append(bifurErrString); errStringXml.append(bifurErrString);
errString = ""; errString = "";
} }
if (errorType.equalsIgnoreCase("E")) { if (errorType.equalsIgnoreCase("E"))
{
break; break;
} }
} }
...@@ -409,7 +400,8 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo ...@@ -409,7 +400,8 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
errStringXml.append("</Errors> </Root> \r\n"); errStringXml.append("</Errors> </Root> \r\n");
} else { } else
{
errStringXml = new StringBuffer(""); errStringXml = new StringBuffer("");
} }
...@@ -715,6 +707,15 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo ...@@ -715,6 +707,15 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
} }
return msgType; return msgType;
} }
private String checkNull(String input)
{
if (input == null || "null".equalsIgnoreCase(input) || "undefined".equalsIgnoreCase(input))
{
input= "";
}
return input.trim();
}
} // Class } // Class
// return null; // return null;
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