Commit 8dc3b7ba authored by pdas's avatar pdas

Request ID-DI2ASUN029

ADDITION OF VALIDATION CONDITIONS ACCORDING TO TESTCASE


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98033 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 773d5459
......@@ -109,7 +109,7 @@ public class PriceListGenIC extends ValidatorEJB implements PriceListGenLocal, P
String rateStr = "";
int rate = 0;
int minRate = 0;
String unit ="";
int ctr = 0;
int count = 0;
int currentFormNo = 0;
......@@ -135,8 +135,7 @@ public class PriceListGenIC extends ValidatorEJB implements PriceListGenLocal, P
conn = connDriver.getConnectDB("DriverITM");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
genericUtility.getApplDateFormat());
SimpleDateFormat dbDateFormat = new SimpleDateFormat(genericUtility
.getInstance().getDBDateFormat());
SimpleDateFormat dbDateFormat = new SimpleDateFormat(genericUtility.getInstance().getDBDateFormat());
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
conn = connDriver.getConnectDB("DriverITM");
if (objContext != null && objContext.trim().length() > 0)
......@@ -151,6 +150,7 @@ public class PriceListGenIC extends ValidatorEJB implements PriceListGenLocal, P
System.out.println("testing case 1 for validation ");
parentNodeList = dom.getElementsByTagName("Detail1");
valueXmlString.append("<Detail1>");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
......@@ -160,9 +160,18 @@ public class PriceListGenIC extends ValidatorEJB implements PriceListGenLocal, P
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
System.out.println("pricelist>>>><<<<");
priceList = genericUtility.getColumnValue("price_list",dom);
if (childNodeName.equalsIgnoreCase("price_list"))
{
priceList = genericUtility.getColumnValue("price_list",dom);
if(priceList == null )
{
errCode ="VMPRLNULL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
if (priceList != null && priceList.trim().length() > 0)
{
......@@ -214,6 +223,17 @@ public class PriceListGenIC extends ValidatorEJB implements PriceListGenLocal, P
}
}
else if(childNodeName.equalsIgnoreCase("tran_date"))
{
dateStr =genericUtility.getColumnValue("tran_date", dom);
if (dateStr == null) {
errCode = "VTTRNDTNUL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
else if (childNodeName.equalsIgnoreCase("tran_id"))
{
tranId = genericUtility.getColumnValue("tran_id", dom);
......@@ -278,13 +298,14 @@ public class PriceListGenIC extends ValidatorEJB implements PriceListGenLocal, P
}
}
valueXmlString.append("</Detail1>");
break;
case 2:
parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail2>");
ctr =0;
childNodeListLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeListLength; ctr++) {
......@@ -295,6 +316,13 @@ public class PriceListGenIC extends ValidatorEJB implements PriceListGenLocal, P
itemCode = genericUtility.getColumnValue("item_code",
dom);
if (itemCode == null || itemCode.trim().length() == 0) {
errCode = "VTITMNL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
sql = "select count(*) from item where item_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, itemCode);
......@@ -324,17 +352,54 @@ public class PriceListGenIC extends ValidatorEJB implements PriceListGenLocal, P
}
}
else if (childNodeName.equalsIgnoreCase("unit")) {
count =0;
unit = genericUtility.getColumnValue("unit",
dom);
sql = "select count(*) from uom where unit = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,unit);
rs = pstmt.executeQuery();
if (rs.next()) {
count = rs.getInt(1);
}
if (count == 0) {
errCode = "VTINVUNT02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
}
else if (childNodeName.equalsIgnoreCase("min_qty")) {
minQtyStr = genericUtility.getColumnValue("min_qty",
dom);
minQty = minQtyStr == null ? 0 : minQtyStr.trim().length() == 0 ? 0 : Integer.parseInt(minQtyStr.trim());
if(minQtyStr == null || minQtyStr.trim().length() == 0 )
{
errCode = "NULLQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
// minQty = minQtyStr == null ? 0 : minQtyStr.trim().length() == 0 ? 0 : Integer.parseInt(minQtyStr.trim());
maxQtyStr = genericUtility.getColumnValue("max_qty",
dom);
maxQty = maxQtyStr == null ? 0 : maxQtyStr.trim().length() == 0 ? 0 : Integer.parseInt(maxQtyStr.trim());
}
else if (childNodeName.equalsIgnoreCase("max_qty"))
{
maxQtyStr = genericUtility.getColumnValue("max_qty",dom);
if(maxQtyStr == null || minQtyStr.trim().length() == 0 )
{
errCode = "NULLQTY";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
//maxQty = maxQtyStr == null ? 0 : maxQtyStr.trim().length() == 0 ? 0 : Integer.parseInt(maxQtyStr.trim());
minQty = Integer.parseInt(minQtyStr.trim());
maxQty = Integer.parseInt(minQtyStr.trim());
if (maxQty < minQty) {
errCode = "VMMINQTY";
errList.add(errCode);
......@@ -350,6 +415,13 @@ public class PriceListGenIC extends ValidatorEJB implements PriceListGenLocal, P
{
minRate = Integer.parseInt(minRateStr);
rate = Integer.parseInt(rateStr);
if(rate<0)
{
errCode = "VTSUBCRATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
if (rate < minRate) {
errCode = "VMMINRATE";
errList.add(errCode);
......@@ -383,8 +455,9 @@ public class PriceListGenIC extends ValidatorEJB implements PriceListGenLocal, P
}
}
}
}
valueXmlString.append("</Detail2>");
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