Commit 088cc73c authored by dsawant's avatar dsawant

null validation is added for dept_code and cctr_code


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93106 ce508802-f39f-4f6c-b175-0d175dae99d5
parent fe5d2aee
package ibase.webitm.ejb.fin;
package ibase.webitm.ejb.fin.budget;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ValidatorEJB;
......@@ -13,6 +13,9 @@ import java.util.Calendar;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import sun.awt.X11.Depth;
import javax.ejb.Stateless; // added for ejb3
......@@ -218,9 +221,12 @@ public class BudgetGroup extends ValidatorEJB implements BudgetGroupLocal,Budget
if (childNodeName.equalsIgnoreCase("cctr_code"))
{
cctr_code = genericUtility.getColumnValue("cctr_code",dom);
if (cctr_code != null && cctr_code.trim().length() > 0 )
if (cctr_code == null || cctr_code.trim().length() == 0 )
{
errCode = "VMCCTRE";
errString = getErrorString("cctr_code",errCode,userId);
break;
}else
{
sql = "select count(1) from costctr where cctr_code = ? ";
pstmt=conn.prepareStatement(sql);
......@@ -236,7 +242,7 @@ public class BudgetGroup extends ValidatorEJB implements BudgetGroupLocal,Budget
rs = null;
if(cnt == 0)
{
errCode = "VTINCCCODE";
errCode = "VTCCTR1";
errString = getErrorString("cctr_code",errCode,userId);
break;
}
......@@ -247,7 +253,7 @@ public class BudgetGroup extends ValidatorEJB implements BudgetGroupLocal,Budget
if (childNodeName.equalsIgnoreCase("anal_code"))
{
anal_code = genericUtility.getColumnValue("anal_code",dom);
cctr_code = genericUtility.getColumnValue("cctr_code",dom);
acct_code = genericUtility.getColumnValue("acct_code",dom);
if (anal_code != null && anal_code.trim().length() > 0 )
{
......@@ -269,29 +275,30 @@ public class BudgetGroup extends ValidatorEJB implements BudgetGroupLocal,Budget
errString = getErrorString("anal_code",errCode,userId);
break;
}
if(!editFlag.equals("E"))
{
sql = "select count(1) from bud_group_det where "
+" cctr_code = ? and anal_code= ? ";
String val = null;
sql = "select acct_code from accounts_analysis where anal_code= ? ";
System.out.println("CHECK ANAL");
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, cctr_code);
pstmt.setString(2, anal_code);
pstmt.setString(1, anal_code);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt(1);
val = rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (cnt > 0) {
errCode = "VMANAL3";
if (!(val.trim().equalsIgnoreCase(acct_code.trim()))) {
errCode = "VMANAL2";
errString = getErrorString("anal_code",errCode, userId);
break;
}
}
}
......@@ -299,6 +306,41 @@ public class BudgetGroup extends ValidatorEJB implements BudgetGroupLocal,Budget
}
if (childNodeName.equalsIgnoreCase("dept_code"))
{
String dept_code = genericUtility.getColumnValue("dept_code",dom);
if (dept_code == null || dept_code.trim().length() == 0 )
{
errCode = "VMDCTRE";
errString = getErrorString("dept_code",errCode,userId);
break;
}
else
{
sql = "select count(1) from department where dept_code = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,dept_code);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt(1);
}
pstmt.close();
rs.close();
pstmt = null;
rs = null;
if(cnt == 0)
{
errCode = "VMDEP1";
errString = getErrorString("dept_code",errCode,userId);
break;
}
}
}
if (childNodeName.equalsIgnoreCase("alloc_perc"))
{
String alloc_perc = genericUtility.getColumnValue("alloc_perc", dom2);
......
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