Commit a0c406ad authored by arawankar's avatar arawankar

ADDED DEPARTMENT MASTER RELATED FILES:

1.Added DeptIC.java,DeptICLocal.java,DeptICRemote.java files
2.Added sql file : ADM-2017-10-10.SQL

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@171638 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3eab7631
package ibase.webitm.ejb.adm;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.ejb.Stateless;
import org.glassfish.grizzly.filterchain.RerunFilterAction;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@Stateless
public class DeptIC extends ValidatorEJB implements DeptICRemote, DeptICLocal {
public String itemChanged() throws RemoteException, ITMException {
return "";
}
public String itemChanged(String xmlString, String xmlString1,
String xmlString2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException,
ITMException {
Document dom1 = null;
Document dom = null;
Document dom2 = null;
String valueXmlString = "";
E12GenericUtility genericUtility = new E12GenericUtility();
try {
if (xmlString != null && xmlString.trim().length() != 0) {
dom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() != 0) {
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() != 0) {
dom2 = genericUtility.parseString(xmlString2);
}
valueXmlString = itemChanged(dom, dom1, dom2, objContext,
currentColumn, editFlag, xtraParams);
} catch (Exception e) {
System.out.println("Exception :DeptIC :itemChanged(String,String):"+ e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
}
System.out.println("returning from DeptIC itemChanged");
return (valueXmlString);
}
public String itemChanged(Document dom, Document dom1, Document dom2,
String objContext, String currentColumn, String editFlag,
String xtraParams) throws RemoteException, ITMException {
String colName = " ", mcode = " ", mdescr = " ", mdescr1 = " ", err = " ";
String deptCodeParent = " ", deptCode = " ";
colName = currentColumn;
Connection connectionObject = null;
int currentFormNo = 0;
StringBuffer valueXmlString = null;
ResultSet resultSet = null;
PreparedStatement pstmt = null;
String sql = " ";
E12GenericUtility genericUtility = new E12GenericUtility();
try {
System.out.println("currentFormNo...." + currentFormNo);
connectionObject = getConnection();
if (objContext != null && objContext.trim().length() > 0) {
currentFormNo = Integer.parseInt(objContext);
}
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<editFlag>");
valueXmlString.append(editFlag).append("</editFlag>\r\n</Header>\r\n");
System.out.println("current form no: " + currentFormNo);
switch (currentFormNo) {
case 1:
System.out.println("Case1");
valueXmlString.append("<Detail1>\r\n");
if (currentColumn.trim().equals("dept_head"))
{
mcode = genericUtility.getColumnValue("dept_head", dom);
if(mcode !=null && mcode.length()>0)
{
sql = "Select emp_fname, emp_lname from employee where emp_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mcode);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString("emp_fname");
mdescr1 = resultSet.getString("emp_lname");
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
valueXmlString.append("<emp_fname>").append(mdescr).append("</emp_fname>\r\n");
valueXmlString.append("<emp_lname>").append(mdescr1).append("</emp_lname>\r\n");
}
else if (currentColumn.trim().equals("dept_head_1"))
{
mcode = genericUtility.getColumnValue("dept_head_1", dom);
if(mcode != null && mcode.length()>0)
{
sql = "Select emp_fname, emp_lname from employee where emp_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mcode);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString("emp_fname");
mdescr1 = resultSet.getString("emp_lname");
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
valueXmlString.append("<emp_fname_1>").append(mdescr).append("</emp_fname_1>\r\n");
valueXmlString.append("<emp_lname_1>").append(mdescr1).append("</emp_lname_1>\r\n");
}
else if (currentColumn.trim().equals("acct_code"))
{
mcode = genericUtility.getColumnValue("acct_code", dom);
if(mcode != null && mcode.length()>0)
{
sql = "select descr from accounts where acct_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mcode);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString("descr");
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
valueXmlString.append("<accounts_descr>").append(mdescr).append("</accounts_descr>\r\n");
}
else if (currentColumn.trim().equals("cctr_code"))
{
mcode = genericUtility.getColumnValue("cctr_code", dom);
if(mcode != null && mcode.length()>0 )
{
sql = "select descr from costctr where cctr_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mcode);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString("descr");
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
valueXmlString.append("<costctr_descr>").append(mdescr).append("</costctr_descr>\r\n");
}
else if (currentColumn.trim().equals("acct_code__ap"))
{
mcode = genericUtility.getColumnValue("acct_code__ap", dom);
if(mcode !=null && mcode.length()>0)
{
sql = "select descr from accounts where acct_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mcode);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString("descr");
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
valueXmlString.append("<accounts_descr__ap>").append(mdescr).append("</accounts_descr__ap>\r\n");
}
else if (currentColumn.trim().equals("cctr_code__ap"))
{
mcode = genericUtility.getColumnValue("cctr_code__ap", dom);
if(mcode!=null && mcode.length()>0)
{
sql = "select descr from costctr where cctr_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mcode);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString("descr");
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
valueXmlString.append("<costctr_descr__ap>").append(mdescr).append("</costctr_descr__ap>\r\n");
}
else if (currentColumn.trim().equals("dept_code"))
{
System.out.println("dept_code>>>");
deptCode = genericUtility.getColumnValue("dept_code", dom);
deptCodeParent = genericUtility.getColumnValue("dept_code__parent", dom);
if ((deptCode != null && deptCode.trim().length() > 0) && (deptCodeParent == null || deptCodeParent.trim().length() == 0))
{
valueXmlString.append("<dept_code__parent>").append(deptCode).append("</dept_code__parent>\r\n");
}
else
{
valueXmlString.append("<dept_code__parent>").append(deptCode).append("</dept_code__parent>\r\n");
}
}
else if (currentColumn.trim().equals("descr"))
{
deptCode = genericUtility.getColumnValue("dept_code", dom);
deptCodeParent = genericUtility.getColumnValue("dept_code__parent", dom);
mdescr = genericUtility.getColumnValue("descr", dom);
if ((deptCode != null && deptCode.trim().length() > 0) && (deptCodeParent != null && deptCodeParent.trim().equalsIgnoreCase(deptCode.trim())))
{
valueXmlString.append("<parent_dept_descr>").append(mdescr).append("</parent_dept_descr>\r\n");
}
else{
valueXmlString.append("<parent_dept_descr>").append(mdescr).append("</parent_dept_descr>\r\n");
}
}
else if (currentColumn.trim().equals("dept_code__parent"))
{
deptCodeParent = genericUtility.getColumnValue("dept_code__parent", dom);
mdescr = "";
if (deptCodeParent != null && deptCodeParent.trim().length() > 0)
{
deptCode = genericUtility.getColumnValue("dept_code",dom);
if (!deptCodeParent.trim().equalsIgnoreCase(deptCode.trim()))
{
sql = "select FN_GET_DEPT_DESCR(?) from dual";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, deptCodeParent);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString(1);
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
else
{
mdescr = genericUtility.getColumnValue("descr", dom);
}
valueXmlString.append("<parent_dept_descr>").append(mdescr).append("</parent_dept_descr>\r\n");
}
}
else if (currentColumn.trim().equals("bu_code"))
{
mcode = genericUtility.getColumnValue("bu_code", dom);
mdescr = "";
System.out.println("mcode bu_code==="+mcode);
if (mcode != null && mcode.trim().length() > 0)
{
sql = "select FN_GET_BUCODE_DESCR(?) from dual";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mcode);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString(1);
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
valueXmlString.append("<bu_descr>").append(mdescr).append("</bu_descr>\r\n");
}
else if (currentColumn.trim().equals("func_code"))
{
mcode = genericUtility.getColumnValue("func_code", dom);
mdescr = "";
System.out.println("mcode func_code"+mcode);
if (mcode != null && mcode.trim().length() > 0)
{
sql = "select FN_GET_BUFUNC_DESCR(?) from dual";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mcode);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString(1);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
valueXmlString.append("<func_descr>").append(mdescr).append("</func_descr>\r\n");
}
else if (currentColumn.trim().equals("emp_code__funchead"))
{
mcode = genericUtility.getColumnValue("emp_code__funchead",dom);
mdescr = "";
System.out.println("mcode emp_code__funchead"+mcode);
if (mcode != null && mcode.trim().length() > 0)
{
sql = "select FN_GET_EMP_NAME(?,'X') from dual";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mcode);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString(1);
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
valueXmlString.append("<funchead_name>").append(mdescr).append("</funchead_name>\r\n");
}
else if (currentColumn.trim().equals("item_ser"))
{
mcode = genericUtility.getColumnValue("item_ser", dom);
mdescr = "";
System.out.println("mcode item_ser"+mcode);
if (mcode != null && mcode.trim().length() > 0)
{
sql = "select descr from itemser where item_ser = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mcode);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
mdescr = resultSet.getString("descr");
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
valueXmlString.append("<itemser_descr>").append(mdescr).append("</itemser_descr>\r\n");
}
valueXmlString.append("</Detail1>\r\n");
break;
}
valueXmlString.append("</Root>\r\n");
} catch (Exception e) {
System.out.println("Exception :DeptIC :itemChanged(Document,String):"+ e.getMessage() + ":");
valueXmlString.delete(0, valueXmlString.length());
valueXmlString = valueXmlString.append(genericUtility.createErrorString(e));
e.printStackTrace();
} finally {
try {
if (connectionObject != null) {
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (resultSet != null)
{
resultSet.close();
resultSet = null;
}
connectionObject.close();
connectionObject = null;
}
} catch (Exception e)
{
e.printStackTrace();
}
}
System.out.println("\n****ValueXmlString :" + valueXmlString + ":********");
return valueXmlString.toString();
}
public String wfValData() throws RemoteException, ITMException {
return "";
}
public String wfValData(String xmlString, String xmlString1,
String xmlString2, String objContext, String editFlag,
String xtraParams) throws RemoteException,
ITMException {
System.out.println(xmlString);
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = null;
E12GenericUtility genericUtility = new E12GenericUtility();
try {
if (xmlString != null && xmlString.trim().length() != 0) {
dom = genericUtility.parseString(xmlString);
System.out.println("Print dom>>>> "+dom);
}
if (xmlString1 != null && xmlString1.trim().length() != 0) {
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() != 0) {
dom2 = genericUtility.parseString(xmlString2);
}
errString = wfValData(dom, dom1, dom2, objContext, editFlag,
xtraParams);
System.out.println("ErrString :" + errString);
} catch (Exception e) {
System.out
.println("Exception :DeptIC :wfValData(String xmlString):"
+ e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
}
System.out.println("returning from DeptIC wfvaldata");
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2,
String objContext, String editFlag, String xtraParams)
throws RemoteException, ITMException {
boolean checkNextCol = true;
String columnName = "";
String columnValue = "";
String userId = "";
String sql = "";
String errString = "";
Connection connectionObject = null;
ResultSet resultSet = null;
PreparedStatement pstmt = null;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
int counter;
int noOfChilds = 0;
int currentFormNo = 0;
int cnt = 0;
String mVal = "";
String mVal1 = "";
String mVal2 = "";
java.sql.Timestamp mdate1 = null;
java.sql.Timestamp mdate2 = null;
String deptCodeParent = "";
String deptCode = "";
E12GenericUtility genericUtility = new E12GenericUtility();
UtilMethods utilmethod = new UtilMethods();
try {
connectionObject = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("Line no--468");
if(objContext != null && objContext.trim().length() > 0) {
currentFormNo = Integer.parseInt(objContext);
}
parentList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentList.item(0);
childList = parentNode.getChildNodes();
noOfChilds = childList.getLength();
System.out.println("noOfChilds--->>>"+noOfChilds);
for (counter = 0; counter < noOfChilds; counter++) {
childNode = childList.item(counter);
childNodeName = childNode.getNodeName();
System.out.println("childNodeName>>>>>"+childNodeName);
System.out.println("childNode>>>>>>"+childNode);
System.out.println("counter>>>"+counter);
switch (currentFormNo) {
case 1:
if(childNodeName.equals("dept_code"))
{
mVal = genericUtility.getColumnValue("dept_code", dom);
System.out.println("EditFlag--------"+editFlag);
if("A".equalsIgnoreCase(editFlag))
{
if(mVal == null || mVal.length() == 0)
{
errString = getErrorString("dept_code","VEDEP2", userId);
}
else
{
sql = "select count(*) as cnt from department where dept_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mVal);
resultSet = pstmt.executeQuery();
if(resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if(cnt > 0)
{
errString = getErrorString("dept_code","VMDUPL1", userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
}
else if(childNodeName.equalsIgnoreCase("descr"))
{
System.out.println("line --509");
mVal = genericUtility.getColumnValue("descr", dom);
if(mVal == null || mVal.length() == 0)
{
errString = getErrorString("descr", "VTDESC1",userId);
}
}
else if(childNodeName.equalsIgnoreCase("dept_head"))
{
System.out.println("line--515");
mVal = genericUtility.getColumnValue("dept_head", dom);
if(mVal != null && mVal.trim().length() != 0)
{
sql = "select count(*) as cnt from employee where emp_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mVal);
resultSet = pstmt.executeQuery();
if(resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if(cnt == 0)
{
errString = getErrorString("dept_head","VMEMP1", userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
else if(childNodeName.equalsIgnoreCase("dept_head_1"))
{
System.out.println("line--530");
mVal = genericUtility.getColumnValue("dept_head_1", dom);
if(mVal != null && mVal.trim().length() != 0)
{
sql = "select count(*) as cnt from employee where emp_code =?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mVal);
resultSet = pstmt.executeQuery();
if(resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if(cnt == 0)
{
errString = getErrorString("dept_head_1","VMDEPTHD01", userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
else if(childNodeName.equalsIgnoreCase("acct_code"))
{
System.out.println("line --545");
mVal = genericUtility.getColumnValue("acct_code", dom);
//if(mVal != null && mVal.trim().length()>0)
//{
sql = "select count(*) as cnt from accounts where acct_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mVal);
resultSet = pstmt.executeQuery();
if(resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if(cnt == 0)
{
errString = getErrorString("acct_code", "VMACCT1",userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
//}
}
else if(childNodeName.equalsIgnoreCase("cctr_code"))
{
System.out.println("line --558");
mVal = genericUtility.getColumnValue("cctr_code", dom);
if(mVal !=null && mVal.trim().length() != 0)
{
sql = "select count(*) as cnt from costctr where cctr_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mVal);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if (cnt == 0)
{
errString = getErrorString("cctr_code","VMCCTR1", userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
else if(childNodeName.equalsIgnoreCase("pay_table"))
{
System.out.println("573");
mVal = genericUtility.getColumnValue("pay_table", dom);
if(mVal !=null && mVal.trim().length() != 0)
{
sql = "select count(*) as cnt from paytable where pay_table = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mVal);
resultSet = pstmt.executeQuery();
if(resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if(cnt == 0)
{
errString = getErrorString("pay_table","VMPYTAB2", userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
else if(childNodeName.equalsIgnoreCase("dept_code__parent"))
{
System.out.println("line 589");
deptCodeParent = genericUtility.getColumnValue("dept_code__parent", dom);
cnt = 0;
if(deptCodeParent != null && deptCodeParent.trim().length() > 0)
{
deptCode = genericUtility.getColumnValue("dept_code", dom);
if(!deptCodeParent.trim().equalsIgnoreCase(deptCode))
{
sql = "select count(1) as cnt from department where dept_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, deptCodeParent);
resultSet = pstmt.executeQuery();
if(resultSet.next()){
cnt = resultSet.getInt("cnt");
}
if(cnt == 0)
{
errString = getErrorString("dept_code__parent", "VMDEPTPD01",userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
else
{
System.out.println("line--606");
cnt = 0;
if(CommonConstants.DB_NAME.equalsIgnoreCase("ORACLE"))
{
sql = "select count(1) as cnt from DUAL where ? in "
+ " (select dept_code from department where dept_code <> dept_code__parent "
+ " start with dept_code =? connect by prior dept_code = dept_code__parent) ";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, deptCodeParent);
pstmt.setString(2, mVal);
resultSet = pstmt.executeQuery();
if(resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if(cnt > 0)
{
errString = getErrorString("dept_code__parent","VMDEPTPD02", userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
}
else
{
errString = getErrorString("dept_code__parent","VMDEPTPD03", userId);
}
}
else if(childNodeName.equalsIgnoreCase("bu_code"))
{
System.out.println("line--639");
mVal = genericUtility.getColumnValue("bu_code", dom);
cnt = 0;
if(mVal != null && mVal.length() > 0)
{
sql = "select count(1) as cnt from business_units where bu_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mVal);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if (cnt == 0)
{
errString = getErrorString("bu_code","VMDEPTBU01", userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
else if(childNodeName.equalsIgnoreCase("func_code"))
{
System.out.println("line --662");
mVal = genericUtility.getColumnValue("func_code", dom);
cnt = 0;
if(mVal != null && mVal.length() > 0)
{
sql = "select count(1) as cnt from BUSI_FUNCTIONS where func_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mVal);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if(cnt == 0)
{
errString = getErrorString("func_code","VMDEPTFU01", userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
else if(childNodeName.equalsIgnoreCase("emp_code__funchead"))
{
System.out.println("line--679");
mVal = genericUtility.getColumnValue("emp_code__funchead", dom);
cnt = 0;
mVal1 = "";
mdate1 = null;
if(mVal != null && mVal.length() > 0)
{
sql = "select count(1) as cnt from EMPLOYEE where emp_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mVal);
resultSet = pstmt.executeQuery();
if(resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if(cnt == 0)
{
errString = getErrorString("emp_code__funchead", "VMDEPTFH01",userId);
}
else
{
sql = "select status, relieve_date from EMPLOYEE where emp_code = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1, mVal);
resultSet = pstmt.executeQuery();
if(resultSet.next())
{
mVal1 = resultSet.getString("status");
mdate1 = resultSet.getTimestamp("relieve_date");
}
if(mVal1 != null && mVal1.trim().equalsIgnoreCase("S"))
{
errString = getErrorString("emp_code__funchead", "VMDEPTFH02",userId);
}
else if(mdate1 != null &&( utilmethod.date(mdate1).equals(utilmethod.today()) || utilmethod.date(mdate1).before(utilmethod.today())))
{
errString = getErrorString("emp_code__funchead", "VMDEPTFH03",userId);
System.out.println("relieve_date line 835>>>>"+mdate1);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
else if(childNodeName.equalsIgnoreCase("item_ser"))
{
System.out.println("line--723");
mVal = genericUtility.getColumnValue("item_ser", dom);
if(mVal != null && mVal.length()>0)
{
cnt = 0;
sql = "select count(1) as cnt from itemser where item_ser = ?";
pstmt = connectionObject.prepareStatement(sql);
pstmt.setString(1,mVal);
resultSet = pstmt.executeQuery();
if (resultSet.next())
{
cnt = resultSet.getInt("cnt");
}
if(cnt == 0)
{
errString = getErrorString("item_ser", "VMDEPTIS01",userId);
}
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
}
}
}
} catch (Exception e)
{
System.out.println("Exception :DeptIC :wfValData(Document,String):"+ e.getMessage() + ":");
e.printStackTrace();
}finally
{
try
{
if (connectionObject != null)
{
if (resultSet != null) {
resultSet.close();
resultSet = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
connectionObject.close();
connectionObject = null;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
return errString;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local;
import org.w3c.dom.Document;
@Local
public interface DeptICLocal extends ValidatorLocal {
public String itemChanged() throws RemoteException, ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData() throws RemoteException, ITMException;
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag,String xtraParams) throws RemoteException,ITMException ;
public String wfValData(Document dom, Document dom1, Document dom2,String objContext, String editFlag, String xtraParams)throws RemoteException, ITMException;
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
import org.w3c.dom.Document;
@Remote
public interface DeptICRemote extends ValidatorRemote
{
public String itemChanged() throws RemoteException, ITMException;
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData() throws RemoteException, ITMException;
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag,String xtraParams) throws RemoteException,ITMException ;
public String wfValData(Document dom, Document dom1, Document dom2,String objContext, String editFlag, String xtraParams)throws RemoteException, ITMException;
}
[Dolphin]
SortOrder=1
SortRole=date
Timestamp=2017,10,10,16,10,28
Version=3
ViewMode=1
SET DEFINE OFF;
-----------------------------------[obj_name : dept][10/10/2017][START]------------------------------------------------------------------------
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','dept_head',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','dept_head_1',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','acct_code',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','cctr_code',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','acct_code__ap',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','cctr_code__ap',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','dept_code',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','descr',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','dept_code__parent',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','bu_code',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','func_code',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','emp_code__funchead',null);
Insert into OBJ_ITEMCHANGE (OBJ_NAME,FORM_NO,FIELD_NAME,MANDATORY) values ('dept','1','item_ser',null);
Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,OVERWRITE_CORE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,COMP_NAME,COMP_TYPE,COMM_FORMAT) values ('dept','post_item_change','1','poic_default_ejb',null,'0',sysdate,'BASE','BASE','2','DeptIC','EJB',null);
Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,OVERWRITE_CORE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,COMP_NAME,COMP_TYPE,COMM_FORMAT) values ('dept','pre_validate','1','prv_default_ejb',null,'0',sysdate,'Base','Base','2','DeptIC','EJB',null);
Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM) values ('poic_default_ejb',' method for itemchange','http://localhost:9090/axis/services/ValidatorService','BASE','itemChanged','String','S',null,null,sysdate,'base','base');
Insert into system_event_services (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM) values ('prv_default_ejb','method for validation','http://localhost:9090/axis/services/ValidatorService','BASE','wfValData','String','S',null,null,sysdate,'Base','Base');
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',1,'COMPONENT_TYPE','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',2,'COMPONENT_NAME','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',3,'XML_DATA','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',4,'XML_DATA_1','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',5,'XML_DATA_ALL','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',6,'OBJ_CONTEXT','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',7,'FOCUSED_COLUMN','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',8,'EDIT_FLAG','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('poic_default_ejb',9,'XTRA_PARAMS','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prv_default_ejb',1,'COMPONENT_TYPE','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prv_default_ejb',2,'COMPONENT_NAME','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prv_default_ejb',3,'XML_DATA','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prv_default_ejb',4,'XML_DATA_1','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prv_default_ejb',5,'XML_DATA_ALL','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prv_default_ejb',6,'OBJ_CONTEXT','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prv_default_ejb',7,'EDIT_FLAG','I',null,'S',null,sysdate,'Base','Base',null);
Insert into system_service_args (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('prv_default_ejb',8,'XTRA_PARAMS','I',null,'S',null,sysdate,'Base','Base',null);
update SYSTEM_EVENTS set COMP_NAME = 'DeptIC',COMP_TYPE = 'EJB'
where OBJ_NAME ='dept' and EVENT_CODE = 'pre_validate';
update SYSTEM_EVENTS set COMP_NAME = 'DeptIC',COMP_TYPE = 'EJB'
where OBJ_NAME ='dept' and EVENT_CODE = 'post_item_change';
update itm2menu set obj_type = 'T'
where win_name = 'w_dept';
commit
-----------------------------------[obj_name : dept][10/10/2017][END]------------------------------------------------------------------------
-----------------------------------[MESSAGES][10/10/2017][START]------------------------------------------------------------------------
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values
('VMDEPTPD01','Invalid Parent Department!','Specified parent department is not defined in system, please either first define the same or specify another one which is already defined','E','Y',null,null,null,to_date('30-NOV-15','DD-MON-RR'),'BASE','BASE',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VMDEPTBU01','Invalid Business Unit!','Specified business unit is not defined in system, please either first define the same or specify another one which is already defined','E','Y',null,null,null,to_date('30-NOV-15','DD-MON-RR'),'BASE','BASE',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VMDEPTFH01','Invalid Function Head!','Specified code of function head not existing in system, please specify another function head who is existing in system','E','Y',null,null,null,to_date('30-NOV-15','DD-MON-RR'),'BASE','BASE',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VMDEPTFH02','Function Head is Separated!','Specified function head is already separated, please specify another function head who is not separated','E','Y',null,null,null,to_date('30-NOV-15','DD-MON-RR'),'BASE','BASE',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VMDEPTFH03','Function Head is Relieved!','Specified function head is already relieved, please specify another function head who is not relieved','E','Y',null,null,null,to_date('30-NOV-15','DD-MON-RR'),'BASE','BASE',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VMDEPTFU01','Invalid Function Code!','Specified function code is not defined in system, please either first define the same or specify another one which is already defined','E','Y',null,null,null,to_date('30-NOV-15','DD-MON-RR'),'BASE','BASE',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values ('VMDEPTPD02','Recursive Parent Department!','Specified parent department is recursively used which establish cyclic relation, please specify another one','E','Y',null,null,null,to_date('30-NOV-15','DD-MON-RR'),'BASE','BASE',null,null);
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values
('VMDEPTHD01','Invalid employee code','The employee code entered in department head 1 does not exist in the employee master. First you have to define it in the master','E','Y',null,null,null,to_date('13-OCT-14','DD-MON-RR'),'BASE','BASE',null,null);
Insert into messages (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values
('VMDEPTIS01','Invalid Item Series!','Entered item series does not existing in item series master, please enter item series which is existing in item series master or leave it blank','E','Y',null,null,null,to_timestamp('2016-07-05','YYYY-MM-DD HH.MI.SSXFF AM'),'BASE','BASE',null,null);
-----------------------------------[MESSAGES][10/10/2017][END]------------------------------------------------------------------------
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