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; package ibase.webitm.ejb.adm;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.util.*; //import java.util.*;
import java.util.Date; //import java.util.Date;
import java.text.*; //import java.text.*;
import java.sql.*; import java.sql.*;
import org.w3c.dom.*; 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.webitm.ejb.*; import ibase.webitm.ejb.*;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.naming.InitialContext; //import javax.naming.InitialContext;
import ibase.webitm.ejb.ITMDBAccessEJB; //import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.system.config.*; //import ibase.system.config.*;
import ibase.utility.E12GenericUtility;
@Stateless @Stateless
public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProcICLocal,ShiftPatternProcICRemote public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProcICLocal,ShiftPatternProcICRemote
{ {
public String itemChanged() throws RemoteException,ITMException public String itemChanged() throws RemoteException,ITMException
{ {
return ""; return "";
...@@ -35,7 +36,7 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc ...@@ -35,7 +36,7 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
try try
{ {
if(xmlString != null && xmlString.trim().length()!=0) if(xmlString != null && xmlString.trim().length()!=0)
{ {
dom = genericUtility.parseString(xmlString); dom = genericUtility.parseString(xmlString);
...@@ -61,7 +62,8 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc ...@@ -61,7 +62,8 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
String columnValue = ""; String columnValue = "";
String sql = ""; String sql = "";
Connection conn = null; Connection conn = null;
Statement stmt = null; //Statement stmt = null;
PreparedStatement pstmt=null;// Modified by Sana S on 17/09/2019
ResultSet rs = null; ResultSet rs = null;
String loginSite = ""; String loginSite = "";
String empFname = ""; String empFname = "";
...@@ -69,40 +71,67 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc ...@@ -69,40 +71,67 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
String deptDescr = ""; String deptDescr = "";
String siteDescr = ""; String siteDescr = "";
String shiftDescr = ""; String shiftDescr = "";
StringBuffer valueXmlString = new StringBuffer(); StringBuffer valueXmlString = new StringBuffer();
ConnDriver connDriver = new ConnDriver(); // Modified by Sana S on 17/09/2019 [Start]
GenericUtility genericUtility = GenericUtility.getInstance(); /*ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = GenericUtility.getInstance();*/
E12GenericUtility genericUtility=new E12GenericUtility();
// Modified by Sana S on 17/09/2019 [end]
try 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); columnValue = genericUtility.getColumnValue(currentColumn,dom);
System.out.println("columnValue :"+columnValue); System.out.println("columnValue :"+columnValue);
valueXmlString.append("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header><editFlag>"); valueXmlString.append("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></Header>\r\n"); valueXmlString.append(editFlag).append("</editFlag></Header>\r\n");
valueXmlString.append("<Detail1>\r\n"); valueXmlString.append("<Detail1>\r\n");
if (currentColumn.trim().equals("itm_default")) if (currentColumn.trim().equals("itm_default"))
{ {
String shiftPattern = getColumnValue("shift_pattern",dom); String shiftPattern = getColumnValue("shift_pattern",dom);
String shiftTo = getColumnValue("shift_to",dom); String shiftTo = getColumnValue("shift_to",dom);
valueXmlString.append("<shift_pattern protect = '1'> ").append(shiftPattern == null ? "N":shiftPattern).append("</shift_pattern>\r\n"); valueXmlString.append("<shift_pattern protect = '1'> ").append(shiftPattern == null ? "N":shiftPattern).append("</shift_pattern>\r\n");
valueXmlString.append("<shift_to protect = '1'> ").append(shiftTo == null ? "" : shiftTo).append("</shift_to>\r\n"); valueXmlString.append("<shift_to protect = '1'> ").append(shiftTo == null ? "" : shiftTo).append("</shift_to>\r\n");
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSite"); loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSite");
valueXmlString.append("<site_code__fr>").append(loginSite).append("</site_code__fr>\r\n"); 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"); valueXmlString.append("<site_code__to>").append(loginSite).append("</site_code__to>\r\n");
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = '" + loginSite + "'"; // Modified by Sana S on 17/09/2019 [start]
stmt = conn.createStatement(); //sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = '"+loginSite+"'";
rs = stmt.executeQuery(sql); 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()) while (rs.next())
{ {
siteDescr = rs.getString("DESCR"); siteDescr = rs.getString("DESCR");
} }
rs.close();
stmt.close(); // Modified by Sana S on 17/09/2019 [start]
/*rs.close();
stmt.close();*/
if (rs != null)
{
rs.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_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("<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"); valueXmlString.append("<dept_code__fr>").append("00").append("</dept_code__fr>\r\n");
...@@ -113,116 +142,236 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc ...@@ -113,116 +142,236 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
else if (currentColumn.trim().equals("emp_code__fr")) else if (currentColumn.trim().equals("emp_code__fr"))
{ {
String empCode = getColumnValue("emp_code__fr", dom); String empCode = getColumnValue("emp_code__fr", dom);
sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+empCode+"' "; // Modified by Sana S on 17/09/2019 [start]
// sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+empCode+"' ";
stmt = conn.createStatement(); sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = ? ";
rs = stmt.executeQuery(sql); //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()) while (rs.next())
{ {
empFname = rs.getString("EMP_FNAME"); empFname = rs.getString("EMP_FNAME");
empLname = rs.getString("EMP_LNAME"); empLname = rs.getString("EMP_LNAME");
} }
rs.close(); // Modified by Sana S on 17/09/2019 [start]
stmt.close(); /*rs.close();
stmt.close();*/
if (rs != null)
{
rs.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("<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"); 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")) else if (currentColumn.trim().equals("emp_code__to"))
{ {
String empCode = getColumnValue("emp_code__to", dom); String empCode = getColumnValue("emp_code__to", dom);
sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+empCode+"' "; // Modified by Sana S on 17/09/2019 [start]
//sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+empCode+"' ";
stmt = conn.createStatement(); sql = "SELECT EMP_FNAME, EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = ? ";
rs = stmt.executeQuery(sql); //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()) while (rs.next())
{ {
empFname = rs.getString("EMP_FNAME"); empFname = rs.getString("EMP_FNAME");
empLname = rs.getString("EMP_LNAME"); empLname = rs.getString("EMP_LNAME");
} }
rs.close(); // Modified by Sana S on 17/09/2019 [start]
stmt.close(); /*rs.close();
stmt.close();*/
if (rs != null)
{
rs.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("<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"); 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")) else if (currentColumn.trim().equals("dept_code__fr"))
{ {
String deptCode = getColumnValue("dept_code__fr", dom); String deptCode = getColumnValue("dept_code__fr", dom);
sql = "select descr from department where dept_code = '"+deptCode+"' "; // Modified by Sana S on 17/09/2019 [start]
//sql = "select descr from department where dept_code = '"+deptCode+"' ";
stmt = conn.createStatement(); sql = "select descr from department where dept_code = ? ";
rs = stmt.executeQuery(sql); //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()) while (rs.next())
{ {
deptDescr = rs.getString("descr"); deptDescr = rs.getString("descr");
} }
rs.close(); // Modified by Sana S on 17/09/2019 [start]
stmt.close(); /*rs.close();
stmt.close();*/
if (rs != null)
{
rs.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>").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"); 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")) else if (currentColumn.trim().equals("dept_code__to"))
{ {
String deptCode = getColumnValue("dept_code__to", dom); String deptCode = getColumnValue("dept_code__to", dom);
sql = "select descr from department where dept_code = '"+deptCode+"' "; // Modified by Sana S on 17/09/2019 [start]
// sql = "select descr from department where dept_code = '"+deptCode+"' ";
stmt = conn.createStatement(); sql = "select descr from department where dept_code = ? ";
rs = stmt.executeQuery(sql); //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()) while (rs.next())
{ {
deptDescr = rs.getString("descr"); deptDescr = rs.getString("descr");
} }
rs.close(); // Modified by Sana S on 17/09/2019 [start]
stmt.close(); /*rs.close();
stmt.close();*/
if (rs != null)
{
rs.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>").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"); 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")) else if (currentColumn.trim().equals("site_code__fr"))
{ {
String siteCode = getColumnValue("site_code__fr", dom); String siteCode = getColumnValue("site_code__fr", dom);
sql = "select descr from site where site_code = '"+siteCode+"' "; // Modified by Sana S on 17/09/2019 [start]
//sql = "select descr from site where site_code = '"+siteCode+"' ";
stmt = conn.createStatement(); sql = "select descr from site where site_code = ? ";
rs = stmt.executeQuery(sql); //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()) while (rs.next())
{ {
siteDescr = rs.getString("descr"); siteDescr = rs.getString("descr");
} }
rs.close(); // Modified by Sana S on 17/09/2019 [start]
stmt.close(); /*rs.close();
stmt.close();*/
if (rs != null)
{
rs.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>").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"); valueXmlString.append("<site_code_fr_descr>").append(siteDescr == null ? "" : siteDescr).append("</site_code_fr_descr>\r\n");
} }
else if (currentColumn.trim().equals("site_code__to")) else if (currentColumn.trim().equals("site_code__to"))
{ {
String siteCode = getColumnValue("site_code__to", dom); String siteCode = getColumnValue("site_code__to", dom);
sql = "select descr from site where site_code = '"+siteCode+"' "; // Modified by Sana S on 17/09/2019 [start]
// sql = "select descr from site where site_code = '"+siteCode+"' ";
stmt = conn.createStatement(); sql = "select descr from site where site_code = ? ";
rs = stmt.executeQuery(sql); //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()) while (rs.next())
{ {
siteDescr = rs.getString("descr"); siteDescr = rs.getString("descr");
} }
rs.close(); // Modified by Sana S on 17/09/2019 [start]
stmt.close(); /*rs.close();
stmt.close();*/
if (rs != null)
{
rs.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>").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"); valueXmlString.append("<site_code_to_descr>").append(siteDescr == null ? "" : siteDescr).append("</site_code_to_descr>\r\n");
} }
else if(currentColumn.trim().equals("shift_to")) else if(currentColumn.trim().equals("shift_to"))
{ {
String shift = getColumnValue("shift_to", dom); 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)"; // Modified by Sana S on 17/09/2019 [start]
stmt = conn.createStatement(); //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)";
rs = stmt.executeQuery(sql); 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()) while (rs.next())
{ {
shiftDescr = rs.getString("descr"); shiftDescr = rs.getString("descr");
}
// Modified by Sana S on 17/09/2019 [start]
/*rs.close();
stmt.close();*/
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
} }
rs.close(); // Modified by Sana S on 17/09/2019 [end]
stmt.close();
valueXmlString.append("<shift_to>").append(shift == null ? "" : shift).append("</shift_to>\r\n"); 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"); 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 ...@@ -243,10 +392,10 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
rs.close(); rs.close();
rs = null; rs = null;
} }
if (stmt != null) if (pstmt != null)
{ {
stmt.close(); pstmt.close();
stmt = null; pstmt = null;
} }
if (conn != null) if (conn != null)
{ {
...@@ -259,7 +408,6 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc ...@@ -259,7 +408,6 @@ public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProc
throw new ITMException(se); throw new ITMException(se);
} }
} }
return valueXmlString.toString(); 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