Commit 2d5718dc authored by dpingle's avatar dpingle

* updated src file of employee basic info.

EmpBasicInfo.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@214841 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 31fdeb50
......@@ -9,6 +9,8 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import javax.ejb.Stateless;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
......@@ -20,9 +22,9 @@ import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
//Modified By Dipesh on[17/07/2019][Start]
//@Stateless
//Modified By Dipesh on[17/07/2019][End]
@Stateless
public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,EmpBasicInfoRemote
{
......@@ -1324,6 +1326,12 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
String status = "";
String relieveDate ="";
//Added by Dipesh on[17/07/2019][End]
//Added by Dipesh on[08/01/2020][Start]
Timestamp currentDate = null;
Timestamp relievedate = null;
//Added by Dipesh on[08/01/2020][End]
//Varibles used in case 1 End
//Added by Anjali R on[21/02/2018][Start][To change related to accept employee name in long form][Req ID - A17KSUN006 CCF-NO-ADM6/0127]
......@@ -1343,7 +1351,12 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
try
{
itmDbAccess =new ITMDBAccessEJB();
if(objContext != null && objContext.trim().length()>0)
currentDate = new Timestamp(System.currentTimeMillis());
System.out.println("currentDate::::::"+currentDate);
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
......@@ -1360,7 +1373,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
System.out.println("childNode"+childNode);
if( childNode.getNodeType() != Node.ELEMENT_NODE )
{
......@@ -1399,10 +1412,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if (empCode == null || empCode.length() == 0)
{
System.out.println("Employee code null");
errList.add( "VEEMP2" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VEEMP2" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1411,42 +1424,42 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
}
else
{
sql = "";
count = 0;
sql = "SELECT COUNT(*) AS COUNT FROM EMPLOYEE WHERE EMP_CODE = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count in emp_code:::: "+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count > 0)
sql = "";
count = 0;
sql = "SELECT COUNT(*) AS COUNT FROM EMPLOYEE WHERE EMP_CODE = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count in emp_code:::: "+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count > 0)
{
System.out.println("emp_code is already exist in employee master");
errList.add( "VMDUPL1" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMDUPL1" );
if ( msgType.equalsIgnoreCase("E"))
{
System.out.println("emp_code is already exist in employee master");
errList.add( "VMDUPL1" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMDUPL1" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
break;
}
}
}
}
//Added by Rohini Telang on[14/02/2019][Start][validation to check whether the employee code contains any special character or not][Req ID - A17KSUN006]
if(empCode != null && empCode.length() > 0) {
empCode = (empCode).replace("'", "$");
......@@ -1471,7 +1484,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(count>0) {
errList.add( "VMINVLDCHR" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMINVLDCHR" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1503,7 +1516,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
{
errList.add( "VMDUPL1" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMDUPL1" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1513,8 +1526,8 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
}
}
//Added by Rohini Telang on[14/02/2019][End][validation to check whether the employee code contains any special character or not][Req ID - A17KSUN006]
}
}
}
//Validation For Employee Code
else if(childNodeName.equalsIgnoreCase("contact_code"))
{
......@@ -1522,10 +1535,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(contactCode == null || contactCode.length() == 0)
{
System.out.println("contact code null");
errList.add( "VMCCD1" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMCCD1" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1557,10 +1570,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(count == 0)
{
System.out.println("Contact code does not exist in the Contact master");
errList.add( "VMCCD2");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMCCD2" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1575,10 +1588,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(empFname == null || empFname.length() == 0)
{
System.out.println("empFname code null");
errList.add( "VEEMP4" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VEEMP4" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1592,10 +1605,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(empMname == null || empMname.length() == 0)
{
System.out.println("empMname code null");
errList.add( "VEEMP5" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VEEMP5" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1609,10 +1622,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(empLname == null || empLname.length() == 0)
{
System.out.println("empLname code null");
errList.add( "VEEMP3" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VEEMP3" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1627,10 +1640,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(fnameLong == null || fnameLong.length() == 0)
{
System.out.println("empFname code null");
errList.add( "VEEMP4" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VEEMP4" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1644,10 +1657,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(mnameLong == null || mnameLong.length() == 0)
{
System.out.println("empMname code null");
errList.add( "VEEMP5" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VEEMP5" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1661,10 +1674,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(lnameLong == null || lnameLong.length() == 0)
{
System.out.println("empLname code null");
errList.add( "VEEMP3" );
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VEEMP3" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1702,10 +1715,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(count == 0)
{
System.out.println("Employee does not present in employee master :::::::::");
errList.add( "VMEMP1");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMP1" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1737,10 +1750,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(relieveDate == null || relieveDate.trim().length() == 0)
{
System.out.println("relieveDate does not exist ");
errList.add( "VTEMPRLVDT");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VTEMPRLVDT" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1776,7 +1789,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
{
errList.add( "VEEMP6");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VEEMP6" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1787,7 +1800,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
{
errList.add( "VEEMP7");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VEEMP7" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1829,10 +1842,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(count == 0)
{
System.out.println("Functional group does not present :::::::::");
errList.add( "VMEMPFGRP1");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPFGRP1" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1844,10 +1857,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
else
{
System.out.println("Functional group is null :::::::::");
errList.add( "VMEMPFGRP2");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPFGRP2" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1885,10 +1898,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(count == 0)
{
System.out.println("Parent Department does not present :::::::::");
errList.add( "VMEMPPDPT1");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPPDPT1" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1900,10 +1913,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
else
{
System.out.println("Parent Department is null :::::::::");
errList.add( "VMEMPPDPT2");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPPDPT2" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1939,10 +1952,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(count == 0)
{
System.out.println("Department does not present :::::::::");
errList.add( "VMDEP1");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMDEP1" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1955,7 +1968,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,deptCode);
rs = pstmt.executeQuery();
if(rs.next())
{
status = checkNull(rs.getString("STATUS"));
......@@ -1974,10 +1987,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(status.equalsIgnoreCase("I"))
{
System.out.println("Department status Inactive:::::");
errList.add( "VTDPINAC");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VTDPINAC" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -1994,7 +2007,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
//funcGroup = genericUtility.getColumnValue("func_group", dom);
funcGroup = checkNull(genericUtility.getColumnValue("func_group", dom));
//Modified by Dipesh on [17/07/2019][End]
if(funcGroup != null && funcGroup.length() > 0)
{
sql = "select count(*) as cnt from busi_functions where func_code = ? ";
......@@ -2037,7 +2050,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
String empCodeFuncHead = checkNull(genericUtility.getColumnValue("emp_code__funchead", dom));
String empCodeDom = checkNull(genericUtility.getColumnValue("emp_code", dom));
//Modified by Dipesh on [17/07/2019][End]
if(empCodeFuncHead != null && empCodeFuncHead.length() > 0)
{
sql = "select count(*) as cnt from employee where emp_code = ? ";
......@@ -2082,15 +2095,22 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
else
{
sql = "";
sql = "select relieve_date from employee where emp_code = ? ";
//Modified by Dipesh on [08/01/2020][Start]
//sql = "select relieve_date from employee where emp_code = ? ";
sql = "select relieve_date , status from employee where emp_code = ? ";
//Modified by Dipesh on [08/01/2020][End]
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCodeFuncHead);
rs = pstmt.executeQuery();
cnt = 0;
Timestamp relieveDateTS = null;
//Timestamp relieveDateTS = null;
if(rs.next())
{
relieveDateTS = rs.getTimestamp("relieve_date");
//Modified by Dipesh on [08/01/2020][Start]
//relieveDateTS = rs.getTimestamp("relieve_date");
relievedate = rs.getTimestamp("relieve_date");
status = checkNull(rs.getString("status"));
//Modified by Dipesh on [08/01/2020][End]
}
if ( rs != null )
{
......@@ -2102,7 +2122,8 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
pstmt.close();
pstmt = null;
}
if(relieveDateTS != null)
//Modified by Dipesh on [08/01/2020][Start]
/*if(relieveDateTS != null)
{
errList.add("VMEMPFUHD3");
errFields.add(childNodeName.toLowerCase());
......@@ -2111,7 +2132,32 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
{
break;
}
}*/
if(relievedate != null && relievedate.before(currentDate))
{
errList.add("VMEMPREP07");
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, "VMEMPREP07");
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
if(status.equalsIgnoreCase("S"))
{
errList.add( "VMEMPREP06");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPREP06");
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
//Modified by Dipesh on [08/01/2020][End]
}
}
}
......@@ -2122,7 +2168,7 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
//String buCode = genericUtility.getColumnValue("bu_code", dom);
String buCode = checkNull(genericUtility.getColumnValue("bu_code", dom));
//Modified by Dipesh on [17/07/2019][End]
if(buCode != null && buCode.length() > 0)
{
sql = "select count(*) as cnt from business_units where bu_code = ? ";
......@@ -2183,10 +2229,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(count == 0)
{
System.out.println("Grade Code does not present :::::::::");
errList.add( "VMGRA1");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMGRA1" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -2220,10 +2266,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(count == 0)
{
System.out.println("Cadre Code does not present :::::::::");
errList.add( "VMCAD1");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMCAD1" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -2260,10 +2306,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(count == 0)
{
System.out.println("Designation does not present :::::::::");
errList.add( "VMDESIGN");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMDESIGN" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -2295,10 +2341,10 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
if(status.equalsIgnoreCase("I"))
{
System.out.println("Designation status Inactive:::::");
errList.add( "VTDGINAC");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VTDGINAC" );
if ( msgType.equalsIgnoreCase("E"))
{
......@@ -2306,77 +2352,40 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
}
}
}
}
else
{
if(designCode == null || designCode.length() == 0)
{
System.out.println("DesignCode isNull:::::");
errList.add( "VMDESIGN2");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMDESIGN2" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
else if(childNodeName.equalsIgnoreCase("report_to"))
{
count = 0;
//reportTo = checkNull(getColumnValue("report_to",dom,objContext));
//empCode = checkNull(getColumnValue("emp_code",dom,objContext));
reportTo = checkNull(genericUtility.getColumnValue("report_to",dom,objContext),false);
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom,objContext),false);
if(reportTo !=null && reportTo.length() > 0)
{
sql = "SELECT COUNT(*) AS COUNT FROM EMPLOYEE WHERE EMP_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,reportTo);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt("COUNT");
}
System.out.println("Value of count :::::::::::"+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count == 0)
else
{
System.out.println("Employee does not present in Employee master :::::::::");
errList.add( "VMEMP1");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMP1" );
if ( msgType.equalsIgnoreCase("E"))
if(designCode == null || designCode.length() == 0)
{
break;
System.out.println("DesignCode isNull:::::");
errList.add( "VMDESIGN2");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMDESIGN2" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
else
{
sql = "SELECT STATUS FROM EMPLOYEE WHERE EMP_CODE = ? ";
}
else if(childNodeName.equalsIgnoreCase("report_to"))
{
count = 0;
reportTo = checkNull(genericUtility.getColumnValue("report_to",dom,objContext),false);
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom,objContext),false);
if(reportTo !=null && reportTo.length() > 0)
{
sql = "SELECT COUNT(*) AS COUNT FROM EMPLOYEE WHERE EMP_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,reportTo);
rs = pstmt.executeQuery();
// String status = "";
if(rs.next())
{
status = checkNull(rs.getString("STATUS"));
count = rs.getInt("COUNT");
}
System.out.println("status :::::::::::"+status);
System.out.println("Value of count :::::::::::"+count);
if ( rs != null )
{
rs.close();
......@@ -2387,14 +2396,14 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
pstmt.close();
pstmt = null;
}
if(status.equalsIgnoreCase("S"))
if(count == 0)
{
System.out.println("Inside status of employee:::::");
errList.add( "VMEMP2");
System.out.println("Employee does not present in Employee master :::::::::");
errList.add( "VMEMP1");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMP2" );
msgType = errorType( conn , "VMEMP1" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
......@@ -2402,89 +2411,101 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
}
else
{
if(reportTo.trim().equalsIgnoreCase(empCode.trim()))
//Added by Dipesh on[08/01/2020][Start]
//sql = "SELECT STATUS FROM EMPLOYEE WHERE EMP_CODE = ? ";
sql = "SELECT STATUS , RELIEVE_DATE FROM EMPLOYEE WHERE EMP_CODE = ? ";
//Added by Dipesh on[08/01/2020][End]
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,reportTo);
rs = pstmt.executeQuery();
if(rs.next())
{
System.out.println("inside reportTo.trim() == empCode.trim()");
errList.add( "VMEMP4");
status = checkNull(rs.getString("STATUS"));
//Added by Dipesh on[08/01/2020][Start]
relievedate = rs.getTimestamp("RELIEVE_DATE");
//Added by Dipesh on[08/01/2020][End]
}
System.out.println("status @:::::::::::"+status);
System.out.println("relievedate @:::::::::::"+relievedate);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(status.equalsIgnoreCase("S"))
{
System.out.println("Inside status of employee:::::");
//errList.add( "VMEMP2");
errList.add( "VMEMPREP01");//Added by Dipesh on[08/01/2020]
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMP4" );
msgType = errorType( conn , "VMEMPREP01");
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
//Added by Dipesh on[08/01/2020][Start]
else if(relievedate != null)
{
if(relievedate.before(currentDate))
{
System.out.println("::::#relieveDate::::");
errList.add("VMEMPREP0");
errFields.add(childNodeName.toLowerCase());
msgType = errorType( conn , "VMEMPREP0");
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
//Added by Dipesh on[08/01/2020][End]
else
{
if(reportTo.trim().equalsIgnoreCase(empCode.trim()))
{
System.out.println("inside reportTo.trim() == empCode.trim()");
errList.add( "VMEMP4");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMP4" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
}
}
}
}
else if(childNodeName.equalsIgnoreCase("report_to__admin"))
{
count = 0;
//reportToAdmin = checkNull(getColumnValue("report_to__admin",dom,objContext));
//empCode = checkNull(getColumnValue("emp_code",dom,objContext));
reportToAdmin = checkNull(genericUtility.getColumnValue("report_to__admin",dom,objContext),false);
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom,objContext),false);
if(reportToAdmin !=null && reportToAdmin.length() > 0)
{
sql = "SELECT COUNT(*) AS COUNT FROM EMPLOYEE WHERE EMP_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,reportToAdmin);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt("COUNT");
}
System.out.println("Value of count :::::::::::"+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count == 0)
{
System.out.println("Employee does not present in Employee master :::::::::");
errList.add( "VMEMP1");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMP1" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
else if(reportToAdmin.trim().equalsIgnoreCase(empCode.trim()))
{
System.out.println("Inside reportToAdmin.trim() == empCode.trim() :::::::::");
errList.add( "VMEMPACD");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPACD" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
sql = "SELECT RELIEVE_DATE FROM EMPLOYEE WHERE EMP_CODE = ? ";
else if(childNodeName.equalsIgnoreCase("report_to__admin"))
{
count = 0;
//reportToAdmin = checkNull(getColumnValue("report_to__admin",dom,objContext));
//empCode = checkNull(getColumnValue("emp_code",dom,objContext));
reportToAdmin = checkNull(genericUtility.getColumnValue("report_to__admin",dom,objContext),false);
empCode = checkNull(genericUtility.getColumnValue("emp_code",dom,objContext),false);
if(reportToAdmin !=null && reportToAdmin.length() > 0)
{
sql = "SELECT COUNT(*) AS COUNT FROM EMPLOYEE WHERE EMP_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,reportToAdmin);
rs = pstmt.executeQuery();
//String relieveDate ="";
if(rs.next())
{
relieveDate = checkNull(rs.getString("RELIEVE_DATE"));
count = rs.getInt("COUNT");
}
System.out.println("relieveDate:::::::::::"+relieveDate);
System.out.println("Value of count :::::::::::"+count);
if ( rs != null )
{
rs.close();
......@@ -2495,98 +2516,215 @@ public class EmpBasicInfo extends ValidatorEJB implements EmpBasicInfoLocal ,Emp
pstmt.close();
pstmt = null;
}
if(relieveDate != null && relieveDate.trim().length() > 0)
if(count == 0)
{
System.out.println("Employee does not present in Employee master :::::::::");
errList.add( "VMEMP1");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMP1" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
else if(reportToAdmin.trim().equalsIgnoreCase(empCode.trim()))
{
System.out.println("Inside reportToAdmin.trim() == empCode.trim() :::::::::");
errList.add( "VMEMPACD");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPACD" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
//Modified by Dipesh on [08/01/2020][Start]
//sql = "SELECT RELIEVE_DATE FROM EMPLOYEE WHERE EMP_CODE = ? ";
sql = "SELECT RELIEVE_DATE ,STATUS FROM EMPLOYEE WHERE EMP_CODE = ? ";
//Modified by Dipesh on [08/01/2020][End]
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,reportToAdmin);
rs = pstmt.executeQuery();
//String relieveDate ="";
if(rs.next())
{
//Added by Dipesh on[08/01/2020][Start]
//relieveDate = checkNull(rs.getString("RELIEVE_DATE"));
relievedate = rs.getTimestamp("RELIEVE_DATE");
status = checkNull(rs.getString("STATUS"));
//Added by Dipesh on[08/01/2020][End]
}
System.out.println("relievedate:::::::::::"+relievedate);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
//Added by Dipesh on[08/01/2020][End]
/*if(relieveDate != null && relieveDate.trim().length() > 0)
{
System.out.println("relieveDate exist ");
errList.add( "VMEMPREL");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPREL" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}*/
if(relievedate != null && relievedate.before(currentDate))
{
System.out.println("::::#relieveDate::::");
errList.add("VMEMPREP03");
errFields.add(childNodeName.toLowerCase());
msgType = errorType( conn , "VMEMPREP03");
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
if(status.equalsIgnoreCase("S"))
{
errList.add( "VMEMPREP02");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPREP02");
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
//Added by Dipesh on[08/01/2020][End]
}
}
}
}
else if(childNodeName.equalsIgnoreCase("pos_code"))
{
//posCode = checkNull(getColumnValue("pos_code",dom,objContext));
posCode = checkNull(genericUtility.getColumnValue("pos_code",dom,objContext),false);
empCode = checkNull(getColumnValue("emp_code",dom,objContext));
deptCode = checkNull(getColumnValue("dept_code",dom,objContext));
//errString = wf_val_pos(empCode , posCode , deptCode , null, conn);
errString = validatePosition(empCode , posCode , deptCode , null, conn);
if (errString.length() > 0)
{
errList.add(errString);
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn ,errString );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
else if(childNodeName.equalsIgnoreCase("emp_code__hod"))
{
errString = "";
//empCodeHod = checkNull(getColumnValue("emp_code__hod",dom,objContext));
empCodeHod = checkNull(genericUtility.getColumnValue("emp_code__hod",dom,objContext),false);
if(empCodeHod != null && empCodeHod.length() >0)
else if(childNodeName.equalsIgnoreCase("pos_code"))
{
sql = "SELECT RELIEVE_DATE FROM EMPLOYEE WHERE EMP_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCodeHod);
rs = pstmt.executeQuery();
//String relieveDate ="";
if(rs.next())
{
relieveDate = checkNull(rs.getString("RELIEVE_DATE"));
}
else
{
errString = "VMEMP1";
}
System.out.println("relieveDate:::::::::::"+relieveDate);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if (errString != null && errString.trim().length() > 0)
{
errList.add( errString);
//posCode = checkNull(getColumnValue("pos_code",dom,objContext));
posCode = checkNull(genericUtility.getColumnValue("pos_code",dom,objContext),false);
empCode = checkNull(getColumnValue("emp_code",dom,objContext));
deptCode = checkNull(getColumnValue("dept_code",dom,objContext));
//errString = wf_val_pos(empCode , posCode , deptCode , null, conn);
errString = validatePosition(empCode , posCode , deptCode , null, conn);
if (errString.length() > 0)
{
errList.add(errString);
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , errString );
msgType = errorType( conn ,errString );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
if(relieveDate != null && relieveDate.trim().length() > 0)
{
System.out.println("Inside relieveDate == null");
}
else if(childNodeName.equalsIgnoreCase("emp_code__hod"))
{
errString = "";
//empCodeHod = checkNull(getColumnValue("emp_code__hod",dom,objContext));
empCodeHod = checkNull(genericUtility.getColumnValue("emp_code__hod",dom,objContext),false);
if(empCodeHod != null && empCodeHod.length() >0)
{
//Modified by Dipesh on [08/01/2020][Start]
//sql = "SELECT RELIEVE_DATE FROM EMPLOYEE WHERE EMP_CODE = ? ";
sql = "SELECT RELIEVE_DATE , STATUS FROM EMPLOYEE WHERE EMP_CODE = ? ";
//Modified by Dipesh on [08/01/2020][End]
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,empCodeHod);
rs = pstmt.executeQuery();
if(rs.next())
{
//Added by Dipesh on[08/01/2020][Start]
//relieveDate = checkNull(rs.getString("RELIEVE_DATE"));
relievedate = rs.getTimestamp("RELIEVE_DATE");
status = checkNull(rs.getString("STATUS"));
//Added by Dipesh on[08/01/2020][End]
}
else
{
errString = "VMEMP1";
}
System.out.println("relievedate:::::::::::"+relievedate);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if (errString != null && errString.trim().length() > 0)
{
errList.add( errString);
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , errString );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
//Added by Dipesh on[08/01/2020][End]
/*if(relieveDate != null && relieveDate.trim().length() > 0)
{
System.out.println("Inside relieveDate == null");
errList.add( "VMEMPREL");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPREL" );
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}*/
if(relievedate != null && relievedate.before(currentDate))
{
System.out.println("::::#relieveDate::::");
errList.add("VMEMPREP05");
errFields.add(childNodeName.toLowerCase());
msgType = errorType( conn , "VMEMPREP05");
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
else
{
if(status.equalsIgnoreCase("S"))
{
errList.add( "VMEMPREP04");
errFields.add( childNodeName.toLowerCase() );
msgType = errorType( conn , "VMEMPREP04");
if ( msgType.equalsIgnoreCase("E"))
{
break;
}
}
}
//Added by Dipesh on[08/01/2020][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