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 @@ ...@@ -5,7 +5,9 @@
package ibase.webitm.ejb.adm; package ibase.webitm.ejb.adm;
import ibase.system.config.AppConnectParm; 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.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessLocal; import ibase.webitm.ejb.ITMDBAccessLocal;
...@@ -18,8 +20,9 @@ import java.sql.Connection; ...@@ -18,8 +20,9 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
//modified by Shital on 09/08/2019 [Start]
import javax.ejb.Stateless; //import javax.ejb.Stateless;
//modified by Shital on 09/08/2019 [End]
import javax.naming.InitialContext; import javax.naming.InitialContext;
import org.w3c.dom.Document; import org.w3c.dom.Document;
...@@ -27,10 +30,14 @@ import org.w3c.dom.Document; ...@@ -27,10 +30,14 @@ import org.w3c.dom.Document;
/** /**
* Session Bean implementation class EmpMaritalStatusConfPrc * 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 public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalStatusConfPrcRemote, EmpMaritalStatusConfPrcLocal
{ {
E12GenericUtility genericUtility=new E12GenericUtility(); E12GenericUtility genericUtility=new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String process() throws RemoteException,ITMException public String process() throws RemoteException,ITMException
{ {
return ""; return "";
...@@ -67,40 +74,44 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta ...@@ -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 public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException, ITMException
{ {
String returnString = "",confirm="",empCode="",tranDate="",sql=""; String returnString = "";
Timestamp tranDateTimestamp=null; String confirm = "";
String empCode = "";
String tranDate = "";
String sql = "";
Timestamp tranDateTimestamp = null;
boolean isError = false; boolean isError = false;
Connection connection = null; Connection conn = null;
ConnDriver connDriver = null; //modified by Shital on 09/08/2019 [Start]
//ConnDriver connDriver = null;
//modified by Shital on 09/08/2019 [End]
AppConnectParm appConnect = null; AppConnectParm appConnect = null;
InitialContext initialCtx = null; InitialContext initialCtx = null;
EmpMaritalStatusConfLocal empMaritalStatusConf = null; EmpMaritalStatusConfLocal empMaritalStatusConf = null;
//Commented and added by Varsha V on 20-Jul-18 for removing lookup ITMDBAccessLocal itmDBAccess = null;
//ITMDBAccessLocal itmDBAccess = null;
ITMDBAccessEJB itmDBAccess = null;
PreparedStatement pstmt=null; PreparedStatement pstmt=null;
ResultSet rs=null; ResultSet rs=null;
try try
{ {
connDriver = new ConnDriver(); //modified by Shital on 09/08/2019 [Start]
connection = connDriver.getConnectDB("DriverITM"); //connDriver = new ConnDriver();
connection.setAutoCommit(false); //connection = connDriver.getConnectDB("DriverITM");
//Commented and added by Varsha V on 20-Jul-18 for removing lookup conn = getConnection();
//appConnect = new AppConnectParm(); //modified by Shital on 09/08/2019 [End]
//initialCtx = new InitialContext(appConnect.getProperty()); conn.setAutoCommit(false);
//itmDBAccess = (ITMDBAccessLocal)initialCtx.lookup("ibase/ITMDBAccessEJB/local"); appConnect = new AppConnectParm();
itmDBAccess = new ITMDBAccessEJB(); initialCtx = new InitialContext(appConnect.getProperty());
itmDBAccess = (ITMDBAccessLocal)initialCtx.lookup("ibase/ITMDBAccessEJB/local");
empCode = checkNull(genericUtility.getColumnValue("emp_code", headerDom)); empCode = checkNull(genericUtility.getColumnValue("emp_code", headerDom));
tranDate = checkNull(genericUtility.getColumnValue("tran_date", headerDom)); tranDate = checkNull(genericUtility.getColumnValue("tran_date", headerDom));
System.out.println("@V@ VALLABH empCode :- ["+empCode+"]"); System.out.println("@V@ VALLABH empCode :- ["+empCode+"]");
System.out.println("@V@ VALLABH tranDate :- ["+tranDate+"]"); System.out.println("@V@ VALLABH tranDate :- ["+tranDate+"]");
tranDateTimestamp = Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate, genericUtility.getApplDateFormat() tranDateTimestamp = Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
,genericUtility.getDBDateFormat()));
sql = "SELECT CONFIRM FROM EMP_MARITALCHG WHERE EMP_CODE = ? AND TRAN_DATE = ? ";
sql = "SELECT CONFIRM FROM EMP_MARITALCHG WHERE EMP_CODE = ? AND TRAN_DATE = ?"; pstmt = conn.prepareStatement(sql);
pstmt = connection.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDateTimestamp); pstmt.setTimestamp(2, tranDateTimestamp);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -108,20 +119,36 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta ...@@ -108,20 +119,36 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta
{ {
confirm = checkNull(rs.getString("CONFIRM")); confirm = checkNull(rs.getString("CONFIRM"));
} }
pstmt.close(); //Changed By sanket on 08/MAR/18 [for proper closing connection]
pstmt=null; //modified by Shital on 09/08/2019 [Start]
rs.close(); //rs.close();
rs=null; //rs = null;
//pstmt.close();
//pstmt = null;
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//modified by Shital on 09/08/2019 [End]
System.out.println("@V@ VALLABH confirm :- ["+confirm+"]"); System.out.println("@V@ VALLABH confirm :- ["+confirm+"]");
if(!"X".equalsIgnoreCase(confirm)) if(!"X".equalsIgnoreCase(confirm))
{ {
empMaritalStatusConf = (EmpMaritalStatusConfLocal)initialCtx.lookup("ibase/EmpMaritalStatusConf/local"); 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 + "]"); System.out.println("EmpMaritalStatusConfPrc returnString ::[" + returnString + "]");
} }
else 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; return returnString;
} }
if(returnString.length() > 0) if(returnString.length() > 0)
...@@ -131,9 +158,11 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta ...@@ -131,9 +158,11 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta
} }
else 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) catch(Exception e)
{ {
...@@ -149,24 +178,39 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta ...@@ -149,24 +178,39 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta
{ {
if(isError) if(isError)
{ {
connection.rollback(); conn.rollback();
System.out.println("EmpMaritalStatusConfPrc connection rollback"); System.out.println("EmpMaritalStatusConfPrc connection rollback");
} }
else else
{ {
connection.commit(); conn.commit();
System.out.println("EmpMaritalStatusConfPrc connection committed"); 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)
{
pstmt.close();
pstmt = null;
}
//modified by Shital on 09/08/2019 [End]
if(conn != null)
{ {
connection.close(); conn.close();
connection = null; conn = null;
} }
} }
catch(Exception e) catch(Exception e)
{ {
returnString = e.getMessage(); returnString = e.getMessage();
e.printStackTrace(); 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); System.out.println("errString...:: "+returnString);
......
...@@ -9,13 +9,17 @@ import java.sql.Timestamp; ...@@ -9,13 +9,17 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
//modified by Shital on 09/08/2019 [Start]
import ibase.system.config.ConnDriver; //import ibase.system.config.ConnDriver;
import ibase.utility.GenericUtility; 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.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
//modified by Shital on 09/08/2019 [Start]
import javax.ejb.Stateless; //import javax.ejb.Stateless;
//modified by Shital on 09/08/2019 [End]
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
...@@ -24,9 +28,14 @@ import org.w3c.dom.NodeList; ...@@ -24,9 +28,14 @@ import org.w3c.dom.NodeList;
/** /**
* Session Bean implementation class BusinessUnits * 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 public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatusICLocal, EmpMaritalStatusICRemote
{ {
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String itemChanged() throws RemoteException, ITMException public String itemChanged() throws RemoteException, ITMException
{ {
return ""; return "";
...@@ -59,39 +68,68 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus ...@@ -59,39 +68,68 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
{ {
System.out.println("Exception : BusinessUnits : [itemChanged(String, xmlString)] :==>\n" + e.getMessage()); System.out.println("Exception : BusinessUnits : [itemChanged(String, xmlString)] :==>\n" + e.getMessage());
e.printStackTrace(); e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
} }
return valueXmlString; return valueXmlString;
} }
public String itemChanged(Document dom, Document dom1, Document dom2, public String itemChanged(Document dom, Document dom1, Document dom2,String objContext, String currentColumn, String editFlag,String xtraParams) throws RemoteException, ITMException
String objContext, String currentColumn, String editFlag,
String xtraParams) throws RemoteException, ITMException
{ {
System.out.println("@V@ In Item change..."); 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; Connection conn = null;
int currentFormNo = 0; int currentFormNo = 0;
ResultSet rs = null; ResultSet rs = null;
String empCodeHead = "", empFName = "", empMName = "", empLName = "",empMaritalChgEmpFname="",empMaritalChgEmpMname="",empMaritalChgEmpLname="", String empCodeHead = "";
shortName="",empFnameO="",empMnameO="",empLnameO="",shortNameO="",lsSex="",lsNewStatus="",empCode="",sql="",mStatus="",sex="", String empFName = "";
spouseName="",mStatDate=""; String empMName = "";
String mStatDateStr=""; 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; PreparedStatement pstmt = null;
StringBuffer valueXmlString; StringBuffer valueXmlString;
AdmCommon admCommon = new AdmCommon();
try try
{ {
valueXmlString = new StringBuffer(); valueXmlString = new StringBuffer();
genericUtility = GenericUtility.getInstance(); //modified by Shital on 09/08/2019 [Start]
ConnDriver connDriver = new ConnDriver(); //genericUtility = GenericUtility.getInstance();
conn = connDriver.getConnectDB("DriverITM"); //ConnDriver connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//modified by Shital on 09/08/2019 [End]
conn.setAutoCommit(false); conn.setAutoCommit(false);
Calendar currentDate = Calendar.getInstance(); Calendar currentDate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String sysDateStr = sdf.format(currentDate.getTime()); String sysDateStr = sdf.format(currentDate.getTime());
valueXmlString = new StringBuffer( valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
"<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>"); valueXmlString.append(editFlag).append("</editFlag></header>");
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
...@@ -101,12 +139,12 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus ...@@ -101,12 +139,12 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
switch (currentFormNo) switch (currentFormNo)
{ {
case 1: case 1:
valueXmlString.append("<Detail1>\r\n"); valueXmlString.append("<Detail1>\r\n");
if(currentColumn.trim().equalsIgnoreCase("itm_defaultedit")) if(currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{ {
//Modified by Ahmed on 03/May/2017 to only replace for null value [start] //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)); empMaritalChgEmpMname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom));
empMaritalChgEmpLname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom)); empMaritalChgEmpLname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom));
shortName=checkNull(genericUtility.getColumnValue("short_name", dom)); shortName=checkNull(genericUtility.getColumnValue("short_name", dom));
...@@ -115,209 +153,532 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus ...@@ -115,209 +153,532 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
empLnameO=checkNull(genericUtility.getColumnValue("emp_lname__o", dom)); empLnameO=checkNull(genericUtility.getColumnValue("emp_lname__o", dom));
shortNameO=checkNull(genericUtility.getColumnValue("short_name__o", dom)); shortNameO=checkNull(genericUtility.getColumnValue("short_name__o", dom));
spouseName=checkNull(genericUtility.getColumnValue("spouse_name", dom));*/ spouseName=checkNull(genericUtility.getColumnValue("spouse_name", dom));*/
empMaritalChgEmpFname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom)); empMaritalChgEmpFname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom));
empMaritalChgEmpMname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom)); empMaritalChgEmpMname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom));
empMaritalChgEmpLname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom)); empMaritalChgEmpLname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom));
shortName=replaceNull(genericUtility.getColumnValue("short_name", dom)); shortName = replaceNull(genericUtility.getColumnValue("short_name", dom));
empFnameO=replaceNull(genericUtility.getColumnValue("emp_fname__o", dom)); empFnameO = replaceNull(genericUtility.getColumnValue("emp_fname__o", dom));
empMnameO=replaceNull(genericUtility.getColumnValue("emp_mname__o", dom)); empMnameO = replaceNull(genericUtility.getColumnValue("emp_mname__o", dom));
empLnameO=replaceNull(genericUtility.getColumnValue("emp_lname__o", dom)); empLnameO = replaceNull(genericUtility.getColumnValue("emp_lname__o", dom));
shortNameO=replaceNull(genericUtility.getColumnValue("short_name__o", dom)); shortNameO = replaceNull(genericUtility.getColumnValue("short_name__o", dom));
spouseName=replaceNull(genericUtility.getColumnValue("spouse_name", dom)); spouseName = replaceNull(genericUtility.getColumnValue("spouse_name", dom));
//Modified by Ahmed on 03/AMY/2017 to only replace for null value[end] //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>"); valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA[" + empMaritalChgEmpFname+ "]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA[" + empMaritalChgEmpMname+ "]]>").append("</emp_maritalchg_emp_mname>"); valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA[" + empMaritalChgEmpMname+ "]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA[" + empMaritalChgEmpLname+ "]]>").append("</emp_maritalchg_emp_lname>"); 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("<short_name protect=\"1\">").append("<![CDATA[" + shortName+ "]]>").append("</short_name>");
valueXmlString.append("<emp_fname__o protect=\"1\">").append("<![CDATA[" + empFnameO+ "]]>").append("</emp_fname__o>"); valueXmlString.append("<emp_fname__o protect=\"1\">").append("<![CDATA[" + empFnameO+ "]]>").append("</emp_fname__o>");
valueXmlString.append("<emp_mname__o protect=\"1\">").append("<![CDATA[" + empMnameO+ "]]>").append("</emp_mname__o>"); valueXmlString.append("<emp_mname__o protect=\"1\">").append("<![CDATA[" + empMnameO+ "]]>").append("</emp_mname__o>");
valueXmlString.append("<emp_lname__o protect=\"1\">").append("<![CDATA[" + empLnameO+ "]]>").append("</emp_lname__o>"); 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>"); valueXmlString.append("<short_name__o protect=\"1\">").append("<![CDATA[" + shortNameO+ "]]>").append("</short_name__o>");
lsSex=checkNull(genericUtility.getColumnValue("sex", dom)); //modified by Shital on 09/08/2019 [Start]
lsNewStatus=checkNull(genericUtility.getColumnValue("new_status", dom)); admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", empMaritalChgEmpFname);
System.out.println("@V@ SEX of employee :- ["+lsSex+"]"); admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", empMaritalChgEmpMname);
if((lsSex!=null && lsSex.trim().length()>0) && ("F".equalsIgnoreCase(lsSex))) 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((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))) valueXmlString.append("<emp_maritalchg_emp_fname protect=\"0\">").append("<![CDATA[" + empMaritalChgEmpFname+ "]]>").append("</emp_maritalchg_emp_fname>");
if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus))) // CHANGE done as per suggested by P Jain. 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("<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>");
valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>"); 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 else
{ {
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA[" + empMaritalChgEmpFname+ "]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA[" + empMaritalChgEmpMname+ "]]>").append("</emp_maritalchg_emp_mname>");
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>"); 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 else
{ {
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=\"1\">").append("<![CDATA[" + empMaritalChgEmpFname+ "]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA[" + empMaritalChgEmpMname+ "]]>").append("</emp_maritalchg_emp_mname>");
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,
{
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 ..");
valueXmlString.append("<tran_date >").append("<![CDATA[" + sysDateStr+ "]]>").append("</tran_date>");
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA[]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA[]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA[]]>").append("</emp_maritalchg_emp_lname>");
valueXmlString.append("<short_name protect=\"1\">").append("<![CDATA[]]>").append("</short_name>");
valueXmlString.append("<emp_fname__o protect=\"1\">").append("<![CDATA[]]>").append("</emp_fname__o>");
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));
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();
if(rs.next())
{
//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+"]");
}
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;*/
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+"]");
System.out.println("@V@ At emp code item change empLName:- ["+empLName+"]");
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>"); 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 else
{ {
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>"); 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>");
//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(currentColumn.trim().equalsIgnoreCase("itm_default")) else
{
System.out.println("@V@ In Item default ..");
valueXmlString.append("<tran_date >").append("<![CDATA[" + sysDateStr+ "]]>").append("</tran_date>");
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA[]]>").append("</emp_maritalchg_emp_fname>");
valueXmlString.append("<emp_maritalchg_emp_mname protect=\"1\">").append("<![CDATA[]]>").append("</emp_maritalchg_emp_mname>");
valueXmlString.append("<emp_maritalchg_emp_lname protect=\"1\">").append("<![CDATA[]]>").append("</emp_maritalchg_emp_lname>");
valueXmlString.append("<short_name protect=\"1\">").append("<![CDATA[]]>").append("</short_name>");
valueXmlString.append("<emp_fname__o protect=\"1\">").append("<![CDATA[]]>").append("</emp_fname__o>");
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>");
}
else if(currentColumn.trim().equalsIgnoreCase("emp_code"))
{ {
System.out.println("@V@ In emp code Item change .."); if((lsNewStatus != null && lsNewStatus.trim().length() > 0) && ("M".equalsIgnoreCase(lsNewStatus)))
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);
pstmt.setString(1, empCode);
rs=pstmt.executeQuery();
if(rs.next())
{ {
empLName=rs.getString("emp_lname"); valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
empFName=rs.getString("emp_fname"); //modified by Shital on 09/08/2019 [Start]
empMName=rs.getString("emp_mname"); admCommon.setNodeValue(dom, "spouse_name", spouseName);
mStatus=rs.getString("m_status"); //modified by Shital on 09/08/2019 [End]
shortName=rs.getString("short_name");
sex=rs.getString("sex");
mStatDate=rs.getString("m_status_date");
} }
pstmt.close(); else
pstmt=null; {
rs.close(); valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
rs=null; //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>");
System.out.println("@V@ At emp code item change fname:- ["+empFName+"]"); //modified by Shital on 09/08/2019 [Start]
System.out.println("@V@ At emp code item change empMName:- ["+empMName+"]"); admCommon.setNodeValue(dom, "emp_maritalchg_emp_fname", empFNameLong);
System.out.println("@V@ At emp code item change empLName:- ["+empLName+"]"); admCommon.setNodeValue(dom, "emp_maritalchg_emp_mname", empMNameLong);
System.out.println("@V@ At emp code item change mStatus:- ["+mStatus+"]"); admCommon.setNodeValue(dom, "emp_maritalchg_emp_lname", empLNameLong);
System.out.println("@V@ At emp code item change shortName:- ["+shortName+"]"); admCommon.setNodeValue(dom, "short_name", shortName);
System.out.println("@V@ At emp code item change sex:- ["+sex+"]"); //modified by Shital on 09/08/2019 [End]
valueXmlString.append("<emp_fname protect=\"1\">").append("<![CDATA[" + empFName+ "]]>").append("</emp_fname>"); //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("<emp_lname protect=\"1\">").append("<![CDATA[" + empLName+ "]]>").append("</emp_lname>");
valueXmlString.append("<old_status protect=\"1\">").append("<![CDATA[" + mStatus+ "]]>").append("</old_status>"); 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_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_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>");
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>");
if(mStatDate!=null && mStatDate.trim().length()>0) 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]
mStatDateStr=genericUtility.getValidDateString(mStatDate, genericUtility.getDBDateFormat(), valueXmlString.append("<short_name protect=\"1\">").append("<![CDATA[" + shortName+ "]]>").append("</short_name>");*/
genericUtility.getApplDateFormat());
valueXmlString.append("<status_date__o protect=\"1\">").append("<![CDATA[" + mStatDateStr+ "]]>").append("</status_date__o>"); if(mStatDate != null && mStatDate.trim().length() > 0)
} {
else mStatDateStr=genericUtility.getValidDateString(mStatDate, genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat());
{ valueXmlString.append("<status_date__o protect=\"1\">").append("<![CDATA[" + mStatDateStr+ "]]>").append("</status_date__o>");
valueXmlString.append("<status_date__o protect=\"1\">").append("<![CDATA[]]>").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]
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("<short_name__o protect=\"1\">").append("<![CDATA[" + shortName+ "]]>").append("</short_name__o>");
valueXmlString.append("<sex >").append("<![CDATA[" + sex+ "]]>").append("</sex>");
} }
else if(currentColumn.trim().equalsIgnoreCase("new_status")) else
{ {
lsNewStatus=checkNull(genericUtility.getColumnValue("new_status", dom)); valueXmlString.append("<status_date__o protect=\"1\">").append("<![CDATA[]]>").append("</status_date__o>");
//Modified by Ahmed on 03/MAY/2017 to only replace for null value[start] //modified by Shital on 09/08/2019 [Start]
/*empMaritalChgEmpFname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom)); 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>");
//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));
//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)); empMaritalChgEmpMname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom));
empMaritalChgEmpLname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom)); empMaritalChgEmpLname=checkNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom));
shortName=checkNull(genericUtility.getColumnValue("short_name", dom)); shortName=checkNull(genericUtility.getColumnValue("short_name", dom));
spouseName=checkNull(genericUtility.getColumnValue("spouse_name", dom));*/ spouseName=checkNull(genericUtility.getColumnValue("spouse_name", dom));*/
empMaritalChgEmpFname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom)); empMaritalChgEmpFname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_fname", dom));
empMaritalChgEmpMname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom)); empMaritalChgEmpMname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_mname", dom));
empMaritalChgEmpLname=replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom)); empMaritalChgEmpLname = replaceNull(genericUtility.getColumnValue("emp_maritalchg_emp_lname", dom));
shortName=replaceNull(genericUtility.getColumnValue("short_name", dom)); shortName = replaceNull(genericUtility.getColumnValue("short_name", dom));
spouseName=replaceNull(genericUtility.getColumnValue("spouse_name", dom)); spouseName = replaceNull(genericUtility.getColumnValue("spouse_name", dom));
//Modified by Ahmed on 03/MAY/2017 to only replace for null value[end] //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));
if("U".equalsIgnoreCase(lsNewStatus)) System.out.println("@S@ sex from dom["+sex+"]");
{
valueXmlString.append("<spouse_name >").append("<![CDATA[]]>").append("</spouse_name>"); if("U".equalsIgnoreCase(lsNewStatus))
} {
if((sex!=null && sex.trim().length()>0) && ("F".equalsIgnoreCase(sex))) 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))) // Chnage done as per suggested by P Jain,
{ {
// if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus) || "D".equalsIgnoreCase(lsNewStatus))) valueXmlString.append("<emp_maritalchg_emp_fname protect=\"0\">").append("<![CDATA["+empMaritalChgEmpFname+"]]>").append("</emp_maritalchg_emp_fname>");
if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus))) // Chnage done as per suggested by P Jain, 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("<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>");
valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>"); 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 else
{ {
empCode=checkNull(genericUtility.getColumnValue("emp_code", dom)); 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();
if(rs.next())
{
//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]
sql="select emp_lname, emp_fname,m_status, emp_mname, short_name,sex,m_status_date from employee where emp_code =?"; //modified by Shital on 09/08/2019 [Start]
pstmt=conn.prepareStatement(sql); //empFNameLong=rs.getString("emp_fname_long");
pstmt.setString(1, empCode); //empMNameLong=rs.getString("emp_mname_long");
rs=pstmt.executeQuery(); //empLNameLong=rs.getString("emp_lname_long");
if(rs.next()) 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;
}
if(empMNameLong == null || empMNameLong == "")
{ {
empLName=rs.getString("emp_lname"); empMNameLong = empMName;
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");
} }
pstmt.close();
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; pstmt=null;
rs.close(); rs.close();
rs=null; rs=null;*/
close( pstmt, rs);
valueXmlString.append("<emp_maritalchg_emp_fname protect=\"1\">").append("<![CDATA["+empFName+"]]>").append("</emp_maritalchg_emp_fname>"); //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_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>");*/
valueXmlString.append("<short_name protect=\"1\">").append("<![CDATA["+shortName+"]]>").append("</short_name>"); System.out.println("@S@ outside if");
valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_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>");
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,
{
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 else
{ {
if((lsNewStatus!=null && lsNewStatus.trim().length()>0) && ("M".equalsIgnoreCase(lsNewStatus))) // Chnage done as per suggested by P Jain, valueXmlString.append("<spouse_name protect=\"1\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>");
{ //modified by Shital on 09/08/2019 [Start]
valueXmlString.append("<spouse_name protect=\"0\">").append("<![CDATA["+spouseName+"]]>").append("</spouse_name>"); 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>");
}
} }
} }
valueXmlString.append ("</Detail1>\r\n");
break;
} }
valueXmlString.append ("</Detail1>\r\n");
} break;
}
}
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
...@@ -333,16 +694,20 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus ...@@ -333,16 +694,20 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
conn.close(); conn.close();
conn = null; conn = null;
} }
} catch (Exception e1) }
catch (Exception e1)
{ {
e1.printStackTrace(); 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"); valueXmlString.append("</Root>\r\n");
System.out.println("@V@ valueXmlString :- ["+valueXmlString+"]"); System.out.println("@V@ valueXmlString :- ["+valueXmlString+"]");
return valueXmlString.toString(); return valueXmlString.toString();
} }
public String wfValData() throws RemoteException, ITMException public String wfValData() throws RemoteException, ITMException
{ {
return ""; return "";
...@@ -354,7 +719,9 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus ...@@ -354,7 +719,9 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
String errString = ""; 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 try
{ {
if (xmlString != null && xmlString.trim().length() != 0) if (xmlString != null && xmlString.trim().length() != 0)
...@@ -376,361 +743,432 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus ...@@ -376,361 +743,432 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
System.out.println("Exception : StdPayStru : wfValData(String xmlString) : ==>" + e.getMessage()); System.out.println("Exception : StdPayStru : wfValData(String xmlString) : ==>" + e.getMessage());
errString = genericUtility.createErrorString(e); errString = genericUtility.createErrorString(e);
e.printStackTrace(); e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
} }
return (errString); return (errString);
} }
public String wfValData(Document dom, Document dom1, Document dom2, public String wfValData(Document dom, Document dom1, Document dom2,String objContext, String editFlag, String xtraParams)throws RemoteException, ITMException
String objContext, String editFlag, String xtraParams)
throws RemoteException, ITMException
{ {
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
int currentFormNo = 0, childNodeListLength = 0; int currentFormNo = 0;
int childNodeListLength = 0;
String userId = ""; String userId = "";
String childNodeName = null; String childNodeName = null;
String errString = ""; String errString = "";
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String msgType = "";
String msgType = "",empCode="",tranDateStr="",sql="",lsSite="",newStatus="",oldStatus="",lsStatus="",empCodeAprv="",relieveDate=""; String empCode = "";
int count=0; String tranDateStr = "";
Timestamp tranDate=null; String sql = "";
String lsSite = "";
GenericUtility genericUtility = null; 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> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>(); ArrayList<String> errFields = new ArrayList<String>();
try try
{ {
ConnDriver connDriver = new ConnDriver(); //modified by Shital on 09/08/2019 [Start]
conn = connDriver.getConnectDB("DriverITM"); //ConnDriver connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
conn.setAutoCommit(false); conn.setAutoCommit(false);
//genericUtility = GenericUtility.getInstance();
genericUtility = GenericUtility.getInstance(); //modified by Shital on 09/08/2019 [End]
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
switch (currentFormNo) switch (currentFormNo)
{ {
case 1: case 1:
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
for (int ctr = 0; ctr < childNodeListLength; ctr++) for (int ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
if (childNode.getNodeType() != Node.ELEMENT_NODE)
{ {
childNode = childNodeList.item(ctr); continue;
if (childNode.getNodeType() != Node.ELEMENT_NODE) }
{ childNodeName = childNode.getNodeName();
continue;
} System.out.println("childNodeName.editFlag." + childNodeName + ".." + editFlag);
childNodeName = childNode.getNodeName(); System.out.println("@V@ Edit flag :- ["+editFlag+"");
System.out.println("childNodeName.editFlag." + childNodeName + ".." + editFlag); if (childNodeName.equalsIgnoreCase("emp_code"))
System.out.println("@V@ Edit flag :- ["+editFlag+""); {
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
tranDate = Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
if (childNodeName.equalsIgnoreCase("emp_code")) if("A".equalsIgnoreCase(editFlag))
{ {
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); /**
tranDateStr=checkNull(genericUtility.getColumnValue("tran_date", dom)); * Check un-confirmed transaction exist
tranDate= Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDateStr, genericUtility.getApplDateFormat() * for employee
,genericUtility.getDBDateFormat())); * */
sql = "select count(*) as cnt from emp_maritalchg" +
if("A".equalsIgnoreCase(editFlag)) " where (case when confirm is null then 'N' else confirm END ='N') and emp_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{ {
/** count = rs.getInt("cnt");
* Check un-confirmed transaction exist }
* for employee //Changed By sanket on 08/MAR/18 [for proper closing connection]
* */ /*pstmt.close();
sql = "select count(*) as cnt from emp_maritalchg" +
" where (case when confirm is null then 'N' else confirm END ='N') and emp_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt("cnt");
}
pstmt.close();
pstmt=null;
rs.close();
rs=null;
if(count>0)
{
errList.add("VTUNCFPND");
errFields.add("emp_code");
}
/**
* Check already transaction exist
* 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);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
rs=pstmt.executeQuery();
if(rs.next())
{
count=rs.getInt("cnt");
}
pstmt.close();
pstmt=null; pstmt=null;
rs.close(); rs.close();
rs=null; rs=null;*/
if(count>0) close( pstmt, rs);
{
errList.add("VTALEXIST"); if(count > 0)
errFields.add("emp_code"); {
} errList.add("VTUNCFPND");
errFields.add("emp_code");
} }
sql="select emp_site from employee where emp_code =?"; /**
pstmt=conn.prepareStatement(sql); * Check already transaction exist
* 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);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
rs=pstmt.executeQuery(); pstmt.setTimestamp(2, tranDate);
rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
lsSite=rs.getString("emp_site"); count = rs.getInt("cnt");
} }
pstmt.close(); //Changed By sanket on 08/MAR/18 [for proper closing connection]
pstmt=null; /*pstmt.close();
rs.close(); pstmt=null;
rs=null; rs.close();
// Need method to find out. rs=null;*/
String errCode=gbfEmp(empCode,tranDate,lsSite,conn); close( pstmt, rs);
if(errCode!=null && errCode.trim().length()>0)
if(count > 0)
{ {
errList.add(errCode); errList.add("VTALEXIST");
errFields.add(childNodeName.toLowerCase()); errFields.add("emp_code");
} }
} }
else if (childNodeName.equalsIgnoreCase("new_status"))
sql = "select emp_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{ {
newStatus = checkNull(genericUtility.getColumnValue("new_status", dom)); //modified by Shital on 09/08/2019 [Start]
oldStatus = checkNull(genericUtility.getColumnValue("old_status", dom)); //lsSite=rs.getString("emp_site");
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); lsSite = checkNull(rs.getString("emp_site"));
//modified by Shital on 09/08/2019 [End]
if(newStatus!=null && newStatus.trim().length()>0) }
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
pstmt=null;
rs.close();
rs=null;*/
close( pstmt, rs);
// Need method to find out.
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("U".equalsIgnoreCase(oldStatus))
{ {
if("U".equalsIgnoreCase(oldStatus)) if("D".equalsIgnoreCase(newStatus) || "S".equalsIgnoreCase(newStatus) || "K".equalsIgnoreCase(newStatus))
{ {
if("D".equalsIgnoreCase(newStatus) || "S".equalsIgnoreCase(newStatus) || "K".equalsIgnoreCase(newStatus)) errList.add("VTSTAT1");
{ errFields.add(childNodeName.toLowerCase());
errList.add("VTSTAT1");
errFields.add(childNodeName.toLowerCase());
}
} }
else }
else
{
if("M".equalsIgnoreCase(oldStatus) || "D".equalsIgnoreCase(oldStatus) || "S".equalsIgnoreCase(oldStatus))
{ {
if("M".equalsIgnoreCase(oldStatus) || "D".equalsIgnoreCase(oldStatus) || "S".equalsIgnoreCase(oldStatus)) if("U".equalsIgnoreCase(newStatus) || "K".equalsIgnoreCase(newStatus))
{ {
if("U".equalsIgnoreCase(newStatus) || "K".equalsIgnoreCase(newStatus)) errList.add("VTSTAT2");
{ errFields.add(childNodeName.toLowerCase());
errList.add("VTSTAT2"); }
errFields.add(childNodeName.toLowerCase());
}
}
}
if(newStatus.equalsIgnoreCase(oldStatus))
{
errList.add("VTSTATE3");
errFields.add(childNodeName.toLowerCase());
} }
} }
else if(newStatus.equalsIgnoreCase(oldStatus))
{ {
errList.add("VTSTAT"); errList.add("VTSTATE3");
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
if(errList.size()==0) }
else
{
errList.add("VTSTAT");
errFields.add(childNodeName.toLowerCase());
}
if(errList.size() == 0)
{
//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();
if(rs.next())
{ {
sql="select case when status is null then ' ' else status end from employee where EMP_CODE =?"; //modified by Shital on 09/08/2019 [Start]
pstmt=conn.prepareStatement(sql); //lsStatus=rs.getString("status");
pstmt.setString(1, empCode); lsStatus = checkNull(rs.getString("status"));
rs=pstmt.executeQuery(); //modified by Shital on 09/08/2019 [End]
if(rs.next()) }
{ //Changed By sanket on 08/MAR/18 [for proper closing connection]
lsStatus=rs.getString("status"); /*pstmt.close();
}
pstmt.close();
pstmt=null; pstmt=null;
rs.close(); 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()); errList.add("VTINAEMP");
} errFields.add(childNodeName.toLowerCase());
} }
} }
else if (childNodeName.equalsIgnoreCase("emp_code__aprv")) }
else if (childNodeName.equalsIgnoreCase("emp_code__aprv"))
{
empCodeAprv = checkNull(genericUtility.getColumnValue("emp_code__aprv", dom));
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
if(empCodeAprv != null && empCodeAprv.trim().length() > 0)
{ {
empCodeAprv = checkNull(genericUtility.getColumnValue("emp_code__aprv", dom)); sql = "select count(*) as cnt,RELIEVE_DATE from employee where emp_code = ? group by RELIEVE_DATE";
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeAprv);
if(empCodeAprv!=null && empCodeAprv.trim().length()>0) rs = pstmt.executeQuery();
if(rs.next())
{ {
sql="select count(*) as cnt,RELIEVE_DATE from employee where emp_code = ? group by RELIEVE_DATE"; count = rs.getInt("cnt");
pstmt=conn.prepareStatement(sql); //modified by Shital on 09/08/2019 [Start]
pstmt.setString(1, empCodeAprv); //relieveDate = rs.getString("RELIEVE_DATE");
rs=pstmt.executeQuery(); relieveDate = checkNull(rs.getString("RELIEVE_DATE"));
if(rs.next()) //modified by Shital on 09/08/2019 [End]
{ }
count=rs.getInt("cnt"); //Changed By sanket on 08/MAR/18 [for proper closing connection]
relieveDate=rs.getString("RELIEVE_DATE"); /*pstmt.close();
}
pstmt.close();
pstmt=null; pstmt=null;
rs.close(); rs.close();
rs=null; rs=null;*/
close( pstmt, rs);
if(count==0)
{ if(count == 0)
errList.add("VMEMP1"); {
errFields.add(childNodeName.toLowerCase()); 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()); errList.add("VMEMPV");
} errFields.add(childNodeName.toLowerCase());
if(empCodeAprv.equalsIgnoreCase(empCode)) }
{ if(empCodeAprv.equalsIgnoreCase(empCode))
errList.add("VMEMP4"); {
errFields.add(childNodeName.toLowerCase()); errList.add("VMEMP4");
} errFields.add(childNodeName.toLowerCase());
} }
} }
} }
break;
} }
break;
}
int errListSize = errList.size(); int errListSize = errList.size();
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
//ERRORLIST //ERRORLIST
if (errList != null && errListSize > 0) if (errList != null && errListSize > 0)
{
for (int cnt = 0; cnt < errListSize; cnt++)
{ {
for (int cnt = 0; cnt < errListSize; cnt++) String errCode = (String) errList.get(cnt);
String errFldName = (String) errFields.get(cnt);
System.out.println("errCode .........." + errCode);
//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 errCode = (String) errList.get(cnt); String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
String errFldName = (String) errFields.get(cnt); bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8, errString.indexOf("</Errors>"));
System.out.println("errCode .........." + errCode); errStringXml.append(bifurErrString);
System.out.println("errStringXml .........." + errStringXml);
errString = getErrorString(errFldName, errCode, userId); errString = "";
System.out.println("errString is : ::::>>>> " + errString); }
msgType = errorType(conn, errCode); if (msgType.equalsIgnoreCase("E"))
if (errString.length() > 0) {
{ break;
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();
errList = null;
errFields.clear();
errFields = null;
errStringXml.append("</Errors></Root>\r\n");
}
else
{
errStringXml = new StringBuffer("");
} }
errString = errStringXml.toString(); errList.clear();
errList = null;
errFields.clear();
errFields = null;
errStringXml.append("</Errors></Root>\r\n");
} }
else
catch (Exception e)
{ {
System.out.println("Exception ::" + e); errStringXml = new StringBuffer("");
e.printStackTrace(); }
errString = e.getMessage(); errString = errStringXml.toString();
} }
finally
catch (Exception e)
{
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
{ {
try //modified by Shital on 09/08/2019 [Start]
/*if (conn != null)
{ {
if (conn != null) if (rs != null)
{ {
if (rs != null) rs.close();
{ rs = null;
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
} }
conn = null; if(pstmt != null)
} {
catch (Exception d) pstmt.close();
pstmt = null;
}
conn.close();
}
conn = null;*/
if (rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn != null)
{ {
d.printStackTrace(); 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; 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 // TODO Auto-generated method stub
String errCode="",sql="",status=""; String errCode = "";
Timestamp relieveDate=null; String sql = "";
PreparedStatement pstmt=null; String status = "";
ResultSet rs=null; Timestamp relieveDate = null;
PreparedStatement pstmt = null;
try { ResultSet rs = null;
sql="select relieve_date, status from employee where emp_code = ?";
pstmt=conn.prepareStatement(sql); try
{
sql = "select relieve_date, status from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
rs=pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
relieveDate=rs.getTimestamp("relieve_date"); 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 else
{ {
errCode="VMEMP1"; errCode = "VMEMP1";
} }
pstmt.close(); //Changed By sanket on 08/MAR/18 [for proper closing connection]
pstmt=null; close( pstmt, rs);
rs.close();
rs=null;
if(relieveDate !=null && relieveDate.before(tranDate) && "S".equalsIgnoreCase(status)) if(relieveDate !=null && relieveDate.before(tranDate) && "S".equalsIgnoreCase(status))
{ {
errCode="VMEMP2"; errCode = "VMEMP2";
} }
}
} catch (SQLException e) { catch (SQLException e)
{
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
} }
return errCode; return errCode;
} }
...@@ -739,16 +1177,20 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus ...@@ -739,16 +1177,20 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
String msgType = ""; String msgType = "";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = "";
try 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 = conn.prepareStatement(sql);
pstmt.setString(1, errorCode); pstmt.setString(1, errorCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) 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) catch (Exception ex)
...@@ -779,7 +1221,7 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus ...@@ -779,7 +1221,7 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
} }
return msgType; return msgType;
} }
private String checkNull(String input) private String checkNull(String input)
{ {
if (input == null) if (input == null)
...@@ -792,16 +1234,41 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus ...@@ -792,16 +1234,41 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
} }
return input; return input;
} }
// 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)
{
input = "";
}
return input;
}
// 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]
//Modified by Ahmed on 03/MAY/2017[This method is used to only replace for null value][START] private void close(PreparedStatement pstmt, ResultSet rs) throws ITMException
private String replaceNull(String input) {
try
{ {
if (input == null) if (rs != null)
{ {
input = ""; rs.close();
rs = null;
} }
return input; 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]
} }
//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][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