Commit df29c5f3 authored by sgadve's avatar sgadve

Change the GenericUtilty to E12GenericUtility and closing the connection


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@215479 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1df94ece
...@@ -38,12 +38,16 @@ import ibase.webitm.ejb.*; ...@@ -38,12 +38,16 @@ import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.TransIDGenerator; import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.system.config.*; import ibase.system.config.*;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
@Stateless @Stateless
public class AttdProcess extends ProcessEJB implements AttdProcessLocal ,AttdProcessRemote //SessionBean public class AttdProcess extends ProcessEJB implements AttdProcessLocal ,AttdProcessRemote //SessionBean
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); //Added and commented by saiprasad G. [START]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//Added and commented by saiprasad G. [END]
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
CommonConstants commonConstants = new CommonConstants(); CommonConstants commonConstants = new CommonConstants();
...@@ -172,7 +176,10 @@ public class AttdProcess extends ProcessEJB implements AttdProcessLocal ,AttdPr ...@@ -172,7 +176,10 @@ public class AttdProcess extends ProcessEJB implements AttdProcessLocal ,AttdPr
try try
{ {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat());
conn = connDriver.getConnectDB("DriverITM"); //Added and commented by saiprasad G. for the getting connection START
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//Added and commented by saiprasad G. for the getting connection END
conn.setAutoCommit(false); conn.setAutoCommit(false);
System.out.println("xtraParams : "+xtraParams); System.out.println("xtraParams : "+xtraParams);
...@@ -385,6 +392,7 @@ public class AttdProcess extends ProcessEJB implements AttdProcessLocal ,AttdPr ...@@ -385,6 +392,7 @@ public class AttdProcess extends ProcessEJB implements AttdProcessLocal ,AttdPr
if(conn != null) if(conn != null)
{ {
conn.close(); conn.close();
conn = null;
} }
} }
catch(Exception e) catch(Exception e)
...@@ -2233,7 +2241,7 @@ private String getExistTranId(String empCode,Timestamp procDate, Connection con ...@@ -2233,7 +2241,7 @@ private String getExistTranId(String empCode,Timestamp procDate, Connection con
pstmt.setTimestamp(1, attdDate); pstmt.setTimestamp(1, attdDate);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
count = rs.getInt(1); count = rs.getInt(1);
......
...@@ -10,13 +10,16 @@ import org.w3c.dom.*; ...@@ -10,13 +10,16 @@ import org.w3c.dom.*;
import javax.ejb.*; import javax.ejb.*;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.*; import ibase.webitm.utility.*;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3 @Stateless // added for ejb3
public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,AttendancePrcRemote //SessionBean public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,AttendancePrcRemote //SessionBean
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); //Added and commented by saiprasad G.
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
/*public void ejbCreate() throws RemoteException, CreateException /*public void ejbCreate() throws RemoteException, CreateException
...@@ -133,15 +136,26 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -133,15 +136,26 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
{ {
sql = "SELECT SH_DESCR FROM SITE WHERE SITE_CODE = '"+loginSite+"'"; sql = "SELECT SH_DESCR FROM SITE WHERE SITE_CODE = '"+loginSite+"'";
System.out.println("SQL :: "+sql); System.out.println("SQL :: "+sql);
stmt = conn.createStatement(); stmt = conn.createStatement();
rs = stmt.executeQuery(sql); rs = stmt.executeQuery(sql);
if(rs.next()) if(rs.next())
{ {
toSiteCodeDescr=rs.getString("SH_DESCR"); toSiteCodeDescr=rs.getString("SH_DESCR");
} }
//Added by saiprasad G. for closing the resultset and statement[START]
if(rs != null)
{
rs.close();
rs = null;
}
if(stmt != null)
{
stmt.close();
stmt = null;
}
//Added by saiprasad G. for closing the resultset and statement[END]
Calendar cal=Calendar.getInstance(); Calendar cal=Calendar.getInstance();
Date date=cal.getTime(); Date date=cal.getTime();
SimpleDateFormat dateFormat=new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat dateFormat=new SimpleDateFormat(genericUtility.getApplDateFormat());
...@@ -156,38 +170,46 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -156,38 +170,46 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
System.out.println(" monthStr "+monthNum); System.out.println(" monthStr "+monthNum);
System.out.println(" monthStr "+monthStr); System.out.println(" monthStr "+monthStr);
valueXmlString.append("<payroll_date><![CDATA[").append(dateStr).append("]]></payroll_date>\r\n"); valueXmlString.append("<payroll_date><![CDATA[").append(dateStr).append("]]></payroll_date>\r\n");
// valueXmlString.append("<cutoff_date>").append(dateStr).append("</cutoff_date>\r\n"); // valueXmlString.append("<cutoff_date>").append(dateStr).append("</cutoff_date>\r\n");
//valueXmlString.append("<emp_code__fr>").append("A").append("</emp_code__fr>\r\n"); //valueXmlString.append("<emp_code__fr>").append("A").append("</emp_code__fr>\r\n");
//valueXmlString.append("<emp_code__to>").append("ZZ").append("</emp_code__to>\r\n"); //valueXmlString.append("<emp_code__to>").append("ZZ").append("</emp_code__to>\r\n");
// valueXmlString.append("<proc_group__from>").append("A").append("</proc_group__from>\r\n"); // valueXmlString.append("<proc_group__from>").append("A").append("</proc_group__from>\r\n");
// valueXmlString.append("<proc_group__to>").append("ZZ").append("</proc_group__to>\r\n"); // valueXmlString.append("<proc_group__to>").append("ZZ").append("</proc_group__to>\r\n");
valueXmlString.append("<no_days><![CDATA[").append("0").append("]]></no_days>\r\n"); valueXmlString.append("<no_days><![CDATA[").append("0").append("]]></no_days>\r\n");
valueXmlString.append("<site_code__fr><![CDATA[").append(loginSite).append("]]></site_code__fr>\r\n"); valueXmlString.append("<site_code__fr><![CDATA[").append(loginSite).append("]]></site_code__fr>\r\n");
valueXmlString.append("<site_code__to><![CDATA[").append(loginSite).append("]]></site_code__to>\r\n"); valueXmlString.append("<site_code__to><![CDATA[").append(loginSite).append("]]></site_code__to>\r\n");
// valueXmlString.append("<prd_code__fr>").append(yearStr).append(monthNum).append("</prd_code__fr>\r\n"); // valueXmlString.append("<prd_code__fr>").append(yearStr).append(monthNum).append("</prd_code__fr>\r\n");
// valueXmlString.append("<fr_prd_descr>").append(monthStr).append(yearStr).append("</fr_prd_descr>\r\n"); // valueXmlString.append("<fr_prd_descr>").append(monthStr).append(yearStr).append("</fr_prd_descr>\r\n");
//stmt.close(); //stmt.close();
//rs.close(); //rs.close();
valueXmlString.append("<to_site_descr><![CDATA[").append(toSiteCodeDescr).append("]]></to_site_descr>\r\n"); valueXmlString.append("<to_site_descr><![CDATA[").append(toSiteCodeDescr).append("]]></to_site_descr>\r\n");
valueXmlString.append("<fr_site_descr><![CDATA[").append(toSiteCodeDescr).append("]]></fr_site_descr>\r\n"); valueXmlString.append("<fr_site_descr><![CDATA[").append(toSiteCodeDescr).append("]]></fr_site_descr>\r\n");
toSiteCodeDescr=null; toSiteCodeDescr=null;
sql="SELECT PRD_CODE FROM PARAMETER"; sql="SELECT PRD_CODE FROM PARAMETER";
System.out.println("SQL :: "+sql); System.out.println("SQL :: "+sql);
stmt = conn.createStatement(); stmt = conn.createStatement();
rs = stmt.executeQuery(sql); rs = stmt.executeQuery(sql);
if(rs.next()) if(rs.next())
{ {
prdCode=rs.getString("PRD_CODE"); prdCode=rs.getString("PRD_CODE");
} }
stmt.close(); if(stmt != null)
rs.close(); {
stmt.close();
stmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
valueXmlString.append("<prd_code__fr><![CDATA[").append(prdCode).append("]]></prd_code__fr>\r\n"); valueXmlString.append("<prd_code__fr><![CDATA[").append(prdCode).append("]]></prd_code__fr>\r\n");
sql="SELECT DESCR,TO_DATE FROM PERIOD WHERE CODE = '"+prdCode+"'"; sql="SELECT DESCR,TO_DATE FROM PERIOD WHERE CODE = '"+prdCode+"'";
stmt = conn.createStatement(); stmt = conn.createStatement();
...@@ -197,8 +219,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -197,8 +219,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
prdCodeDescr=rs.getString("DESCR"); prdCodeDescr=rs.getString("DESCR");
todate=rs.getString("TO_DATE"); todate=rs.getString("TO_DATE");
} }
stmt.close(); if(stmt != null)
rs.close(); {
stmt.close();
stmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
// Modified by Piyush on 19/03/2015 [During RCP Migration].Start // Modified by Piyush on 19/03/2015 [During RCP Migration].Start
String cutOffDate = ""; String cutOffDate = "";
cutOffDate = todate; cutOffDate = todate;
...@@ -240,8 +270,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -240,8 +270,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
empfname=rs.getString("EMP_FNAME"); empfname=rs.getString("EMP_FNAME");
emplname=rs.getString("EMP_LNAME"); emplname=rs.getString("EMP_LNAME");
} }
stmt.close(); if(stmt != null)
rs.close(); {
stmt.close();
stmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
valueXmlString.append("<emp_name__fr><![CDATA[").append(empfname).append(emplname).append("]]></emp_name__fr>\r\n"); valueXmlString.append("<emp_name__fr><![CDATA[").append(empfname).append(emplname).append("]]></emp_name__fr>\r\n");
} }
...@@ -274,8 +312,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -274,8 +312,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
empfname=rs.getString("EMP_FNAME"); empfname=rs.getString("EMP_FNAME");
emplname=rs.getString("EMP_LNAME"); emplname=rs.getString("EMP_LNAME");
} }
stmt.close(); if(stmt != null)
rs.close(); {
stmt.close();
stmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
valueXmlString.append("<emp_name__to><![CDATA[").append(empfname).append(emplname).append("]]></emp_name__to>\r\n"); valueXmlString.append("<emp_name__to><![CDATA[").append(empfname).append(emplname).append("]]></emp_name__to>\r\n");
} }
...@@ -305,8 +351,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -305,8 +351,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
{ {
frSiteCodeDescr=rs.getString("sh_descr"); frSiteCodeDescr=rs.getString("sh_descr");
} }
stmt.close(); if(stmt != null)
rs.close(); {
stmt.close();
stmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
valueXmlString.append("<fr_site_descr><![CDATA[").append(frSiteCodeDescr).append("]]></fr_site_descr>\r\n"); valueXmlString.append("<fr_site_descr><![CDATA[").append(frSiteCodeDescr).append("]]></fr_site_descr>\r\n");
} }
...@@ -400,8 +454,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -400,8 +454,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
{ {
frProcGr=rs.getString("descr"); frProcGr=rs.getString("descr");
} }
stmt.close(); if(stmt != null)
rs.close(); {
stmt.close();
stmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
valueXmlString.append("<to_p_group_descr><![CDATA[").append(frProcGr).append("]]></to_p_group_descr>\r\n"); valueXmlString.append("<to_p_group_descr><![CDATA[").append(frProcGr).append("]]></to_p_group_descr>\r\n");
} }
...@@ -445,8 +507,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -445,8 +507,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
dateTo=startDate.toString(); dateTo=startDate.toString();
} */ } */
stmt.close(); if(stmt != null)
rs.close(); {
stmt.close();
stmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
valueXmlString.append("<fr_prd_descr><![CDATA[").append(pdDescr).append("]]></fr_prd_descr>\r\n").append("<cutoff_date>").append(dateTo).append("</cutoff_date>\r\n"); valueXmlString.append("<fr_prd_descr><![CDATA[").append(pdDescr).append("]]></fr_prd_descr>\r\n").append("<cutoff_date>").append(dateTo).append("</cutoff_date>\r\n");
// valueXmlString.append("<cutoff_date>").append(dateTo).append("</cutoff_date>\r\n"); // valueXmlString.append("<cutoff_date>").append(dateTo).append("</cutoff_date>\r\n");
...@@ -467,9 +537,20 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -467,9 +537,20 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
{ {
try try
{ {
if(stmt != null)
{
stmt.close();
stmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(conn != null) if(conn != null)
{ {
conn.close(); conn.close();
conn = null;
} }
} }
catch(Exception ex) catch(Exception ex)
...@@ -544,7 +625,10 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -544,7 +625,10 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
{ {
case 1: case 1:
{ {
parentNodeList = dom1.getElementsByTagName("Detail2"); //commented by Saiprasad G. for getting detail with detail1 [START]
//parentNodeList = dom1.getElementsByTagName("Detail2");
parentNodeList = dom1.getElementsByTagName("Detail1");
//commented by Saiprasad G. for getting detail with detail1 [END]
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
...@@ -587,8 +671,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -587,8 +671,16 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
break; break;
} }
} }
stmt.close(); if(stmt != null)
rs.close(); {
stmt.close();
stmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
} }
} }
...@@ -788,9 +880,20 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A ...@@ -788,9 +880,20 @@ public class AttendancePrc extends ValidatorEJB implements AttendancePrcLocal,A
{ {
try try
{ {
if(stmt != null)
{
stmt.close();
stmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(conn != null) if(conn != null)
{ {
conn.close(); conn.close();
conn = null;
} }
} }
catch(Exception ex) catch(Exception ex)
......
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