Commit 173adb0d authored by sanashaikh's avatar sanashaikh

Sana S : Modified on [19/09/2019]

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@207734 ce508802-f39f-4f6c-b175-0d175dae99d5
parent fae877ee
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.util.*;
import java.util.Date;
import java.text.*;
//import java.util.*;
//import java.util.Date;
//import java.text.*;
import java.sql.*;
import org.w3c.dom.*;
import javax.ejb.*;
//import javax.ejb.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.*;
//import ibase.webitm.utility.*;
import ibase.webitm.ejb.*;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
import ibase.webitm.ejb.ITMDBAccessEJB;
//import javax.naming.InitialContext;
//import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.system.config.*;
//import ibase.system.config.*;
import ibase.utility.E12GenericUtility;
@Stateless
......@@ -61,7 +62,8 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
String columnValue = "";
String sql = "";
Connection conn = null;
Statement stmt = null;
//Statement stmt = null;
PreparedStatement pstmt=null;// Modified by Sana S on 17/09/2019
ResultSet rs = null;
String loginSite = "";
String empFname = "";
......@@ -71,11 +73,19 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
String shiftDescr = "";
StringBuffer valueXmlString = new StringBuffer();
ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = GenericUtility.getInstance();
// Modified by Sana S on 17/09/2019 [Start]
/*ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = GenericUtility.getInstance();*/
E12GenericUtility genericUtility=new E12GenericUtility();
// Modified by Sana S on 17/09/2019 [end]
try
{
conn = connDriver.getConnectDB("DriverITM");
// Modified by Sana S on 17/09/2019 [start]
//conn = connDriver.getConnectDB("DriverITM");
conn=getConnection();
// Modified by Sana S on 17/09/2019 [end]
columnValue = genericUtility.getColumnValue(currentColumn,dom);
System.out.println("columnValue :"+columnValue);
valueXmlString.append("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header><editFlag>");
......@@ -94,15 +104,34 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
valueXmlString.append("<site_code__fr>").append(loginSite).append("</site_code__fr>\r\n");
valueXmlString.append("<site_code__to>").append(loginSite).append("</site_code__to>\r\n");
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = '" + loginSite + "'";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
// Modified by Sana S on 17/09/2019 [start]
//sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = '"+loginSite+"'";
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = ?";
//stmt = conn.createStatement();
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, loginSite);
// rs = pstmt.executeQuery(sql);
rs = pstmt.executeQuery();
// Modified by Sana S on 17/09/2019 [end]
while (rs.next())
{
siteDescr = rs.getString("DESCR");
}
// Modified by Sana S on 17/09/2019 [start]
/*rs.close();
stmt.close();*/
if (rs != null)
{
rs.close();
stmt.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Modified by Sana S on 17/09/2019 [end]
valueXmlString.append("<site_code_fr_descr>").append(siteDescr).append("</site_code_fr_descr>\r\n");
valueXmlString.append("<site_code_to_descr>").append(siteDescr).append("</site_code_to_descr>\r\n");
valueXmlString.append("<dept_code__fr>").append("00").append("</dept_code__fr>\r\n");
......@@ -113,82 +142,167 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
else if (currentColumn.trim().equals("emp_code__fr"))
{
String empCode = getColumnValue("emp_code__fr", dom);
sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+empCode+"' ";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
// Modified by Sana S on 17/09/2019 [start]
// sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+empCode+"' ";
sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = ? ";
//stmt = conn.createStatement();
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, empCode);
// rs = pstmt.executeQuery(sql);
rs = pstmt.executeQuery();
// Modified by Sana S on 17/09/2019 [end]
while (rs.next())
{
empFname = rs.getString("EMP_FNAME");
empLname = rs.getString("EMP_LNAME");
}
// Modified by Sana S on 17/09/2019 [start]
/*rs.close();
stmt.close();*/
if (rs != null)
{
rs.close();
stmt.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Modified by Sana S on 17/09/2019 [end]
valueXmlString.append("<emp_code__fr>").append(empCode == null ? "" : empCode).append("</emp_code__fr>\r\n");
valueXmlString.append("<fr_emp_name>").append(empFname == null ? "" : empFname).append(" ").append(empLname == null ? "" : empLname).append("</fr_emp_name>\r\n");
}
else if (currentColumn.trim().equals("emp_code__to"))
{
String empCode = getColumnValue("emp_code__to", dom);
sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+empCode+"' ";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
// Modified by Sana S on 17/09/2019 [start]
//sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+empCode+"' ";
sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = ? ";
//stmt = conn.createStatement();
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, empCode);
// rs = pstmt.executeQuery(sql);
rs = pstmt.executeQuery();
// Modified by Sana S on 17/09/2019 [end]
while (rs.next())
{
empFname = rs.getString("EMP_FNAME");
empLname = rs.getString("EMP_LNAME");
}
// Modified by Sana S on 17/09/2019 [start]
/*rs.close();
stmt.close();*/
if (rs != null)
{
rs.close();
stmt.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Modified by Sana S on 17/09/2019 [end]
valueXmlString.append("<emp_code__to>").append(empCode == null ? "" : empCode).append("</emp_code__to>\r\n");
valueXmlString.append("<to_emp_name>").append(empFname == null ? "" : empFname).append(" ").append(empLname == null ? "" : empLname).append("</to_emp_name>\r\n");
}
else if (currentColumn.trim().equals("dept_code__fr"))
{
String deptCode = getColumnValue("dept_code__fr", dom);
sql = "select descr from department where dept_code = '"+deptCode+"' ";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
// Modified by Sana S on 17/09/2019 [start]
//sql = "select descr from department where dept_code = '"+deptCode+"' ";
sql = "select descr from department where dept_code = ? ";
//stmt = conn.createStatement();
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, deptCode);
// rs = pstmt.executeQuery(sql);
rs = pstmt.executeQuery();
// Modified by Sana S on 17/09/2019 [end]
while (rs.next())
{
deptDescr = rs.getString("descr");
}
// Modified by Sana S on 17/09/2019 [start]
/*rs.close();
stmt.close();*/
if (rs != null)
{
rs.close();
stmt.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Modified by Sana S on 17/09/2019 [end]
valueXmlString.append("<dept_code__fr>").append(deptCode == null ? "" : deptCode).append("</dept_code__fr>\r\n");
valueXmlString.append("<dept_code_fr_descr>").append(deptDescr == null ? "" : deptDescr).append("</dept_code_fr_descr>\r\n");
}
else if (currentColumn.trim().equals("dept_code__to"))
{
String deptCode = getColumnValue("dept_code__to", dom);
sql = "select descr from department where dept_code = '"+deptCode+"' ";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
// Modified by Sana S on 17/09/2019 [start]
// sql = "select descr from department where dept_code = '"+deptCode+"' ";
sql = "select descr from department where dept_code = ? ";
//stmt = conn.createStatement();
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, deptCode);
// rs = pstmt.executeQuery(sql);
rs = pstmt.executeQuery();
// Modified by Sana S on 17/09/2019 [end]
while (rs.next())
{
deptDescr = rs.getString("descr");
}
// Modified by Sana S on 17/09/2019 [start]
/*rs.close();
stmt.close();*/
if (rs != null)
{
rs.close();
stmt.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Modified by Sana S on 17/09/2019 [end]
valueXmlString.append("<dept_code__to>").append(deptCode == null ? "" : deptCode).append("</dept_code__to>\r\n");
valueXmlString.append("<dept_code_to_descr>").append(deptDescr == null ? "" : deptDescr).append("</dept_code_to_descr>\r\n");
}
else if (currentColumn.trim().equals("site_code__fr"))
{
String siteCode = getColumnValue("site_code__fr", dom);
sql = "select descr from site where site_code = '"+siteCode+"' ";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
// Modified by Sana S on 17/09/2019 [start]
//sql = "select descr from site where site_code = '"+siteCode+"' ";
sql = "select descr from site where site_code = ? ";
//stmt = conn.createStatement();
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
// rs = pstmt.executeQuery(sql);
rs = pstmt.executeQuery();
// Modified by Sana S on 17/09/2019 [end]
while (rs.next())
{
siteDescr = rs.getString("descr");
}
// Modified by Sana S on 17/09/2019 [start]
/*rs.close();
stmt.close();*/
if (rs != null)
{
rs.close();
stmt.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Modified by Sana S on 17/09/2019 [end]
valueXmlString.append("<site_code__fr>").append(siteCode == null ? "" : siteCode).append("</site_code__fr>\r\n");
valueXmlString.append("<site_code_fr_descr>").append(siteDescr == null ? "" : siteDescr).append("</site_code_fr_descr>\r\n");
......@@ -197,16 +311,33 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
{
String siteCode = getColumnValue("site_code__to", dom);
sql = "select descr from site where site_code = '"+siteCode+"' ";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
// Modified by Sana S on 17/09/2019 [start]
// sql = "select descr from site where site_code = '"+siteCode+"' ";
sql = "select descr from site where site_code = ? ";
//stmt = conn.createStatement();
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, siteCode);
// rs = pstmt.executeQuery(sql);
rs = pstmt.executeQuery();
// Modified by Sana S on 17/09/2019 [end]
while (rs.next())
{
siteDescr = rs.getString("descr");
}
// Modified by Sana S on 17/09/2019 [start]
/*rs.close();
stmt.close();*/
if (rs != null)
{
rs.close();
stmt.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Modified by Sana S on 17/09/2019 [end]
valueXmlString.append("<site_code__to>").append(siteCode == null ? "" : siteCode).append("</site_code__to>\r\n");
valueXmlString.append("<site_code_to_descr>").append(siteDescr == null ? "" : siteDescr).append("</site_code_to_descr>\r\n");
......@@ -214,15 +345,33 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
else if(currentColumn.trim().equals("shift_to"))
{
String shift = getColumnValue("shift_to", dom);
sql = "select a.descr from workshft a where a.shift = '" + shift + "' and a.day_no = (select min(b.day_no) from workshft b where b.shift = a.shift)";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
// Modified by Sana S on 17/09/2019 [start]
//sql = "select a.descr from workshft a where a.shift = '" + shift + "' and a.day_no = (select min(b.day_no) from workshft b where b.shift = a.shift)";
sql = "select a.descr from workshft a where a.shift = ? and a.day_no = (select min(b.day_no) from workshft b where b.shift = a.shift)";
//stmt = conn.createStatement();
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, shift);
// rs = pstmt.executeQuery(sql);
rs = pstmt.executeQuery();
// Modified by Sana S on 17/09/2019 [end]
while (rs.next())
{
shiftDescr = rs.getString("descr");
}
// Modified by Sana S on 17/09/2019 [start]
/*rs.close();
stmt.close();*/
if (rs != null)
{
rs.close();
stmt.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
// Modified by Sana S on 17/09/2019 [end]
valueXmlString.append("<shift_to>").append(shift == null ? "" : shift).append("</shift_to>\r\n");
valueXmlString.append("<shift_to_descr>").append(shiftDescr == null ? "" : shiftDescr).append("</shift_to_descr>\r\n");
}
......@@ -243,10 +392,10 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
rs.close();
rs = null;
}
if (stmt != null)
if (pstmt != null)
{
stmt.close();
stmt = null;
pstmt.close();
pstmt = null;
}
if (conn != null)
{
......@@ -259,7 +408,6 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
throw new ITMException(se);
}
}
return valueXmlString.toString();
}
......
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