Commit 72e4d276 authored by dpingle's avatar dpingle

*Migration done for below menu option

1)w_emp_mthad
EmpMthadIC.java
EmpMthadLocal.java
EmpMthadRemote.java

2)w_grade_ad
GradeAdIC.java
GradeAdLocal.java
GradeAdRemote.java

3)w_loanscheme_grade
GradeWiseLoanSchemeIC.java
GradeWiseLoanSchemeLocal.java
GradeWiseLoanSchemeRemote.java

4)w_leave
LeavesIC.java
LeavesLocal.java
LeavesRemote.java

5)w_lvetable
LeaveTableIC.java
LeaveTableLocal.java
LeaveTableRemote.java

6)w_loanscheme
LoanSchemeIC.java
LoanSchemeLocal.java
LoanSchemeRemote.java

7)w_workshft
WorkShiftIC.java
WorkShiftLocal.java
WorkShiftRemote.java

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@203939 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8fbb1dfe
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class CadreAdIC extends ValidatorEJB implements CadreAdLocal,CadreAdRemote
{
@Override
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 = "";
E12GenericUtility genericUtility = null;
try {
genericUtility = new E12GenericUtility();
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 :CadreAdIC :wfValData(String xmlString):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from CadreAdIC wfvaldata");
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
StringBuffer errStringXml = null;
PreparedStatement pstmt = null;
ITMDBAccessEJB itmDbAcess = null;
ResultSet rs = null;
Connection conn = null;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
String errString = "";
String userId = "";
String adCode = "";
String sql = "";
String expDateStr = "";
String effDateStr = "";
int currentFormNo = 0;
int noOfChilds = 0;
int cnt = 0;
int counter;
E12GenericUtility genericUtility = null;
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
genericUtility = new E12GenericUtility();
itmDbAcess = new ITMDBAccessEJB();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = 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:
NodeList parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
NodeList childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
System.out.println("child Node List Length::::::" + childNodeListLength);
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode" + childNode);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "" + editFlag);
System.out.println("@V@ Edit flag :- [" + editFlag + "");
if ("ad_code".equalsIgnoreCase(childNodeName))
{
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
sql="select count(*) as cnt from allwdedn where ad_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMADC1");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("eff_date".equalsIgnoreCase(childNodeName))
{
effDateStr = checkNull(genericUtility.getColumnValue("eff_date",dom));
if(effDateStr == null || effDateStr.trim().length() == 0)
{
errList.add("VTDATE11");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("exp_date".equalsIgnoreCase(childNodeName))
{
effDateStr = checkNull(genericUtility.getColumnValue("eff_date",dom));
expDateStr = checkNull(genericUtility.getColumnValue("exp_date",dom));
if(expDateStr == null || expDateStr.trim().length() == 0)
{
errList.add("VTDATE11");
errFields.add(childNodeName.toLowerCase());
}
if(effDateStr != null && expDateStr != null)
{
if(effDateStr.trim().length() > 0 && expDateStr.trim().length() > 0)
{
Date effDate = sdf.parse( effDateStr );
Date expDate = sdf.parse( expDateStr );
if(effDate.after(expDate))
{
errList.add("VMEXPDATE");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
}
break;
}
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
System.out.println("errList==[" + errList + "]");
int errListSize = errList.size();
System.out.println("errListSize:::::::[" + errListSize + "]");
System.out.println("in error::::::::::");
for (int i = 0; i < errListSize; i++)
{
System.out.println("in error For:::::::::::::::");
String errCode = (String) errList.get(i);
String errFldName = (String) errFields.get(i);
System.out.println("errCode .........." + errCode);
errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
String msgType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........." + errStringXml);
errString = "";
}
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errFields.clear();
}
errStringXml.append("</Errors></Root>\r\n");
System.out.println("errStringXml.toString()---2= "+errStringXml.toString());
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
errString = errStringXml.toString();
return errString;
}
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 = null;
try {
genericUtility = new E12GenericUtility();
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 :CadreAdIC :itemChanged(String,String):" + e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from CadreAdIC itemChanged");
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException, ITMException
{
StringBuffer valueXmlString = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
E12GenericUtility genericUtility = null;
int currentFormNo = 0;
String payTable = "";
String cadreCode = "";
String lsVarValue = "";
String lsVarValues = "";
String adCode = "";
String sql = "";
String mdescr = "";
String lsProp = "";
AdmCommon admCommon = new AdmCommon();
try
{
genericUtility = new E12GenericUtility();
System.out.println("currentFormNo...." + currentFormNo);
conn = 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 ("itm_default".equalsIgnoreCase(currentColumn))
{
payTable = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "pay_table");
valueXmlString.append("<pay_table ><![CDATA[").append(payTable).append("]]></pay_table>\r\n");
cadreCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "cadre_code");
valueXmlString.append("<cadre_code ><![CDATA[").append(cadreCode).append("]]></cadre_code>\r\n");
lsVarValue = admCommon.getEnv("999999", "AD_EFFDATE", conn);
System.out.println("lsVarValue==["+lsVarValue+"]");
System.out.println("genericUtility.getApplDateFormat()==["+genericUtility.getApplDateFormat()+"]");
lsVarValue = genericUtility.getValidDateString(lsVarValue, genericUtility.getApplDateFormat());
System.out.println("lsVarValue==after["+lsVarValue+"]");
lsVarValues = admCommon.getEnv("999999", "AD_EXPDATE", conn);
lsVarValues = genericUtility.getValidDateString(lsVarValues, genericUtility.getApplDateFormat());
valueXmlString.append("<eff_date ><![CDATA[").append(lsVarValue).append("]]></eff_date>\r\n");
valueXmlString.append("<exp_date ><![CDATA[").append(lsVarValues).append("]]></exp_date>\r\n");
}
if ("ad_code".equalsIgnoreCase(currentColumn))
{
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
sql="Select descr, prop_yn as ls_prop from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if (rs.next())
{
mdescr = rs.getString("descr");
lsProp = rs.getString("ls_prop");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<allwdedn_descr ><![CDATA[").append(mdescr).append("]]></allwdedn_descr>\r\n");
valueXmlString.append("<prop_yn ><![CDATA[").append(lsProp).append("]]></prop_yn>\r\n");
}
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
conn.close();
conn = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
if (conn == null)
{
System.out.println("Connection is null");
} else
{
System.out.println("Connection is not null");
}
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
public interface CadreAdLocal extends ValidatorLocal
{
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(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 org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
public interface CadreAdRemote extends ValidatorRemote
{
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(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;
}
......@@ -19,7 +19,11 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@Stateless
import ibase.webitm.ejb.ITMDBAccessEJB;
//Modified By Dipesh on[17/07/2019][Start]
//@Stateless
//Modified By Dipesh on[17/07/2019][End]
public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,EmpBasicInfoRemote
{
......@@ -69,7 +73,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
//ConnDriver connDriver = new ConnDriver();//modified by dipesh on [17/07/2019]
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
......@@ -102,7 +106,12 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
String empCodeHod ="";
String empCodeHodFname ="";
String empCodeHodLname ="";
//Added by Dipesh p on[17/07/2019][Start]
String funcHeadName = "";
String buHeadName = "" ;
String buDescr = "";
String empCodeBuHead = "";
//Added by Dipesh p on[17/07/2019][End]
//Variable defined for employee details . End
//Added by Anjali R on[21/02/2018][Start][To change related to accept employee name in long form][Req ID - A17KSUN006 CCF-NO-ADM6/0127]
......@@ -136,7 +145,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
try
{
conn = connDriver.getConnectDB("Driver");
//Added by Dipesh on[17/07/2019][Start]
//conn = connDriver.getConnectDB("Driver");
conn=getConnection();
//Added by Dipesh on[17/07/2019][End]
conn.setAutoCommit(false);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
......@@ -571,12 +583,15 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
}
else if(currentColumn.trim().equalsIgnoreCase("emp_code__funchead"))
{
String empCodeFuncHead = genericUtility.getColumnValue("emp_code__funchead", dom);
//Added by Dipesh on[17/07/2019][Start]
//String empCodeFuncHead = (genericUtility.getColumnValue("emp_code__funchead", dom);
String empCodeFuncHead = checkNull(genericUtility.getColumnValue("emp_code__funchead", dom));
//Added by Dipesh on[17/07/2019][End]
sql = "SELECT FN_GET_EMP_NAME(?, 'X') AS FUNCHEAD_NAME FROM DUAL";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeFuncHead);
rs = pstmt.executeQuery();
String funcHeadName = "";
//String funcHeadName = "";
if(rs.next())
{
funcHeadName = checkNull(rs.getString("FUNCHEAD_NAME"));
......@@ -595,12 +610,15 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
}
else if(currentColumn.trim().equalsIgnoreCase("bu_code"))
{
String buCode = genericUtility.getColumnValue("bu_code", dom);
//Added by Dipesh on[17/07/2019][Start]
//String buCode = genericUtility.getColumnValue("bu_code", dom);
String buCode =checkNull(genericUtility.getColumnValue("bu_code", dom));
//Added by Dipesh on[17/07/2019][Start]
sql = "SELECT DESCR, EMP_CODE__HEAD, FN_GET_EMP_NAME(EMP_CODE__HEAD, 'X') AS BUHEAD_NAME FROM BUSINESS_UNITS WHERE BU_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, buCode);
rs = pstmt.executeQuery();
String buHeadName = "", buDescr = "", empCodeBuHead = "";
//String buHeadName = "", buDescr = "", empCodeBuHead = "";
if(rs.next())
{
buDescr = checkNull(rs.getString("DESCR"));
......@@ -1073,7 +1091,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("Driver");
//Added by Dipesh on[17/07/2019][Start]
//conn = connDriver.getConnectDB("Driver");
conn=getConnection();
//Added by Dipesh on[17/07/2019][End]
conn.setAutoCommit(false);
errString = wfValData( dom, dom1, dom2, objContext, editFlag, xtraParams,conn);
......@@ -1107,7 +1128,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
Node parentNode = null;
Node childNode = null;
ITMDBAccessEJB itmDbAccess = null;
NodeList parentNodeList = null;
NodeList childNodeList = null;
......@@ -1151,6 +1172,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
String reportToAdmin = "";
String posCode = "";
String empCodeHod = "";
//Added by Dipesh on[17/07/2019][Start]
String status = "";
String relieveDate ="";
//Added by Dipesh on[17/07/2019][End]
//Varibles used in case 1 End
//Added by Anjali R on[21/02/2018][Start][To change related to accept employee name in long form][Req ID - A17KSUN006 CCF-NO-ADM6/0127]
......@@ -1168,6 +1193,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
try
{
itmDbAccess =new ITMDBAccessEJB();
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
......@@ -1312,7 +1338,20 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
{
count = rs.getInt("cnt");
}
if(count > 0) {
//Added by Dipesh P on[17/07/2019][Start]
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
//Added by Dipesh P on[17/07/2019][End]
if(count > 0)
{
errList.add( "VMDUPL1" );
errFields.add( childNodeName.toLowerCase() );
......@@ -1530,7 +1569,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCodeLink);
rs = pstmt.executeQuery();
String relieveDate ="";
//String relieveDate ="";
if(rs.next())
{
relieveDate = checkNull(rs.getString("RELIEVE_DATE"));
......@@ -1767,7 +1806,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,deptCode);
rs = pstmt.executeQuery();
String status = "";
//String status = "";
if(rs.next())
{
status = checkNull(rs.getString("STATUS"));
......@@ -1802,7 +1841,11 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
else if(childNodeName.equalsIgnoreCase("func_group"))
{
System.out.println(" Validaion for field "+childNodeName);
funcGroup = genericUtility.getColumnValue("func_group", dom);
//Modified by Dipesh on [17/07/2019][Start]
//funcGroup = genericUtility.getColumnValue("func_group", dom);
funcGroup = checkNull(genericUtility.getColumnValue("func_group", dom));
//Modified by Dipesh on [17/07/2019][End]
if(funcGroup != null && funcGroup.length() > 0)
{
sql = "select count(*) as cnt from busi_functions where func_code = ? ";
......@@ -1839,8 +1882,13 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
else if(childNodeName.equalsIgnoreCase("emp_code__funchead"))
{
System.out.println(" Validaion for field "+childNodeName);
String empCodeFuncHead = genericUtility.getColumnValue("emp_code__funchead", dom);
String empCodeDom = genericUtility.getColumnValue("emp_code", dom);
//Modified by Dipesh on [17/07/2019][Start]
//String empCodeFuncHead = genericUtility.getColumnValue("emp_code__funchead", dom);
//String empCodeDom = genericUtility.getColumnValue("emp_code", dom);
String empCodeFuncHead = checkNull(genericUtility.getColumnValue("emp_code__funchead", dom));
String empCodeDom = checkNull(genericUtility.getColumnValue("emp_code", dom));
//Modified by Dipesh on [17/07/2019][End]
if(empCodeFuncHead != null && empCodeFuncHead.length() > 0)
{
sql = "select count(*) as cnt from employee where emp_code = ? ";
......@@ -1921,7 +1969,11 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
else if(childNodeName.equalsIgnoreCase("bu_code"))
{
System.out.println(" Validaion for field "+childNodeName);
String buCode = genericUtility.getColumnValue("bu_code", dom);
//Modified by Dipesh on [17/07/2019][Start]
//String buCode = genericUtility.getColumnValue("bu_code", dom);
String buCode = checkNull(genericUtility.getColumnValue("bu_code", dom));
//Modified by Dipesh on [17/07/2019][End]
if(buCode != null && buCode.length() > 0)
{
sql = "select count(*) as cnt from business_units where bu_code = ? ";
......@@ -2075,7 +2127,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,designCode);
rs = pstmt.executeQuery();
String status = "";
//String status = "";
if(rs.next())
{
status = checkNull(rs.getString("STATUS"));
......@@ -2170,7 +2222,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,reportTo);
rs = pstmt.executeQuery();
String status = "";
// String status = "";
if(rs.next())
{
status = checkNull(rs.getString("STATUS"));
......@@ -2278,7 +2330,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,reportToAdmin);
rs = pstmt.executeQuery();
String relieveDate ="";
//String relieveDate ="";
if(rs.next())
{
relieveDate = checkNull(rs.getString("RELIEVE_DATE"));
......@@ -2342,7 +2394,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCodeHod);
rs = pstmt.executeQuery();
String relieveDate ="";
//String relieveDate ="";
if(rs.next())
{
relieveDate = checkNull(rs.getString("RELIEVE_DATE"));
......@@ -2401,7 +2453,11 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
errFldName = (String)errFields.get(cnt);
System.out.println("errCode .........."+errCode);
errString = getErrorString( errFldName, errCode, userId );
//Modified by Dipesh on 17/07/2019[Start]
//errString = getErrorString( errFldName, errCode, userId );
errString = itmDbAccess.getErrorString(errFldName, errCode, userId, "", conn);
//Modified by Dipesh on 17/07/2019[End]
System.out.println("errString is : ::::>>>> " + errString);
msgType = errorType( conn , errCode );
if ( errString.length() > 0)
......
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
public class EmpMthadIC extends ValidatorEJB implements EmpMthadLocal,EmpMthadRemote
{
@Override
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 = "";
E12GenericUtility genericUtility = null;
try {
genericUtility = new E12GenericUtility();
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 :EmpMthadIC :wfValData(String xmlString):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from EmpMthadIC wfvaldata");
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
StringBuffer errStringXml = null;
ITMDBAccessEJB itmDbAcess = null;
Connection conn = null;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
AdmCommon admCommon = new AdmCommon();
String userId = "";
String adCode = "";
String sql = "";
String mtype = "";
String effDateStr = "";
String expDateStr = "";
String refType = "";
String refNo = "";
String empCode = "";
String mval3 = "";
String lsSite = "";
String errString = "";
String lsVarValue = "";
String balOpt = "";
double minBasic = 0;
double maxBasic = 0;
double minAmt = 0;
double maxAmt = 0;
int currentFormNo = 0;
int noOfChilds = 0;
int cnt = 0;
int counter;
E12GenericUtility genericUtility = null;
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
genericUtility = new E12GenericUtility();
itmDbAcess = new ITMDBAccessEJB();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = 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:
NodeList parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
NodeList childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
System.out.println("child Node List Length::::::" + childNodeListLength);
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode" + childNode);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "" + editFlag);
System.out.println("@V@ Edit flag :- [" + editFlag + "");
if ("ad_code".equalsIgnoreCase(childNodeName))
{
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
sql = "select count(*) as cnt from allwdedn where ad_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMADC1");
errFields.add(childNodeName.toLowerCase());
}
else
{
sql="select type as mtype from allwdedn where ad_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if (rs.next())
{
mtype = rs.getString("mtype");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(mtype.equalsIgnoreCase("S"))
{
errList.add("VMAD2");
errFields.add(childNodeName.toLowerCase());
}
}
}
else if ("eff_date".equalsIgnoreCase(childNodeName))
{
effDateStr = checkNull(genericUtility.getColumnValue("eff_date",dom));
if(effDateStr == null || effDateStr.trim().length() == 0)
{
errList.add("VTDATE11");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("exp_date".equalsIgnoreCase(childNodeName))
{
effDateStr = checkNull(genericUtility.getColumnValue("eff_date",dom));
expDateStr = checkNull(genericUtility.getColumnValue("exp_date",dom));
if(expDateStr == null || expDateStr.trim().length() == 0)
{
errList.add("VTDATE11");
errFields.add(childNodeName.toLowerCase());
}
if(effDateStr != null && expDateStr != null)
{
if(effDateStr.length() > 0 && expDateStr.length() > 0)
{
Date effDate = sdf.parse( effDateStr );
Date expDate = sdf.parse( expDateStr );
if(effDate.compareTo(expDate)>0)
{
errList.add("VMEXPDATE");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
else if ("ref_type".equalsIgnoreCase(childNodeName))
{
refType = checkNull(genericUtility.getColumnValue("ref_type", dom));
if(!"O".equalsIgnoreCase(refType) && !"L".equalsIgnoreCase(refType))
{
errList.add("VTREF1");
errFields.add(childNodeName.toLowerCase());
}
if(refType.equalsIgnoreCase("L"))
{
refNo = checkNull(genericUtility.getColumnValue("ref_no", dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql="select count(*)as cnt from loans where loan_no=? and emp_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, refNo);
pstmt.setString(2, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VTLOAN3");
errFields.add(childNodeName.toLowerCase());
}
}
if(refType.equalsIgnoreCase("O"))
{
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
sql="select bal_opt as bal_opt from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if (rs.next())
{
balOpt = rs.getString("bal_opt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(mval3.equalsIgnoreCase("C"))
{
errList.add("VTCONS");
errFields.add(childNodeName.toLowerCase());
}
}
}
else if ("emp_code".equalsIgnoreCase(childNodeName))
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql = "select count(*) as cnt from employee where emp_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMEMP1");
errFields.add(childNodeName.toLowerCase());
}
else
{
mval3 = "";
sql = "select pay_site, nvl(status , ' ') as mval3 from employee where emp_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
lsSite = rs.getString("pay_site");
mval3 = rs.getString("mval3");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(mval3 != null && mval3.equalsIgnoreCase("S"))
{
errList.add("VTPAYSTR01");
errFields.add(childNodeName.toLowerCase());
}
else
{
effDateStr = checkNull(genericUtility.getColumnValue("eff_date",dom));
Date effDate = null;
effDate = effDateStr!=null ? sdf.parse(effDateStr) : effDate;
lsVarValue = admCommon.gbfEmp(empCode, effDate, lsSite, userId, conn);
}
}
}
else if ("min_basic".equalsIgnoreCase(childNodeName))
{
minBasic = Double.parseDouble(checkNull(genericUtility.getColumnValue("min_basic",dom)));
if(minBasic == 0 || minBasic < 0)
{
errList.add("VMPAYSTR01");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("max_basic".equalsIgnoreCase(childNodeName))
{
maxBasic = Double.parseDouble(checkNull(genericUtility.getColumnValue("max_basic",dom)));
if(maxBasic == 0 || maxBasic < 0)
{
errList.add("VMPAYSTR02");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("min_amt".equalsIgnoreCase(childNodeName))
{
minAmt = Double.parseDouble(checkNull(genericUtility.getColumnValue("min_amt",dom)));
if(minAmt == 0 || minAmt < 0)
{
errList.add("VMPAYSTR03");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("max_amt".equalsIgnoreCase(childNodeName))
{
maxAmt = Double.parseDouble(checkNull(genericUtility.getColumnValue("max_amt",dom)));
if(maxAmt == 0 || maxAmt < 0)
{
errList.add("VMPAYSTR04");
errFields.add(childNodeName.toLowerCase());
}
}
}
break;
}
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
System.out.println("errList==[" + errList + "]");
int errListSize = errList.size();
System.out.println("errListSize:::::::[" + errListSize + "]");
System.out.println("in error::::::::::");
for (int i = 0; i < errListSize; i++)
{
System.out.println("in error For:::::::::::::::");
String errCode = (String) errList.get(i);
String errFldName = (String) errFields.get(i);
System.out.println("errCode .........." + errCode);
errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
String msgType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........." + errStringXml);
errString = "";
}
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errFields.clear();
}
errStringXml.append("</Errors></Root>\r\n");
System.out.println("errStringXml.toString()---2= "+errStringXml.toString());
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
errString = errStringXml.toString();
return errString;
}
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 = null;
try {
genericUtility = new E12GenericUtility();
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 :EmpMthadIC :itemChanged(String,String):" + e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from EmpMthadIC itemChanged");
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException, ITMException
{
StringBuffer valueXmlString = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
E12GenericUtility genericUtility = null;
int currentFormNo = 0;
String empCode = "";
String monthCode = "";
String sql = "";
String lsSite = "";
String adCode = "";
String mdescr = "";
String lsProp = "";
String lsVarValue = "";
String lsVarValues = "";
String paySite = "";
AdmCommon admCommon = new AdmCommon();
try
{
genericUtility = new E12GenericUtility();
System.out.println("currentFormNo...." + currentFormNo);
conn = 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 ("itm_default".equalsIgnoreCase(currentColumn))
{
empCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "emp_code");
monthCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "month_code");
sql="select pay_site as pay_site from employee where emp_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
paySite = rs.getString("pay_site");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<emp_code ><![CDATA[").append(empCode).append("]]></emp_code>\r\n");
//monthCode = checkNull(genericUtility.getColumnValue("month_code", dom));
if(monthCode != null && monthCode.trim().length()>0)
{
valueXmlString.append("<month_code protect=\"1\"><![CDATA[").append(monthCode).append("]]></month_code>\r\n");
}
else
{
valueXmlString.append("<month_code protect=\"0\"><![CDATA[").append(monthCode).append("]]></month_code>\r\n");
}
//empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
if(empCode != null && empCode.trim().length()>0)
{
valueXmlString.append("<emp_code protect=\"1\"><![CDATA[").append(empCode).append("]]></emp_code>\r\n");
}
else
{
valueXmlString.append("<emp_code protect=\"0\"><![CDATA[").append(empCode).append("]]></emp_code>\r\n");
}
valueXmlString.append("<month_code protect=\"1\"><![CDATA[").append(monthCode).append("]]></month_code>\r\n");
valueXmlString.append("<emp_code protect=\"1\"><![CDATA[").append(empCode).append("]]></emp_code>\r\n");
//paySite = checkNull(genericUtility.getColumnValue("pay_site", dom));
valueXmlString.append("<pay_site ><![CDATA[").append(paySite).append("]]></pay_site>\r\n");
lsVarValue = admCommon.getEnv("999999", "AD_EFFDATE", conn);
System.out.println("lsVarValue==["+lsVarValue+"]");
System.out.println("genericUtility.getApplDateFormat()==["+genericUtility.getApplDateFormat()+"]");
lsVarValue = genericUtility.getValidDateString(lsVarValue, genericUtility.getApplDateFormat());
System.out.println("lsVarValue==after["+lsVarValue+"]");
lsVarValues = admCommon.getEnv("999999", "AD_EXPDATE", conn);
lsVarValues = genericUtility.getValidDateString(lsVarValues, genericUtility.getApplDateFormat());
valueXmlString.append("<eff_date ><![CDATA[").append(lsVarValue).append("]]></eff_date>\r\n");
valueXmlString.append("<exp_date ><![CDATA[").append(lsVarValues).append("]]></exp_date>\r\n");
}
else if ("ad_code".equalsIgnoreCase(currentColumn))
{
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
sql="Select descr, prop_yn as ls_prop from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if (rs.next())
{
mdescr = rs.getString("descr");
lsProp = rs.getString("ls_prop");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<allwdedn_descr ><![CDATA[").append(mdescr).append("]]></allwdedn_descr>\r\n");
valueXmlString.append("<prop_yn ><![CDATA[").append(lsProp).append("]]></prop_yn>\r\n");
}
else if ("emp_code".equalsIgnoreCase(currentColumn))
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql="select pay_site as pay_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if (rs.next())
{
paySite = rs.getString("pay_site");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<pay_site ><![CDATA[").append(paySite).append("]]></pay_site>\r\n");
}
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
if (conn == null)
{
System.out.println("Connection is null");
} else
{
System.out.println("Connection is not null");
}
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
public interface EmpMthadLocal extends ValidatorLocal
{
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(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 org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
public interface EmpMthadRemote extends ValidatorRemote
{
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(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;
}
......@@ -11,19 +11,22 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import javax.ejb.Stateless;
//import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
//import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;//Modified By Hemlata on[20/11/2014] [As per changes in framework to use genericUtility ]
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
@Stateless
//Modified By Dipesh on[19/07/2019][Start]
//@Stateless
//Modified By Dipesh on[19/07/2019][End]
public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLocal ,EmpPersonalInfoRemote
{
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
......@@ -31,12 +34,12 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = null;
//Modified By Hemlata on[20/11/2014] [As per changes in framework to use genericUtility ][Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
E12GenericUtility genericUtility = new E12GenericUtility();
//Modified By Hemlata on[20/11/2014] [As per changes in framework to use genericUtility ][End]
try
{
......@@ -73,7 +76,7 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
//ConnDriver connDriver = new ConnDriver();
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
......@@ -116,7 +119,7 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
//Modified by Rohini T on 11/March/2019[Req ID: A17DSUN006][End]
int currentFormNo = 0;
AdmCommon admCommon = new AdmCommon();
//AdmCommon admCommon = new AdmCommon();
//Modified By Hemlata on[20/11/2014] [As per changes in framework to use genericUtility ][Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
......@@ -138,7 +141,10 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
try
{
conn = connDriver.getConnectDB("Driver");
//Added by Dipesh on[19/07/2019][Start]
//conn = connDriver.getConnectDB("Driver");
conn=getConnection();
//Added by Dipesh on[19/07/2019][End]
conn.setAutoCommit(false);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
......@@ -152,24 +158,33 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
case 1:
{
valueXmlString.append("<Detail1 domID='1' dbID='' objContext='1' objName='"+objNameDefault+"' selected='Y'>\r\n");
empCode = genericUtility.getColumnValue("emp_code",dom2);
//Added by Dipesh on[19/07/2019][Start]
//empCode = genericUtility.getColumnValue("emp_code",dom2);
//empCode = checkNull(genericUtility.getColumnValue("emp_code",dom2));
//Added by Dipesh on[19/07/2019][End]
if(currentColumn.equalsIgnoreCase("itm_defaultedit"))
{
//Modified by Rohini T on 11/March/2019[Req ID:A17DSUN006 ][START]
revNo = genericUtility.getColumnValue("revision_no", dom);
//Added by Dipesh on[19/07/2019][Start]
//revNo = genericUtility.getColumnValue("revision_no", dom);
revNo = checkNull(genericUtility.getColumnValue("revision_no", dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom));
//Added by Dipesh on[19/07/2019][End]
if(revNo != null && revNo.trim().length() > 0)
{
//revisionNo = Integer.parseInt(revNo);
//revisionNo = revisionNo+1;
//Modified by Rohini T on 13/March/2019[Req ID: A17DSUN006][START]
long revisionNo = 0;
try {
try
{
revisionNo = (revNo != null && revNo.trim().length() > 0) ? Long.parseLong(revNo):0;
}
catch (Exception e) {
catch (Exception e)
{
revisionNo = 0;
}
revisionNo = revisionNo+1;
......@@ -514,9 +529,16 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
else if (currentColumn.equalsIgnoreCase("birth_date"))
{
int retirementAge = 0;
retAge = genericUtility.getColumnValue("retirement_age",dom);
String birthDate = genericUtility.getColumnValue("birth_date",dom);
retDate = genericUtility.getColumnValue("retirement_date",dom);
//Added by Dipesh on[19/07/2019][Start]
//retAge = checkNull(genericUtility.getColumnValue("retirement_age",dom));
//String birthDate = checkNull(genericUtility.getColumnValue("birth_date",dom));
//retDate = checkNull(genericUtility.getColumnValue("retirement_date",dom));
retAge = checkNull(genericUtility.getColumnValue("retirement_age",dom));
String birthDate = checkNull(genericUtility.getColumnValue("birth_date",dom));
retDate = checkNull(genericUtility.getColumnValue("retirement_date",dom));
//Added by Dipesh on[19/07/2019][End]
birthDateDT = Timestamp.valueOf(genericUtility.getValidDateString(birthDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
try
{
......@@ -551,7 +573,7 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
}//END OF SWITCH
}//End of try block
catch(Exception e)
catch(Exception e)
{
e.printStackTrace();
System.out.println( "Exception :EmpPersonalInfo [itemChanged(String xmlString)] : ==>\n"+e.getMessage());
......@@ -582,6 +604,7 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
{
System.out.println("Exception ::"+e);
e.printStackTrace();
throw new ITMException(e);
}
}//End of finally block
......@@ -656,7 +679,7 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
Node parentNode = null;
Node childNode = null;
ITMDBAccessEJB itmDbAccess = null;
NodeList parentNodeList = null;
NodeList childNodeList = null;
......@@ -701,9 +724,12 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
Connection conn = null;
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("Driver");
itmDbAccess =new ITMDBAccessEJB();
//Added by Dipesh on[19/07/2019][Start]
//ConnDriver connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("Driver");
//Added by Dipesh on[19/07/2019][End]
conn=getConnection();
conn.setAutoCommit(false);
if(objContext != null && objContext.trim().length()>0)
......@@ -734,7 +760,10 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
if(childNodeName.equalsIgnoreCase("nationality"))
{
nationality = genericUtility.getColumnValue("nationality",dom,objContext);
//Added by Dipesh on[19/07/2019][Start]
//nationality = genericUtility.getColumnValue("nationality",dom,objContext);
nationality = checkNull(genericUtility.getColumnValue("nationality",dom,objContext));
//Added by Dipesh on[19/07/2019][End]
System.out.println("nationality got in the validation ..::["+nationality+"]");
sql = "SELECT COUNT(*) AS COUNTRY_CNT FROM COUNTRY WHERE COUNT_CODE = ?";
......@@ -776,7 +805,10 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
}
else if(childNodeName.equalsIgnoreCase("contact_state"))
{
contactState = genericUtility.getColumnValue("contact_state",dom,objContext);
//Added by Dipesh on[19/07/2019][Start]
//contactState = genericUtility.getColumnValue("contact_state",dom,objContext);
contactState = checkNull(genericUtility.getColumnValue("contact_state",dom,objContext));
//Added by Dipesh on[19/07/2019][End]
System.out.println("contactState got in the validation ..::["+contactState+"]");
if( contactState != null && contactState.length() > 0 )
......@@ -822,8 +854,10 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
else if(childNodeName.equalsIgnoreCase("handicap_category"))
{
count = 0;
handicapcategory = genericUtility.getColumnValue("handicap_category",dom,objContext);
//Added by Dipesh on[19/07/2019][Start]
//handicapcategory = genericUtility.getColumnValue("handicap_category",dom,objContext);
handicapcategory = checkNull(genericUtility.getColumnValue("handicap_category",dom,objContext));
//Added by Dipesh on[19/07/2019][End]
System.out.println("handicapcategory got in the validation ..::["+handicapcategory+"]");
if(handicapcategory != null && handicapcategory.length() > 0)
......@@ -877,8 +911,10 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
errCode = (String)errList.get(cnt);
errFldName = (String)errFields.get(cnt);
System.out.println("errCode .........."+errCode);
errString = getErrorString( errFldName, errCode, userId );
//Modified by Dipesh on 19/07/2019[Start]
//errString = getErrorString( errFldName, errCode, userId );
errString = itmDbAccess.getErrorString(errFldName, errCode, userId, "", conn);
//Modified by Dipesh on 19/07/2019[Start]
System.out.println("errString is : ::::>>>> " + errString);
msgType = errorType( conn , errCode );
if ( errString.length() > 0)
......@@ -1027,7 +1063,7 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
return msgType;
}
public String getEnv(String prdCode, String varName,Connection conn)
public String getEnv(String prdCode, String varName,Connection conn) throws ITMException
{
String retValue = "";
String sql = "";
......@@ -1055,11 +1091,13 @@ public class EmpPersonalInfo extends ValidatorEJB implements EmpPersonalInfoLoca
{
System.out.println("Exception :ITMDBAccessEJB :getEnvFin:" + se.getMessage() + ":");
se.printStackTrace();
throw new ITMException(se);
}
catch (Exception e)
{
System.out.println("Exception :ITMDBAccessEJB :getEnvFin:" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("Returning Value From getEnv() :: "+retValue);
return retValue;
......
......@@ -20,7 +20,12 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@Stateless
import ibase.webitm.ejb.ITMDBAccessEJB;
//Modified By Dipesh on[22/07/2019][Start]
//@Stateless
//Modified By Dipesh on[22/07/2019][End]
public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWorkInfoRemote
{
E12GenericUtility genericUtility = new E12GenericUtility();//Modified by Rohini T.
......@@ -64,16 +69,18 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
e.printStackTrace();
System.out.println("Exception :EmpWorkInfo [:" + e.getMessage() + ":]" );
errString = genericUtility.createErrorString(e);
throw new ITMException(e);
}
System.out.println("EmpWorkInfo errString returing at Stage 2[" + errString+"]");
return errString;
}
//Start of itemChanged block
public String itemChanged(Document dom, Document dom1,Document dom2, 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
{
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
//ConnDriver connDriver = new ConnDriver();
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
......@@ -152,7 +159,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
try
{
conn = connDriver.getConnectDB("Driver");
//Modified By Dipesh on[22/07/2019][Start]
//conn = connDriver.getConnectDB("Driver");
conn=getConnection();
//Modified By Dipesh on[22/07/2019][End]
conn.setAutoCommit(false);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
......@@ -167,12 +177,16 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
case 1:
{
valueXmlString.append("<Detail1 domID='1' dbID='' objContext='1' objName='"+objNameDefault+"' selected='Y'>\r\n");
empCode = genericUtility.getColumnValue("emp_code",dom2);
//empCode = genericUtility.getColumnValue("emp_code",dom2);
if(currentColumn.equalsIgnoreCase("itm_defaultedit"))
{
//Modified by Rohini T on 11/March/2019[Req ID: A17DSUN006][START]
revNo = genericUtility.getColumnValue("revision_no", dom);
//Modified By Dipesh on[22/07/2019][Start]
//revNo = genericUtility.getColumnValue("revision_no", dom);
revNo = checkNull(genericUtility.getColumnValue("revision_no", dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom));
//Modified By Dipesh on[22/07/2019][End]
if(revNo != null && revNo.trim().length() > 0)
{
//revisionNo = Integer.parseInt(revNo);
......@@ -192,7 +206,8 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
//Modified by Rohini T on 11/March/2019[Req A17DSUN006 ][End]
sql = " SELECT NOTICE_PRD, GRADE, EMP_SITE, PAY_SITE, WORK_SITE, TRAINING_PRD, PROBATION_PRD, SHIFT_ROT, CONFIRMED , PROBATION , DATE_JOIN FROM EMPLOYEE WHERE EMP_CODE = ? ";
sql = " SELECT NOTICE_PRD, GRADE, EMP_SITE, PAY_SITE, WORK_SITE, TRAINING_PRD, PROBATION_PRD, "
+ "SHIFT_ROT, CONFIRMED , PROBATION , DATE_JOIN FROM EMPLOYEE WHERE EMP_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
rs = pstmt.executeQuery();
......@@ -413,7 +428,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
}
else
{
if (confirmed.equalsIgnoreCase("Y") && Integer.parseInt(probationPrd) > 0 )
//Modified By Dipesh on[22/07/2019][Start]
//if (confirmed.equalsIgnoreCase("Y") && Integer.parseInt(probationPrd) >0))
if (confirmed.equalsIgnoreCase("Y") && Integer.parseInt(checkInt(probationPrd))> 0)
//Modified By Dipesh on[22/07/2019][End]
{
valueXmlString.append("<probation_prd protect=\"1\"><![CDATA[").append(probationPrd).append("]]></probation_prd>\r\n");
}
......@@ -464,9 +482,14 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
}
else if (currentColumn.equalsIgnoreCase("emp_site"))
{
empSite = checkNull(getColumnValue("emp_site",dom,"1")) ;
paySite = checkNull(getColumnValue("pay_site",dom,"1")) ;
workSite = checkNull(getColumnValue("work_site",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][Start]
//empSite = checkNull(getColumnValue("emp_site",dom,"1")) ;
//paySite = checkNull(getColumnValue("pay_site",dom,"1")) ;
//workSite = checkNull(getColumnValue("work_site",dom,"1")) ;
empSite = checkNull(genericUtility.getColumnValue("emp_site",dom,"1")) ;
paySite = checkNull(genericUtility.getColumnValue("pay_site",dom,"1")) ;
workSite = checkNull(genericUtility.getColumnValue("work_site",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][End]
if(paySite == null || paySite.length() == 0)
{
valueXmlString.append("<pay_site><![CDATA[").append(empSite).append("]]></pay_site>\r\n");
......@@ -478,7 +501,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
}
else if (currentColumn.equalsIgnoreCase("occupation_code"))
{
occupationCode = checkNull(getColumnValue("occupation_code",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][Start]
//occupationCode = checkNull(getColumnValue("occupation_code",dom,"1")) ;
occupationCode = checkNull(genericUtility.getColumnValue("occupation_code",dom,"1"));
//Modified By Dipesh on[22/07/2019][Start]
sql = "SELECT DESCR FROM GENCODES WHERE FLD_NAME = 'OCCUPATION_CODE' AND FLD_VALUE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,occupationCode);
......@@ -502,7 +528,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
}
else if (currentColumn.equalsIgnoreCase("work_loc_code"))
{
workLocCode = checkNull(getColumnValue("work_loc_code",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][Start]
//workLocCode = checkNull(getColumnValue("work_loc_code",dom,"1")) ;
workLocCode = checkNull(genericUtility.getColumnValue("work_loc_code",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][End]
if(workLocCode != null && workLocCode.length() > 0)
{
sql = "SELECT DESCR FROM WORK_LOCATIONS WHERE WORK_LOC_CODE = ? ";
......@@ -529,12 +558,20 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
}
else if (currentColumn.equalsIgnoreCase("training_prd"))
{
trainingPrd = checkNull(getColumnValue("training_prd",dom,"1")) ;
probationPrd = checkNull(getColumnValue("probation_prd",dom,"1")) ;
probationFlag = checkNull(getColumnValue("probation",dom,"1")) ;
confirmedFlag = checkNull(getColumnValue("confirmed",dom,"1")) ;
empCode = checkNull(getColumnValue("emp_code",dom,"1")) ;
dateJoin = checkNull(getColumnValue("date_join",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][Start]
//trainingPrd = checkNull(getColumnValue("training_prd",dom,"1")) ;
//probationPrd = checkNull(getColumnValue("probation_prd",dom,"1")) ;
//probationFlag = checkNull(getColumnValue("probation",dom,"1")) ;
//confirmedFlag = checkNull(getColumnValue("confirmed",dom,"1")) ;
//empCode = checkNull(getColumnValue("emp_code",dom,"1")) ;
//dateJoin = checkNull(getColumnValue("date_join",dom,"1")) ;
trainingPrd = checkNull(genericUtility.getColumnValue("training_prd",dom,"1")) ;
probationPrd = checkNull(genericUtility.getColumnValue("probation_prd",dom,"1")) ;
probationFlag = checkNull(genericUtility.getColumnValue("probation",dom,"1")) ;
confirmedFlag = checkNull(genericUtility.getColumnValue("confirmed",dom,"1")) ;
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom,"1")) ;
dateJoin = checkNull(genericUtility.getColumnValue("date_join",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][End]
//SimpleDateFormat sdf = new SimpleDateFormat(getApplDateFormat());
//java.util.Date joinDateStr = sdf.parse(dateJoin);
......@@ -585,12 +622,20 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
}
else if (currentColumn.equalsIgnoreCase("probation_prd"))
{
trainingPrd = checkNull(getColumnValue("training_prd",dom,"1")) ;
probationPrd = checkNull(getColumnValue("probation_prd",dom,"1")) ;
probationFlag = checkNull(getColumnValue("probation",dom,"1")) ;
confirmedFlag = checkNull(getColumnValue("confirmed",dom,"1")) ;
empCode = checkNull(getColumnValue("emp_code",dom,"1")) ;
probationDate = checkNull(getColumnValue("probation_date",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][Start]
//trainingPrd = checkNull(getColumnValue("training_prd",dom,"1")) ;
//probationPrd = checkNull(getColumnValue("probation_prd",dom,"1")) ;
//probationFlag = checkNull(getColumnValue("probation",dom,"1")) ;
//confirmedFlag = checkNull(getColumnValue("confirmed",dom,"1")) ;
//empCode = checkNull(getColumnValue("emp_code",dom,"1")) ;
//probationDate = checkNull(getColumnValue("probation_date",dom,"1")) ;
trainingPrd = checkNull(genericUtility.getColumnValue("training_prd",dom,"1")) ;
probationPrd = checkNull(genericUtility.getColumnValue("probation_prd",dom,"1")) ;
probationFlag = checkNull(genericUtility.getColumnValue("probation",dom,"1")) ;
confirmedFlag = checkNull(genericUtility.getColumnValue("confirmed",dom,"1")) ;
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom,"1")) ;
probationDate = checkNull(genericUtility.getColumnValue("probation_date",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][End]
System.out.println("probationDate :::"+probationDate);
if(probationDate != null && probationDate.trim().length() > 0)
......@@ -619,9 +664,14 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
}
else if (currentColumn.equalsIgnoreCase("date_join"))
{
dateJoin = checkNull(getColumnValue("date_join",dom,"1")) ;
trainingPrd = checkNull(getColumnValue("training_prd",dom,"1")) ;
probationPrd = checkNull(getColumnValue("probation_prd",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][Start]
//dateJoin = checkNull(getColumnValue("date_join",dom,"1")) ;
//trainingPrd = checkNull(getColumnValue("training_prd",dom,"1")) ;
//probationPrd = checkNull(getColumnValue("probation_prd",dom,"1")) ;
dateJoin = checkNull(genericUtility.getColumnValue("date_join",dom,"1")) ;
trainingPrd = checkNull(genericUtility.getColumnValue("training_prd",dom,"1")) ;
probationPrd = checkNull(genericUtility.getColumnValue("probation_prd",dom,"1")) ;
//Modified By Dipesh on[22/07/2019][End]
System.out.println("dateJoin ..:: ["+dateJoin+"]");
System.out.println("trainingPrd ..:: ["+trainingPrd+"]");
......@@ -696,7 +746,7 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
//retireAge = retirementAge * 12;
retireAge = retirementAge ;
//Modified by Rohini T on 26/04/19 [end]
empCode = genericUtility.getColumnValue("emp_code", dom);
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
System.out.println("empCode:::::::"+empCode);
//Modified by Rohini T on[15/05/19][start]
//Modified by Rohini T on[15/05/19][start]
......@@ -861,7 +911,7 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
}//End of Case 1
break;
}//END OF SWITCH
}//End of try block
catch(Exception e)
{
......@@ -894,6 +944,7 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
{
System.out.println("Exception ::"+e);
e.printStackTrace();
throw new ITMException(e);
}
}//End of finally block
......@@ -959,7 +1010,7 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
System.out.println("Exception : [EmpWorkInfo][wfValData(String xmlString)] : ==>\n"+e.getMessage());
e.printStackTrace();
errString = genericUtility.createErrorString(e);
throw new ITMException(e);
}
return (errString);
}
......@@ -1014,7 +1065,7 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
NodeList parentNodeList = null;
NodeList childNodeList = null;
ITMDBAccessEJB itmDbAccess = null;
String errString = "";
String childNodeName = "";
......@@ -1070,8 +1121,12 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
try
{
//30/10/2014.Start
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("Driver");
//Added by Dipesh on[22/07/2019][Start]
//ConnDriver connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("Driver");
conn=getConnection();
itmDbAccess = new ITMDBAccessEJB();
//Added by Dipesh on[22/07/2019][End]
conn.setAutoCommit(false);
//30/10/2014.End
......@@ -1107,9 +1162,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
{
count = 0;
//30/10/2014
//Modified By Dipesh on[22/07/2019][Start]
//empSite = checkNull(getColumnValue("emp_site",dom,objContext));
empSite = genericUtility.getColumnValue("emp_site",dom,objContext);
empSite = checkNull(genericUtility.getColumnValue("emp_site",dom,objContext));
//Modified By Dipesh on[22/07/2019][End]
System.out.println("empSite got in the validation ..::["+empSite+"]");
sql = "SELECT COUNT(*) AS COUNT FROM SITE WHERE SITE_CODE = ? " ;
......@@ -1151,8 +1207,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
{
count = 0 ;
//30/10/2014
//Modified By Dipesh on[22/07/2019][Start]
//paySite = checkNull(getColumnValue("pay_site",dom,objContext));
paySite = genericUtility.getColumnValue("pay_site",dom,objContext);
paySite = checkNull(genericUtility.getColumnValue("pay_site",dom,objContext));
//Modified By Dipesh on[22/07/2019][End]
sql = "SELECT COUNT(*) AS COUNT FROM SITE WHERE SITE_CODE = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,paySite);
......@@ -1192,8 +1250,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
{
count = 0 ;
//30/10/2014
//Modified By Dipesh on[22/07/2019][Start]
//workSite = checkNull(getColumnValue("work_site",dom,objContext));
workSite = genericUtility.getColumnValue("work_site",dom,objContext);
//Modified By Dipesh on[22/07/2019][End]
sql = "SELECT COUNT(*) AS COUNT FROM SITE WHERE SITE_CODE = ? " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,workSite);
......@@ -1302,10 +1362,12 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
count = 0 ;
//30/10/2014
//siteCodePayment = checkNull(getColumnValue("site_code__payment",dom,objContext));
siteCodePayment = genericUtility.getColumnValue("site_code__payment",dom,objContext);
//30/10/2014
empSite = genericUtility.getColumnValue("emp_site",dom,objContext);
//empSite = checkNull(getColumnValue("emp_site",dom,objContext));
//Modified By Dipesh on[22/07/2019][Start]
//siteCodePayment = genericUtility.getColumnValue("site_code__payment",dom,objContext);
//empSite = genericUtility.getColumnValue("emp_site",dom,objContext);
siteCodePayment = checkNull(genericUtility.getColumnValue("site_code__payment",dom,objContext));
empSite = checkNull(genericUtility.getColumnValue("emp_site",dom,objContext));
//Modified By Dipesh on[22/07/2019][End]
if(siteCodePayment != null && siteCodePayment.trim().length() > 0)
{
......@@ -1387,8 +1449,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
{
//30/10/2014
//patternCode = checkNull(getColumnValue("pattern_code",dom,objContext));
patternCode = genericUtility.getColumnValue("pattern_code",dom,objContext);
//Modified By Dipesh on[22/07/2019][Start]
//patternCode = genericUtility.getColumnValue("pattern_code",dom,objContext);
patternCode = checkNull(genericUtility.getColumnValue("pattern_code",dom,objContext));
//Modified By Dipesh on[22/07/2019][End]
java.util.Date startDate = null;
if(patternCode != null && patternCode.trim().length() > 0 )
{
......@@ -1466,8 +1530,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom,objContext));
//30/10/2014
//workSite = checkNull(getColumnValue("work_site",dom,objContext));
workSite = genericUtility.getColumnValue("work_site",dom,objContext);
//Modified By Dipesh on[22/07/2019][Start]
//workSite = genericUtility.getColumnValue("work_site",dom,objContext);
workSite = checkNull(genericUtility.getColumnValue("work_site",dom,objContext));
//Modified By Dipesh on[22/07/2019][End]
sql = "SELECT COUNT(*) AS COUNT FROM WORKSHFT WHERE SITE_CODE = ? AND SHIFT = ? ";
pstmt = conn.prepareStatement(sql);
......@@ -1578,8 +1644,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
//30/10/2014
//suppCodeCon = checkNull(getColumnValue("supp_code__con",dom,objContext));
suppCodeCon = genericUtility.getColumnValue("supp_code__con",dom,objContext);
//Modified By Dipesh on[22/07/2019][Start]
//suppCodeCon = genericUtility.getColumnValue("supp_code__con",dom,objContext);
suppCodeCon = checkNull(genericUtility.getColumnValue("supp_code__con",dom,objContext));
//Modified By Dipesh on[22/07/2019][End]
if(suppCodeCon != null && suppCodeCon.trim().length() > 0)
{
sql = "SELECT COUNT(1) AS COUNT FROM SUPPLIER WHERE SUPP_CODE = ? ";
......@@ -1628,7 +1696,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
else if(childNodeName.equalsIgnoreCase("work_loc_code"))
{
count = 0;
workLocCode = genericUtility.getColumnValue("work_loc_code",dom,objContext);
//Modified By Dipesh on[22/07/2019][Start]
//workLocCode = genericUtility.getColumnValue("work_loc_code",dom,objContext);
workLocCode = checkNull(genericUtility.getColumnValue("work_loc_code",dom,objContext));
//Modified By Dipesh on[22/07/2019][End]
if(workLocCode != null && workLocCode.length() > 0 )
{
......@@ -1786,8 +1857,10 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
errCode = (String)errList.get(cnt);
errFldName = (String)errFields.get(cnt);
System.out.println("errCode .........."+errCode);
errString = getErrorString( errFldName, errCode, userId );
//Modified by Dipesh on 22/07/2019[Start]
//errString = getErrorString( errFldName, errCode, userId );
errString = itmDbAccess.getErrorString(errFldName, errCode, userId, "", conn);
//Modified by Dipesh on 22/07/2019[End]
System.out.println("errString is : ::::>>>> " + errString);
msgType = errorType( conn , errCode );
if ( errString.length() > 0)
......@@ -2167,5 +2240,15 @@ public class EmpWorkInfo extends ValidatorEJB implements EmpWorkInfoLocal ,EmpWo
return (retDate);
}
//Modified by Rohini T on 26/March/2019[Req ID:A18KSUN005][End]
//Modified By Dipesh on[23/07/2019][Start]
private String checkInt(String input)
{
if(input == null || input.trim().length() == 0)
{
input = "0";
}
return input;
//Modified By Dipesh on[23/07/2019][End]
}
}
\ No newline at end of file
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class GradeAdIC extends ValidatorEJB implements GradeAdLocal,GradeAdRemote
{
@Override
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = "";
E12GenericUtility genericUtility = null;
try {
genericUtility = new E12GenericUtility();
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 :GradeAdIC :wfValData(String xmlString):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from GradeAdIC wfvaldata");
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
StringBuffer errStringXml = null;
ResultSet rs = null;
Connection conn = null;
PreparedStatement pstmt = null;
ITMDBAccessEJB itmDbAcess = null;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
String errString = "";
String userId = "";
String adCode = "";
String sql = "";
String effDateStr = "";
String expDateStr = "";
int currentFormNo = 0;
int noOfChilds = 0;
int cnt = 0;
int counter;
E12GenericUtility genericUtility = null;
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
genericUtility = new E12GenericUtility();
itmDbAcess = new ITMDBAccessEJB();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
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:
NodeList parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
NodeList childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
System.out.println("child Node List Length::::::" + childNodeListLength);
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode" + childNode);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "" + editFlag);
System.out.println("@V@ Edit flag :- [" + editFlag + "");
if ("ad_code".equalsIgnoreCase(childNodeName))
{
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
sql=" select count(*) as cnt from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMADC1");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("eff_date".equalsIgnoreCase(childNodeName))
{
effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom));
if(effDateStr == null || effDateStr.trim().length() == 0)
{
errList.add("VTDATE11");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("exp_date".equalsIgnoreCase(childNodeName))
{
effDateStr = checkNull(genericUtility.getColumnValue("eff_date", dom));
expDateStr = checkNull(genericUtility.getColumnValue("exp_date", dom));
if(expDateStr == null || expDateStr.trim().length() == 0)
{
errList.add("VTDATE11");
errFields.add(childNodeName.toLowerCase());
}
if(effDateStr != null && expDateStr != null)
{
if(effDateStr.trim().length() > 0 && expDateStr.trim().length() > 0)
{
Date effDate = sdf.parse( effDateStr );
Date expDate = sdf.parse( expDateStr );
if(effDate.after(expDate))
{
errList.add("VMEXPDATE");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
}
break;
}
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
System.out.println("errList==[" + errList + "]");
int errListSize = errList.size();
System.out.println("errListSize:::::::[" + errListSize + "]");
System.out.println("in error::::::::::");
for (int i = 0; i < errListSize; i++)
{
System.out.println("in error For:::::::::::::::");
String errCode = (String) errList.get(i);
String errFldName = (String) errFields.get(i);
System.out.println("errCode .........." + errCode);
errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
String msgType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........." + errStringXml);
errString = "";
}
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errFields.clear();
}
errStringXml.append("</Errors></Root>\r\n");
System.out.println("errStringXml.toString()---2= "+errStringXml.toString());
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
errString = errStringXml.toString();
return errString;
}
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 = null;
try {
genericUtility = new E12GenericUtility();
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 :GradeAdIC :itemChanged(String,String):" + e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from GradeAdIC itemChanged");
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException, ITMException
{
StringBuffer valueXmlString = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
E12GenericUtility genericUtility = null;
int currentFormNo = 0;
String payTable = "";
String gradeCode= "";
String lsVarValue = "";
String lsVarValues = "";
String adCode = "";
String sql = "";
String mdescr = "";
String lsProp = "";
AdmCommon admCommon = new AdmCommon();
try
{
genericUtility = new E12GenericUtility();
System.out.println("currentFormNo...." + currentFormNo);
conn = 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 ("itm_default".equalsIgnoreCase(currentColumn))
{
payTable = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "pay_table");
gradeCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "grade_code");
valueXmlString.append("<pay_table ><![CDATA[").append(payTable).append("]]></pay_table>\r\n");
valueXmlString.append("<grade_code ><![CDATA[").append(gradeCode).append("]]></grade_code>\r\n");
lsVarValue = admCommon.getEnv("999999", "AD_EFFDATE", conn);
System.out.println("lsVarValue==["+lsVarValue+"]");
System.out.println("genericUtility.getApplDateFormat()==["+genericUtility.getApplDateFormat()+"]");
lsVarValue = genericUtility.getValidDateString(lsVarValue, genericUtility.getApplDateFormat());
System.out.println("lsVarValue==after["+lsVarValue+"]");
lsVarValues = admCommon.getEnv("999999", "AD_EXPDATE", conn);
lsVarValues = genericUtility.getValidDateString(lsVarValues, genericUtility.getApplDateFormat());
valueXmlString.append("<eff_date ><![CDATA[").append(lsVarValue).append("]]></eff_date>\r\n");
valueXmlString.append("<exp_date ><![CDATA[").append(lsVarValues).append("]]></exp_date>\r\n");
}
else if ("ad_code".equalsIgnoreCase(currentColumn))
{
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
sql= "Select descr, prop_yn as ls_prop from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCode);
rs = pstmt.executeQuery();
if (rs.next())
{
mdescr = rs.getString("descr");
lsProp = rs.getString("ls_prop");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<allwdedn_descr ><![CDATA[").append(mdescr).append("]]></allwdedn_descr>\r\n");
valueXmlString.append("<prop_yn ><![CDATA[").append(lsProp).append("]]></prop_yn>\r\n");
}
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
conn.close();
conn = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
if (conn == null)
{
System.out.println("Connection is null");
} else
{
System.out.println("Connection is not null");
}
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
public interface GradeAdLocal extends ValidatorLocal
{
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(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 org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
public interface GradeAdRemote extends ValidatorRemote
{
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(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 java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class GradeWiseLoanSchemeIC extends ValidatorEJB implements GradeWiseLoanSchemeLocal,GradeWiseLoanSchemeRemote
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = "";
E12GenericUtility genericUtility = null;
try {
genericUtility = new E12GenericUtility();
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 :GradeAdIC :wfValData(String xmlString):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from GradeAdIC wfvaldata");
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
StringBuffer errStringXml = null;
ResultSet rs = null;
Connection conn = null;
PreparedStatement pstmt = null;
ITMDBAccessEJB itmDbAcess = null;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
String errString = "";
String userId = "";
String gradeCode = "";
String sql = "";
String intTerm = "";
int currentFormNo = 0;
int noOfChilds = 0;
int cnt = 0;
E12GenericUtility genericUtility = null;
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
genericUtility = new E12GenericUtility();
itmDbAcess = new ITMDBAccessEJB();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
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);
switch (currentFormNo)
{
case 1:
NodeList parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
NodeList childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
System.out.println("child Node List Length::::::" + childNodeListLength);
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode" + childNode);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "" + editFlag);
System.out.println("@V@ Edit flag :- [" + editFlag + "");
if ("grade_code".equalsIgnoreCase(childNodeName))
{
gradeCode = checkNull(genericUtility.getColumnValue("grade_code", dom));
sql = "select count(*) as cnt from grade where grade_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, gradeCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMGRA1");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("int_term".equalsIgnoreCase(childNodeName))
{
intTerm = checkNull(genericUtility.getColumnValue("int_term", dom));
sql= "select count(*) as cnt from interestterm where int_term = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, intTerm);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMINT1");
errFields.add(childNodeName.toLowerCase());
}
}
}
break;
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
System.out.println("errList==[" + errList + "]");
int errListSize = errList.size();
System.out.println("errListSize:::::::[" + errListSize + "]");
System.out.println("in error::::::::::");
for (int i = 0; i < errListSize; i++)
{
System.out.println("in error For:::::::::::::::");
String errCode = (String) errList.get(i);
String errFldName = (String) errFields.get(i);
System.out.println("errCode .........." + errCode);
errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
String msgType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........." + errStringXml);
errString = "";
}
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errFields.clear();
}
errStringXml.append("</Errors></Root>\r\n");
System.out.println("errStringXml.toString()---2= "+errStringXml.toString());
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
errString = errStringXml.toString();
return errString;
}
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 = null;
try {
genericUtility = new E12GenericUtility();
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 :LoanSchemeIC :itemChanged(String,String):" + e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from LoanSchemeIC itemChanged");
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException, ITMException
{
StringBuffer valueXmlString = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
E12GenericUtility genericUtility = null;
int currentFormNo = 0;
int term = 0;
int maxAmt = 0;
int interest = 0;
int minAmt = 0;
String schemeNo = "";
String gradeCode = "";
String sql = "";
String mdescr = "";
String intTerm = "";
try
{
genericUtility = new E12GenericUtility();
System.out.println("currentFormNo...." + currentFormNo);
conn = 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("itm_default".equalsIgnoreCase(currentColumn))
{
schemeNo = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "scheme_no");
valueXmlString.append("<scheme_no ><![CDATA[").append(schemeNo).append("]]></scheme_no>\r\n");
valueXmlString.append("<scheme_no protect=\"1\"><![CDATA[").append(schemeNo).append("]]></scheme_no>\r\n");
}
else if("itm_defaultedit".equalsIgnoreCase(currentColumn))
{
schemeNo = checkNull(genericUtility.getColumnValue("scheme_no", dom));
gradeCode = checkNull(genericUtility.getColumnValue("grade_code", dom));
valueXmlString.append("<scheme_no protect=\"1\"><![CDATA[").append(schemeNo).append("]]></scheme_no>\r\n");
valueXmlString.append("<grade_code protect=\"1\"><![CDATA[").append(gradeCode).append("]]></grade_code>\r\n");
}
else if("grade_code".equalsIgnoreCase(currentColumn))
{
schemeNo = checkNull(genericUtility.getColumnValue("scheme_no", dom));
gradeCode = checkNull(genericUtility.getColumnValue("grade_code", dom));
sql = "Select descr as mdescr from grade where grade_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, gradeCode);
rs = pstmt.executeQuery();
if (rs.next())
{
mdescr = rs.getString("mdescr");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<grade_descr ><![CDATA[").append(mdescr).append("]]></grade_descr>\r\n");
sql = "select min_amt, max_amt, term, int_term, interest from loan_scheme where scheme_no = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, schemeNo);
rs = pstmt.executeQuery();
if (rs.next())
{
minAmt = rs.getInt("min_amt");
maxAmt = rs.getInt("max_amt");
term = rs.getInt("term");
intTerm = rs.getString("int_term");
interest = rs.getInt("interest");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<min_amt ><![CDATA[").append(minAmt).append("]]></min_amt>\r\n");
valueXmlString.append("<max_amt ><![CDATA[").append(maxAmt).append("]]></max_amt>\r\n");
valueXmlString.append("<term ><![CDATA[").append(term).append("]]></term>\r\n");
valueXmlString.append("<int_term ><![CDATA[").append(intTerm).append("]]></int_term>\r\n");
valueXmlString.append("<interest ><![CDATA[").append(interest).append("]]></interest>\r\n");
}
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
conn.close();
conn = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
if (conn == null)
{
System.out.println("Connection is null");
} else
{
System.out.println("Connection is not null");
}
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
public interface GradeWiseLoanSchemeLocal extends ValidatorLocal
{
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(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 org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
public interface GradeWiseLoanSchemeRemote extends ValidatorRemote
{
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(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 java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class LeaveTableIC extends ValidatorEJB implements LeaveTableRemote, LeaveTableLocal
{
@Override
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 = "";
E12GenericUtility genericUtility = null;
try {
genericUtility = new E12GenericUtility();
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 :LeaveTableIC :wfValData(String xmlString):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from LeaveTableIC wfvaldata");
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
int minAllowed=0;
int maxAllowed=0;
int leaveOnDays=0;
int cnt = 0;
int counter;
String errString = "";
String lveCode="";
String daysType="";
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
String childNodeName = null;
StringBuffer errStringXml = null;
ITMDBAccessEJB itmDbAcess = null;
Connection conn = null;
int currentFormNo = 0;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
int noOfChilds = 0;
String userId = "";
String minAllowedStr = "";
String maxAllowedStr = "";
String leaveOnDaysStr="";
E12GenericUtility genericUtility = null;
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
genericUtility = new E12GenericUtility();
itmDbAcess = new ITMDBAccessEJB();
conn = 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:
NodeList parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
NodeList childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
System.out.println("child Node List Length::::::" + childNodeListLength);
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode" + childNode);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "" + editFlag);
System.out.println("@V@ Edit flag :- [" + editFlag + "");
if ("lve_code".equalsIgnoreCase(childNodeName))
{
lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
sql="select count(*) as cnt from leaves where lve_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lveCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMLVECD1");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("max_allowed".equalsIgnoreCase(childNodeName) || ("min_allowed".equalsIgnoreCase(childNodeName)))
{
minAllowedStr = checkNull(genericUtility.getColumnValue("min_allowed", dom));
maxAllowedStr = checkNull(genericUtility.getColumnValue("max_allowed", dom));
try
{
minAllowed = Integer.parseInt(minAllowedStr);
}
catch(Exception e)
{
minAllowed = 0;
}
try
{
maxAllowed = Integer.parseInt(maxAllowedStr);
}
catch(Exception e)
{
maxAllowed = 0;
}
if (minAllowed > 0 && maxAllowed > 0 && minAllowed > maxAllowed)
{
errList.add("VMNUMBER1");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("leave_on_days".equalsIgnoreCase(childNodeName))
{
leaveOnDaysStr = checkNull(genericUtility.getColumnValue("leave_on_days", dom));
daysType = checkNull(genericUtility.getColumnValue("days_type", dom));
try
{
leaveOnDays = Integer.parseInt(leaveOnDaysStr);
}
catch(Exception e)
{
leaveOnDays = 0;
}
if(leaveOnDays < 0)
{
errList.add("VMNEGLVON");
errFields.add(childNodeName.toLowerCase());
}
else if(leaveOnDays > 12 && daysType.equalsIgnoreCase("M"))
{
errList.add("VMLVONDAYS");
errFields.add(childNodeName.toLowerCase());
}
}
}
break;
}
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
System.out.println("errList==[" + errList + "]");
int errListSize = errList.size();
System.out.println("errListSize:::::::[" + errListSize + "]");
System.out.println("in error::::::::::");
for (int i = 0; i < errListSize; i++)
{
System.out.println("in error For:::::::::::::::");
String errCode = (String) errList.get(i);
String errFldName = (String) errFields.get(i);
System.out.println("errCode .........." + errCode);
errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
String msgType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........." + errStringXml);
errString = "";
}
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errFields.clear();
}
errStringXml.append("</Errors></Root>\r\n");
System.out.println("errStringXml.toString()---2= "+errStringXml.toString());
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
errString = errStringXml.toString();
return errString;
}
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 = null;
try {
genericUtility = new E12GenericUtility();
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 :LeaveTableIC :itemChanged(String,String):" + e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from LeaveTableIC itemChanged");
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException, ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
String maxDaysUnit="";
String lveUnit="";
String noDaysUnit="";
String maxAllowedUnit="";
String maxAccumulateUnit="";
String sql = "";
String lsLveCode="";
String lveCode="";
String lsLveUnit="";
String accumulate="";
String lsBalOpt="";
String allowAdvLeave="";
String lsLveTblNo="";
String accumulateMonths="";
String balOpt="";
String lveTvlNo="";
String maxDays="";
String encashable="";
String absMth="";
String earnNew="";
String avail="";
String maccum="";
String maccu="";
String mdescr="";
int availLt=0;
int maxTimes=0;
int minAllowed=0;
int maxAllowed=0;
int mmaxday=0;
Connection conn = null;
int currentFormNo = 0;
StringBuffer valueXmlString = null;
E12GenericUtility genericUtility = null;
try
{
genericUtility = new E12GenericUtility();
System.out.println("currentFormNo...." + currentFormNo);
conn = 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 ("itm_defaultedit".equalsIgnoreCase(currentColumn))
{
lveTvlNo = checkNull(genericUtility.getColumnValue("lve_tvlno", dom));
lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
maxDays = checkNull(genericUtility.getColumnValue("max_days", dom));
accumulate = checkNull(genericUtility.getColumnValue("accumulate", dom));
accumulateMonths = checkNull(genericUtility.getColumnValue("accumulate_months", dom));
valueXmlString.append("<lve_tvlno protect=\"1\"><![CDATA[").append(lveTvlNo).append("]]></lve_tvlno>\r\n");
valueXmlString.append("<lve_code protect=\"1\"><![CDATA[").append(lveCode).append("]]></lve_code>\r\n");
valueXmlString.append("<max_days protect=\"0\"><![CDATA[").append(maxDays).append("]]></max_days>\r\n");
if(accumulate.equalsIgnoreCase("N"))
{
valueXmlString.append("<accumulate_months protect=\"1\"><![CDATA[").append(accumulateMonths).append("]]></accumulate_months>\r\n");
}
else
{
valueXmlString.append("<accumulate_months protect=\"0\"><![CDATA[").append(accumulateMonths).append("]]></accumulate_months>\r\n");
}
lsLveUnit = checkNull(genericUtility.getColumnValue("lve_unit", dom));
lsLveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
if(lsLveUnit == null || lsLveUnit.trim().length() == 0)
{
sql="select case when lve_unit is null then 'D' else lve_unit END as lve_unit from leaves where lve_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsLveCode);
rs = pstmt.executeQuery();
if (rs.next())
{
lveUnit = rs.getString("lve_unit");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(lveUnit == null || lveUnit.trim().length() == 0)
{
lveUnit = "D";
}
valueXmlString.append("<lve_unit><![CDATA[").append(lsLveUnit).append("]]></lve_unit>\r\n");
maxDaysUnit = checkNull(genericUtility.getColumnValue("max_days_unit", dom));
noDaysUnit = checkNull(genericUtility.getColumnValue("no_days_unit", dom));
maxAllowedUnit = checkNull(genericUtility.getColumnValue("max_allowed_unit", dom));
maxAccumulateUnit = checkNull(genericUtility.getColumnValue("max_accumulate_unit", dom));
if(lsLveUnit.equalsIgnoreCase("D"))
{
valueXmlString.append("<max_days_unit protect=\"1\"><![CDATA[").append("D").append("]]></max_days_unit>\r\n");
valueXmlString.append("<no_days_unit protect=\"1\"><![CDATA[").append("D").append("]]></no_days_unit>\r\n");
valueXmlString.append("<max_allowed_unit protect=\"1\"><![CDATA[").append("D").append("]]></max_allowed_unit>\r\n");
valueXmlString.append("<max_accumulate_unit protect=\"1\"><![CDATA[").append("D").append("]]></max_accumulate_unit>\r\n");
}
else
{
valueXmlString.append("<max_days_unit protect=\"0\"><![CDATA[").append(maxDaysUnit).append("]]></max_days_unit>\r\n");
valueXmlString.append("<no_days_unit protect=\"0\"><![CDATA[").append(noDaysUnit).append("]]></no_days_unit>\r\n");
valueXmlString.append("<max_allowed_unit protect=\"0\"><![CDATA[").append(maxAllowedUnit).append("]]></max_allowed_unit>\r\n");
valueXmlString.append("<max_accumulate_unit protect=\"0\"><![CDATA[").append(maxAccumulateUnit).append("]]></max_accumulate_unit>\r\n");
}
lsLveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
sql="select case when bal_opt is null then 'N' else bal_opt END as bal_opt from leaves where lve_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsLveCode);
rs = pstmt.executeQuery();
if (rs.next())
{
balOpt = rs.getString("bal_opt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
balOpt = checkNull(genericUtility.getColumnValue("ls_bal_opt", dom));
if(balOpt == null || balOpt.trim().length() == 0)
{
balOpt = "N";
}
if(balOpt.equalsIgnoreCase("N"))
{
allowAdvLeave = checkNull(genericUtility.getColumnValue("allow_adv_leave", dom));
valueXmlString.append("<allow_adv_leave protect=\"1\"><![CDATA[").append(allowAdvLeave).append("]]></allow_adv_leave>\r\n");
}
}
}
else if("itm_default".equalsIgnoreCase(currentColumn))
{
lsLveTblNo = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "lve_tblno");
valueXmlString.append("<lve_tblno ><![CDATA[").append(lsLveTblNo).append("]]></lve_tblno>\r\n");
valueXmlString.append("<nvo_no ><![CDATA[2]]></nvo_no>\r\n");
accumulateMonths = checkNull(genericUtility.getColumnValue("accumulate_months", dom));
accumulate = checkNull(genericUtility.getColumnValue("accumulate", dom));
if(accumulate.equalsIgnoreCase("N"))
{
valueXmlString.append("<accumulate_months protect=\"1\"><![CDATA[").append(accumulateMonths).append("]]></accumulate_months>\r\n");
}
else
{
valueXmlString.append("<accumulate_months protect=\"0\"><![CDATA[").append(accumulateMonths).append("]]></accumulate_months>\r\n");
}
}
else if("lve_code".equalsIgnoreCase(currentColumn))
{
lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
String AllowAdvLeave = "N";
sql="Select descr, max_days,accumulate,accumulate_months, max_allowed,min_allowed, max_times,avail,avail_lt,"
+ "earn_new,abs_mth,accumulate,accumulate_months,encashable,case when allow_adv_leave is null then 'N' else allow_adv_leave end as allow_adv_leave "
+ "from leaves where lve_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lveCode);
rs = pstmt.executeQuery();
if (rs.next())
{
mdescr = rs.getString("descr");
mmaxday = rs.getInt("max_days");
maccu = rs.getString("accumulate");
maccum = rs.getString("accumulate_months");
maxAllowed = rs.getInt("max_allowed");
minAllowed = rs.getInt("min_allowed");
maxTimes = rs.getInt("max_times");
avail = rs.getString("avail");
availLt = rs.getInt("avail_lt");
earnNew = rs.getString("earn_new");
absMth = rs.getString("abs_mth");
accumulate = rs.getString("accumulate");
accumulateMonths = rs.getString("accumulate_months");
encashable = rs.getString("encashable");
allowAdvLeave = rs.getString("allow_adv_leave");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
System.out.println("allow_adv_leave ..:: [" + allowAdvLeave + "]");
valueXmlString.append("<leaves_descr ><![CDATA[").append(mdescr).append("]]></leaves_descr>\r\n");
valueXmlString.append("<max_days ><![CDATA[").append(mmaxday).append("]]></max_days>\r\n");
valueXmlString.append("<max_allowed ><![CDATA[").append(maxAllowed).append("]]></max_allowed>\r\n");
valueXmlString.append("<min_allowed ><![CDATA[").append(minAllowed).append("]]></min_allowed>\r\n");
valueXmlString.append("<max_times ><![CDATA[").append(maxTimes).append("]]></max_times>\r\n");
valueXmlString.append("<avail ><![CDATA[").append(avail).append("]]></avail>\r\n");
valueXmlString.append("<avail_lt ><![CDATA[").append(availLt).append("]]></avail_lt>\r\n");
valueXmlString.append("<earn_new ><![CDATA[").append(earnNew).append("]]></earn_new>\r\n");
valueXmlString.append("<abs_mth ><![CDATA[").append(absMth).append("]]></abs_mth>\r\n");
valueXmlString.append("<accumulate ><![CDATA[").append(accumulate).append("]]></accumulate>\r\n");
valueXmlString.append("<accumulate_months ><![CDATA[").append(accumulateMonths).append("]]></accumulate_months>\r\n");
valueXmlString.append("<encashable ><![CDATA[").append(encashable).append("]]></encashable>\r\n");
if(allowAdvLeave == null || allowAdvLeave.trim().length() == 0)
{
allowAdvLeave="N";
}
valueXmlString.append("<allow_adv_leave ><![CDATA[").append(allowAdvLeave).append("]]></allow_adv_leave>\r\n");
sql="select case when lve_unit is null then 'D' else lve_unit END as lve_unit from leaves where lve_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lveCode);
rs = pstmt.executeQuery();
if (rs.next())
{
lveUnit = rs.getString("lve_unit");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(lveUnit == null || lveUnit.trim().length() == 0)
{
lveUnit="D";
}
valueXmlString.append("<lve_unit protect=\"1\"><![CDATA[").append(lveUnit).append("]]></lve_unit>\r\n");
if(lveUnit.equalsIgnoreCase("D"))
{
valueXmlString.append("<max_days_unit protect=\"1\"><![CDATA[").append("D").append("]]></max_days_unit>\r\n");
valueXmlString.append("<no_days_unit protect=\"1\"><![CDATA[").append("D").append("]]></no_days_unit>\r\n");
valueXmlString.append("<max_allowed_unit protect=\"1\"><![CDATA[").append("D").append("]]></max_allowed_unit>\r\n");
valueXmlString.append("<max_accumulate_unit protect=\"1\"><![CDATA[").append("D").append("]]></max_accumulate_unit>\r\n");
}
else
{
valueXmlString.append("<max_days_unit protect=\"0\"><![CDATA[").append("H").append("]]></max_days_unit>\r\n");
valueXmlString.append("<no_days_unit protect=\"0\"><![CDATA[").append("H").append("]]></no_days_unit>\r\n");
valueXmlString.append("<max_allowed_unit protect=\"0\"><![CDATA[").append("H").append("]]></max_allowed_unit>\r\n");
valueXmlString.append("<max_accumulate_unit protect=\"0\"><![CDATA[").append("H").append("]]></max_accumulate_unit>\r\n");
}
lsLveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
allowAdvLeave = checkNull(genericUtility.getColumnValue("allow_adv_leave", dom));
sql="select case when bal_opt is null then 'N' else bal_opt END as bal_opt from leaves where lve_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lsLveCode);
rs = pstmt.executeQuery();
if (rs.next())
{
balOpt = rs.getString("bal_opt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(balOpt == null || balOpt.trim().length() == 0)
{
balOpt="N";
}
if(balOpt.equalsIgnoreCase("N"))
{
valueXmlString.append("<allow_adv_leave protect=\"1\"><![CDATA[").append(allowAdvLeave).append("]]></allow_adv_leave>\r\n");
}
}
else if("accumulate".equalsIgnoreCase(currentColumn))
{
accumulateMonths = checkNull(genericUtility.getColumnValue("accumulate_months", dom));
accumulate = checkNull(genericUtility.getColumnValue("accumulate", dom));
if(accumulate.trim().equalsIgnoreCase("N"))
{
valueXmlString.append("<accumulate_months protect=\"1\"><![CDATA[").append(0).append("]]></accumulate_months>\r\n");
}
else
{
valueXmlString.append("<accumulate_months protect=\"0\"><![CDATA[").append(accumulateMonths).append("]]></accumulate_months>\r\n");
}
}
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception :Leaves [itemChanged(String xmlString)] : ==>\n" + e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
if (conn == null)
{
System.out.println("Connection is null");
} else
{
System.out.println("Connection is not null");
}
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
public interface LeaveTableLocal extends ValidatorLocal
{
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(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 org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
public interface LeaveTableRemote extends ValidatorRemote
{
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(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.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.sybase.ejb.RemoteException;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class LeavesIC extends ValidatorEJB implements LeavesRemote, LeavesLocal {
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 = null;
try {
genericUtility = new E12GenericUtility();
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 :LeavesIC :itemChanged(String,String):" + e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from LeavesIC itemChanged");
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,String editFlag, String xtraParams) throws java.rmi.RemoteException, ITMException {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String colName = "";
String sql = "";
String encashable = "";
String accumulate = "";
String descr = "";
String leaveUnit = "";
String lveCode = "";
String balOpt = "N";
String adCodeEnch = "";
int cnt = 0;
colName = currentColumn;
int currentFormNo = 0;
StringBuffer valueXmlString = null;
E12GenericUtility genericUtility = null;
try
{
genericUtility = new E12GenericUtility();
System.out.println("currentFormNo...." + currentFormNo);
conn = 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.equalsIgnoreCase("itm_defaultedit"))
{
leaveUnit = checkNull(genericUtility.getColumnValue("lve_unit", dom));
if (leaveUnit == null || leaveUnit.trim().length() == 0)
{
valueXmlString.append("<lve_unit><![CDATA[").append("D").append("]]></lve_unit>\r\n");
leaveUnit = "D";
}
lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
sql = "select count(*) as cnt from empleave where lve_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lveCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
System.out.println("cnt ..:: [" + cnt + "]");
if (cnt == 0)
{
sql = "select count(*) as cnt from leavebal where lve_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lveCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
System.out.println("cnt ..:: [" + cnt + "]");
if (cnt == 0)
{
sql = "select count(*) as cnt from lvetable where lve_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lveCode);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
System.out.println("cnt ..:: [" + cnt + "]");
}
}
if (cnt == 0)
{
valueXmlString.append("<lve_unit protect=\"0\"><![CDATA[").append(leaveUnit).append("]]></lve_unit>\r\n");
}
else
{
valueXmlString.append("<lve_unit protect=\"1\"><![CDATA[").append(leaveUnit).append("]]></lve_unit>\r\n");
}
balOpt = checkNull(genericUtility.getColumnValue("bal_opt", dom));
if (balOpt == null || balOpt.trim().length()==0)
{
balOpt = "N";
}
if (balOpt.equalsIgnoreCase("N"))
{
valueXmlString.append("<allow_adv_leave protect=\"1\"><![CDATA[").append("N").append("]]></allow_adv_leave>\r\n");
}
else
{
valueXmlString.append("<allow_adv_leave protect=\"0\"><![CDATA[").append("").append("]]></allow_adv_leave>\r\n");
}
encashable = checkNull(genericUtility.getColumnValue("encashable", dom));
String lveCodeConvert = checkNull(genericUtility.getColumnValue("lve_code__convert", dom));
if (!encashable.trim().equalsIgnoreCase("C"))
{
valueXmlString.append("<lve_code__convert protect=\"1\"><![CDATA[").append(lveCodeConvert).append("]]></lve_code__convert>\r\n");
}
else
{
valueXmlString.append("<lve_code__convert protect=\"0\"><![CDATA[").append(lveCodeConvert).append("]]></lve_code__convert>\r\n");
}
adCodeEnch = checkNull(genericUtility.getColumnValue("ad_code__ench", dom));
if (!encashable.trim().equalsIgnoreCase("Y"))
{
valueXmlString.append("<ad_code__ench protect=\"1\"><![CDATA[").append(adCodeEnch).append("]]></ad_code__ench>\r\n");
}
else
{
valueXmlString.append("<ad_code__ench protect=\"0\"><![CDATA[").append(adCodeEnch).append("]]></ad_code__ench>\r\n");
}
accumulate = checkNull(genericUtility.getColumnValue("accumulate", dom));
String accumulateMonth = checkNull(genericUtility.getColumnValue("accumulate_months", dom));
if (accumulate.trim().equalsIgnoreCase("N"))
{
valueXmlString.append("<accumulate_months protect=\"1\"><![CDATA[").append(0).append("]]></accumulate_months>\r\n");
}
else
{
valueXmlString.append("<accumulate_months protect=\"0\"><![CDATA[").append(accumulateMonth).append("]]></accumulate_months>\r\n");
}
}
else if (currentColumn.equalsIgnoreCase("ad_code_ench"))
{
adCodeEnch = checkNull(genericUtility.getColumnValue("ad_code_ench", dom));
sql = "select descr from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCodeEnch);
rs = pstmt.executeQuery();
if (rs.next())
{
descr = rs.getString("descr");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
System.out.println("descr ..:: [" + descr + "]");
valueXmlString.append("<allwdedn_descr><![CDATA[").append(descr).append("]]></allwdedn_descr>\r\n");
}
else if (currentColumn.equalsIgnoreCase("encashable"))
{
encashable = checkNull(genericUtility.getColumnValue("encashable", dom));
if (!encashable.trim().equalsIgnoreCase("C"))
{
valueXmlString.append("<lve_code__convert protect=\"1\"><![CDATA[").append("").append("]]></lve_code__convert>\r\n");
}
else
{
valueXmlString.append("<lve_code__convert protect=\"0\"><![CDATA[").append("").append("]]></lve_code__convert>\r\n");
}
if (!encashable.trim().equalsIgnoreCase("Y"))
{
valueXmlString.append("<ad_code__ench protect=\"1\"><![CDATA[").append("").append("]]></ad_code__ench>\r\n");
valueXmlString.append("<allwdedn_descr><![CDATA[").append("").append("]]></allwdedn_descr>\r\n");
}
else
{
valueXmlString.append("<ad_code__ench protect=\"0\"><![CDATA[").append("").append("]]></ad_code__ench>\r\n");
}
}
else if (currentColumn.equalsIgnoreCase("accumulate"))
{
accumulate = checkNull(genericUtility.getColumnValue("accumulate", dom));
if (accumulate.trim().equalsIgnoreCase("N"))
{
valueXmlString.append("<accumulate_months protect=\"1\"><![CDATA[").append(0).append("]]></accumulate_months>\r\n");
}
else
{
valueXmlString.append("<accumulate_months protect=\"0\"><![CDATA[").append("").append("]]></accumulate_months>\r\n");
}
}
else if (currentColumn.equalsIgnoreCase("bal_opt"))
{
balOpt = checkNull(genericUtility.getColumnValue("bal_opt", dom));
if (balOpt == null)
{
balOpt = "N";
}
if (balOpt.trim().equalsIgnoreCase("N"))
{
valueXmlString.append("<allow_adv_leave protect=\"1\"><![CDATA[").append("N").append("]]></allow_adv_leave>\r\n");
}
else
{
valueXmlString.append("<allow_adv_leave protect=\"0\"><![CDATA[").append("").append("]]></allow_adv_leave>\r\n");
}
}
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception :Leaves [itemChanged(String xmlString)] : ==>\n" + e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
conn = null;
}
} catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}
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 = null;
try {
genericUtility = new E12GenericUtility();
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 :LeavesIC :wfValData(String xmlString):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from LeavesIC wfvaldata");
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException {
System.out.println("wfValData called...Dipesh");
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
int counter;
int noOfChilds = 0;
String userId = "";
String errString = "";
String encashable = "";
String adCodeEnch = "";
int minAllowed = 0;
int maxAllowed = 0;
String lveCodeConvert = "";
String fldnm = "";
String lveCode = "";
String descr = "";
String payAble = "";
String balOpt = "";
String lveUnit = "";
StringBuffer errStringXml = null;
int sfieldno = 0;
long cnt = 0;
int currentFormNo = 0;
Connection conn = null;
ITMDBAccessEJB itmDbAcess = null;
E12GenericUtility genericUtility = null;
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
genericUtility = new E12GenericUtility();
itmDbAcess = new ITMDBAccessEJB();
conn = 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:
NodeList parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
NodeList childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
System.out.println("child Node List Length::::::" + childNodeListLength);
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode" + childNode);
if (childNode.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "" + editFlag);
System.out.println("@V@ Edit flag :- [" + editFlag + "");
if (childNodeName.equalsIgnoreCase("encashable"))
{
encashable = checkNull(genericUtility.getColumnValue("encashable", dom));
if (encashable.trim().equalsIgnoreCase("C")) {
lveCodeConvert = checkNull(genericUtility.getColumnValue("lve_code__convert", dom));
if (lveCodeConvert == null || lveCodeConvert.trim().length() == 0) {
errList.add("VMLVECD1");
errFields.add(childNodeName.toLowerCase());
}
}
if (encashable.trim().equalsIgnoreCase("Y")) {
adCodeEnch = checkNull(genericUtility.getColumnValue("ad_code__ench", dom));
if (adCodeEnch == null || adCodeEnch.trim().length() == 0) {
errList.add("VEADN1");
errFields.add(childNodeName.toLowerCase());
}
}
}
else if (childNodeName.equalsIgnoreCase("ad_code__ench"))
{
adCodeEnch = checkNull(genericUtility.getColumnValue("ad_code__ench", dom));
encashable = checkNull(genericUtility.getColumnValue("encashable", dom));
if (adCodeEnch.trim().equalsIgnoreCase("Y"))
{
sql = "select count(*) as cnt from allwdedn where ad_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCodeEnch);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt("cnt");
}
System.out.println("cnt:::: " + cnt);
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (cnt == 0)
{
errList.add("VEADN1");
errFields.add(childNodeName.toLowerCase());
}
}
}
else if (childNodeName.equalsIgnoreCase("min_allowed") || (childNodeName.equalsIgnoreCase("max_allowed")))
{
minAllowed = Integer.parseInt(checkNull(genericUtility.getColumnValue("min_allowed", dom)));
maxAllowed = Integer.parseInt(checkNull(genericUtility.getColumnValue("max_allowed", dom)));
if (minAllowed > 0 && maxAllowed > 0 && minAllowed > maxAllowed)
{
errList.add("VMNUMBER1");
errFields.add(childNodeName.toLowerCase());
}
}
else if (childNodeName.equalsIgnoreCase("lve_code__convert"))
{
lveCodeConvert = checkNull(genericUtility.getColumnValue("lve_code__convert", dom));
System.out.println("lveCodeConvert: " + lveCodeConvert);
encashable = checkNull(genericUtility.getColumnValue("encashable", dom));
lveCode = checkNull(genericUtility.getColumnValue("lve_code", dom));
if (encashable.trim().equalsIgnoreCase("C"))
{
sql = "select count(*) as cnt from leaves where lve_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, lveCodeConvert);
rs = pstmt.executeQuery();
if (rs.next()) {
cnt = rs.getInt("cnt");
}
System.out.println("cnt:::: " + cnt);
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (cnt > 0) {
if (lveCodeConvert.trim().equalsIgnoreCase(lveCode.trim())) {
errList.add("VMLVECD2");
errFields.add(childNodeName.toLowerCase());
}
}
else {
errList.add("VMLVECD1");
errFields.add(childNodeName.toLowerCase());
}
}
}
else if (childNodeName.equalsIgnoreCase("descr"))
{
descr = checkNull(genericUtility.getColumnValue("descr", dom));
if (descr == null || descr.trim().length() == 0)
{
errList.add("VELVE2");
errFields.add(childNodeName.toLowerCase());
}
}
else if (childNodeName.equalsIgnoreCase("bal_opt"))
{
balOpt = checkNull(genericUtility.getColumnValue("bal_opt", dom));
payAble = checkNull(genericUtility.getColumnValue("payable", dom));
if (balOpt.equalsIgnoreCase("N") && payAble.equalsIgnoreCase("Y")) {
errList.add("VTLVE1");
errFields.add(childNodeName.toLowerCase());
}
}
else if (childNodeName.equalsIgnoreCase("lve_unit"))
{
lveUnit = checkNull(genericUtility.getColumnValue("lve_unit", dom));
if (lveUnit == null || lveUnit.trim().length() == 0 || (!"D".equalsIgnoreCase(lveUnit) && !"H".equalsIgnoreCase(lveUnit)))
{
errList.add("VTLVUNIT");
errFields.add(childNodeName.toLowerCase());
}
}
}
break;
}
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
System.out.println("errList==[" + errList + "]");
int errListSize = errList.size();
System.out.println("errListSize:::::::[" + errListSize + "]");
System.out.println("in error::::::::::");
for (int i = 0; i < errListSize; i++) {
System.out.println("in error For:::::::::::::::");
String errCode = (String) errList.get(i);
String errFldName = (String) errFields.get(i);
System.out.println("errCode .........." + errCode);
errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
String msgType = errorType(conn, errCode);
if (errString.length() > 0) {
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,
errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,
errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........." + errStringXml);
errString = "";
}
if (msgType.equalsIgnoreCase("E")) {
break;
}
}
errList.clear();
errFields.clear();
}
errStringXml.append("</Errors></Root>\r\n");
System.out.println("errStringXml.toString()---2= "+errStringXml.toString());
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try {
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
} catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
errString = errStringXml.toString();
return errString;
}
private String errorType(Connection conn, String errorCode) throws ITMException {
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
if (conn == null) {
System.out.println("Connection is null");
} else {
System.out.println("Connection is not null");
}
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
} catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
public interface LeavesLocal extends ValidatorLocal
{
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(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 org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
public interface LeavesRemote extends ValidatorRemote
{
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(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 java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class LoanSchemeIC extends ValidatorEJB implements LoanSchemeLocal, LoanSchemeRemote
{
@Override
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = "";
E12GenericUtility genericUtility = null;
try {
genericUtility = new E12GenericUtility();
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 :LoanSchemeIC :wfValData(String xmlString):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from LoanSchemeIC wfvaldata");
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
StringBuffer errStringXml = null;
ResultSet rs = null;
Connection conn = null;
PreparedStatement pstmt = null;
ITMDBAccessEJB itmDbAcess = null;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
String errString = "";
String userId = "";
String adCodeDed = "";
String sql = "";
String balOpt = "";
String postYn = "";
String acctCodeLoan = "";
String active = "";
String acctCodePay = "";
String cctrCodeLoan = "";
String intTerm = "";
String adCodeSource = "";
String adCode = "";
String mVal2 = "";
int currentFormNo = 0;
int noOfChilds = 0;
int counter;
int cnt = 0;
E12GenericUtility genericUtility = null;
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
genericUtility = new E12GenericUtility();
itmDbAcess = new ITMDBAccessEJB();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
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);
switch (currentFormNo)
{
case 1:
NodeList parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
NodeList childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
System.out.println("child Node List Length::::::" + childNodeListLength);
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode" + childNode);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "" + editFlag);
System.out.println("@V@ Edit flag :- [" + editFlag + "");
if (childNodeName.trim().equalsIgnoreCase("ad_code__ded"))
{
adCodeDed = checkNull(genericUtility.getColumnValue("ad_code__ded", dom));
sql = "select bal_opt, post_yn from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCodeDed);
rs = pstmt.executeQuery();
if (rs.next())
{
balOpt = checkNull(rs.getString("bal_opt"));
postYn = checkNull(rs.getString("post_yn"));
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(!(balOpt.equalsIgnoreCase("C") && postYn.equalsIgnoreCase("Y")))
{
errList.add("VMAD5");
errFields.add(childNodeName.toLowerCase());
}
}
else if (childNodeName.trim().equalsIgnoreCase("acct_code__loan"))
{
acctCodeLoan = checkNull(genericUtility.getColumnValue("acct_code__loan", dom));
if(acctCodeLoan != null && acctCodeLoan.trim().length() > 0)
{
sql="select count(*) as cnt from accounts where acct_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acctCodeLoan);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMACCT1");
errFields.add(childNodeName.toLowerCase());
}
else
{
sql="select active from accounts where acct_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acctCodeLoan);
rs = pstmt.executeQuery();
if (rs.next())
{
active = checkNull(rs.getString("active"));
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(!"Y".equalsIgnoreCase(active))
{
errList.add("VMACCTA");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
else if (childNodeName.trim().equalsIgnoreCase("acct_code__pay"))
{
acctCodePay = checkNull(genericUtility.getColumnValue("acct_code__pay", dom));
sql="select count(*) as cnt from accounts where acct_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acctCodePay);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMACCT1");
errFields.add(childNodeName.toLowerCase());
}
else
{
sql="select active as active from accounts where acct_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acctCodePay);
rs = pstmt.executeQuery();
if (rs.next())
{
active = checkNull(rs.getString("active"));
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(!"Y".equalsIgnoreCase(active))
{
errList.add("VMACCTA");
errFields.add(childNodeName.toLowerCase());
}
}
}
else if(childNodeName.trim().equalsIgnoreCase("cctr_code__loan") || childNodeName.trim().equalsIgnoreCase("cctr_code__pay"))
{
cctrCodeLoan = checkNull(genericUtility.getColumnValue("cctr_code__loan", dom));
if(cctrCodeLoan != null && cctrCodeLoan.trim().length() > 0)
{
sql="select count(*) as cnt from costctr where cctr_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, cctrCodeLoan);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if( cnt == 0)
{
errList.add("VMCCTR1");
errFields.add(childNodeName.toLowerCase());
}
}
}
else if (childNodeName.trim().equalsIgnoreCase("int_term"))
{
intTerm = checkNull(genericUtility.getColumnValue("int_term", dom));
sql = "select count(*) as cnt from interestterm where int_term = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, intTerm);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if( cnt == 0)
{
errList.add("VMINT1");
errFields.add(childNodeName.toLowerCase());
}
}
else if (childNodeName.trim().equalsIgnoreCase("ad_code__source"))
{
adCodeSource = checkNull(genericUtility.getColumnValue("ad_code__source", dom));
if(adCodeSource != null && adCodeSource.length() > 0)
{
sql = "select ad_code, nvl(bal_opt,'N') as mval2 from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCodeSource);
rs = pstmt.executeQuery();
if (rs.next())
{
adCode = rs.getString("ad_code");
mVal2 = rs.getString("mval2");
}
else
{
errList.add("VMADSOURCE");
errFields.add(childNodeName.toLowerCase());
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(mVal2.trim().equalsIgnoreCase("C"))
{
errList.add("VMADBLNA");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
break;
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
System.out.println("errList==[" + errList + "]");
int errListSize = errList.size();
System.out.println("errListSize:::::::[" + errListSize + "]");
System.out.println("in error::::::::::");
for (int i = 0; i < errListSize; i++)
{
System.out.println("in error For:::::::::::::::");
String errCode = (String) errList.get(i);
String errFldName = (String) errFields.get(i);
System.out.println("errCode .........." + errCode);
errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
String msgType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........." + errStringXml);
errString = "";
}
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errFields.clear();
}
errStringXml.append("</Errors></Root>\r\n");
System.out.println("errStringXml.toString()---2= "+errStringXml.toString());
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
errString = errStringXml.toString();
return errString;
}
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 = null;
try {
genericUtility = new E12GenericUtility();
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 :LoanSchemeIC :itemChanged(String,String):" + e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from LoanSchemeIC itemChanged");
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException, ITMException
{
StringBuffer valueXmlString = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
E12GenericUtility genericUtility = null;
int currentFormNo = 0;
String adCodeDed = "";
String sql = "";
String mdescr = "";
String mdescr1 = "";
String mdescr2 = "";
String adCodeSource = "";
String lsAdCodeDescr = "";
try
{
genericUtility = new E12GenericUtility();
System.out.println("currentFormNo...." + currentFormNo);
conn = 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().equalsIgnoreCase("ad_code__ded"))
{
adCodeDed = checkNull(genericUtility.getColumnValue("ad_code__ded", dom));
sql = "Select descr, acct_code__sal, cctr_code__sal from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCodeDed);
rs = pstmt.executeQuery();
if (rs.next())
{
mdescr = checkNull(rs.getString("descr"));
mdescr1 = checkNull(rs.getString("acct_code__sal"));
mdescr2 = checkNull(rs.getString("cctr_code__sal"));
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<allwdedn_descr ><![CDATA[").append(mdescr).append("]]></allwdedn_descr>\r\n");
valueXmlString.append("<acct_code__loan ><![CDATA[").append(mdescr1).append("]]></acct_code__loan>\r\n");
valueXmlString.append("<cctr_code__loan ><![CDATA[").append(mdescr2).append("]]></cctr_code__loan>\r\n");
}
else if(currentColumn.trim().equalsIgnoreCase("ad_code__source"))
{
adCodeSource = checkNull(genericUtility.getColumnValue("ad_code__source", dom));
sql = "Select descr as ls_ad_code_descr from allwdedn where ad_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, adCodeSource);
rs = pstmt.executeQuery();
if (rs.next())
{
lsAdCodeDescr = checkNull(rs.getString("ls_ad_code_descr"));
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<allwdedn_descr_1 ><![CDATA[").append(lsAdCodeDescr).append("]]></allwdedn_descr_1>\r\n");
}
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
conn.close();
conn = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
if (conn == null)
{
System.out.println("Connection is null");
} else
{
System.out.println("Connection is not null");
}
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
public interface LoanSchemeLocal extends ValidatorLocal
{
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(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 org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
public interface LoanSchemeRemote extends ValidatorRemote
{
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(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 java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class WorkShiftIC extends ValidatorEJB implements WorkShiftLocal, WorkShiftRemote
{
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 = "";
E12GenericUtility genericUtility = null;
try {
genericUtility = new E12GenericUtility();
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 :WorkShiftIC :wfValData(String xmlString):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from WorkShiftIC wfvaldata");
return errString;
}
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,
String xtraParams) throws RemoteException, ITMException
{
StringBuffer errStringXml = null;
PreparedStatement pstmt = null;
ITMDBAccessEJB itmDbAcess = null;
ResultSet rs = null;
Connection conn = null;
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
String childNodeName = null;
String userId = "";
String errString = "";
String shift = "";
String dayNo = "";
String sql = "";
String nextShift = "";
String descr = "";
String inTime = "";
String outTime = "";
String hdInTime = "";
int currentFormNo = 0;
int noOfChilds = 0;
int cnt = 0;
long hdIntimeMin = 0;
long inTimeMin = 0;
long outTimeMin = 0;
long lmin3 = 0;
long lmin4 = 0;
double hdHrs = 0.0;
double fdHrs = 0.0;
E12GenericUtility genericUtility = null;
errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
genericUtility = new E12GenericUtility();
itmDbAcess = new ITMDBAccessEJB();
conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
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);
switch (currentFormNo)
{
case 1:
NodeList parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
NodeList childNodeList = parentNode.getChildNodes();
int childNodeListLength = childNodeList.getLength();
System.out.println("child Node List Length::::::" + childNodeListLength);
for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode" + childNode);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{
continue;
}
childNodeName = childNode.getNodeName();
System.out.println("childNodeName.editFlag." + childNodeName + "" + editFlag);
System.out.println("@V@ Edit flag :- [" + editFlag + "");
if ("shift".equalsIgnoreCase(childNodeName))
{
shift = checkNull(genericUtility.getColumnValue("shift", dom));
dayNo = checkNull(genericUtility.getColumnValue("day_no", dom));
if(editFlag.equalsIgnoreCase("A"))
{
if(shift.length() == 0 || shift == null)
{
errList.add("VEWSH1");
errFields.add(childNodeName.toLowerCase());
}
else
{
sql = "select count (*) as cnt from workshft where shift= ? and day_no =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, shift);
pstmt.setString(2, dayNo);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{
errList.add("VDWSH1");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
else if ("next_shift".equalsIgnoreCase(childNodeName))
{
nextShift = checkNull(genericUtility.getColumnValue("next_shift", dom));
sql= "select count(*) as cnt from workshft where shift = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, nextShift);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errList.add("VMSHIFT");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("descr".equalsIgnoreCase(childNodeName))
{
descr = checkNull(genericUtility.getColumnValue("descr", dom));
if(descr.length() == 0 || descr == null)
{
errList.add("VTDESC1");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("in_time".equalsIgnoreCase(childNodeName))
{
inTime = checkNull(genericUtility.getColumnValue("in_time", dom));
if(! isTime(inTime))
{
errList.add("VMTIME");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("out_time".equalsIgnoreCase(childNodeName))
{
outTime = checkNull(genericUtility.getColumnValue("out_time", dom));
if(! isTime(outTime))
{
//not istime(string(mval,"@@:@@"))
errList.add("VMTIME");
errFields.add(childNodeName.toLowerCase());
}
}
else if ("fd_hrs".equalsIgnoreCase(childNodeName))
{
hdHrs = Double.parseDouble(checkNull(genericUtility.getColumnValue("hd_hrs", dom)));
fdHrs = Double.parseDouble(checkNull(genericUtility.getColumnValue("fd_hrs", dom)));
if(hdHrs > fdHrs)
{
errList.add("VMHDFD");
errFields.add(childNodeName.toLowerCase());
}
}
else if("hd_in_time".equalsIgnoreCase(childNodeName))
{
hdInTime = checkNull(genericUtility.getColumnValue("hd_in_time", dom));
inTime = checkNull(genericUtility.getColumnValue("in_time", dom));
outTime = checkNull(genericUtility.getColumnValue("out_time", dom));
if(hdInTime.indexOf(":") <0 && inTime.indexOf(":") <0 && outTime.indexOf(":") <0)
{
errList.add("VMTIME");
errFields.add(childNodeName.toLowerCase());
}
else
{
hdIntimeMin = toMins(hdInTime);
inTimeMin = toMins(inTime);
outTimeMin = toMins(outTime);
lmin3 = toMins("23:59");
lmin4 = 0;
}
if(outTimeMin < inTimeMin)
{
if ((inTimeMin <= hdIntimeMin) && (hdIntimeMin <= lmin3))
{
String a= "A";
}
else
{
if((lmin4 <= hdIntimeMin) && (hdIntimeMin <= outTimeMin))
{
String a= "B";
}
else
{
errList.add("VMTIME");
errFields.add(childNodeName.toLowerCase());
}
}
}
else
{
if((inTimeMin > hdIntimeMin ) || (hdIntimeMin > outTimeMin))
{
errList.add("VMTIME");
errFields.add(childNodeName.toLowerCase());
}
}
}
}
break;
}
System.out.println("errStringXml.toString()---1= "+errStringXml.toString());
if (errList != null && errList.size() > 0)
{
System.out.println("errList==[" + errList + "]");
int errListSize = errList.size();
System.out.println("errListSize:::::::[" + errListSize + "]");
System.out.println("in error::::::::::");
for (int i = 0; i < errListSize; i++)
{
System.out.println("in error For:::::::::::::::");
String errCode = (String) errList.get(i);
String errFldName = (String) errFields.get(i);
System.out.println("errCode .........." + errCode);
errString = itmDbAcess.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
String msgType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
System.out.println("errStringXml .........." + errStringXml);
errString = "";
}
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errFields.clear();
}
errStringXml.append("</Errors></Root>\r\n");
System.out.println("errStringXml.toString()---2= "+errStringXml.toString());
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
errString = errStringXml.toString();
return errString;
}
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 = null;
try {
genericUtility = new E12GenericUtility();
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 :WorkShiftIC :itemChanged(String,String):" + e.getMessage() + ":");
valueXmlString = genericUtility.createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from WorkShiftIC itemChanged");
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,
String editFlag, String xtraParams) throws RemoteException, ITMException
{
StringBuffer valueXmlString = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
E12GenericUtility genericUtility = null;
int currentFormNo = 0;
String siteCode = "";
try
{
genericUtility = new E12GenericUtility();
System.out.println("currentFormNo...." + currentFormNo);
conn = 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 ("itm_default".equalsIgnoreCase(currentColumn))
{
siteCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "site_code");
valueXmlString.append("<site_code ><![CDATA[").append(siteCode).append("]]></site_code>\r\n");
valueXmlString.append("<hd_in_time ><![CDATA[").append("00:00").append("]]></hd_in_time>\r\n");
valueXmlString.append("<in_time ><![CDATA[").append("00:00").append("]]></in_time>\r\n");
valueXmlString.append("<out_time ><![CDATA[").append("00:00").append("]]></out_time>\r\n");
}
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (conn != null)
{
conn.close();
conn = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
throw new ITMException(e);
}
}
return valueXmlString.toString();
}
private String errorType(Connection conn, String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
if (conn == null)
{
System.out.println("Connection is null");
} else
{
System.out.println("Connection is not null");
}
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return msgType;
}
public boolean isTime(String timeHoursMins)throws ITMException
{
PreparedStatement pstmt = null;
ResultSet rs = null;
boolean flag= true;
try
{
if( ((int)timeHoursMins.charAt(1)<48 || (int)timeHoursMins.charAt(1)>57) || ((int)timeHoursMins.charAt(4)<48 || (int)timeHoursMins.charAt(4)>57) )
{
flag = false;
System.out.println("false");
}
else if((int)timeHoursMins.charAt(3)<48 || (int)timeHoursMins.charAt(3)>53)
{
flag = false;
System.out.println("false");
}
else if((int)timeHoursMins.charAt(0)<48 || (int)timeHoursMins.charAt(0)>50 || ( (int)timeHoursMins.charAt(0)==50 && (int)timeHoursMins.charAt(1)>51 ) )
{
flag = false;
System.out.println("false");
}
else
{
flag = true;
System.out.println("True");
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
}
return flag;
}
private String checkNull(String input)
{
if (input == null)
{
input = "";
}
return input;
}
private static long toMins(String s)
{
String[] hdInTime = s.split(":");
int hour = Integer.parseInt(hdInTime[0]);
int mins = Integer.parseInt(hdInTime[1]);
int hoursInMins = hour * 60;
return hoursInMins + mins;
}
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import ibase.webitm.utility.ITMException;
public interface WorkShiftLocal extends ValidatorLocal
{
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(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 org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
import ibase.webitm.utility.ITMException;
public interface WorkShiftRemote extends ValidatorRemote
{
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(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;
}
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