Commit dbd72cfb authored by sghate's avatar sghate

*Done Changes On PayarrToProc Master Component.

PayarrToProc.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@204788 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c29a24f4
...@@ -9,19 +9,23 @@ import java.sql.SQLException; ...@@ -9,19 +9,23 @@ import java.sql.SQLException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import javax.ejb.Stateless;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
@Stateless
public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,PayarrToProcRemote public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,PayarrToProcRemote
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 12/07/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = null;
//modified by Shital on 12/07/2019[End]
ITMDBAccessEJB itmDbAccess = new ITMDBAccessEJB();
AdmCommon admCommon = new AdmCommon(); AdmCommon admCommon = new AdmCommon();
public String wfValData() throws RemoteException, ITMException public String wfValData() throws RemoteException, ITMException
{ {
...@@ -30,39 +34,41 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -30,39 +34,41 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
//added wfValData method by Varsha V on 24-08-18 for Arrears to processed validation[START] A17ESUN001 //added wfValData method by Varsha V on 24-08-18 for Arrears to processed validation[START] A17ESUN001
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
String retString = ""; String retString = "";
try try
{ {
if(xmlString != null && xmlString.trim().length() > 0) genericUtility = new E12GenericUtility();
{ if(xmlString != null && xmlString.trim().length() > 0)
dom = genericUtility.parseString(xmlString); {
} dom = genericUtility.parseString(xmlString);
if(xmlString1 != null && xmlString1.trim().length() > 0) }
{ if(xmlString1 != null && xmlString1.trim().length() > 0)
dom1 = genericUtility.parseString(xmlString1); {
} dom1 = genericUtility.parseString(xmlString1);
if(xmlString2 != null && xmlString2.trim().length() > 0) }
{ if(xmlString2 != null && xmlString2.trim().length() > 0)
dom2 = genericUtility.parseString(xmlString2); {
} dom2 = genericUtility.parseString(xmlString2);
retString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams); }
System.out.println("retString of PayarrToProc--> wfValData:::"+retString); retString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
} System.out.println("retString of PayarrToProc--> wfValData:::"+retString);
catch(Exception e) }
{ catch(Exception e)
System.out.println("::: PayarrToProc ::"+ e.getMessage()); {
e.getMessage(); System.out.println("::: PayarrToProc ::"+ e.getMessage());
} e.getMessage();
return retString; throw new ITMException(e);
}
return retString;
} }
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
{ {
//ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB(); //ITMDBAccessEJB itmDBAccess = new ITMDBAccessEJB();
int childNodeLength = 0; int childNodeLength = 0;
int currentFormNo=0; int currentFormNo=0;
int ctr = 0, cnt = 0; int ctr = 0, cnt = 0;
Connection conn = null; Connection conn = null;
...@@ -74,84 +80,164 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -74,84 +80,164 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
Node childNode = null; Node childNode = null;
String childNodeName = ""; String childNodeName = "";
String errString=""; String errString="";
String userId = "", errCode = "", errorType = "", loginCode = ""; String userId = "";
String errCode = "";
String errorType = "";
String loginCode = "";
String msgType = "";//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails] String msgType = "";//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]
ArrayList<String> errList = new ArrayList<String>(); ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>(); ArrayList<String> errFields = new ArrayList<String>();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = null;
String sql = ""; String sql = "";
String empCode = "", status = "", prdCode = "", procType = "", paySite = "", tranId = ""; String empCode = "";
String status = "";
String prdCode = "";
String procType = "";
String paySite = "";
String tranId = "";
int userLevel = 0; int userLevel = 0;
Date fromDate = null, relieveDate = null, toDate = null, joinDate = null; Date fromDate = null;
Date relieveDate = null;
Date toDate = null;
Date joinDate = null;
try try
{ {
conn = getConnection(); conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
if(objContext != null && objContext.trim().length() > 0) if(objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
System.out.println("currentFormNo:::"+currentFormNo); System.out.println("currentFormNo:::"+currentFormNo);
switch(currentFormNo) switch(currentFormNo)
{ {
case 1: case 1:
{ {
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeLength; ctr++) for(ctr = 0; ctr < childNodeLength; ctr++)
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
System.out.println(">>>>>> childNodeName: "+childNodeName); System.out.println(">>>>>> childNodeName: "+childNodeName);
if("emp_code".equalsIgnoreCase(childNodeName)) if("emp_code".equalsIgnoreCase(childNodeName))
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
if(empCode == null || empCode.trim().length() == 0)
{ {
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom)); errCode = "VTPAYARR04";
if(empCode == null || empCode.trim().length() == 0) errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{ {
errCode = "VTPAYARR04"; break;
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
} }
else if("A".equalsIgnoreCase(editFlag))// added condition by varsha V to execute validation on add mode 02-11-18 //Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
}
else if("A".equalsIgnoreCase(editFlag))// added condition by varsha V to execute validation on add mode 02-11-18
{
if(empCode != null && empCode.trim().length() > 0)
{ {
if(empCode != null && empCode.trim().length() > 0) cnt = 0;
sql = "select status, pay_site from employee where emp_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
status = checkNull(rs.getString("status"));
paySite = checkNull(rs.getString("pay_site"));
cnt++;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errCode = "VTPAYARR04";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
}
if(status.equalsIgnoreCase("S"))
{
errCode = "VTPAYARR01";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
}
sql = "select usr_lev from users where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginCode);
rs = pstmt.executeQuery();
if(rs.next())
{
userLevel = rs.getInt("usr_lev");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(userLevel > 1)
{ {
cnt = 0; cnt = 0;
sql = "select status, pay_site from employee where emp_code = ?"; sql = "select count(*) as cnt from user_site where user_id = ? and site_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, loginCode);
pstmt.setString(2, paySite);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
status = checkNull(rs.getString("status")); cnt = rs.getInt("cnt");
paySite = checkNull(rs.getString("pay_site"));
cnt++;
} }
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(cnt == 0)
if(cnt <= 0)
{ {
errCode = "VTPAYARR04"; errCode = "VTPAYARR06";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start //Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode); msgType = errorType(conn, errCode);
...@@ -161,10 +247,93 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -161,10 +247,93 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
} }
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end //Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
} }
if(status.equalsIgnoreCase("S")) }
}
}
}
else if("prd_code".equalsIgnoreCase(childNodeName))
{
prdCode = checkNull(genericUtility.getColumnValue("prd_code", dom));
if(prdCode == null || prdCode.trim().length() == 0)
{
errCode = "VTPAYARR05";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
}
else if("A".equalsIgnoreCase(editFlag))
{
if(prdCode != null && prdCode.trim().length() > 0)
{
cnt = 0;
sql = "select fr_date, to_date from period where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
rs = pstmt.executeQuery();
if(rs.next())
{
fromDate = rs.getDate("fr_date");
toDate = rs.getDate("to_date");
cnt++;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errCode = "VTPAYARR05";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
}
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql = "select RELIEVE_DATE, DATE_JOIN from employee where EMP_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
relieveDate = rs.getDate("RELIEVE_DATE");
joinDate = rs.getDate("DATE_JOIN");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(fromDate != null && relieveDate != null)
{
if(fromDate.after(relieveDate))
{ {
errCode = "VTPAYARR01"; errCode = "VTPAYARR02";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start //Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode); msgType = errorType(conn, errCode);
...@@ -174,74 +343,54 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -174,74 +343,54 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
} }
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end //Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
} }
}
sql = "select usr_lev from users where code = ?"; //Added below code by Varsha V to check whether period code is before joining date or not 02-11-18
pstmt = conn.prepareStatement(sql); if(toDate != null && joinDate != null)
pstmt.setString(1, loginCode); {
rs = pstmt.executeQuery(); if(toDate.before(joinDate))
if(rs.next())
{
userLevel = rs.getInt("usr_lev");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(userLevel > 1)
{ {
cnt = 0; errCode = "VTPAYARR08";
sql = "select count(*) as cnt from user_site where user_id = ? and site_code = ?"; errList.add(errCode);
pstmt = conn.prepareStatement(sql); errFields.add(childNodeName.toLowerCase());
pstmt.setString(1, loginCode); //Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
pstmt.setString(2, paySite); msgType = errorType(conn, errCode);
rs = pstmt.executeQuery(); if (msgType.equalsIgnoreCase("E"))
if(rs.next())
{
cnt = rs.getInt("cnt");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt <= 0)
{ {
errCode = "VTPAYARR06"; break;
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
} }
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
} }
} }
//Ended below code by Varsha V to check whether period code is before joining date or not 02-11-18
} }
procType = checkNull(genericUtility.getColumnValue("proc_type", dom));
}
else if("prd_code".equalsIgnoreCase(childNodeName)) cnt = 0;
{ sql = "select count(*) as cnt from payarr_to_proc where EMP_CODE = ?"
prdCode = checkNull(genericUtility.getColumnValue("prd_code", dom)); + " and prd_code = ? and proc_type = ? and (status is null or status = 'U')";
pstmt = conn.prepareStatement(sql);
if(prdCode == null || prdCode.trim().length() == 0) pstmt.setString(1, empCode);
pstmt.setString(2, prdCode);
pstmt.setString(3, procType);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{ {
errCode = "VTPAYARR05"; errCode = "VTPAYARR03";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start //Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode); msgType = errorType(conn, errCode);
...@@ -251,109 +400,28 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -251,109 +400,28 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
} }
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end //Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
} }
else if("A".equalsIgnoreCase(editFlag)) }
//Added by Jaffar S. for validation while editing same record on 19-11-18 [Start]
else if("E".equalsIgnoreCase(editFlag))
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
procType = checkNull(genericUtility.getColumnValue("proc_type", dom));
tranId = checkNull(genericUtility.getColumnValue("tran_id", dom));
status = checkNull(genericUtility.getColumnValue("status", dom));
cnt = 0;
//Modified by Rohini on 03-Dec-2018[System should check for duplicate entries only in case of new Status is 'U']start
if(status.equalsIgnoreCase("U") )
{ {
if(prdCode != null && prdCode.trim().length() > 0)
{
cnt = 0;
sql = "select fr_date, to_date from period where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, prdCode);
rs = pstmt.executeQuery();
if(rs.next())
{
fromDate = rs.getDate("fr_date");
toDate = rs.getDate("to_date");
cnt++;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt == 0)
{
errCode = "VTPAYARR05";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
}
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
sql = "select RELIEVE_DATE, DATE_JOIN from employee where EMP_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
rs = pstmt.executeQuery();
if(rs.next())
{
relieveDate = rs.getDate("RELIEVE_DATE");
joinDate = rs.getDate("DATE_JOIN");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(fromDate != null && relieveDate != null)
{
if(fromDate.after(relieveDate))
{
errCode = "VTPAYARR02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
}
}
//Added below code by Varsha V to check whether period code is before joining date or not 02-11-18
if(toDate != null && joinDate != null)
{
if(toDate.before(joinDate))
{
errCode = "VTPAYARR08";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
}
}
//Ended below code by Varsha V to check whether period code is before joining date or not 02-11-18
}
procType = checkNull(genericUtility.getColumnValue("proc_type", dom));
cnt = 0;
sql = "select count(*) as cnt from payarr_to_proc where EMP_CODE = ?" sql = "select count(*) as cnt from payarr_to_proc where EMP_CODE = ?"
+ " and prd_code = ? and proc_type = ? and (status is null or status = 'U')"; + " and prd_code = ? and proc_type = ? and (status = ? )"
+ "and tran_id <> ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode); pstmt.setString(1, empCode);
pstmt.setString(2, prdCode); pstmt.setString(2, prdCode);
pstmt.setString(3, procType); pstmt.setString(3, procType);
pstmt.setString(4, status);
pstmt.setString(5, tranId);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
...@@ -362,84 +430,35 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -362,84 +430,35 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(cnt > 0) if(cnt > 0)
{ {
errCode = "VTPAYARR03"; errCode = "VTPAYARR09";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]start
msgType = errorType(conn, errCode); msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E")) if (msgType.equalsIgnoreCase("E"))
{ {
break; break;
} }
//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]end
}
}
//Added by Jaffar S. for validation while editing same record on 19-11-18 [Start]
else if("E".equalsIgnoreCase(editFlag))
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
procType = checkNull(genericUtility.getColumnValue("proc_type", dom));
tranId = checkNull(genericUtility.getColumnValue("tran_id", dom));
status = checkNull(genericUtility.getColumnValue("status", dom));
cnt = 0;
//Modified by Rohini on 03-Dec-2018[System should check for duplicate entries only in case of new Status is 'U']start
if(status.equalsIgnoreCase("U") )
{
sql = "select count(*) as cnt from payarr_to_proc where EMP_CODE = ?"
+ " and prd_code = ? and proc_type = ? and (status = ? )"
+ "and tran_id <> ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, empCode);
pstmt.setString(2, prdCode);
pstmt.setString(3, procType);
pstmt.setString(4, status);
pstmt.setString(5, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{
errCode = "VTPAYARR09";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
msgType = errorType(conn, errCode);
if (msgType.equalsIgnoreCase("E"))
{
break;
}
}
} }
} }
//Modified by Rohini on 03-Dec-2018[System should check for duplicate entries only in case of new Status is 'U']end
//Added by Jaffar S. for validation while editing same record on 19-11-18 [End]
} }
} //Modified by Rohini on 03-Dec-2018[System should check for duplicate entries only in case of new Status is 'U']end
} //Added by Jaffar S. for validation while editing same record on 19-11-18 [End]
} }
int errListSize = errList.size(); }
System.out.println("errListSize::::::::::"+errListSize);
}
}
int errListSize = errList.size();
System.out.println("errListSize::::::::::"+errListSize);
int count = 0; int count = 0;
String errFldName = null; String errFldName = null;
if (errList != null && errListSize > 0) if (errList != null && errListSize > 0)
...@@ -449,7 +468,10 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -449,7 +468,10 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
errCode = errList.get(count); errCode = errList.get(count);
errFldName = errFields.get(count); errFldName = errFields.get(count);
System.out.println(" testing :errCode .:" + errCode); System.out.println(" testing :errCode .:" + errCode);
errString = getErrorString(errFldName, errCode, userId); //modified by Shital on 12/07/2019[Start]
//errString = getErrorString(errFldName, errCode, userId);
errString = itmDbAccess.getErrorString(errFldName, errCode, userId, "", conn);
//modified by Shital on 12/07/2019[End]
System.out.println("errString>>>>>>>>>"+errString); System.out.println("errString>>>>>>>>>"+errString);
errorType = errorType(conn, errCode); errorType = errorType(conn, errCode);
if (errString.length() > 0) if (errString.length() > 0)
...@@ -468,13 +490,15 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -468,13 +490,15 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
errList = null; errList = null;
errFields.clear(); errFields.clear();
errFields = null; errFields = null;
errStringXml.append("</Errors> </Root> \r\n");
} }
else else
{ {
errStringXml = new StringBuffer(""); errStringXml = new StringBuffer("");
} }
} }
errStringXml.append("</Errors> </Root> \r\n");
} }
catch(SQLException se) catch(SQLException se)
{ {
...@@ -495,21 +519,25 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -495,21 +519,25 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
finally finally
{ {
try { try {
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if ( conn != null ) if ( conn != null )
{ {
if ( rs != null ) //modified by Shital on 12/07/2019[Start]
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
conn.close(); conn.close();
conn = null; conn = null;
//modified by Shital on 12/07/2019[End]
} }
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -533,9 +561,13 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -533,9 +561,13 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
String errFields = null; String errFields = null;
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital Start Date 12/07/2019
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = null;
//modified by Shital End Date 12/07/2019
try try
{ {
genericUtility = new E12GenericUtility();
System.out.println("xmlString [" + xmlString + "]"); System.out.println("xmlString [" + xmlString + "]");
System.out.println("xmlString1 [" + xmlString1 + "]"); System.out.println("xmlString1 [" + xmlString1 + "]");
System.out.println("xmlString2 [" + xmlString2 + "]"); System.out.println("xmlString2 [" + xmlString2 + "]");
...@@ -558,6 +590,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -558,6 +590,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
{ {
System.out.println("Exception :PayarrToProc :" + e.getMessage()+ ":"); System.out.println("Exception :PayarrToProc :" + e.getMessage()+ ":");
errFields = genericUtility.createErrorString(e); errFields = genericUtility.createErrorString(e);
throw new ITMException(e);
} }
return errFields; return errFields;
} }
...@@ -576,23 +609,29 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -576,23 +609,29 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
String descr=""; String descr="";
String procType=""; String procType="";
String tranId=""; String tranId="";
String empName = "", paySite = "", loginCode = ""; String empName = "";
String paySite = "";
String loginCode = "";
int userLevel = 0, cnt = 0; int userLevel = 0, cnt = 0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = ""; String sql = "";
StringBuffer xmlString = new StringBuffer(); StringBuffer xmlString = null;
Connection conn = null; Connection conn = null;
int currentFormNo = 0;
try try
{ {
conn = getConnection(); conn= getConnection();
chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "userId")); xmlString = new StringBuffer();
genericUtility = new E12GenericUtility();
//chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "userId"));
chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = getValueFromXTRA_PARAMS(xtraParams, "termId"); chgTerm = getValueFromXTRA_PARAMS(xtraParams, "termId");
java.util.Date currDate = new java.util.Date(); java.util.Date currDate = new java.util.Date();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
chgDate = sdf.format(currDate); chgDate = sdf.format(currDate);
int currentFormNo = 0;
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
...@@ -604,232 +643,252 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -604,232 +643,252 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
System.out.println("xtraparam is [" + xtraParams + "]"); System.out.println("xtraparam is [" + xtraParams + "]");
switch ( currentFormNo ) switch ( currentFormNo )
{ {
case 1: case 1:
{
xmlString.append("<Detail1 domID='1' dbID=''>\r\n");
//added itm_default itemchange by Varsha V on 24-08-18 [START] A17ESUN001
if (currentColumn.trim().equalsIgnoreCase("itm_default"))
{
xmlString.append("<emp_code protect=\"0\"><![CDATA[").append("").append("]]></emp_code>\r\n");
xmlString.append("<site protect=\"1\"><![CDATA[").append("").append("]]></site>\r\n");
xmlString.append("<descr protect=\"1\"><![CDATA[").append("").append("]]></descr>\r\n");
xmlString.append("<prd_code protect=\"0\"><![CDATA[").append("").append("]]></prd_code>\r\n");
xmlString.append("<status protect=\"1\"><![CDATA[").append("U").append("]]></status>\r\n");
xmlString.append("<prd_code__acc protect=\"1\"><![CDATA[").append("").append("]]></prd_code__acc>\r\n");
xmlString.append("<proc_date protect=\"1\"><![CDATA[").append("").append("]]></proc_date>\r\n");
xmlString.append("<proc_type protect=\"0\"><![CDATA[").append("PY").append("]]></proc_type>\r\n");
xmlString.append("<tran_id protect=\"1\"><![CDATA[").append("").append("]]></tran_id>\r\n");
}//Ended itm_default itemchange by Varsha V on 24-08-18 [END]
else if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{ {
xmlString.append("<Detail1 domID='1' dbID=''>\r\n"); //modified by Shital on 12/07/2019[Start]
//added itm_default itemchange by Varsha V on 24-08-18 [START] A17ESUN001 //empCode=checkNull(genericUtility.getColumnValue("emp_code", dom1));
if (currentColumn.trim().equalsIgnoreCase("itm_default")) empCode=checkNull(genericUtility.getColumnValue("emp_code", dom));
System.out.println("Emp_Code: ["+empCode+"]");
//site=checkNull(genericUtility.getColumnValue("site", dom1));
site=checkNull(genericUtility.getColumnValue("site", dom));
System.out.println("Site_Code: ["+site+"]");
//descr=checkNull(genericUtility.getColumnValue("descr", dom1));
descr=checkNull(genericUtility.getColumnValue("descr", dom));
System.out.println("Description: ["+descr+"]");
//prdCode=checkNull(genericUtility.getColumnValue("prd_code", dom1));
prdCode=checkNull(genericUtility.getColumnValue("prd_code", dom));
System.out.println("Prd_Code: ["+prdCode+"]");
//status=checkNull(genericUtility.getColumnValue("status", dom1));
status=checkNull(genericUtility.getColumnValue("status", dom));
System.out.println("Status: ["+status+"]");
//prdCodeAcc=checkNull(genericUtility.getColumnValue("prd_code__acc", dom1));
prdCodeAcc=checkNull(genericUtility.getColumnValue("prd_code__acc", dom));
System.out.println("prd_code__acc: ["+prdCodeAcc+"]");
//procDate=checkNull(genericUtility.getColumnValue("proc_date", dom1));
procDate=checkNull(genericUtility.getColumnValue("proc_date", dom));
System.out.println("proc_Date: ["+procDate+"]");
//procType=checkNull(genericUtility.getColumnValue("proc_type", dom1));
procType=checkNull(genericUtility.getColumnValue("proc_type", dom));
System.out.println("proc_type: ["+procType+"]");
//tranId=checkNull(genericUtility.getColumnValue("tran_id", dom1));
tranId=checkNull(genericUtility.getColumnValue("tran_id", dom));
//modified by Shital on 12/07/2019[End]
System.out.println("tran_id: ["+tranId+"]");
System.out.println("Current column is[" + currentColumn + "]");
xmlString.append("<emp_code protect=\"1\"><![CDATA[").append(checkNull(empCode)).append("]]></emp_code>\r\n");
xmlString.append("<site protect=\"1\"><![CDATA[").append(checkNull(site)).append("]]></site>\r\n");
xmlString.append("<descr protect=\"1\"><![CDATA[").append(checkNull(descr)).append("]]></descr>\r\n");
xmlString.append("<prd_code protect=\"1\"><![CDATA[").append(checkNull(prdCode)).append("]]></prd_code>\r\n");
xmlString.append("<prd_code__acc protect=\"1\"><![CDATA[").append(checkNull(prdCodeAcc)).append("]]></prd_code__acc>\r\n");
xmlString.append("<proc_date protect=\"1\"><![CDATA[").append(checkNull(procDate)).append("]]></proc_date>\r\n");
//Modified by Rohini on 03-Dec-2018[To set user required process type]start
//xmlString.append("<proc_type protect=\"1\"><![CDATA[").append("PY").append("]]></proc_type>\r\n");
xmlString.append("<proc_type protect=\"1\"><![CDATA[").append(procType).append("]]></proc_type>\r\n");
//Modified by Rohini on 03-Dec-2018[To set user required process type]end
xmlString.append("<tran_id protect=\"1\"><![CDATA[").append(checkNull(tranId)).append("]]></tran_id>\r\n");
xmlString.append("<chg_date><![CDATA[").append(checkNull(chgDate)).append("]]></chg_date>\r\n");
xmlString.append("<chg_user><![CDATA[").append(checkNull(chgUser)).append("]]></chg_user>\r\n");
xmlString.append("<chg_term><![CDATA[").append(checkNull(chgTerm)).append("]]></chg_term>\r\n");
// if((prdCodeAcc != null && prdCodeAcc.trim().length()>0 ) && status.trim().equalsIgnoreCase("P") )
// {
//
// System.out.println("IN IF CONDITION::::::::::");
// xmlString.append("<status protect=\"1\"><![CDATA[").append(checkNull(status)).append("]]></status>\r\n");
// }
if((status.trim().equalsIgnoreCase("P") ))
{
System.out.println("IN IF CONDITION::::::::::");
xmlString.append("<status protect=\"1\"><![CDATA[").append(checkNull(status)).append("]]></status>\r\n");
}
else
{ {
xmlString.append("<emp_code protect=\"0\"><![CDATA[").append("").append("]]></emp_code>\r\n"); xmlString.append("<status protect=\"0\"><![CDATA[").append(checkNull(status)).append("]]></status>\r\n");
xmlString.append("<site protect=\"1\"><![CDATA[").append("").append("]]></site>\r\n"); System.out.println("IN ELSE CONDITION::::::::::");
xmlString.append("<descr protect=\"1\"><![CDATA[").append("").append("]]></descr>\r\n"); }
xmlString.append("<prd_code protect=\"0\"><![CDATA[").append("").append("]]></prd_code>\r\n"); }
xmlString.append("<status protect=\"1\"><![CDATA[").append("U").append("]]></status>\r\n"); //added emp_code itemchange by Varsha V on 24-08-18 [START] A17ESUN001
xmlString.append("<prd_code__acc protect=\"1\"><![CDATA[").append("").append("]]></prd_code__acc>\r\n"); else if (currentColumn.trim().equalsIgnoreCase("emp_code"))
xmlString.append("<proc_date protect=\"1\"><![CDATA[").append("").append("]]></proc_date>\r\n"); {
xmlString.append("<proc_type protect=\"0\"><![CDATA[").append("PY").append("]]></proc_type>\r\n"); empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
xmlString.append("<tran_id protect=\"1\"><![CDATA[").append("").append("]]></tran_id>\r\n"); site = ""; empName = ""; paySite = "";
if(empCode != null && empCode.trim().length() > 0)
}//Ended itm_default itemchange by Varsha V on 24-08-18 [END]
else if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{ {
empCode=checkNull(genericUtility.getColumnValue("emp_code", dom1)); sql = "SELECT EMP_SITE, FN_GET_EMP_NAME( EMP_CODE,'X')AS EMP_NAME, PAY_SITE FROM EMPLOYEE WHERE EMP_CODE= ?";
System.out.println("Emp_Code: ["+empCode+"]"); pstmt = conn.prepareStatement(sql);
site=checkNull(genericUtility.getColumnValue("site", dom1)); pstmt.setString(1, empCode);
System.out.println("Site_Code: ["+site+"]"); rs = pstmt.executeQuery();
descr=checkNull(genericUtility.getColumnValue("descr", dom1)); if(rs.next())
System.out.println("Description: ["+descr+"]");
prdCode=checkNull(genericUtility.getColumnValue("prd_code", dom1));
System.out.println("Prd_Code: ["+prdCode+"]");
status=checkNull(genericUtility.getColumnValue("status", dom1));
System.out.println("Status: ["+status+"]");
prdCodeAcc=checkNull(genericUtility.getColumnValue("prd_code__acc", dom1));
System.out.println("prd_code__acc: ["+prdCodeAcc+"]");
procDate=checkNull(genericUtility.getColumnValue("proc_date", dom1));
System.out.println("proc_Date: ["+procDate+"]");
procType=checkNull(genericUtility.getColumnValue("proc_type", dom1));
System.out.println("proc_type: ["+procType+"]");
tranId=checkNull(genericUtility.getColumnValue("tran_id", dom1));
System.out.println("tran_id: ["+tranId+"]");
System.out.println("Current column is[" + currentColumn + "]");
xmlString.append("<emp_code protect=\"1\"><![CDATA[").append(checkNull(empCode)).append("]]></emp_code>\r\n");
xmlString.append("<site protect=\"1\"><![CDATA[").append(checkNull(site)).append("]]></site>\r\n");
xmlString.append("<descr protect=\"1\"><![CDATA[").append(checkNull(descr)).append("]]></descr>\r\n");
xmlString.append("<prd_code protect=\"1\"><![CDATA[").append(checkNull(prdCode)).append("]]></prd_code>\r\n");
xmlString.append("<prd_code__acc protect=\"1\"><![CDATA[").append(checkNull(prdCodeAcc)).append("]]></prd_code__acc>\r\n");
xmlString.append("<proc_date protect=\"1\"><![CDATA[").append(checkNull(procDate)).append("]]></proc_date>\r\n");
//Modified by Rohini on 03-Dec-2018[To set user required process type]start
//xmlString.append("<proc_type protect=\"1\"><![CDATA[").append("PY").append("]]></proc_type>\r\n");
xmlString.append("<proc_type protect=\"1\"><![CDATA[").append(procType).append("]]></proc_type>\r\n");
//Modified by Rohini on 03-Dec-2018[To set user required process type]end
xmlString.append("<tran_id protect=\"1\"><![CDATA[").append(checkNull(tranId)).append("]]></tran_id>\r\n");
xmlString.append("<chg_date><![CDATA[").append(checkNull(chgDate)).append("]]></chg_date>\r\n");
xmlString.append("<chg_user><![CDATA[").append(checkNull(chgUser)).append("]]></chg_user>\r\n");
xmlString.append("<chg_term><![CDATA[").append(checkNull(chgTerm)).append("]]></chg_term>\r\n");
// if((prdCodeAcc != null && prdCodeAcc.trim().length()>0 ) && status.trim().equalsIgnoreCase("P") )
// {
//
// System.out.println("IN IF CONDITION::::::::::");
// xmlString.append("<status protect=\"1\"><![CDATA[").append(checkNull(status)).append("]]></status>\r\n");
// }
if((status.trim().equalsIgnoreCase("P") ))
{ {
System.out.println("IN IF CONDITION::::::::::"); site = checkNull(rs.getString("EMP_SITE"));
xmlString.append("<status protect=\"1\"><![CDATA[").append(checkNull(status)).append("]]></status>\r\n"); empName = checkNull(rs.getString("EMP_NAME"));
paySite = checkNull(rs.getString("PAY_SITE"));
} }
else if(rs != null)
{ {
xmlString.append("<status protect=\"0\"><![CDATA[").append(checkNull(status)).append("]]></status>\r\n"); rs.close();
System.out.println("IN ELSE CONDITION::::::::::"); rs = null;
} }
} if(pstmt != null)
//added emp_code itemchange by Varsha V on 24-08-18 [START] A17ESUN001
else if (currentColumn.trim().equalsIgnoreCase("emp_code"))
{
empCode = checkNull(genericUtility.getColumnValue("emp_code", dom));
site = ""; empName = ""; paySite = "";
if(empCode != null && empCode.trim().length() > 0)
{ {
sql = "SELECT EMP_SITE, FN_GET_EMP_NAME( EMP_CODE,'X')AS EMP_NAME, PAY_SITE FROM EMPLOYEE WHERE EMP_CODE= ?"; pstmt.close();
pstmt = conn.prepareStatement(sql); pstmt = null;
pstmt.setString(1, empCode); }
rs = pstmt.executeQuery(); // addec below code by Varsha V to check user rights 02-11-18
if(rs.next()) sql = "select usr_lev from users where code = ?";
{ pstmt = conn.prepareStatement(sql);
site = checkNull(rs.getString("EMP_SITE")); pstmt.setString(1, loginCode);
empName = checkNull(rs.getString("EMP_NAME")); rs = pstmt.executeQuery();
paySite = checkNull(rs.getString("PAY_SITE")); if(rs.next())
} {
if(rs != null) userLevel = rs.getInt("usr_lev");
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
// addec below code by Varsha V to check user rights 02-11-18
sql = "select usr_lev from users where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginCode);
rs = pstmt.executeQuery();
if(rs.next())
{
userLevel = rs.getInt("usr_lev");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Ended below code by Varsha V to check user rights 02-11-18
siteDescr = "";
if(site.trim().length() > 0 && !"null".equalsIgnoreCase(site) )
{
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, site );
rs = pstmt.executeQuery();
if(rs.next())
{
siteDescr = checkNull( rs.getString( "DESCR" ) );
}
System.out.println("Site description::: [:" + siteDescr+ ":]" );
if( rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
}
} }
// addec below code by Varsha V to check user rights on 02-11-18 if(rs != null)
if(userLevel > 1)
{ {
cnt = 0; rs.close();
sql = "select count(*) as cnt from user_site where user_id = ? and site_code = ?"; rs = null;
pstmt = conn.prepareStatement(sql); }
pstmt.setString(1, loginCode); if(pstmt != null)
pstmt.setString(2, paySite); {
pstmt.close();
pstmt = null;
}
// Ended below code by Varsha V to check user rights 02-11-18
siteDescr = "";
if(site.trim().length() > 0 && !"null".equalsIgnoreCase(site) )
{
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString( 1, site );
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
cnt = rs.getInt("cnt"); siteDescr = checkNull( rs.getString( "DESCR" ) );
} }
if(rs != null) System.out.println("Site description::: [:" + siteDescr+ ":]" );
if( rs != null )
{ {
rs.close(); rs.close();
rs = null; rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
} }
if( pstmt != null )
if(cnt > 0)
{ {
xmlString.append("<name><![CDATA[").append(empName).append("]]></name>\r\n"); pstmt.close();
xmlString.append("<site><![CDATA[").append(site).append("]]></site>\r\n"); pstmt = null;
xmlString.append("<descr><![CDATA[").append(siteDescr).append("]]></descr>\r\n"); }
}
else
{
xmlString.append("<name><![CDATA[").append("").append("]]></name>\r\n");
xmlString.append("<site><![CDATA[").append("").append("]]></site>\r\n");
xmlString.append("<descr><![CDATA[").append("").append("]]></descr>\r\n");
}
} }
else }
// addec below code by Varsha V to check user rights on 02-11-18
if(userLevel > 1)
{
cnt = 0;
sql = "select count(*) as cnt from user_site where user_id = ? and site_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, loginCode);
pstmt.setString(2, paySite);
rs = pstmt.executeQuery();
if(rs.next())
{
cnt = rs.getInt("cnt");
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(cnt > 0)
{ {
xmlString.append("<name><![CDATA[").append(empName).append("]]></name>\r\n"); xmlString.append("<name><![CDATA[").append(empName).append("]]></name>\r\n");
xmlString.append("<site><![CDATA[").append(site).append("]]></site>\r\n"); xmlString.append("<site><![CDATA[").append(site).append("]]></site>\r\n");
xmlString.append("<descr><![CDATA[").append(siteDescr).append("]]></descr>\r\n"); xmlString.append("<descr><![CDATA[").append(siteDescr).append("]]></descr>\r\n");
} }
// Ended below code by Varsha V to check user rights 02-11-18 else
{
xmlString.append("<name><![CDATA[").append("").append("]]></name>\r\n");
xmlString.append("<site><![CDATA[").append("").append("]]></site>\r\n");
xmlString.append("<descr><![CDATA[").append("").append("]]></descr>\r\n");
}
}
else
{
xmlString.append("<name><![CDATA[").append(empName).append("]]></name>\r\n");
xmlString.append("<site><![CDATA[").append(site).append("]]></site>\r\n");
xmlString.append("<descr><![CDATA[").append(siteDescr).append("]]></descr>\r\n");
} }
//Ended emp_code itemchange by Varsha V on 24-08-18 [End] // Ended below code by Varsha V to check user rights 02-11-18
xmlString.append("</Detail1>\r\n");
} }
//Ended emp_code itemchange by Varsha V on 24-08-18 [End]
xmlString.append("</Detail1>\r\n");
}
} }
xmlString.append("</Root>\r\n");
} }
catch (Exception ex) catch (Exception ex)
{ {
System.out.println("1st catch Exception::" + ex.getMessage()); System.out.println("1st catch Exception::" + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex);
} }
finally finally
{ {
try { try {
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if ( conn != null ) if ( conn != null )
{ {
if ( rs != null ) //modified by Shital on 12/07/2019[start]
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
conn.close(); conn.close();
conn = null; conn = null;
//modified by Shital on 12/07/2019[End]
} }
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("[PayarrToProc][itemChanged]Exception ::"+e); System.out.println("[PayarrToProc][itemChanged]Exception ::"+e);
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);
} }
} }
System.out.println("value of xmlString::::" + xmlString); System.out.println("value of xmlString::::" + xmlString);
xmlString.append("</Root>\r\n");
System.out.println("xmlString....[" + xmlString.toString()); System.out.println("xmlString....[" + xmlString.toString());
return xmlString.toString(); return xmlString.toString();
} }
...@@ -838,7 +897,8 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -838,7 +897,8 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
if (input == null) if (input == null)
{ {
input = ""; input = "";
} else }
else
{ {
input = input.trim(); input = input.trim();
} }
...@@ -859,10 +919,22 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -859,10 +919,22 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
{ {
msgType = rs.getString("MSG_TYPE"); msgType = rs.getString("MSG_TYPE");
} }
rs.close(); //modified by Shital on 12/07/2019[start]
rs = null; //rs.close();
pstmt.close(); //rs = null;
pstmt = null; //pstmt.close();
//pstmt = null;
if(rs != null)
{
rs.close();
rs = null;
}
//modified by Shital on 12/07/2019[End]
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -895,4 +967,4 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -895,4 +967,4 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
} }
//Created by Suraj [20/3/15] [To create a payarr_to_proc transaction][Ends] //Created by Suraj [20/3/15] [To create a payarr_to_proc transaction][Ends]
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