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
childNode = childNodeList.item(ctr);
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))
{
sql = "select count(*) from min_rate_history where doc_key= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, docKey);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("cnt value is :[" + cnt + "]");
if (cnt>0)
{
errCode = "VTKNET";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
sql = "select count(*) from min_rate_history where doc_key= ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, docKey);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("cnt value is :[" + cnt + "]");
if (cnt>0)
{
errCode = "VTKNET";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
else if (childNodeName.equalsIgnoreCase("scheme_code")) {
schemeCode = this.genericUtility.getColumnValue("scheme_code", dom);
itemCode=this.genericUtility.getColumnValue("item_code", dom);
else if (childNodeName.equalsIgnoreCase("scheme_code"))
{
schemeCode = checkNull(this.genericUtility.getColumnValue("scheme_code", dom));
itemCode=checkNull(this.genericUtility.getColumnValue("item_code", dom));
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 =?";
......@@ -181,40 +182,34 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
pstmt = null;
if(cnt==0) {
if(cnt==0)
{
System.out.println("itemCode Testing : " +itemCode);
sql= "select bom_code from item where item_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, schemeCode);
rs=pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
sql= "select count(*) from item where item_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, schemeCode);
rs=pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
if (cnt == 0)
{
errCode = "VTSCHNO1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
{
errCode = "VTSCHNO1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
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 + "]");
if (invoiceId != null && invoiceId.trim().length() > 0)
{
sql = "select count(*) from invoice where invoice_id = ? ";
......@@ -238,9 +233,9 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
}
} else if (childNodeName.equalsIgnoreCase("line_no"))
{
invoiceId = genericUtility.getColumnValue("invoice_id", dom);
lineNo = genericUtility.getColumnValue("line_no", dom);
invoiceId = checkNull(genericUtility.getColumnValue("invoice_id", dom));
lineNo = checkNull(genericUtility.getColumnValue("line_no", dom));
if (invoiceId != null && invoiceId.trim().length() > 0)
{
sql = "select count(*) from invdet where invoice_id = ? and line_no= ? ";
......@@ -263,46 +258,46 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
errFields.add(childNodeName.toLowerCase());
}
}
System.out.println("Testing done");
System.out.println("Testing done");
}
else if (childNodeName.equalsIgnoreCase("cust_code"))
{
System.out.println("Testing pending");
custCode = genericUtility.getColumnValue("cust_code", dom);
if(custCode== null || custCode.trim().length() == 0)
{
errCode = "VTMSG";
{
System.out.println("Testing pending");
custCode = checkNull(genericUtility.getColumnValue("cust_code", dom));
if(custCode== null || custCode.trim().length() == 0)
{
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);
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());
}
errFields.add(childNodeName.toLowerCase());
}
}
}
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)
{
errCode = "VTITMNUL";
......@@ -333,46 +328,39 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
errFields.add(childNodeName.toLowerCase());
}
}
}
else if (childNodeName.equalsIgnoreCase("site_code"))
{
siteCode = genericUtility.getColumnValue("site_code", dom);
if ( siteCode== null || siteCode.trim().length() == 0) {
errCode = "VTSITEEMT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
siteCode = checkNull(genericUtility.getColumnValue("site_code", dom));
if ( siteCode== null || siteCode.trim().length() == 0)
{
errCode = "VTSITEEMT";
errList.add(errCode);
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);
}
if (siteCode != null && siteCode.trim().length() > 0)
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt == 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();
pstmt = null;
if (cnt == 0)
{
errCode = "VTIVSITE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
errCode = "VTIVSITE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}
} // end of for
......@@ -382,9 +370,11 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
cnt = 0;
String errFldName = null;
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);
errFldName = errFields.get(cnt);
System.out.println(" testing :errCode .:" + errCode);
......@@ -398,7 +388,8 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
errStringXml.append(bifurErrString);
errString = "";
}
if (errorType.equalsIgnoreCase("E")) {
if (errorType.equalsIgnoreCase("E"))
{
break;
}
}
......@@ -409,7 +400,8 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
errStringXml.append("</Errors> </Root> \r\n");
} else {
} else
{
errStringXml = new StringBuffer("");
}
......@@ -715,6 +707,15 @@ public class MinRateHistoryIC extends ValidatorEJB implements MinRateHistoryICLo
}
return msgType;
}
private String checkNull(String input)
{
if (input == null || "null".equalsIgnoreCase(input) || "undefined".equalsIgnoreCase(input))
{
input= "";
}
return input.trim();
}
} // Class
// 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