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