Commit 886af51a authored by sghate's avatar sghate

Updated component :

EmpMaritalStatusConfIC.java
EmpMaritalStatusConfPrc.java
EmpMaritalStatusIC.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@216795 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 115d1a36
......@@ -3,8 +3,9 @@
* Component Name : EmpMaritalStatusConfIC
*/
package ibase.webitm.ejb.adm;
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.ValidatorEJB;
......@@ -17,39 +18,45 @@ import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
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.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@Stateless
//modified by Shital on 09/08/2019 [Start]
//@Stateless
//modified by Shital on 09/08/2019 [End]
public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalStatusConfICLocal , EmpMaritalStatusConfICRemote
{
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
E12GenericUtility genericUtility = new E12GenericUtility();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = "";
E12GenericUtility genericUtility = new E12GenericUtility();
try
{
System.out.println("EmpMaritalStatusConfIC:wfValData value of xmlString ["+xmlString+"]");
System.out.println("EmpMaritalStatusConfIC:wfValData value of xmlString ["+xmlString1+"]");
System.out.println("EmpMaritalStatusConfIC:wfValData value of xmlString ["+xmlString2+"]");
if (xmlString != null && xmlString.trim().length()!=0)
if (xmlString != null && xmlString.trim().length() != 0)
{
dom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length()!=0)
if (xmlString1 != null && xmlString1.trim().length() != 0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length()!=0)
if (xmlString2 != null && xmlString2.trim().length() != 0)
{
dom2 = genericUtility.parseString(xmlString2);
}
......@@ -74,24 +81,34 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
PreparedStatement pstmt = null;
ResultSet rs = null;
java.sql.Timestamp tranDate = null;
NodeList parentList = null , childList = null;
Node parentNode = null , childNode = null ;
int noOfChilds = 0 , counterChild = 0;
String sql = "", empCode = "", confirm = "", errString = "", tranDateStr = "";
NodeList parentList = null;
NodeList childList = null;
Node parentNode = null;
Node childNode = null;
int noOfChilds = 0;
int counterChild = 0;
String sql = "";
String empCode = "";
String confirm = "";
String errString = "";
String tranDateStr = "";
String childNodeName = "";
int currentFormNo = 0;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
E12GenericUtility genericUtility = new E12GenericUtility();
String genVoucher = "";
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("Driver");
//modified by Shital on 09/08/2019 [Start]
//ConnDriver connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("Driver");
conn = getConnection();
//modified by Shital on 09/08/2019 [End]
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
parentList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentList.item(0);
childList = parentNode.getChildNodes();
......@@ -109,11 +126,18 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
{
case 1:
System.out.println("In case 1 ::::::::");
empCode = genericUtility.getColumnValue("emp_code", dom);
//modified by Shital on 09/08/2019 [Start]
//empCode = genericUtility.getColumnValue("emp_code", dom);
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
System.out.println("empCode from Dom::"+empCode);
tranDateStr = genericUtility.getColumnValue("tran_date", dom);
//tranDateStr = genericUtility.getColumnValue("tran_date", dom);
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
//modified by Shital on 09/08/2019 [End]
System.out.println("tranDateStr from Dom::"+tranDateStr);
if(tranDateStr != null && tranDateStr.trim().length() > 0) //modified by Shital on 27/01/2020
{
tranDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
}
System.out.println("tranDate after parsing::"+tranDate);
if("emp_code".equalsIgnoreCase(childNodeName))
......@@ -128,18 +152,29 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
confirm = checkNull( rs.getString( "CONFIRM" ) );
}
close(pstmt, rs);
if( "Y".equalsIgnoreCase(confirm.trim()) )
{
errString = itmDBAccessEJB.getErrorString("","VTMARSCH01","","",conn);
//errString = itmDBAccessEJB.getErrorString("","VTMARSCH01","","",conn);
errString = itmDBAccessEJB.getErrorString("","VTMARSCH01", "", "", conn);
return errString;
}
}
else if("generate_voucher".equalsIgnoreCase(childNodeName))
//else if("voucher_no".equalsIgnoreCase(childNodeName)) //modified by Shital on 09/08/2019
{
String genVoucher = genericUtility.getColumnValue("generate_voucher", dom);
//modified by Shital on 09/08/2019 [Start]
//String genVoucher = genericUtility.getColumnValue("generate_voucher", dom);
genVoucher = checkNull(genericUtility.getColumnValue("generate_voucher", dom));
//modified by Shital on 09/08/2019 [End]
System.out.println("::::genVoucher:::::"+genVoucher);
if(genVoucher == null || genVoucher.trim().length() == 0)
{
errString = itmDBAccessEJB.getErrorString("","VTMARSCH04","","",conn);
//modified by Shital on 09/08/2019 [Start]
//errString = itmDBAccessEJB.getErrorString("","VTMARSCH04","","",conn);
errString = itmDBAccessEJB.getErrorString("","VTMARSCH04", "", "", conn);
//modified by Shital on 09/08/2019 [End]
return errString;
}
}
......@@ -166,21 +201,21 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
catch (Exception 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 itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = null;
E12GenericUtility genericUtility = new E12GenericUtility();
try
{
System.out.println("EmpMaritalStatusConfIC:itemChanged value of xmlString ["+xmlString+"]");
......@@ -190,15 +225,15 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
System.out.println("currentColumn ..:: ["+currentColumn+"]");
System.out.println("editFlag ..:: ["+editFlag+"]");
if (xmlString != null && xmlString.trim().length()!=0)
if (xmlString != null && xmlString.trim().length() != 0)
{
dom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length()!=0)
if (xmlString1 != null && xmlString1.trim().length() != 0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length()!=0)
if (xmlString2 != null && xmlString2.trim().length() != 0)
{
dom2 = genericUtility.parseString(xmlString2);
}
......@@ -207,6 +242,9 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
}
catch (Exception e)
{
//modified by Shital on 09/08/2019 [Start]
e.printStackTrace();
//modified by Shital on 09/08/2019 [End]
System.out.println ("EmpMaritalStatusConfIC::Exception :itemChanged(String,String):" + e.getMessage() + ":");
errString = genericUtility.createErrorString(e);
throw new ITMException(e);
......@@ -218,66 +256,97 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
int currentFormNo = 0;
StringBuffer valueXmlString = null;
String objNameDefault = "" ;
String sql = "", empCode = "", oldStatus = "", newStatus = "", empName = "", confirm = "", tranDateStr = "", statusDateStr = "";
String objNameDefault = "";
String sql = "";
String empCode = "";
String oldStatus = "";
String newStatus = "";
String empName = "";
String confirm = "";
String tranDateStr = "";
String statusDateStr = "";
double amount = 0.0d;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
Timestamp tranDate = null;
Date statusDate = null;
String prdCode = "", giftCode = "";
String prdCode = "";
String giftCode = "";
AdmCommon admCommon = null;
SimpleDateFormat sdf = null;
try
{
sdf = new SimpleDateFormat(getApplDateFormat());
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("Driver");
//modified by Shital on 09/08/2019 [Start]
//ConnDriver connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("Driver");
conn = getConnection();
//modified by Shital on 09/08/2019 [End]
E12GenericUtility genericUtility = new E12GenericUtility();
if (objContext != null && objContext.trim().length() > 0 )
{
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("dom ..:: ["+genericUtility.serializeDom(dom)+"]");
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
objNameDefault = checkNull(getObjName(dom ,"1"));
System.out.println("objNameDefault ..:: ["+objNameDefault+"]");
switch (currentFormNo)
{
case 1:
{
System.out.println("current form::::::::::::"+currentFormNo);
empCode = genericUtility.getColumnValue("emp_code", dom);
//modified by Shital on 09/08/2019 [Start]
//empCode = genericUtility.getColumnValue("emp_code", dom);
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
System.out.println("empCode from Dom::"+empCode);
tranDateStr = genericUtility.getColumnValue("tran_date", dom);
//tranDateStr = genericUtility.getColumnValue("tran_date", dom);
tranDateStr = checkNull(genericUtility.getColumnValue("tran_date", dom));
//modified by Shital on 09/08/2019 [End]
System.out.println("tranDateStr from Dom::"+tranDateStr);
if(tranDateStr != null && tranDateStr.trim().length() > 0) //modified by Shital on 27/01/2020
{
tranDate = java.sql.Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDateStr, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
}
System.out.println("tranDate after parsing::"+tranDate);
valueXmlString.append("<Detail>\r\n");
if(currentColumn.equalsIgnoreCase("itm_default"))
{
sql = "SELECT STATUS_DATE, OLD_STATUS, NEW_STATUS, SHORT_NAME, CONFIRM FROM EMP_MARITALCHG WHERE EMP_CODE = ? AND TRAN_DATE = ? ";
pstmt=conn.prepareStatement(sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setTimestamp(2, tranDate);
rs=pstmt.executeQuery();
rs = pstmt.executeQuery();
while(rs.next())
{
statusDate = rs.getDate("STATUS_DATE");
oldStatus=checkNull(rs.getString("OLD_STATUS"));
oldStatus = checkNull(rs.getString("OLD_STATUS"));
newStatus = checkNull(rs.getString("NEW_STATUS"));
empName = checkNull(rs.getString("SHORT_NAME"));
confirm = checkNull(rs.getString("CONFIRM"));
}
System.out.println("statusDate:::::::::::"+statusDate);
System.out.println("oldStatus:::::::::::"+oldStatus);
System.out.println("newStatus:::::::::::"+newStatus);
System.out.println("empName:::::::::::"+empName);
System.out.println("confirm:::::::::::"+confirm);
close(pstmt, rs);
valueXmlString.append("<emp_code><![CDATA[" + empCode + "]]></emp_code>\r\n");
valueXmlString.append("<tran_date><![CDATA[" + tranDateStr + "]]></tran_date>\r\n");
valueXmlString.append("<status_date><![CDATA[" + statusDateStr + "]]></status_date>\r\n");
valueXmlString.append("<old_status><![CDATA[" + oldStatus + "]]></old_status>\r\n");
valueXmlString.append("<new_status><![CDATA[" + newStatus + "]]></new_status>\r\n");
valueXmlString.append("<emp_name><![CDATA[" + empName + "]]></emp_name>\r\n");
if(statusDate != null)
{
statusDateStr = sdf.format(statusDate);
......@@ -291,6 +360,7 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
{
prdCode = checkNull(rs.getString("CODE"));
}
close(pstmt, rs);
admCommon = new AdmCommon();
......@@ -313,12 +383,15 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
}
close(pstmt, rs);
valueXmlString.append("<emp_code><![CDATA[" + empCode + "]]></emp_code>\r\n");
valueXmlString.append("<tran_date><![CDATA[" + tranDateStr + "]]></tran_date>\r\n");
valueXmlString.append("<status_date><![CDATA[" + statusDateStr + "]]></status_date>\r\n");
valueXmlString.append("<old_status><![CDATA[" + oldStatus + "]]></old_status>\r\n");
valueXmlString.append("<new_status><![CDATA[" + newStatus + "]]></new_status>\r\n");
valueXmlString.append("<emp_name><![CDATA[" + empName + "]]></emp_name>\r\n");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "emp_code", empCode);
admCommon.setNodeValue(dom, "tran_date", tranDateStr);
admCommon.setNodeValue(dom, "status_date", statusDateStr);
admCommon.setNodeValue(dom, "old_status", oldStatus);
admCommon.setNodeValue(dom, "new_status", newStatus);
admCommon.setNodeValue(dom, "emp_name", empName);
//modified by Shital on 09/08/2019 [End]
//if(!("Y".equalsIgnoreCase(confirm)))
if(!("Y".equalsIgnoreCase(confirm)) && !("X".equalsIgnoreCase(confirm)))//Modified by Ahmed on 19-Jun-2017 to set blank value in dropdown
......@@ -328,18 +401,35 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
valueXmlString.append("<gift_amount><![CDATA[" + amount + "]]></gift_amount>\r\n");
//valueXmlString.append("<generate_voucher protect=\"0\"><![CDATA[N]]></generate_voucher>\r\n");
valueXmlString.append("<generate_voucher protect=\"0\"><![CDATA[]]></generate_voucher>\r\n");//Modified by Ahmed on 19-Jun-2017 to set blank value in dropdown
//valueXmlString.append("<voucher_no protect=\"0\"><![CDATA[]]></voucher_no>\r\n"); //modified by Shital on 09/08/2019
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "gift_amount", amount+"");
//admCommon.setNodeValue(dom, "voucher_no", "");
//modified by Shital on 09/08/2019 [End]
}
else
{
valueXmlString.append("<gift_amount><![CDATA[0]]></gift_amount>\r\n");
valueXmlString.append("<generate_voucher protect=\"1\"><![CDATA[N]]></generate_voucher>\r\n");
//valueXmlString.append("<voucher_no protect=\"1\"><![CDATA[N]]></voucher_no>\r\n"); //modified by Shital on 09/08/2019
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "gift_amount", 0+"");
//admCommon.setNodeValue(dom, "voucher_no", "N");
//modified by Shital on 09/08/2019 [End]
}
}
else
{
valueXmlString.append("<gift_amount><![CDATA[" +amount+ "]]></gift_amount>\r\n");
valueXmlString.append("<generate_voucher protect=\"1\"><![CDATA[N]]></generate_voucher>\r\n");
//valueXmlString.append("<voucher_no protect=\"1\"><![CDATA[N]]></voucher_no>\r\n"); //modified by Shital on 09/08/2019
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "gift_amount", amount+"");
admCommon.setNodeValue(dom, "generate_voucher", "N");
//modified by Shital on 09/08/2019 [End]
}
}
valueXmlString.append ("</Detail>\r\n");
......@@ -349,6 +439,9 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
}
catch(Exception e)
{
//modified by Shital on 09/08/2019 [Start]
e.printStackTrace();
//modified by Shital on 09/08/2019 [End]
throw new ITMException(e);
}
finally
......@@ -361,18 +454,21 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
conn.close();
conn = null;
}
}
catch (Exception e)
{
e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
}
}
valueXmlString.append("</Root>\r\n");
System.out.println("valueXmlString"+valueXmlString);
return valueXmlString.toString();
}
private String getObjName(Document dom,String objContext)
private String getObjName(Document dom,String objContext)throws ITMException
{
Node elementName = null;
NodeList elementList = null;
......@@ -399,6 +495,9 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
catch(Exception e)
{
e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
}
return objName;
}
......@@ -417,7 +516,7 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
return input;
}
private void close(PreparedStatement pstmt,ResultSet rs) //Method to close PreparedStatement & ResultSet
private void close(PreparedStatement pstmt,ResultSet rs) throws ITMException//Method to close PreparedStatement & ResultSet
{
try
{
......@@ -435,6 +534,9 @@ public class EmpMaritalStatusConfIC extends ValidatorEJB implements EmpMaritalSt
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]
}
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessLocal;
import ibase.webitm.ejb.ProcessEJB;
import ibase.webitm.ejb.adm.adv.EmpMaritalStatusConf;
import ibase.webitm.ejb.adm.adv.EmpMaritalStatusConfLocal;
import ibase.webitm.utility.ITMException;
......@@ -87,8 +88,8 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta
//modified by Shital on 09/08/2019 [End]
AppConnectParm appConnect = null;
InitialContext initialCtx = null;
EmpMaritalStatusConfLocal empMaritalStatusConf = null;
ITMDBAccessLocal itmDBAccess = null;
//EmpMaritalStatusConfLocal empMaritalStatusConf = null;
//ITMDBAccessLocal itmDBAccess = null;
PreparedStatement pstmt=null;
ResultSet rs=null;
......@@ -101,15 +102,18 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta
conn = getConnection();
//modified by Shital on 09/08/2019 [End]
conn.setAutoCommit(false);
appConnect = new AppConnectParm();
/*appConnect = new AppConnectParm();
initialCtx = new InitialContext(appConnect.getProperty());
itmDBAccess = (ITMDBAccessLocal)initialCtx.lookup("ibase/ITMDBAccessEJB/local");
itmDBAccess = (ITMDBAccessLocal)initialCtx.lookup("ibase/ITMDBAccessEJB/local");*/
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); //modified by Shital on 27/01/2020
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+"]");
if(tranDate != null && tranDate.trim().length() > 0) //modified by Shital on 27/01/2020
{
tranDateTimestamp = Timestamp.valueOf(genericUtility.getValidDateTimeString(tranDate, genericUtility.getApplDateFormat(),genericUtility.getDBDateFormat()));
}
sql = "SELECT CONFIRM FROM EMP_MARITALCHG WHERE EMP_CODE = ? AND TRAN_DATE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
......@@ -139,7 +143,8 @@ public class EmpMaritalStatusConfPrc extends ProcessEJB implements EmpMaritalSta
System.out.println("@V@ VALLABH confirm :- ["+confirm+"]");
if(!"X".equalsIgnoreCase(confirm))
{
empMaritalStatusConf = (EmpMaritalStatusConfLocal)initialCtx.lookup("ibase/EmpMaritalStatusConf/local");
/*empMaritalStatusConf = (EmpMaritalStatusConfLocal)initialCtx.lookup("ibase/EmpMaritalStatusConf/local");*/
EmpMaritalStatusConf empMaritalStatusConf = new EmpMaritalStatusConf();
returnString = checkNull(empMaritalStatusConf.actionHandler("", headerDom, detailDom, xtraParams, "N", conn));
System.out.println("EmpMaritalStatusConfPrc returnString ::[" + returnString + "]");
}
......
......@@ -9,17 +9,14 @@ import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
//modified by Shital on 09/08/2019 [Start]
//import ibase.system.config.ConnDriver;
//import ibase.system.config.ConnDriver; //commented by Shital on 09/08/2019
import ibase.utility.E12GenericUtility;
//import ibase.utility.GenericUtility;
//modified by Shital on 09/08/2019 [End]
import ibase.webitm.ejb.ITMDBAccessEJB;
//import ibase.utility.GenericUtility; //commented by Shital on 09/08/2019
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
//modified by Shital on 09/08/2019 [Start]
//import javax.ejb.Stateless;
//modified by Shital on 09/08/2019 [End]
//import javax.ejb.Stateless; //commented by Shital on 09/08/2019
import org.w3c.dom.Document;
import org.w3c.dom.Node;
......@@ -28,14 +25,9 @@ import org.w3c.dom.NodeList;
/**
* Session Bean implementation class BusinessUnits
*/
//modified by Shital on 09/08/2019 [Start]
//@Stateless
//modified by Shital on 09/08/2019 [End]
//@Stateless //commented by Shital on 09/08/2019
public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatusICLocal, EmpMaritalStatusICRemote
{
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String itemChanged() throws RemoteException, ITMException
{
return "";
......@@ -68,52 +60,28 @@ 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...");
//modified by Shital on 09/08/2019 [Start]
E12GenericUtility genericUtility = new E12GenericUtility(); //modified by Shital on 09/08/2019
//GenericUtility genericUtility = null;
//modified by Shital on 09/08/2019 [End]
Connection conn = null;
int currentFormNo = 0;
ResultSet rs = null;
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 = "";
String empCodeHead = "", empFName = "", empMName = "", empLName = "",empMaritalChgEmpFname="",empMaritalChgEmpMname="",empMaritalChgEmpLname="",
shortName="",empFnameO="",empMnameO="",empLnameO="",shortNameO="",lsSex="",lsNewStatus="",empCode="",sql="",mStatus="",sex="",
spouseName="",mStatDate="";
String mStatDateStr="";
//Added By sanket J on 01/March/18
String empFNameLong = "";
String empMNameLong = "";
String empLNameLong = "";
String empFNameLong="",empMNameLong="",empLNameLong="";
PreparedStatement pstmt = null;
StringBuffer valueXmlString;
AdmCommon admCommon = new AdmCommon();
try
{
valueXmlString = new StringBuffer();
......@@ -129,7 +97,8 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
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)
......@@ -144,7 +113,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));
......@@ -153,15 +122,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>");
......@@ -173,52 +142,26 @@ 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>");
//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));
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) || "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
......@@ -228,35 +171,20 @@ 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 ..");
......@@ -269,73 +197,42 @@ 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));
lsNewStatus = checkNull(genericUtility.getColumnValue("new_status", dom));
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);
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())
{
//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"));
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");
shortName=shortName==null?"":shortName;
sex=rs.getString("sex");
mStatDate=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]
empFNameLong=rs.getString("emp_fname_long");
empMNameLong=rs.getString("emp_mname_long");
empLNameLong=rs.getString("emp_lname_long");
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;
......@@ -369,50 +266,27 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
//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]
valueXmlString.append("<spouse_name >").append("<![CDATA[]]>").append("</spouse_name>");
}
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) || "D".equalsIgnoreCase(lsNewStatus)))
// 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
......@@ -422,46 +296,23 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
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((lsNewStatus != null && lsNewStatus.trim().length() > 0) && ("M".equalsIgnoreCase(lsNewStatus)))
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
}
......@@ -478,20 +329,15 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
//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>");
//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>");
......@@ -503,125 +349,79 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
//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));
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));
System.out.println("shortName::::::"+shortName);
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
{
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));
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);
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())
{
//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]
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");
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");
mStatDate=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]
empFNameLong=rs.getString("emp_fname_long");
empMNameLong=rs.getString("emp_mname_long");
empLNameLong=rs.getString("emp_lname_long");
if(empFNameLong == null || empFNameLong == "")
{
empFNameLong = empFName;
}
if(empMNameLong == null || empMNameLong == "")
{
empMNameLong = empMName;
}
if(empLNameLong == null || empLNameLong == "")
{
empLNameLong = empLName;
......@@ -645,32 +445,17 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
//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]
}
}
}
......@@ -694,13 +479,9 @@ 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");
......@@ -719,9 +500,8 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
Document dom1 = null;
Document dom2 = null;
String errString = "";
//modified by Shital on 09/08/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 09/08/2019 [End]
//GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 09/08/2019
E12GenericUtility genericUtility = new E12GenericUtility();
try
{
if (xmlString != null && xmlString.trim().length() != 0)
......@@ -743,63 +523,52 @@ 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;
int childNodeListLength = 0;
int currentFormNo = 0, childNodeListLength = 0;
String userId = "";
String childNodeName = null;
String errString = "";
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = 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]
String msgType = "",empCode="",tranDateStr="",sql="",lsSite="",newStatus="",oldStatus="",lsStatus="",empCodeAprv="",relieveDate="";
int count=0;
Timestamp tranDate=null;
//GenericUtility genericUtility = null;
//modified by Shital on 09/08/2019 [End]
E12GenericUtility genericUtility = new E12GenericUtility(); //modified by Shital on 09/08/2019
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
try
{
//modified by Shital on 09/08/2019 [Start]
//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();
//modified by Shital on 09/08/2019[End]
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
}
switch (currentFormNo)
{
case 1:
......@@ -822,8 +591,9 @@ 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))
{
......@@ -847,7 +617,7 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
rs=null;*/
close( pstmt, rs);
if(count > 0)
if(count>0)
{
errList.add("VTUNCFPND");
errFields.add("emp_code");
......@@ -858,14 +628,14 @@ 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");
}
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
......@@ -873,24 +643,20 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
rs.close();
rs=null;*/
close( pstmt, rs);
if(count > 0)
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())
{
//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]
lsSite=rs.getString("emp_site");
}
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
......@@ -899,21 +665,20 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
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))
{
......@@ -945,20 +710,17 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
errList.add("VTSTAT");
errFields.add(childNodeName.toLowerCase());
}
if(errList.size() == 0)
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);
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())
{
//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]
lsStatus=rs.getString("status");
}
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
......@@ -967,7 +729,7 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
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());
......@@ -979,19 +741,16 @@ 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");
//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]
count=rs.getInt("cnt");
relieveDate=rs.getString("RELIEVE_DATE");
}
//Changed By sanket on 08/MAR/18 [for proper closing connection]
/*pstmt.close();
......@@ -1000,12 +759,12 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
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());
......@@ -1033,12 +792,9 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
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);
errString = getErrorString(errFldName, errCode, userId);
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>"));
......@@ -1071,16 +827,12 @@ 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
{
//modified by Shital on 09/08/2019 [Start]
/*if (conn != null)
if (conn != null)
{
if (rs != null)
{
......@@ -1094,81 +846,52 @@ 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) throws ITMException
private String gbfEmp(String empCode, Timestamp tranDate, String lsSite, Connection conn)
{
// TODO Auto-generated method stub
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);
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);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
rs=pstmt.executeQuery();
if(rs.next())
{
relieveDate=rs.getTimestamp("relieve_date");
//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]
status=rs.getString("status");
}
else
{
errCode = "VMEMP1";
errCode="VMEMP1";
}
//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;
}
......@@ -1177,20 +900,16 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
try
{
sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
String sql = " SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
while (rs.next())
{
//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]
msgType = rs.getString("MSG_TYPE");
}
}
catch (Exception ex)
......@@ -1246,28 +965,21 @@ public class EmpMaritalStatusIC extends ValidatorEJB implements EmpMaritalStatus
}
// 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
private void close(PreparedStatement pstmt, ResultSet rs)
{
try
{
if (rs != null)
{
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null)
{
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
}
catch (Exception ex)
} 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