Commit 91a4d4f0 authored by sghate's avatar sghate

Done Migration related changes in EmpMaritalStatusIC Component

EmpMaritalStatusConfPrc.java
EmpMaritalStatusIC.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@214556 ce508802-f39f-4f6c-b175-0d175dae99d5
parent acbbd617
......@@ -5,7 +5,9 @@
package ibase.webitm.ejb.adm;
import ibase.system.config.AppConnectParm;
import ibase.system.config.ConnDriver;
//modified by Shital on 09/08/2019 [Start]
//import ibase.system.config.ConnDriver;
//modified by Shital on 09/08/2019 [End]
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessLocal;
......@@ -18,8 +20,9 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import javax.ejb.Stateless;
//modified by Shital on 09/08/2019 [Start]
//import javax.ejb.Stateless;
//modified by Shital on 09/08/2019 [End]
import javax.naming.InitialContext;
import org.w3c.dom.Document;
......@@ -27,10 +30,14 @@ import org.w3c.dom.Document;
/**
* Session Bean implementation class EmpMaritalStatusConfPrc
*/
@Stateless
//modified by Shital on 09/08/2019 [Start]
//@Stateless
//modified by Shital on 09/08/2019 [End]
public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalStatusConfPrcRemote, EmpMaritalStatusConfPrcLocal
{
E12GenericUtility genericUtility=new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String process() throws RemoteException,ITMException
{
return "";
......@@ -67,40 +74,44 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException, ITMException
{
String returnString = "",confirm="",empCode="",tranDate="",sql="";
Timestamp tranDateTimestamp=null;
String returnString = "";
String confirm = "";
String empCode = "";
String tranDate = "";
String sql = "";
Timestamp tranDateTimestamp = null;
boolean isError = false;
Connection connection = null;
ConnDriver connDriver = null;
Connection conn = null;
//modified by Shital on 09/08/2019 [Start]
//ConnDriver connDriver = null;
//modified by Shital on 09/08/2019 [End]
AppConnectParm appConnect = null;
InitialContext initialCtx = null;
EmpMaritalStatusConfLocal empMaritalStatusConf = null;
//Commented and added by Varsha V on 20-Jul-18 for removing lookup
//ITMDBAccessLocal itmDBAccess = null;
ITMDBAccessEJB itmDBAccess = null;
ITMDBAccessLocal itmDBAccess = null;
PreparedStatement pstmt=null;
ResultSet rs=null;
try
{
connDriver = new ConnDriver();
connection = connDriver.getConnectDB("DriverITM");
connection.setAutoCommit(false);
//Commented and added by Varsha V on 20-Jul-18 for removing lookup
//appConnect = new AppConnectParm();
//initialCtx = new InitialContext(appConnect.getProperty());
//itmDBAccess = (ITMDBAccessLocal)initialCtx.lookup("ibase/ITMDBAccessEJB/local");
itmDBAccess = new ITMDBAccessEJB();
//modified by Shital on 09/08/2019 [Start]
//connDriver = new ConnDriver();
//connection = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//modified by Shital on 09/08/2019 [End]
conn.setAutoCommit(false);
appConnect = new AppConnectParm();
initialCtx = new InitialContext(appConnect.getProperty());
itmDBAccess = (ITMDBAccessLocal)initialCtx.lookup("ibase/ITMDBAccessEJB/local");
empCode = checkNull(genericUtility.getColumnValue("emp_code", headerDom));
tranDate = checkNull(genericUtility.getColumnValue("tran_date", headerDom));
System.out.println("@V@ VALLABH empCode :- ["+empCode+"]");
System.out.println("@V@ VALLABH tranDate :- ["+tranDate+"]");
tranDateTimestamp = Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate, genericUtility.getApplDateFormat()
,genericUtility.getDBDateFormat()));
tranDateTimestamp = Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
sql = "SELECT CONFIRM FROM EMP_MARITALCHG WHERE EMP_CODE = ? AND TRAN_DATE = ?";
pstmt = connection.prepareStatement(sql);
sql = "SELECT CONFIRM FROM EMP_MARITALCHG WHERE EMP_CODE = ? AND TRAN_DATE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDateTimestamp);
rs = pstmt.executeQuery();
......@@ -108,20 +119,36 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta
{
confirm = checkNull(rs.getString("CONFIRM"));
}
pstmt.close();
pstmt=null;
//Changed By sanket on 08/MAR/18 [for proper closing connection]
//modified by Shital on 09/08/2019 [Start]
//rs.close();
//rs = null;
//pstmt.close();
//pstmt = null;
if(rs != null)
{
rs.close();
rs=null;
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//modified by Shital on 09/08/2019 [End]
System.out.println("@V@ VALLABH confirm :- ["+confirm+"]");
if(!"X".equalsIgnoreCase(confirm))
{
empMaritalStatusConf = (EmpMaritalStatusConfLocal)initialCtx.lookup("ibase/EmpMaritalStatusConf/local");
returnString = checkNull(empMaritalStatusConf.actionHandler("", headerDom, detailDom, xtraParams, "N", connection));
returnString = checkNull(empMaritalStatusConf.actionHandler("", headerDom, detailDom, xtraParams, "N", conn));
System.out.println("EmpMaritalStatusConfPrc returnString ::[" + returnString + "]");
}
else
{
returnString = itmDBAccess.getErrorString("", "VTALRDCACL", "", "", connection);
//modified by Shital on 09/08/2019 [Start]
//returnString = itmDBAccess.getErrorString("", "VTALRDCACL", "", "", conn);
returnString = itmDBAccessEJB.getErrorString("", "VTALRDCACL", "", "", conn);
//modified by Shital on 09/08/2019 [End]
return returnString;
}
if(returnString.length() > 0)
......@@ -131,9 +158,11 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta
}
else
{
returnString = itmDBAccess.getErrorString("", "VTMARSCH03", "", "", connection);
//modified by Shital on 09/08/2019 [Start]
//returnString = itmDBAccess.getErrorString("", "VTMARSCH03", "", "", conn);
returnString = itmDBAccessEJB.getErrorString("", "VTMARSCH03", "", "", conn);
//modified by Shital on 09/08/2019 [End]
}
}
catch(Exception e)
{
......@@ -149,24 +178,39 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta
{
if(isError)
{
connection.rollback();
conn.rollback();
System.out.println("EmpMaritalStatusConfPrc connection rollback");
}
else
{
connection.commit();
conn.commit();
System.out.println("EmpMaritalStatusConfPrc connection committed");
}
if(connection != null)
//modified by Shital on 09/08/2019 [Start]
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
connection.close();
connection = null;
pstmt.close();
pstmt = null;
}
//modified by Shital on 09/08/2019 [End]
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
returnString = e.getMessage();
e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
}
}
System.out.println("errString...:: "+returnString);
......
......@@ -9,13 +9,17 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import ibase.system.config.ConnDriver;
import ibase.utility.GenericUtility;
//modified by Shital on 09/08/2019 [Start]
//import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
//import ibase.utility.GenericUtility;
//modified by Shital on 09/08/2019 [End]
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
import javax.ejb.Stateless;
//modified by Shital on 09/08/2019 [Start]
//import javax.ejb.Stateless;
//modified by Shital on 09/08/2019 [End]
import org.w3c.dom.Document;
import org.w3c.dom.Node;
......@@ -24,9 +28,14 @@ import org.w3c.dom.NodeList;
/**
* Session Bean implementation class BusinessUnits
*/
@Stateless
//modified by Shital on 09/08/2019 [Start]
//@Stateless
//modified by Shital on 09/08/2019 [End]
public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatusICLocal, EmpMaritalStatusICRemote
{
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String itemChanged() throws RemoteException, ITMException
{
return "";
......@@ -59,39 +68,68 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
{
System.out.println("Exception : BusinessUnits : [itemChanged(String, xmlString)] :==>\n" + e.getMessage());
e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
}
return valueXmlString;
}
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
{
System.out.println("@V@ In Item change...");
GenericUtility genericUtility = null;
//modified by Shital on 09/08/2019 [Start]
//GenericUtility genericUtility = null;
//modified by Shital on 09/08/2019 [End]
Connection conn = null;
int currentFormNo = 0;
ResultSet rs = null;
String empCodeHead = "", empFName = "", empMName = "", empLName = "",empMaritalChgEmpFname="",empMaritalChgEmpMname="",empMaritalChgEmpLname="",
shortName="",empFnameO="",empMnameO="",empLnameO="",shortNameO="",lsSex="",lsNewStatus="",empCode="",sql="",mStatus="",sex="",
spouseName="",mStatDate="";
String mStatDateStr="";
String empCodeHead = "";
String empFName = "";
String empMName = "";
String empLName = "";
String empMaritalChgEmpFname = "";
String empMaritalChgEmpMname = "";
String empMaritalChgEmpLname = "";
String shortName = "";
String empFnameO = "";
String empMnameO = "";
String empLnameO = "";
String shortNameO ="";
String lsSex = "";
String lsNewStatus = "";
String empCode = "";
String sql = "";
String mStatus = "";
String sex = "";
String spouseName = "";
String mStatDate = "";
String mStatDateStr = "";
//Added By sanket J on 01/March/18
String empFNameLong = "";
String empMNameLong = "";
String empLNameLong = "";
PreparedStatement pstmt = null;
StringBuffer valueXmlString;
AdmCommon admCommon = new AdmCommon();
try
{
valueXmlString = new StringBuffer();
genericUtility = GenericUtility.getInstance();
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
//modified by Shital on 09/08/2019 [Start]
//genericUtility = GenericUtility.getInstance();
//ConnDriver connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//modified by Shital on 09/08/2019 [End]
conn.setAutoCommit(false);
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDateStr = sdf.format(currentDate.getTime());
valueXmlString = new StringBuffer(
"<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
if (objContext != null && objContext.trim().length() > 0)
......@@ -106,7 +144,7 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
if(currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{
//Modified by Ahmed on 03/May/2017 to only replace for null value [start]
/* empMaritalChgEmpFname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom));
/* empMaritalChgEmpFname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom));
empMaritalChgEmpMname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom));
empMaritalChgEmpLname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom));
shortName=checkNull(genericUtility.getColumnValue("short_name", dom));
......@@ -115,15 +153,15 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
empLnameO=checkNull(genericUtility.getColumnValue("emp_lname__o", dom));
shortNameO=checkNull(genericUtility.getColumnValue("short_name__o", dom));
spouseName=checkNull(genericUtility.getColumnValue("spouse_name", dom));*/
empMaritalChgEmpFname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom));
empMaritalChgEmpMname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom));
empMaritalChgEmpLname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom));
shortName=replaceNull(genericUtility.getColumnValue("short_name", dom));
empFnameO=replaceNull(genericUtility.getColumnValue("emp_fname__o", dom));
empMnameO=replaceNull(genericUtility.getColumnValue("emp_mname__o", dom));
empLnameO=replaceNull(genericUtility.getColumnValue("emp_lname__o", dom));
shortNameO=replaceNull(genericUtility.getColumnValue("short_name__o", dom));
spouseName=replaceNull(genericUtility.getColumnValue("spouse_name", dom));
empMaritalChgEmpFname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom));
empMaritalChgEmpMname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom));
empMaritalChgEmpLname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom));
shortName = replaceNull(genericUtility.getColumnValue("short_name", dom));
empFnameO = replaceNull(genericUtility.getColumnValue("emp_fname__o", dom));
empMnameO = replaceNull(genericUtility.getColumnValue("emp_mname__o", dom));
empLnameO = replaceNull(genericUtility.getColumnValue("emp_lname__o", dom));
shortNameO = replaceNull(genericUtility.getColumnValue("short_name__o", dom));
spouseName = replaceNull(genericUtility.getColumnValue("spouse_name", dom));
//Modified by Ahmed on 03/AMY/2017 to only replace for null value[end]
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA[" + empMaritalChgEmpFname+ "]]>").append("</emp_maritalchg_emp_fname>");
......@@ -135,19 +173,53 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
valueXmlString.append("<emp_lname__o protect=\"1\">").append("<![CDATA[" + empLnameO+ "]]>").append("</emp_lname__o>");
valueXmlString.append("<short_name__o protect=\"1\">").append("<![CDATA[" + shortNameO+ "]]>").append("</short_name__o>");
lsSex=checkNull(genericUtility.getColumnValue("sex", dom));
lsNewStatus=checkNull(genericUtility.getColumnValue("new_status", dom));
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", empMaritalChgEmpFname);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", empMaritalChgEmpMname);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_lname", empMaritalChgEmpLname);
admCommon.setNodeValue(dom, "short_name", shortName);
admCommon.setNodeValue(dom, "emp_fname__o", empFnameO);
admCommon.setNodeValue(dom, "emp_mname__o", empMnameO);
admCommon.setNodeValue(dom, "emp_lname__o", empLnameO);
admCommon.setNodeValue(dom, "short_name__o", shortNameO);
//modified by Shital on 09/08/2019 [End]
lsSex = checkNull(genericUtility.getColumnValue("sex", dom));
lsNewStatus = checkNull(genericUtility.getColumnValue("new_status", dom));
System.out.println("@V@ SEX of employee :- ["+lsSex+"]");
if((lsSex!=null && lsSex.trim().length()>0) && ("F".equalsIgnoreCase(lsSex)))
if((lsSex != null && lsSex.trim().length() > 0) && ("F".equalsIgnoreCase(lsSex)))
{
// if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus) || "D".equalsIgnoreCase(lsNewStatus)))
if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus))) // CHANGE done as per suggested by P Jain.
if((lsNewStatus != null && lsNewStatus.trim().length() > 0) && ("M".equalsIgnoreCase(lsNewStatus) || "D".equalsIgnoreCase(lsNewStatus)))
//if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus))) // CHANGE done as per suggested by P Jain.
{
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"0\">").append("<![CDATA[" + empMaritalChgEmpFname+ "]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"0\">").append("<![CDATA[" + empMaritalChgEmpMname+ "]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"0\">").append("<![CDATA[" + empMaritalChgEmpLname+ "]]>").append("</emp_maritalchg_emp_lname>");
valueXmlString.append("<short_name protect=\"0\">").append("<![CDATA[" + shortName+ "]]>").append("</short_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", empMaritalChgEmpFname);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", empMaritalChgEmpMname);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_lname", empMaritalChgEmpLname);
admCommon.setNodeValue(dom, "short_name", shortName);
//modified by Shital on 09/08/2019 [End]
//valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
if("M".equalsIgnoreCase(lsNewStatus))
{
valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
else
{
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
}
else
{
......@@ -156,20 +228,35 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA[" + empMaritalChgEmpLname+ "]]>").append("</emp_maritalchg_emp_lname>");
valueXmlString.append("<short_name protect=\"1\">").append("<![CDATA[" + shortName+ "]]>").append("</short_name>");
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", empMaritalChgEmpFname);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", empMaritalChgEmpMname);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_lname", empMaritalChgEmpLname);
admCommon.setNodeValue(dom, "short_name", shortName);
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
}
else
{
if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus))) // Chnage done as per suggested by P Jain,
if((lsNewStatus != null && lsNewStatus.trim().length() > 0) && ("M".equalsIgnoreCase(lsNewStatus))) // Chnage done as per suggested by P Jain,
{
valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
AdmCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
else
{
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
}
}
else if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
System.out.println("@V@ In Item default ..");
......@@ -182,30 +269,86 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
valueXmlString.append("<emp_mname__o protect=\"1\">").append("<![CDATA[]]>").append("</emp_mname__o>");
valueXmlString.append("<emp_lname__o protect=\"1\">").append("<![CDATA[]]>").append("</emp_lname__o>");
valueXmlString.append("<short_name__o protect=\"1\">").append("<![CDATA[]]>").append("</short_name__o>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "tran_date", sysDateStr);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", "");
admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", "");
admCommon.setNodeValue(dom, "emp_maritalchg_emp_lname", "");
admCommon.setNodeValue(dom, "short_name", "");
admCommon.setNodeValue(dom, "emp_fname__o", "");
admCommon.setNodeValue(dom, "emp_mname__o", "");
admCommon.setNodeValue(dom, "emp_lname__o", "");
admCommon.setNodeValue(dom, "short_name__o", "");
//modified by Shital on 09/08/2019 [End]
}
else if(currentColumn.trim().equalsIgnoreCase("emp_code"))
{
System.out.println("@V@ In emp code Item change ..");
empCode=checkNull(genericUtility.getColumnValue("emp_code", dom));
sql="select emp_lname, emp_fname,m_status, emp_mname, short_name,sex,m_status_date from employee where emp_code =?";
pstmt=conn.prepareStatement(sql);
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
lsNewStatus = checkNull(genericUtility.getColumnValue("new_status", dom));
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]
//sql="select emp_lname, emp_fname,m_status, emp_mname, short_name,sex,m_status_date from employee where emp_code =?";
sql = "select emp_lname, emp_fname,m_status, emp_mname,emp_fname_long, emp_mname_long, emp_lname_long, short_name,sex,m_status_date from employee where emp_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs=pstmt.executeQuery();
rs = pstmt.executeQuery();
if(rs.next())
{
empLName=rs.getString("emp_lname");
empFName=rs.getString("emp_fname");
empMName=rs.getString("emp_mname");
mStatus=rs.getString("m_status");
shortName=rs.getString("short_name");
sex=rs.getString("sex");
mStatDate=rs.getString("m_status_date");
//modified by Shital on 09/08/2019 [Start]
//empLName=rs.getString("emp_lname");
//empFName=rs.getString("emp_fname");
//empMName=rs.getString("emp_mname");
//mStatus=rs.getString("m_status");
//shortName=rs.getString("short_name");
empLName = checkNull(rs.getString("emp_lname"));
empFName = checkNull(rs.getString("emp_fname"));
empMName = checkNull(rs.getString("emp_mname"));
mStatus = checkNull(rs.getString("m_status"));
shortName = checkNull(rs.getString("short_name"));
shortName = shortName == null?"":shortName;
//sex = rs.getString("sex");
sex = checkNull(rs.getString("sex"));
//modified by Shital on 09/08/2019 [End]
//mStatDate=rs.getString("m_status_date");
mStatDate = checkNull(rs.getString("m_status_date"));
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[Start]
//modified by Shital on 09/08/2019 [Start]
//empFNameLong=rs.getString("emp_fname_long");
//empMNameLong=rs.getString("emp_mname_long");
//empLNameLong=rs.getString("emp_lname_long");
empFNameLong = checkNull(rs.getString("emp_fname_long"));
empMNameLong = checkNull(rs.getString("emp_mname_long"));
empLNameLong = checkNull(rs.getString("emp_lname_long"));
//modified by Shital on 09/08/2019 [End]
if(empFNameLong == null || empFNameLong == "")
{
empFNameLong = empFName;
System.out.println("Inside empFnameLong is null or blank--["+empFNameLong+"]");
}
pstmt.close();
if(empMNameLong == null || empMNameLong == "")
{
empMNameLong = empMName;
System.out.println("Inside empMnameLong is null or blank--["+empMNameLong+"]");
}
if(empLNameLong == null || empLNameLong == "")
{
empLNameLong = empLName;
System.out.println("Inside empLnameLong is null or blank--["+empLNameLong+"]");
}
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[End]
}
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
close( pstmt, rs);
System.out.println("@V@ At emp code item change fname:- ["+empFName+"]");
System.out.println("@V@ At emp code item change empMName:- ["+empMName+"]");
......@@ -213,103 +356,321 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
System.out.println("@V@ At emp code item change mStatus:- ["+mStatus+"]");
System.out.println("@V@ At emp code item change shortName:- ["+shortName+"]");
System.out.println("@V@ At emp code item change sex:- ["+sex+"]");
System.out.println("@A@ At emp code item change NewStatus:- ["+lsNewStatus+"]");
/*shortName=replaceNull(genericUtility.getColumnValue("short_name", dom));
spouseName=replaceNull(genericUtility.getColumnValue("spouse_name", dom));*/
//modified by santosh .start
//ADDED BY AMIT SHRIVASTAVA ON 191218 FOR PRINT EMP_LONG_NAME[START]
/*valueXmlString.append("<emp_fname protect=\"1\">").append("<![CDATA[" + empFName+ "]]>").append("</emp_fname>");
valueXmlString.append("<emp_lname protect=\"1\">").append("<![CDATA[" + empLName+ "]]>").append("</emp_lname>");*/
valueXmlString.append("<emp_fname_long protect=\"1\">").append("<![CDATA[" + empFNameLong+ "]]>").append("</emp_fname_long>");
valueXmlString.append("<emp_lname_long protect=\"1\">").append("<![CDATA[" + empLNameLong+ "]]>").append("</emp_lname_long>");
//ADDED BY AMIT SHRIVASTAVA ON 191218 FOR PRINT EMP_LONG_NAME[END.]
valueXmlString.append("<old_status protect=\"1\">").append("<![CDATA[" + mStatus+ "]]>").append("</old_status>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_fname_long", empFNameLong);
admCommon.setNodeValue(dom, "emp_lname_long", empLNameLong);
admCommon.setNodeValue(dom, "old_status", mStatus);
//modified by Shital on 09/08/2019 [End]
//modified by santosh .end
if("U".equalsIgnoreCase(lsNewStatus))
{
valueXmlString.append("spouse_name >").append("<![CDATA[]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", "");
//modified by Shital on 09/08/2019 [End]
}
if((sex != null && sex.trim().length() > 0) && ("F".equalsIgnoreCase(sex)))
{
// if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus) || "D".equalsIgnoreCase(lsNewStatus)))
if((lsNewStatus != null && lsNewStatus.trim().length() > 0) && ("M".equalsIgnoreCase(lsNewStatus) || "D".equalsIgnoreCase(lsNewStatus)))
{
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"0\">").append("<![CDATA["+empFNameLong+"]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"0\">").append("<![CDATA["+empMNameLong+"]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"0\">").append("<![CDATA["+empLNameLong+"]]>").append("</emp_maritalchg_emp_lname>");
valueXmlString.append("<short_name protect=\"0\">").append("<![CDATA["+shortName+"]]>").append("</short_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", empFNameLong);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", empMNameLong);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_lname", empLNameLong);
admCommon.setNodeValue(dom, "short_name", shortName);
//modified by Shital on 09/08/2019 [End]
if("M".equalsIgnoreCase(lsNewStatus))
{
valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
else
{
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
}
else
{
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA["+empFNameLong+"]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA["+empMNameLong+"]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA["+empLNameLong+"]]>").append("</emp_maritalchg_emp_lname>");
valueXmlString.append("<short_name protect=\"1\">").append("<![CDATA["+shortName+"]]>").append("</short_name>");
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
valueXmlString.append("<emp_fname protect=\"1\">").append("<![CDATA[" + empFName+ "]]>").append("</emp_fname>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", empFNameLong);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", empMNameLong);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_lname", empLNameLong);
admCommon.setNodeValue(dom, "short_name", shortName);
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
}
else
{
if((lsNewStatus != null && lsNewStatus.trim().length() > 0) && ("M".equalsIgnoreCase(lsNewStatus)))
{
valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
else
{
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
//modified by santosh 30/MAR/2018 .start
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA["+empFNameLong+"]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA["+empMNameLong+"]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA["+empLNameLong+"]]>").append("</emp_maritalchg_emp_lname>");
valueXmlString.append("<short_name protect=\"1\">").append("<![CDATA["+shortName+"]]>").append("</short_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", empFNameLong);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", empMNameLong);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_lname", empLNameLong);
admCommon.setNodeValue(dom, "short_name", shortName);
//modified by Shital on 09/08/2019 [End]
//modified by santosh 30/MAR/2018 .end
}
/*valueXmlString.append("<emp_fname protect=\"1\">").append("<![CDATA[" + empFName+ "]]>").append("</emp_fname>");
valueXmlString.append("<emp_lname protect=\"1\">").append("<![CDATA[" + empLName+ "]]>").append("</emp_lname>");
valueXmlString.append("<old_status protect=\"1\">").append("<![CDATA[" + mStatus+ "]]>").append("</old_status>");
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[Start]
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA[" + empFName+ "]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA[" + empMName+ "]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA[" + empLName+ "]]>").append("</emp_maritalchg_emp_lname>");
valueXmlString.append("<short_name protect=\"1\">").append("<![CDATA[" + shortName+ "]]>").append("</short_name>");
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA[" + empFNameLong+ "]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA[" + empMNameLong+ "]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA[" + empLNameLong+ "]]>").append("</emp_maritalchg_emp_lname>");
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[End]
valueXmlString.append("<short_name protect=\"1\">").append("<![CDATA[" + shortName+ "]]>").append("</short_name>");*/
if(mStatDate!=null && mStatDate.trim().length()>0)
if(mStatDate != null && mStatDate.trim().length() > 0)
{
mStatDateStr=genericUtility.getValidDateString(mStatDate, genericUtility.getDBDateFormat(),
genericUtility.getApplDateFormat());
mStatDateStr=genericUtility.getValidDateString(mStatDate, genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat());
valueXmlString.append("<status_date__o protect=\"1\">").append("<![CDATA[" + mStatDateStr+ "]]>").append("</status_date__o>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "status_date__o", mStatDateStr);
//modified by Shital on 09/08/2019 [End]
}
else
{
valueXmlString.append("<status_date__o protect=\"1\">").append("<![CDATA[]]>").append("</status_date__o>");
}
valueXmlString.append("<emp_fname__o protect=\"1\">").append("<![CDATA[" + empFName+ "]]>").append("</emp_fname__o>");
valueXmlString.append("<emp_mname__o protect=\"1\">").append("<![CDATA[" + empMName+ "]]>").append("</emp_mname__o>");
valueXmlString.append("<emp_lname__o protect=\"1\">").append("<![CDATA[" + empLName+ "]]>").append("</emp_lname__o>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "status_date__o", "");
//modified by Shital on 09/08/2019 [End]
}
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[Start]
//valueXmlString.append("<emp_fname__o protect=\"1\">").append("<![CDATA[" + empFName+ "]]>").append("</emp_fname__o>");
//valueXmlString.append("<emp_mname__o protect=\"1\">").append("<![CDATA[" + empMName+ "]]>").append("</emp_mname__o>");
//valueXmlString.append("<emp_lname__o protect=\"1\">").append("<![CDATA[" + empLName+ "]]>").append("</emp_lname__o>");
valueXmlString.append("<emp_fname__o protect=\"1\">").append("<![CDATA[" + empFNameLong+ "]]>").append("</emp_fname__o>");
valueXmlString.append("<emp_mname__o protect=\"1\">").append("<![CDATA[" + empMNameLong+ "]]>").append("</emp_mname__o>");
valueXmlString.append("<emp_lname__o protect=\"1\">").append("<![CDATA[" + empLNameLong+ "]]>").append("</emp_lname__o>");
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[End]
valueXmlString.append("<short_name__o protect=\"1\">").append("<![CDATA[" + shortName+ "]]>").append("</short_name__o>");
valueXmlString.append("<sex>").append("<![CDATA[" + sex+ "]]>").append("</sex>");
valueXmlString.append("<sex >").append("<![CDATA[" + sex+ "]]>").append("</sex>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_fname__o", empFNameLong);
admCommon.setNodeValue(dom, "emp_mname__o", empMNameLong);
admCommon.setNodeValue(dom, "emp_lname__o", empLNameLong);
admCommon.setNodeValue(dom, "short_name__o", shortName);
admCommon.setNodeValue(dom, "sex", sex);
//modified by Shital on 09/08/2019 [End]
}
else if(currentColumn.trim().equalsIgnoreCase("new_status"))
{
lsNewStatus=checkNull(genericUtility.getColumnValue("new_status", dom));
lsNewStatus = checkNull(genericUtility.getColumnValue("new_status", dom));
//Modified by Ahmed on 03/MAY/2017 to only replace for null value[start]
/*empMaritalChgEmpFname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom));
empMaritalChgEmpMname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom));
empMaritalChgEmpLname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom));
shortName=checkNull(genericUtility.getColumnValue("short_name", dom));
spouseName=checkNull(genericUtility.getColumnValue("spouse_name", dom));*/
empMaritalChgEmpFname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom));
empMaritalChgEmpMname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom));
empMaritalChgEmpLname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom));
shortName=replaceNull(genericUtility.getColumnValue("short_name", dom));
spouseName=replaceNull(genericUtility.getColumnValue("spouse_name", dom));
empMaritalChgEmpFname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom));
empMaritalChgEmpMname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom));
empMaritalChgEmpLname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom));
shortName = replaceNull(genericUtility.getColumnValue("short_name", dom));
spouseName = replaceNull(genericUtility.getColumnValue("spouse_name", dom));
//Modified by Ahmed on 03/MAY/2017 to only replace for null value[end]
sex=checkNull(genericUtility.getColumnValue("sex", dom));
sex = checkNull(genericUtility.getColumnValue("sex", dom));
System.out.println("@S@ sex from dom["+sex+"]");
if("U".equalsIgnoreCase(lsNewStatus))
{
valueXmlString.append("<spouse_name >").append("<![CDATA[]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", "");
//modified by Shital on 09/08/2019 [End]
}
if((sex!=null && sex.trim().length()>0) && ("F".equalsIgnoreCase(sex)))
if((sex != null && sex.trim().length() > 0) && ("F".equalsIgnoreCase(sex)))
{
// if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus) || "D".equalsIgnoreCase(lsNewStatus)))
if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus))) // Chnage done as per suggested by P Jain,
// if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus) || "D".equalsIgnoreCase(lsNewStatus)))
if((lsNewStatus != null && lsNewStatus.trim().length() > 0) && ("M".equalsIgnoreCase(lsNewStatus))) // Chnage done as per suggested by P Jain,
{
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"0\">").append("<![CDATA["+empMaritalChgEmpFname+"]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"0\">").append("<![CDATA["+empMaritalChgEmpMname+"]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"0\">").append("<![CDATA["+empMaritalChgEmpLname+"]]>").append("</emp_maritalchg_emp_lname>");
valueXmlString.append("<short_name protect=\"0\">").append("<![CDATA["+shortName+"]]>").append("</short_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", empMaritalChgEmpFname);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", empMaritalChgEmpMname);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_lname", empMaritalChgEmpLname);
admCommon.setNodeValue(dom, "short_name", shortName);
//modified by Shital on 09/08/2019 [End]
//valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
if("M".equalsIgnoreCase(lsNewStatus))
{
valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
else
{
empCode=checkNull(genericUtility.getColumnValue("emp_code", dom));
sql="select emp_lname, emp_fname,m_status, emp_mname, short_name,sex,m_status_date from employee where emp_code =?";
pstmt=conn.prepareStatement(sql);
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
}
else
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]
//sql="select emp_lname, emp_fname,m_status, emp_mname, short_name,sex,m_status_date from employee where emp_code =?";
sql = "select emp_lname, emp_fname,m_status, emp_mname,emp_fname_long, emp_mname_long, emp_lname_long, short_name,sex,m_status_date from employee where emp_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs=pstmt.executeQuery();
rs = pstmt.executeQuery();
if(rs.next())
{
empLName=rs.getString("emp_lname");
empFName=rs.getString("emp_fname");
empMName=rs.getString("emp_mname");
mStatus=rs.getString("m_status");
shortName=rs.getString("short_name");
sex=rs.getString("sex");
mStatDate=rs.getString("m_status_date");
//modified by Shital on 09/08/2019 [Start]
//empLName=rs.getString("emp_lname");
//empFName=rs.getString("emp_fname");
//empMName=rs.getString("emp_mname");
//mStatus=rs.getString("m_status");
//shortName=rs.getString("short_name");
empLName = checkNull(rs.getString("emp_lname"));
empFName = checkNull(rs.getString("emp_fname"));
empMName = checkNull(rs.getString("emp_mname"));
mStatus = checkNull(rs.getString("m_status"));
shortName = checkNull(rs.getString("short_name"));
shortName = shortName == null?"":shortName;//Modified by Ahmed on 26-Apr-2018 to filter out null as value for short name on display
//sex=rs.getString("sex");
sex = checkNull(rs.getString("sex"));
//mStatDate = rs.getString("m_status_date");
mStatDate = checkNull(rs.getString("m_status_date"));
//modified by Shital on 09/08/2019 [End]
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[Start]
//modified by Shital on 09/08/2019 [Start]
//empFNameLong=rs.getString("emp_fname_long");
//empMNameLong=rs.getString("emp_mname_long");
//empLNameLong=rs.getString("emp_lname_long");
empFNameLong = checkNull(rs.getString("emp_fname_long"));
empMNameLong = checkNull(rs.getString("emp_mname_long"));
empLNameLong = checkNull(rs.getString("emp_lname_long"));
//modified by Shital on 09/08/2019 [End]
if(empFNameLong == null || empFNameLong == "")
{
empFNameLong = empFName;
}
pstmt.close();
if(empMNameLong == null || empMNameLong == "")
{
empMNameLong = empMName;
}
if(empLNameLong == null || empLNameLong == "")
{
empLNameLong = empLName;
}
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[End]
}
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA["+empFName+"]]>").append("</emp_maritalchg_emp_fname>");
rs=null;*/
close( pstmt, rs);
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[Start]
/*valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA["+empFName+"]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA["+empMName+"]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA["+empLName+"]]>").append("</emp_maritalchg_emp_lname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA["+empLName+"]]>").append("</emp_maritalchg_emp_lname>");*/
System.out.println("@S@ outside if");
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA["+empFNameLong+"]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA["+empMNameLong+"]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA["+empLNameLong+"]]>").append("</emp_maritalchg_emp_lname>");
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[End]
valueXmlString.append("<short_name protect=\"1\">").append("<![CDATA["+shortName+"]]>").append("</short_name>");
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", empFNameLong);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", empMNameLong);
admCommon.setNodeValue(dom, "emp_maritalchg_emp_lname", empLNameLong);
admCommon.setNodeValue(dom, "short_name", shortName);
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
}
else
{
if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus))) // Chnage done as per suggested by P Jain,
if((lsNewStatus != null && lsNewStatus.trim().length() > 0) && ("M".equalsIgnoreCase(lsNewStatus))) // Chnage done as per suggested by P Jain,
{
valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
else
{
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "spouse_name", spouseName);
//modified by Shital on 09/08/2019 [End]
}
}
}
......@@ -333,9 +694,13 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
conn.close();
conn = null;
}
} catch (Exception e1)
}
catch (Exception e1)
{
e1.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e1);
//modified by Shital on 09/08/2019 [End]
}
}
valueXmlString.append("</Root>\r\n");
......@@ -354,7 +719,9 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
Document dom1 = null;
Document dom2 = null;
String errString = "";
GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 09/08/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 09/08/2019 [End]
try
{
if (xmlString != null && xmlString.trim().length() != 0)
......@@ -376,48 +743,63 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
System.out.println("Exception : StdPayStru : wfValData(String xmlString) : ==>" + e.getMessage());
errString = genericUtility.createErrorString(e);
e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
}
return (errString);
}
public String wfValData(Document dom, Document dom1, Document dom2,
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
{
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
int currentFormNo = 0, childNodeListLength = 0;
int currentFormNo = 0;
int childNodeListLength = 0;
String userId = "";
String childNodeName = null;
String errString = "";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String msgType = "",empCode="",tranDateStr="",sql="",lsSite="",newStatus="",oldStatus="",lsStatus="",empCodeAprv="",relieveDate="";
int count=0;
Timestamp tranDate=null;
GenericUtility genericUtility = null;
String msgType = "";
String empCode = "";
String tranDateStr = "";
String sql = "";
String lsSite = "";
String newStatus = "";
String oldStatus = "";
String lsStatus = "";
String empCodeAprv = "";
String relieveDate = "";
int count = 0;
Timestamp tranDate = null;
//modified by Shital on 09/08/2019 [Start]
//GenericUtility genericUtility = null;
//modified by Shital on 09/08/2019 [End]
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
//modified by Shital on 09/08/2019 [Start]
//ConnDriver connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
conn.setAutoCommit(false);
//genericUtility = GenericUtility.getInstance();
//modified by Shital on 09/08/2019 [End]
genericUtility = GenericUtility.getInstance();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
}
switch (currentFormNo)
{
case 1:
......@@ -440,9 +822,8 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
if (childNodeName.equalsIgnoreCase("emp_code"))
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
tranDateStr=checkNull(genericUtility.getColumnValue("tran_date", dom));
tranDate= Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDateStr, genericUtility.getApplDateFormat()
,genericUtility.getDBDateFormat()));
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
tranDate = Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
if("A".equalsIgnoreCase(editFlag))
{
......@@ -459,12 +840,14 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
{
count = rs.getInt("cnt");
}
pstmt.close();
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
close( pstmt, rs);
if(count>0)
if(count > 0)
{
errList.add("VTUNCFPND");
errFields.add("emp_code");
......@@ -475,53 +858,62 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
* for emp_code and tran_date
* for employee
* */
sql="select count(*) as cnt from emp_maritalchg where emp_code =? and tran_date=?";
pstmt=conn.prepareStatement(sql);
sql = "select count(*) as cnt from emp_maritalchg where emp_code =? and tran_date=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
rs=pstmt.executeQuery();
rs = pstmt.executeQuery();
if(rs.next())
{
count=rs.getInt("cnt");
count = rs.getInt("cnt");
}
pstmt.close();
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
if(count>0)
rs=null;*/
close( pstmt, rs);
if(count > 0)
{
errList.add("VTALEXIST");
errFields.add("emp_code");
}
}
sql="select emp_site from employee where emp_code =?";
pstmt=conn.prepareStatement(sql);
sql = "select emp_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs=pstmt.executeQuery();
rs = pstmt.executeQuery();
if(rs.next())
{
lsSite=rs.getString("emp_site");
//modified by Shital on 09/08/2019 [Start]
//lsSite=rs.getString("emp_site");
lsSite = checkNull(rs.getString("emp_site"));
//modified by Shital on 09/08/2019 [End]
}
pstmt.close();
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
close( pstmt, rs);
// Need method to find out.
String errCode=gbfEmp(empCode,tranDate,lsSite,conn);
if(errCode!=null && errCode.trim().length()>0)
String errCode = gbfEmp(empCode,tranDate,lsSite,conn);
if(errCode != null && errCode.trim().length() > 0)
{
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
else if (childNodeName.equalsIgnoreCase("new_status"))
{
newStatus = checkNull(genericUtility.getColumnValue("new_status", dom));
oldStatus = checkNull(genericUtility.getColumnValue("old_status", dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
if(newStatus!=null && newStatus.trim().length()>0)
if(newStatus != null && newStatus.trim().length() > 0)
{
if("U".equalsIgnoreCase(oldStatus))
{
......@@ -553,22 +945,29 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
errList.add("VTSTAT");
errFields.add(childNodeName.toLowerCase());
}
if(errList.size()==0)
if(errList.size() == 0)
{
sql="select case when status is null then ' ' else status end from employee where EMP_CODE =?";
pstmt=conn.prepareStatement(sql);
//Changed By Sanket J on 01/March/18 for [new column to handle long value employee names]-[Start]
//sql="select case when status is null then ' ' else status end from employee where EMP_CODE =?";
sql = "select case when status is null then ' ' else status end as status from employee where EMP_CODE =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs=pstmt.executeQuery();
rs = pstmt.executeQuery();
if(rs.next())
{
lsStatus=rs.getString("status");
//modified by Shital on 09/08/2019 [Start]
//lsStatus=rs.getString("status");
lsStatus = checkNull(rs.getString("status"));
//modified by Shital on 09/08/2019 [End]
}
pstmt.close();
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
close( pstmt, rs);
if(lsStatus!=null && lsStatus.trim().length() !=0)
if(lsStatus != null && lsStatus.trim().length() != 0)
{
errList.add("VTINAEMP");
errFields.add(childNodeName.toLowerCase());
......@@ -580,28 +979,33 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
empCodeAprv = checkNull(genericUtility.getColumnValue("emp_code__aprv", dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
if(empCodeAprv!=null && empCodeAprv.trim().length()>0)
if(empCodeAprv != null && empCodeAprv.trim().length() > 0)
{
sql="select count(*) as cnt,RELIEVE_DATE from employee where emp_code = ? group by RELIEVE_DATE";
pstmt=conn.prepareStatement(sql);
sql = "select count(*) as cnt,RELIEVE_DATE from employee where emp_code = ? group by RELIEVE_DATE";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeAprv);
rs=pstmt.executeQuery();
rs = pstmt.executeQuery();
if(rs.next())
{
count=rs.getInt("cnt");
relieveDate=rs.getString("RELIEVE_DATE");
count = rs.getInt("cnt");
//modified by Shital on 09/08/2019 [Start]
//relieveDate = rs.getString("RELIEVE_DATE");
relieveDate = checkNull(rs.getString("RELIEVE_DATE"));
//modified by Shital on 09/08/2019 [End]
}
pstmt.close();
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;
rs=null;*/
close( pstmt, rs);
if(count==0)
if(count == 0)
{
errList.add("VMEMP1");
errFields.add(childNodeName.toLowerCase());
}
if(relieveDate!=null && relieveDate.trim().length()!=0)
if(relieveDate != null && relieveDate.trim().length() != 0)
{
errList.add("VMEMPV");
errFields.add(childNodeName.toLowerCase());
......@@ -629,9 +1033,12 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
String errFldName = (String) errFields.get(cnt);
System.out.println("errCode .........." + errCode);
errString = getErrorString(errFldName, errCode, userId);
//modified by Shital on 09/08/2019 [Start]
//errString = getErrorString(errFldName, errCode, userId);
errString = itmDBAccessEJB.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString is : ::::>>>> " + errString);
msgType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
......@@ -664,12 +1071,16 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
System.out.println("Exception ::" + e);
e.printStackTrace();
errString = e.getMessage();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
}
finally
{
try
{
if (conn != null)
//modified by Shital on 09/08/2019 [Start]
/*if (conn != null)
{
if (rs != null)
{
......@@ -683,54 +1094,81 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
}
conn.close();
}
conn = null;*/
if (rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
//modified by Shital on 09/08/2019 [End]
}
catch (Exception d)
{
d.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(d);
//modified by Shital on 09/08/2019 [End]
}
}
System.out.println("ErrString ::" + errString);
return errString;
}
private String gbfEmp(String empCode, Timestamp tranDate, String lsSite, Connection conn)
private String gbfEmp(String empCode, Timestamp tranDate, String lsSite, Connection conn) throws ITMException
{
// TODO Auto-generated method stub
String errCode="",sql="",status="";
Timestamp relieveDate=null;
PreparedStatement pstmt=null;
ResultSet rs=null;
try {
sql="select relieve_date, status from employee where emp_code = ?";
pstmt=conn.prepareStatement(sql);
String errCode = "";
String sql = "";
String status = "";
Timestamp relieveDate = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
sql = "select relieve_date, status from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs=pstmt.executeQuery();
rs = pstmt.executeQuery();
if(rs.next())
{
relieveDate=rs.getTimestamp("relieve_date");
status=rs.getString("status");
//modified by Shital on 09/08/2019 [Start]
//status=rs.getString("status");
status = checkNull(rs.getString("status"));
//modified by Shital on 09/08/2019 [End]
}
else
{
errCode="VMEMP1";
errCode = "VMEMP1";
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
//Changed By sanket on 08/MAR/18 [for proper closing connection]
close( pstmt, rs);
if(relieveDate !=null && relieveDate.before(tranDate) && "S".equalsIgnoreCase(status))
{
errCode="VMEMP2";
errCode = "VMEMP2";
}
} catch (SQLException e) {
}
catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
}
return errCode;
}
......@@ -739,16 +1177,20 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
try
{
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
while (rs.next())
{
msgType = rs.getString("MSG_TYPE");
//modified by Shital on 09/08/2019 [Start]
//msgType = rs.getString("MSG_TYPE");
msgType = checkNull(rs.getString("MSG_TYPE"));
//modified by Shital on 09/08/2019 [End]
}
}
catch (Exception ex)
......@@ -793,7 +1235,7 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
return input;
}
//Modified by Ahmed on 03/MAY/2017[This method is used to only replace for null value][START]
// Modified by Ahmed on 03/MAY/2017[This method is used to only replace for null value][START]
private String replaceNull(String input)
{
if (input == null)
......@@ -802,6 +1244,31 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
}
return input;
}
//Modified by Ahmed on 03/MAY/2017[This method is used to only replace for null value][END]
// Modified by Ahmed on 03/MAY/2017[This method is used to only replace for null value][END]
// Added by Sanket on 08/MAR/2018[Closing result set and prepared stmt][Start]
private void close(PreparedStatement pstmt, ResultSet rs) throws ITMException
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
{
ex.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(ex);
//modified by Shital on 09/08/2019 [End]
}
}
// Added by Sanket on 08/MAR/2018[Closing result set and prepared stmt][END]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment