Commit c3155e29 authored by gahmad's avatar gahmad

Migrated to EJB3 and added changes of EJB2

java-projects-ejb3/ibase/webitm-adm/ibase/webitm/ejb/adm/ShiftProcess.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91209 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 238cd628
...@@ -3,6 +3,12 @@ ...@@ -3,6 +3,12 @@
*/ */
package ibase.webitm.ejb.adm; package ibase.webitm.ejb.adm;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import ibase.utility.CommonConstants;
import ibase.system.config.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.util.*; import java.util.*;
import java.sql.*; import java.sql.*;
...@@ -10,14 +16,11 @@ import java.text.SimpleDateFormat; ...@@ -10,14 +16,11 @@ import java.text.SimpleDateFormat;
import org.w3c.dom.*; import org.w3c.dom.*;
import javax.ejb.*; import javax.ejb.*;
import javax.naming.InitialContext;
import ibase.webitm.utility.ITMException; @Stateless
import ibase.webitm.ejb.*; //public class ShiftProcessEJB extends ProcessEJB implements SessionBean //Commented By Gulzar - 15/01/10()
import ibase.webitm.utility.GenericUtility; public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftProcessRemote //Added By Gulzar - 15/01/10()
import ibase.utility.CommonConstants;
import ibase.system.config.*;
public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftProcessRemote //SessionBean
{ {
/* UPDATED BY NISAR ON 17/12/07 FOR REQUEST ID : AD7SUN0016 */ /* UPDATED BY NISAR ON 17/12/07 FOR REQUEST ID : AD7SUN0016 */
String sql = null; String sql = null;
...@@ -38,14 +41,19 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -38,14 +41,19 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//InvAllocTrace invallocTrace = new InvAllocTrace(); //InvAllocTrace invallocTrace = new InvAllocTrace();
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
//GenericUtility genericUtility = new GenericUtility(); //COMMENTED BY ALKA 24/07/07 AS GENERIC UTILITY NOT INITIALIASED PROPERLY. //GenericUtility genericUtility = new GenericUtility(); //COMMENTED BY ALKA 24/07/07 AS GENERIC UTILITY NOT INITIALIASED PROPERLY.
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); //Commented and Changes below by Gulzar- 15/01/10
//ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
ITMDBAccessLocal itmDBAccessLocal = null;
InitialContext ctx = null;
CommonConstants commonConstants = new CommonConstants(); CommonConstants commonConstants = new CommonConstants();
String chgUser = null; String chgUser = null;
String chgTerm = null; String chgTerm = null;
/*
/*--Commented by Gulzar- 15/01/10 for ejb3
public void ejbCreate() throws RemoteException, CreateException public void ejbCreate() throws RemoteException, CreateException
{ {
try try
...@@ -68,8 +76,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -68,8 +76,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
public void ejbPassivate() public void ejbPassivate()
{ {
}*/ }
*/
//End Commented by Gulzar - 15/01/10
public String process() throws RemoteException,ITMException public String process() throws RemoteException,ITMException
{ {
return ""; return "";
...@@ -82,6 +91,18 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -82,6 +91,18 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
Document detailDom = null; Document detailDom = null;
String userId = ""; String userId = "";
try try
{
if ( itmDBAccessLocal == null )
{
ctx = getInitialContext();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" );
}
}
catch (Exception e)
{
e.printStackTrace();
}
try
{ {
System.out.println("xtraParams :: " + xtraParams); System.out.println("xtraParams :: " + xtraParams);
System.out.println("xmlString2 :: " + xmlString2); System.out.println("xmlString2 :: " + xmlString2);
...@@ -111,7 +132,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -111,7 +132,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
catch (Exception e) catch (Exception e)
{ {
System.out.println("Exception :ShiftProcessEJB : process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":"); System.out.println("Exception :ShiftProcessEJB : process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
rtrStr = itmDBAccessEJB.getErrorString("","VTPROUNSUC",userId); //rtrStr = itmDBAccessEJB.getErrorString("","VTPROUNSUC",userId);//commented by Gulzar for ejb3 - 15/01/10
rtrStr = itmDBAccessLocal.getErrorString("","VTPROUNSUC",userId); //Added by Gulzar for ejb3 - 15/01/10
//throw new ITMException(e); //throw new ITMException(e);
} }
return rtrStr; return rtrStr;
...@@ -152,6 +174,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -152,6 +174,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
String resultString = ""; String resultString = "";
String dayslist1 = ""; String dayslist1 = "";
String dayslist2 = ""; String dayslist2 = "";
java.util.Date currDate = null; java.util.Date currDate = null;
java.sql.Date procDate = null; java.sql.Date procDate = null;
java.sql.Date startDate = null; java.sql.Date startDate = null;
...@@ -190,6 +213,11 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -190,6 +213,11 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
int shiftIndexTo = 0;//Added by Jaimin on 16/06/2008 (AD89SUN014) int shiftIndexTo = 0;//Added by Jaimin on 16/06/2008 (AD89SUN014)
try try
{ {
if ( itmDBAccessLocal == null )
{
ctx = getInitialContext();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" );
}
connDriver = new ConnDriver(); connDriver = new ConnDriver();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat());
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
...@@ -259,6 +287,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -259,6 +287,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{ {
siteCodeTo = "ZZ"; siteCodeTo = "ZZ";
} }
patternCodeFilt = genericUtility.getColumnValue("pattern_code",headerDom); patternCodeFilt = genericUtility.getColumnValue("pattern_code",headerDom);
fromDate = genericUtility.getColumnValue("date__fr",headerDom); fromDate = genericUtility.getColumnValue("date__fr",headerDom);
System.out.println(" From Date [" +fromDate+"]"); System.out.println(" From Date [" +fromDate+"]");
...@@ -353,8 +382,13 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -353,8 +382,13 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pStmt = null; pStmt = null;
int noOfEmp = empList.size(); int noOfEmp = empList.size();
System.out.println("noOfEmp..........::"+noOfEmp);
//while( rsn1.next() ) //while( rsn1.next() )
//Commented and Changes below - Gulzar - 17/09/09 - Date is incremented by using Calendar
//java.sql.Date toSqlDate1 = new java.sql.Date(toSqlDate.getTime()+(24*60*60*1000)); //Gulzar - 06/08/09
java.sql.Date toSqlDate1 = getNextDate( toSqlDate );
//End Changes - Gulzar - 17/09/09
for( int noOfEmpCnt = 0; noOfEmpCnt < noOfEmp; noOfEmpCnt++ ) for( int noOfEmpCnt = 0; noOfEmpCnt < noOfEmp; noOfEmpCnt++ )
{ {
holiTblNo = null; holiTblNo = null;
...@@ -402,6 +436,33 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -402,6 +436,33 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtn1=null; pstmtn1=null;
*/ */
//end commented by msalam on 170308 as all the information is coming in getdatasql Query //end commented by msalam on 170308 as all the information is coming in getdatasql Query
//Added - Gulzar - 05/08/09
/*
if ( transType != null && "W".equalsIgnoreCase(transType.trim()) )
{
java.sql.Date frSqlDateTemp = frSqlDate;
frSqlDate = new java.sql.Date(frSqlDate.getTime()+(24*60*60*1000));
sql = "UPDATE WORK_SHIFT SET TO_DT = ? "+
"WHERE EMP_CODE = '"+emp+"' "+
"AND FROM_DT < ? AND TO_DT > = ? ";
System.out.println("sql :"+sql);
pstmtn2 = conn.prepareStatement(sql);
pstmtn2.setDate(1,frSqlDateTemp);
pstmtn2.setDate(2,frSqlDate);
pstmtn2.setDate(3,frSqlDate);
upd = pstmtn2.executeUpdate();
System.out.println("Update Count ["+upd+"]");
if ( upd > 0 )
{
System.out.println("Update into WORK_SHIFT Successfully ["+upd+"]");
}
pstmtn2.close();
pstmtn2 = null;
}
//End Added - Gulzar - 05/08/09
*/
sql = "DELETE FROM WORK_SHIFT WHERE EMP_CODE = ? " sql = "DELETE FROM WORK_SHIFT WHERE EMP_CODE = ? "
+"AND FROM_DT BETWEEN ? AND ? " +"AND FROM_DT BETWEEN ? AND ? "
+"AND TO_DT BETWEEN ? AND ? "; +"AND TO_DT BETWEEN ? AND ? ";
...@@ -416,9 +477,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -416,9 +477,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtn2.setDate(4,frSqlDate); pstmtn2.setDate(4,frSqlDate);
pstmtn2.setDate(5,toSqlDate); pstmtn2.setDate(5,toSqlDate);
upd = pstmtn2.executeUpdate(); upd = pstmtn2.executeUpdate();
System.out.println("No Of record deleted fromWORK_SHIFT ["+upd+"]"); System.out.println("No Of record deleted from WORK_SHIFT ["+upd+"]");
pstmtn2.close(); pstmtn2.close();
pstmtn2=null; pstmtn2 = null;
//commented by msalam on 170308 as all the information is coming in getdatasql Query //commented by msalam on 170308 as all the information is coming in getdatasql Query
//no need of this as it can be put in outer query //no need of this as it can be put in outer query
...@@ -472,7 +533,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -472,7 +533,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
" CASE WHEN SHIFT_INDEX__FR IS NULL THEN 0 ELSE SHIFT_INDEX__FR END AS SHIFT_INDEX__FR, "+ " CASE WHEN SHIFT_INDEX__FR IS NULL THEN 0 ELSE SHIFT_INDEX__FR END AS SHIFT_INDEX__FR, "+
" CASE WHEN SHIFT_INDEX__TO IS NULL THEN 0 ELSE SHIFT_INDEX__TO END AS SHIFT_INDEX__TO "+ " CASE WHEN SHIFT_INDEX__TO IS NULL THEN 0 ELSE SHIFT_INDEX__TO END AS SHIFT_INDEX__TO "+
" FROM EMP_EMPLOY_EVENTS WHERE EMP_CODE = '"+emp+"' "+ " FROM EMP_EMPLOY_EVENTS WHERE EMP_CODE = '"+emp+"' "+
"AND EFF_DATE BETWEEN ? AND ? ORDER BY EFF_DATE"; //Sql modify by jaimin on 16/06/2008 (AD89SUN014) " AND EFF_DATE BETWEEN ? AND ? ORDER BY EFF_DATE"; //Sql modify by jaimin on 16/06/2008 (AD89SUN014)
System.out.print("EMP_EMPLOY_EVENTS[sql] :: " + sql); System.out.print("EMP_EMPLOY_EVENTS[sql] :: " + sql);
System.out.print("Parameters 1:: [" + frSqlDate+"]"); System.out.print("Parameters 1:: [" + frSqlDate+"]");
System.out.print("Parameters 2:: [" + toSqlDate+"]"); System.out.print("Parameters 2:: [" + toSqlDate+"]");
...@@ -532,7 +593,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -532,7 +593,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
lastShiftIndexStr = shiftIndexTo+""; //Added by jaimin on 16/06/2008 (AD89SUN014) lastShiftIndexStr = shiftIndexTo+""; //Added by jaimin on 16/06/2008 (AD89SUN014)
} }
} }
edShiftDate = new java.sql.Date(edShiftDate.getTime()+(24*60*60*1000)); //Commented and Changes below - Gulzar - 17/09/09 - Date is incremented by using Calendar
//edShiftDate = new java.sql.Date(edShiftDate.getTime()+(24*60*60*1000));
edShiftDate = getNextDate( edShiftDate );
//End Changes Gulzar - 17/09/09
System.out.println("After Adding 1 to edShiftDate ["+edShiftDate+"]"); System.out.println("After Adding 1 to edShiftDate ["+edShiftDate+"]");
} }
} }
...@@ -571,7 +635,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -571,7 +635,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtn4=null; pstmtn4=null;
System.out.println("At 420 Pattern Code -lastPatternCodeStr -::"+lastPatternCodeStr); System.out.println("At 420 Pattern Code -lastPatternCodeStr -::"+lastPatternCodeStr);
} }
toSqlDate = new java.sql.Date(toSqlDate.getTime()+(24*60*60*1000)); //toSqlDate = new java.sql.Date(toSqlDate.getTime()+(24*60*60*1000)); //Gulzar - 19/06/09
if(lastPatternCodeStr == null || lastPatternCodeStr.trim().length() == 0) if(lastPatternCodeStr == null || lastPatternCodeStr.trim().length() == 0)
{ {
lastPatternCodeStr = patternCode; lastPatternCodeStr = patternCode;
...@@ -586,7 +650,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -586,7 +650,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//End Addition - Jaimin - 16/06/2008 - (AD89SUN014) //End Addition - Jaimin - 16/06/2008 - (AD89SUN014)
//errString = insertUpdateWorkShift(empInfo, emp, stShiftDate, toSqlDate, lastPatternCodeStr, lastPatternCodeStr,holiTblNo ,conn);//Commented by jaimin on 16/06/2008 (AD89SUN014) //errString = insertUpdateWorkShift(empInfo, emp, stShiftDate, toSqlDate, lastPatternCodeStr, lastPatternCodeStr,holiTblNo ,conn);//Commented by jaimin on 16/06/2008 (AD89SUN014)
errString = insertUpdateWorkShift(empInfo, emp, stShiftDate, toSqlDate, lastPatternCodeStr, lastPatternCodeStr,holiTblNo ,Integer.parseInt(lastShiftIndexStr),conn);//Added by jaimin on 16/06/2008 (AD89SUN014) errString = insertUpdateWorkShift(empInfo, emp, stShiftDate, toSqlDate1, lastPatternCodeStr, lastPatternCodeStr,holiTblNo ,Integer.parseInt(lastShiftIndexStr),conn);//Added by jaimin on 16/06/2008 (AD89SUN014)
if(errString.length() > 0) if(errString.length() > 0)
{ {
...@@ -612,7 +676,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -612,7 +676,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
if (cnt == 0) if (cnt == 0)
{ {
System.out.println("Record not found for process ........"); System.out.println("Record not found for process ........");
errString = itmDBAccessEJB.getErrorString("","VTRDNTFD","","",conn); //errString = itmDBAccessEJB.getErrorString("","VTRDNTFD","","",conn);//commented by Gulzar for ejb3 - 15/01/10
errString = itmDBAccessLocal.getErrorString("","VTRDNTFD","","",conn);//Added by Gulzar for ejb3 - 15/01/10
return errString; return errString;
} }
else else
...@@ -652,21 +717,20 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -652,21 +717,20 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{ {
try try
{ {
if(pstmtn1!=null)
{
pstmtn1.close();
pstmtn1=null;
}
if(pstmtn3!=null)
{
pstmtn3.close();
pstmtn3=null;
}
if(conn != null) if(conn != null)
{ {
conn.close(); conn.close();
conn = null; conn = null;
if(pstmtn1!=null)
{
pstmtn1.close();
pstmtn1=null;
}
if(pstmtn3!=null)
{
pstmtn3.close();
pstmtn3=null;
}
} }
} }
catch(Exception e) catch(Exception e)
...@@ -706,10 +770,17 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -706,10 +770,17 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.util.Date joiningDate = null; java.util.Date joiningDate = null;
try{ try{
if ( itmDBAccessLocal == null )
{
ctx = getInitialContext();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" );
}
stmt = conn.createStatement(); stmt = conn.createStatement();
if(frpatternCode == null) if(frpatternCode == null)
{ {
errString = itmDBAccessEJB.getErrorString("","VTPATTERNU",""); //errString = itmDBAccessEJB.getErrorString("","VTPATTERNU","");//commented by Gulzar for ejb3 - 15/01/10
errString = itmDBAccessLocal.getErrorString("","VTPATTERNU","");//Added by Gulzar for ejb3 - 15/01/10
return errString ; return errString ;
} }
sql = "SELECT SHIFT_PATTERN,START_DATE,NO_OF_DAYS FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+frpatternCode+"'"; sql = "SELECT SHIFT_PATTERN,START_DATE,NO_OF_DAYS FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+frpatternCode+"'";
...@@ -737,7 +808,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -737,7 +808,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.sql.Date shiftStDate2 = shiftStDate; java.sql.Date shiftStDate2 = shiftStDate;
System.out.println("shiftStDate2 : " + shiftStDate2 + " shiftEndDate : " + shiftEndDate); System.out.println("shiftStDate2 : " + shiftStDate2 + " shiftEndDate : " + shiftEndDate);
while( shiftStDate2.compareTo( shiftEndDate ) < 0) while( shiftStDate2.compareTo( shiftEndDate ) < 0 )
{ {
shiftOfDate = null; shiftOfDate = null;
//Updated by nisar on 21/02/06 //Updated by nisar on 21/02/06
...@@ -746,11 +817,12 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -746,11 +817,12 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//added by msalam on 25/02/08 for inserting record of Holiday type W //added by msalam on 25/02/08 for inserting record of Holiday type W
String holidayType = null; String holidayType = null;
//getHolidayTypeForDate( java.util.Date shiftDate, String holiTblNo, Connection conn) //getHolidayTypeForDate( java.util.Date shiftDate, String holiTblNo, Connection conn)
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
//added by msalam on 25/02/08 for inserting record of Holiday type W //added by msalam on 25/02/08 for inserting record of Holiday type W
//next line commented and modified line added by msalam on 25/02/08 //next line commented and modified line added by msalam on 25/02/08
//while(isHolidayForType(shiftStDate2, 'H', holiTblNo,conn)) //while(isHolidayForType(shiftStDate2, 'H', holiTblNo,conn))
/*-- Commented by Gulzar to ignore holiday and considered as normal day - 24/11/09 (AD89SUN117)
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
while( isHolidayForType(shiftStDate2, holidayType, holiTblNo,conn) && shiftStDate2.compareTo( toPrdDate ) <= 0 ) while( isHolidayForType(shiftStDate2, holidayType, holiTblNo,conn) && shiftStDate2.compareTo( toPrdDate ) <= 0 )
{ {
//added by nisar on 17/12/07 for requestId : AD7SUN0016 //added by nisar on 17/12/07 for requestId : AD7SUN0016
...@@ -764,8 +836,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -764,8 +836,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("shiftStDate2 :: " + shiftStDate2); System.out.println("shiftStDate2 :: " + shiftStDate2);
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn ); holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
} }
*/
//End Changes by Gulzar - 24/11/09 (AD89SUN117)
if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 )) if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 ))
{ {
System.out.println("In Continue.."); System.out.println("In Continue..");
continue; continue;
...@@ -873,8 +947,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -873,8 +947,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
stDate = new java.sql.Date( stDate.getTime() + ( 24 * 60 * 60 * 1000 )); stDate = new java.sql.Date( stDate.getTime() + ( 24 * 60 * 60 * 1000 ));
} }
*/ */
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
java.sql.Date previousDate = stDate; java.sql.Date previousDate = stDate;
/*-- Commented by Gulzar to ignore holiday and considered as normal day - 24/11/09 (AD89SUN117)
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
while( isHolidayForType( stDate, holidayType, holiTblNo,conn ) && stDate.compareTo( toPrdDate ) <= 0 ) while( isHolidayForType( stDate, holidayType, holiTblNo,conn ) && stDate.compareTo( toPrdDate ) <= 0 )
{ {
System.out.println( "From 839" ); System.out.println( "From 839" );
...@@ -884,6 +959,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -884,6 +959,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("stDate :: " + stDate); System.out.println("stDate :: " + stDate);
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn ); holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
} }
*/
//End Changes - Gulzar - 24/11/09
//end by msalam on 250208 //end by msalam on 250208
shiftOfDate = stDate; shiftOfDate = stDate;
...@@ -952,9 +1029,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -952,9 +1029,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
shiftOfDate = new java.sql.Date(shiftOfDate.getTime()+(24*60*60*1000)); shiftOfDate = new java.sql.Date(shiftOfDate.getTime()+(24*60*60*1000));
} }
*/ */
holidayType = getHolidayTypeForDate( (java.util.Date)shiftOfDate, holiTblNo, conn );
java.util.Date tempShiftOfDate = shiftOfDate; java.util.Date tempShiftOfDate = shiftOfDate;
java.util.Date previousDate = tempShiftOfDate; java.util.Date previousDate = tempShiftOfDate;
/*-- Commented by Gulzar to ignore holiday and considered as normal day - 24/11/09 (AD89SUN117)
holidayType = getHolidayTypeForDate( (java.util.Date)shiftOfDate, holiTblNo, conn );
while( isHolidayForType( tempShiftOfDate, holidayType, holiTblNo,conn ) ) while( isHolidayForType( tempShiftOfDate, holidayType, holiTblNo,conn ) )
{ {
System.out.println( "From 917" ); System.out.println( "From 917" );
...@@ -966,6 +1044,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -966,6 +1044,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println( "In isHolidayForType at 912 tempShiftOfDate :: " + tempShiftOfDate ); System.out.println( "In isHolidayForType at 912 tempShiftOfDate :: " + tempShiftOfDate );
holidayType = getHolidayTypeForDate( tempShiftOfDate, holiTblNo, conn ); holidayType = getHolidayTypeForDate( tempShiftOfDate, holiTblNo, conn );
} }
*/
//End Changes by Gulzar - 24/11/09 (AD89SUN117)
//end by msalam on 250208 //end by msalam on 250208
//shiftOfDate = shiftOfDate1; //shiftOfDate = shiftOfDate1;
...@@ -982,7 +1062,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -982,7 +1062,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtn6.setDate(1, shiftStDate); pstmtn6.setDate(1, shiftStDate);
//pstmtn6.setDate(2, shiftStDate2);//ADDED EXTRA PARAMETER LINE BY DURGA 02/04/07 //pstmtn6.setDate(2, shiftStDate2);//ADDED EXTRA PARAMETER LINE BY DURGA 02/04/07
System.out.println("Sql At 939 :: " + sql); System.out.println("Sql At 1018 :: " + sql);
System.out.println("PARAMETER IN UPDATE QUERY FROM_DT "+shiftStDate+"\n"); System.out.println("PARAMETER IN UPDATE QUERY FROM_DT "+shiftStDate+"\n");
System.out.println("PARAMETER IN UPDATE QUERY SHIFT "+shift+"\n"); System.out.println("PARAMETER IN UPDATE QUERY SHIFT "+shift+"\n");
System.out.println("PARAMETER IN UPDATE QUERY EMP_CODE "+empCode+"\n"); System.out.println("PARAMETER IN UPDATE QUERY EMP_CODE "+empCode+"\n");
...@@ -1053,7 +1133,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1053,7 +1133,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
if(stDate != null && stDate.compareTo(shiftStDate) > 0) if(stDate != null && stDate.compareTo(shiftStDate) > 0)
{ {
System.out.println("Pattern is not Valid for the Processing Month........"); System.out.println("Pattern is not Valid for the Processing Month........");
errString = itmDBAccessEJB.getErrorString("","VTINVPATRN","","",conn); //errString = itmDBAccessEJB.getErrorString("","VTINVPATRN","","",conn);//commented by Gulzar for ejb3 - 15/01/10
errString = itmDBAccessLocal.getErrorString("","VTINVPATRN","","",conn);//Added by Gulzar for ejb3 - 15/01/10
conn.rollback(); conn.rollback();
return errString; return errString;
} }
...@@ -1112,6 +1193,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1112,6 +1193,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//start - Overload - function added by jaimin on 16/06/2008 (AD89SUN014) //start - Overload - function added by jaimin on 16/06/2008 (AD89SUN014)
private String insertUpdateWorkShift(EmpInfo empInfo, String empCode, java.sql.Date shiftStDate, java.sql.Date shiftEndDate, String frpatternCode, String topatterenCode, String holiTblNo,int shiftIndexNew, Connection conn) throws Exception private String insertUpdateWorkShift(EmpInfo empInfo, String empCode, java.sql.Date shiftStDate, java.sql.Date shiftEndDate, String frpatternCode, String topatterenCode, String holiTblNo,int shiftIndexNew, Connection conn) throws Exception
{ {
System.out.println("insertUpdateWorkShift is called...............");
String insertSql ="",updateSql = "",errString = ""; String insertSql ="",updateSql = "",errString = "";
PreparedStatement pstmtn5 = null,pstmtn6=null,pstmtInsert = null,pstmtUpdate = null; PreparedStatement pstmtn5 = null,pstmtn6=null,pstmtInsert = null,pstmtUpdate = null;
PreparedStatement pstmtEmp = null; PreparedStatement pstmtEmp = null;
...@@ -1128,10 +1210,16 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1128,10 +1210,16 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.util.Date joiningDate = null; java.util.Date joiningDate = null;
try{ try{
if ( itmDBAccessLocal == null )
{
ctx = getInitialContext();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" );
}
stmt = conn.createStatement(); stmt = conn.createStatement();
if(frpatternCode == null) if(frpatternCode == null)
{ {
errString = itmDBAccessEJB.getErrorString("","VTPATTERNU",""); //errString = itmDBAccessEJB.getErrorString("","VTPATTERNU","");//commented by Gulzar for ejb3 - 15/01/10
errString = itmDBAccessLocal.getErrorString("","VTPATTERNU","");//Added by Gulzar for ejb3 - 15/01/10
return errString ; return errString ;
} }
sql = "SELECT SHIFT_PATTERN,START_DATE,NO_OF_DAYS FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+frpatternCode+"'"; sql = "SELECT SHIFT_PATTERN,START_DATE,NO_OF_DAYS FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+frpatternCode+"'";
...@@ -1159,7 +1247,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1159,7 +1247,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.sql.Date shiftStDate2 = shiftStDate; java.sql.Date shiftStDate2 = shiftStDate;
System.out.println("shiftStDate2 : " + shiftStDate2 + " shiftEndDate : " + shiftEndDate); System.out.println("shiftStDate2 : " + shiftStDate2 + " shiftEndDate : " + shiftEndDate);
while( shiftStDate2.compareTo( shiftEndDate ) < 0) while( shiftStDate2.compareTo( shiftEndDate ) < 0 )
{ {
shiftOfDate = null; shiftOfDate = null;
//Updated by nisar on 21/02/06 //Updated by nisar on 21/02/06
...@@ -1168,11 +1256,12 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1168,11 +1256,12 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//added by msalam on 25/02/08 for inserting record of Holiday type W //added by msalam on 25/02/08 for inserting record of Holiday type W
String holidayType = null; String holidayType = null;
//getHolidayTypeForDate( java.util.Date shiftDate, String holiTblNo, Connection conn) //getHolidayTypeForDate( java.util.Date shiftDate, String holiTblNo, Connection conn)
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
//added by msalam on 25/02/08 for inserting record of Holiday type W //added by msalam on 25/02/08 for inserting record of Holiday type W
//next line commented and modified line added by msalam on 25/02/08 //next line commented and modified line added by msalam on 25/02/08
//while(isHolidayForType(shiftStDate2, 'H', holiTblNo,conn)) //while(isHolidayForType(shiftStDate2, 'H', holiTblNo,conn))
/*-- Commented by Gulzar to ignore holiday and considered as normal day - 24/11/09 (AD89SUN117)
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
while( isHolidayForType(shiftStDate2, holidayType, holiTblNo,conn) && shiftStDate2.compareTo( toPrdDate ) <= 0 ) while( isHolidayForType(shiftStDate2, holidayType, holiTblNo,conn) && shiftStDate2.compareTo( toPrdDate ) <= 0 )
{ {
//added by nisar on 17/12/07 for requestId : AD7SUN0016 //added by nisar on 17/12/07 for requestId : AD7SUN0016
...@@ -1182,10 +1271,15 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1182,10 +1271,15 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
insertIntoWorkShiftForHoliday( empCode, shiftStDate, shiftStDate2, holidayType, frpatternCode, conn ); insertIntoWorkShiftForHoliday( empCode, shiftStDate, shiftStDate2, holidayType, frpatternCode, conn );
//code ended by nisar on 17/12/07 for requestId : AD7SUN0016 //code ended by nisar on 17/12/07 for requestId : AD7SUN0016
shiftStDate = shiftStDate2; shiftStDate = shiftStDate2;
shiftStDate2 = new java.sql.Date(shiftStDate2.getTime()+(24*60*60*1000)); //Commented and Changes below - Gulzar - 17/09/09 - Date is incremented by using Calendar
//shiftStDate2 = new java.sql.Date(shiftStDate2.getTime()+(24*60*60*1000));
shiftStDate2 = getNextDate( shiftStDate2 );
//End Changes - Gulzar - 17/09/09
System.out.println("shiftStDate2 :: " + shiftStDate2); System.out.println("shiftStDate2 :: " + shiftStDate2);
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn ); holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
} }
*/
//End changes - Gulzar - 24/11/09
if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 )) if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 ))
{ {
...@@ -1274,7 +1368,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1274,7 +1368,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
shift = getActualshift(shiftStDate2,frpatternCode,shiftPattern,stDate,noOfDays); shift = getActualshift(shiftStDate2,frpatternCode,shiftPattern,stDate,noOfDays);
System.out.println("At 612 Shift:: " + shift); System.out.println("At 612 Shift:: " + shift);
} }
else if(!shiftDateNewString.equalsIgnoreCase("NULLFOUND")&& shiftDateNewString.trim().length()!=0) else if(!shiftDateNewString.equalsIgnoreCase("NULLFOUND") && shiftDateNewString.trim().length()!=0)
{ {
System.out.println("At 615 "); System.out.println("At 615 ");
if( shiftOfDate == null ) if( shiftOfDate == null )
...@@ -1296,17 +1390,23 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1296,17 +1390,23 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
stDate = new java.sql.Date( stDate.getTime() + ( 24 * 60 * 60 * 1000 )); stDate = new java.sql.Date( stDate.getTime() + ( 24 * 60 * 60 * 1000 ));
} }
*/ */
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
java.sql.Date previousDate = stDate; java.sql.Date previousDate = stDate;
/*-- Commented by Gulzar to ignore holiday and considered as normal day - 24/11/09 (AD89SUN117)
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
while( isHolidayForType( stDate, holidayType, holiTblNo,conn ) && stDate.compareTo( toPrdDate ) <= 0 ) while( isHolidayForType( stDate, holidayType, holiTblNo,conn ) && stDate.compareTo( toPrdDate ) <= 0 )
{ {
System.out.println( "From 839" ); System.out.println( "From 839" );
insertIntoWorkShiftForHoliday( empCode, previousDate, stDate, holidayType, frpatternCode, conn ); insertIntoWorkShiftForHoliday( empCode, previousDate, stDate, holidayType, frpatternCode, conn );
previousDate = stDate; previousDate = stDate;
stDate = new java.sql.Date( stDate.getTime() + ( 24*60*60*1000 ) ); //Commented and Changes below - Gulzar - 17/09/09 - Date is incremented by using Calendar
//stDate = new java.sql.Date( stDate.getTime() + ( 24*60*60*1000 ) );
stDate = getNextDate( stDate );
//End changes Gulzar - 17/09/09
System.out.println("stDate :: " + stDate); System.out.println("stDate :: " + stDate);
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn ); holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
} }
*/
//End Changes by Gulzar - 24/11/09 (AD89SUN117)
//end by msalam on 250208 //end by msalam on 250208
shiftOfDate = stDate; shiftOfDate = stDate;
...@@ -1375,20 +1475,28 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1375,20 +1475,28 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
shiftOfDate = new java.sql.Date(shiftOfDate.getTime()+(24*60*60*1000)); shiftOfDate = new java.sql.Date(shiftOfDate.getTime()+(24*60*60*1000));
} }
*/ */
holidayType = getHolidayTypeForDate( (java.util.Date)shiftOfDate, holiTblNo, conn );
java.util.Date tempShiftOfDate = shiftOfDate; java.util.Date tempShiftOfDate = shiftOfDate;
java.util.Date previousDate = tempShiftOfDate; java.util.Date previousDate = tempShiftOfDate;
/*-- Commented by Gulzar to ignore holiday and considered as normal day - 24/11/09 (AD89SUN117)
holidayType = getHolidayTypeForDate( (java.util.Date)shiftOfDate, holiTblNo, conn );
while( isHolidayForType( tempShiftOfDate, holidayType, holiTblNo,conn ) ) while( isHolidayForType( tempShiftOfDate, holidayType, holiTblNo,conn ) )
{ {
System.out.println( "From 917" ); System.out.println( "From 917" );
insertIntoWorkShiftForHoliday( empCode, ( new java.sql.Date( previousDate.getTime() ) ), insertIntoWorkShiftForHoliday( empCode, ( new java.sql.Date( previousDate.getTime() ) ),
( new java.sql.Date( tempShiftOfDate.getTime() ) ), holidayType, frpatternCode, conn ); ( new java.sql.Date( tempShiftOfDate.getTime() ) ), holidayType, frpatternCode, conn );
stDate = new java.sql.Date(shiftOfDate.getTime()+(24*60*60*1000)); //Commented and Changes below - Gulzar - 17/09/09 - Date is incremented by using Calendar
//stDate = new java.sql.Date(shiftOfDate.getTime()+(24*60*60*1000));
stDate = getNextDate( new java.sql.Date( shiftOfDate.getTime() ) );
previousDate = tempShiftOfDate; previousDate = tempShiftOfDate;
tempShiftOfDate = new java.sql.Date(tempShiftOfDate.getTime()+(24*60*60*1000)); //tempShiftOfDate = new java.sql.Date(tempShiftOfDate.getTime()+(24*60*60*1000));
java.sql.Date sDate1 = getNextDate( new java.sql.Date( tempShiftOfDate.getTime() ) );
tempShiftOfDate = new java.util.Date( sDate1.getTime() );
//End Changes - Gulzar - 17/09/09
System.out.println( "In isHolidayForType at 912 tempShiftOfDate :: " + tempShiftOfDate ); System.out.println( "In isHolidayForType at 912 tempShiftOfDate :: " + tempShiftOfDate );
holidayType = getHolidayTypeForDate( tempShiftOfDate, holiTblNo, conn ); holidayType = getHolidayTypeForDate( tempShiftOfDate, holiTblNo, conn );
} }
*/
//End Changes by Gulzar - 24/11/09 (AD89SUN117)
//end by msalam on 250208 //end by msalam on 250208
//shiftOfDate = shiftOfDate1; //shiftOfDate = shiftOfDate1;
...@@ -1405,7 +1513,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1405,7 +1513,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtn6.setDate(1, shiftStDate); pstmtn6.setDate(1, shiftStDate);
//pstmtn6.setDate(2, shiftStDate2);//ADDED EXTRA PARAMETER LINE BY DURGA 02/04/07 //pstmtn6.setDate(2, shiftStDate2);//ADDED EXTRA PARAMETER LINE BY DURGA 02/04/07
System.out.println("Sql At 939 :: " + sql); System.out.println("Sql At 1444 :: " + sql);
System.out.println("PARAMETER IN UPDATE QUERY FROM_DT "+shiftStDate+"\n"); System.out.println("PARAMETER IN UPDATE QUERY FROM_DT "+shiftStDate+"\n");
System.out.println("PARAMETER IN UPDATE QUERY SHIFT "+shift+"\n"); System.out.println("PARAMETER IN UPDATE QUERY SHIFT "+shift+"\n");
System.out.println("PARAMETER IN UPDATE QUERY EMP_CODE "+empCode+"\n"); System.out.println("PARAMETER IN UPDATE QUERY EMP_CODE "+empCode+"\n");
...@@ -1466,9 +1574,16 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1466,9 +1574,16 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtUpdate.close(); pstmtUpdate.close();
pstmtUpdate=null; pstmtUpdate=null;
} }
shiftStDate2 = new java.sql.Date(shiftStDate2.getTime()+(24*60*60*1000)); //Commented and Changes below - Gulzar - 17/09/09
System.gc(); //shiftStDate2 = new java.sql.Date(shiftStDate2.getTime()+(24*60*60*1000)); //Gulzar - 17/09/09
{
System.out.println("Before Incrementing shiftStDate2 by one day.........::"+shiftStDate2);
shiftStDate2 = getNextDate( shiftStDate2 ); //Gulzar - 17/09/09
System.out.println("After incremented shiftStDate2 by one day....::"+shiftStDate2);
}
//System.gc();
//End Changes Gulzar - 17/09/09
}//end of while }//end of while
//pstmtn5.close(); //pstmtn5.close();
...@@ -1476,7 +1591,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1476,7 +1591,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
if(stDate != null && stDate.compareTo(shiftStDate) > 0) if(stDate != null && stDate.compareTo(shiftStDate) > 0)
{ {
System.out.println("Pattern is not Valid for the Processing Month........"); System.out.println("Pattern is not Valid for the Processing Month........");
errString = itmDBAccessEJB.getErrorString("","VTINVPATRN","","",conn); //errString = itmDBAccessEJB.getErrorString("","VTINVPATRN","","",conn);//commented by Gulzar for ejb3 - 15/01/10
errString = itmDBAccessLocal.getErrorString("","VTINVPATRN","","",conn);//Added by Gulzar for ejb3 - 15/01/10
conn.rollback(); conn.rollback();
return errString; return errString;
} }
...@@ -1769,7 +1885,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1769,7 +1885,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; int cnt = 0; ResultSet rs = null; int cnt = 0;
System.out.println("Shift date isHoliday :: " + shiftDate); System.out.println("Shift date isHoliday :: " + shiftDate);
System.out.println("Hol Tupe in isHoliday :: " + holidayType); System.out.println("Hol Type in isHoliday :: " + holidayType);
try{ try{
sqlStr = "select count(*) from holiday where Hol_Date = ? and Hol_Type = '" + holidayType + "' and HOL_TBLNO ='"+holiTblNo+"'"; sqlStr = "select count(*) from holiday where Hol_Date = ? and Hol_Type = '" + holidayType + "' and HOL_TBLNO ='"+holiTblNo+"'";
stmt = conn.prepareStatement(sqlStr); stmt = conn.prepareStatement(sqlStr);
...@@ -1793,10 +1909,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1793,10 +1909,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
try try
{ {
if(rs!=null) if(rs!=null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if(stmt != null) if(stmt != null)
{ {
stmt.close(); stmt.close();
...@@ -1896,21 +2012,30 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1896,21 +2012,30 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtUpdate.close(); pstmtUpdate.close();
pstmtUpdate=null; pstmtUpdate=null;
} }
if(pstmtInsert!=null)
{
pstmtInsert.close();
pstmtInsert=null;
}
if(pstmtUpdate!=null)
{
pstmtUpdate.close();
pstmtUpdate=null;
}
} }
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
finally
{
try
{
if(pstmtInsert!=null)
{
pstmtInsert.close();
pstmtInsert=null;
}
if(pstmtUpdate!=null)
{
pstmtUpdate.close();
pstmtUpdate=null;
}
}
catch (Exception e1)
{
}
}
}//end of insertIntoWorkShiftForHoliday()//added by nisar on 17/12/07 }//end of insertIntoWorkShiftForHoliday()//added by nisar on 17/12/07
//ADDED BY MSALAM ON 250208 TO GET HOLIDAY DAY TYPE //ADDED BY MSALAM ON 250208 TO GET HOLIDAY DAY TYPE
private String getHolidayTypeForDate( java.util.Date shiftDate, String holiTblNo, Connection conn) private String getHolidayTypeForDate( java.util.Date shiftDate, String holiTblNo, Connection conn)
...@@ -1920,7 +2045,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1920,7 +2045,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
String holType = null; String holType = null;
System.out.println("Holiday tyoe for date :: " + shiftDate); System.out.println("Holiday type for date :: " + shiftDate);
try{ try{
//sqlStr = "select Hol_Type from holiday where Hol_Date = ? and HOL_TBLNO ='" + holiTblNo + "'";//Commentd by jaimin on 17/06/2008 (AD89SUN016) //sqlStr = "select Hol_Type from holiday where Hol_Date = ? and HOL_TBLNO ='" + holiTblNo + "'";//Commentd by jaimin on 17/06/2008 (AD89SUN016)
sqlStr = "select Hol_Type from holiday where Hol_Date = ? and HOL_TBLNO ='" + holiTblNo + "' and HOL_TYPE <> 'W' "; //Added by jaimin on 17/06/2008 (AD89SUN016) sqlStr = "select Hol_Type from holiday where Hol_Date = ? and HOL_TBLNO ='" + holiTblNo + "' and HOL_TYPE <> 'W' "; //Added by jaimin on 17/06/2008 (AD89SUN016)
...@@ -1947,10 +2072,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1947,10 +2072,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
try try
{ {
if(rs!=null) if(rs!=null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if(stmt != null) if(stmt != null)
{ {
stmt.close(); stmt.close();
...@@ -1978,4 +2103,47 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1978,4 +2103,47 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
public java.util.Date dateJoin = null; public java.util.Date dateJoin = null;
} }
//end bean class added by msalam on 170308 //end bean class added by msalam on 170308
} //Function added - Gulzar - 17/09/09
\ No newline at end of file private java.sql.Date getNextDate( java.sql.Date currShiftDate )
{
java.util.Date uDate1 = null;
java.sql.Date nextShiftDate = null;
try
{
Calendar calObject = Calendar.getInstance();
calObject.setTime( currShiftDate );
calObject.add( calObject.DATE, 1 );
uDate1 = calObject.getTime();
nextShiftDate = new java.sql.Date( uDate1.getTime() );
calObject = null;
}
catch( Exception e )
{
e.printStackTrace();
}
return nextShiftDate;
}
//End Added - Gulzar - 17/09/09
//Added - Gulzar - 15/01/10
protected InitialContext getInitialContext()throws ITMException
{
InitialContext ctx = null;
try
{
AppConnectParm appConnect = new AppConnectParm();
ctx = new InitialContext(appConnect.getProperty());
}
catch(ITMException itme)
{
System.out.println("ITMException :[SprsItemReorg] :getInitialContext :==>");
throw itme;
}
catch(Exception e)
{
System.out.println("Exception :[SprsItemReorg] :getInitialContext :==>");
throw new ITMException(e);
}
return ctx;
}
//End Added - Gulzar - 15/01/10
}
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