Commit df00226d authored by gahmad's avatar gahmad

Req ID : AD01SUN008 : changes made in shift patern , new component for...

Req ID : AD01SUN008 : changes made in shift patern , new component  for itemchange and validation of shift pattern process and migrated the shift process component from ejb2 to ejb3
Req ID : AD01SUN009: changes made in separation close confirmation logic and separation close itemchange and validation components


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91350 ce508802-f39f-4f6c-b175-0d175dae99d5
parent fd5bde8c
......@@ -16,12 +16,14 @@ import ibase.webitm.utility.TransIDGenerator;//TID
import ibase.utility.CommonConstants;//TID
import ibase.webitm.utility.GenericUtility; //Added by Raj (ADM5000192)- 28/04/2008
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemote // SessionBean
//Changed by Pawan 10/5/2010 [AD01SUN009] to migrate from ejb2 to ejb3 Syntax
//public class SepClose extends ValidatorEJB implements SessionBean
@javax.ejb.Stateless
public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemote
{
/*
Changed by Pawan 10/5/2010 [AD01SUN009] .No home interface is there in ejb3 so ejbCreate method is not required
and callback methods are nor required for Stateless component . START
public void ejbCreate() throws RemoteException, CreateException
{
System.out.println("SepCloseEjb Process modified On Date 06 November..........");
......@@ -34,7 +36,10 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
}
public void ejbPassivate()
{
}*/
}
Changed by Pawan 10/5/2010 [AD01SUN009] to migrate from ejb2 to ejb3. END
*/
public String wfValData() throws RemoteException,ITMException
{
return "";
......@@ -95,7 +100,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
Node childNode = null;
int ctr,currentFormNo=0;
int childNodeListLength;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
//Changed by Pawan 10/5/2010 [AD01SUN009] as instance of ITMDBAccessEJB has not been used.
//ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
String userId = getValueFromXTRA_PARAMS(xtraParams,"userId");
String empCodeAprv= getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
String loginSite = getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
......@@ -297,7 +303,6 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
System.out.println("Exception ::"+e);
e.printStackTrace();
}
//Added below by Raj (AD90SUN017)- 12/05/2010
finally
{
try
......@@ -325,7 +330,6 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
}
catch(Exception e){}
}
//Addition ended by Raj (AD90SUN017)- 12/05/2010
System.out.println("ErrString ::"+errString);
return errString;
}//END OF VALIDATION
......@@ -337,12 +341,18 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
String valueXmlString = "";
try
{
dom = parseString(xmlString);
System.out.println("xmlString:::" + xmlString);
System.out.println("xmlString1:::" + xmlString1);
System.out.println("xmlString2:::" + xmlString2);
dom1 = parseString(xmlString1);
if (xmlString2.trim().length() > 0 )
if (xmlString != null && xmlString.trim().length() > 0 )
{
dom = parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() > 0 )
{
dom1 = parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() > 0 )
{
dom2 = parseString(xmlString2);
}
......@@ -373,7 +383,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
Node parentNode = null;
Node childNode = null;
NodeList childNodeList = null;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
//Changed by Pawan 10/5/2010 [AD01SUN009] as instance of ITMDBAccessEJB has not been used.
//ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance();
java.util.Date DateX = new java.util.Date();
String userId = getValueFromXTRA_PARAMS(xtraParams,"userId");
......@@ -382,7 +393,7 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
StringBuffer retString = new StringBuffer();
StringBuffer valueXmlString = new StringBuffer();
System.out.println("xtraParams::::::::::::::::"+xtraParams);
//Added below by Raj (AD90SUN017)- 12/05/2010
//Added below by Raj (AD90SUN017)- 13/05/2010
String status = "";
String sepMode = "";
String reason = "";
......@@ -390,8 +401,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
String confDate = "";
String empCodeConf = "";
String reliveDate = "";
//Addition ended by Raj (AD90SUN017)- 12/05/2010
//Addition ended by Raj (AD90SUN017)- 13/05/2010
try
{
connSep = getConnection();
......@@ -406,7 +417,7 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
switch (currentFormNo)
{
case 1:
// SEARCHING THE DOM FOR THE INCOMING COLUMN VALUE START
//SEARCHING THE DOM FOR THE INCOMING COLUMN VALUE START
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
......@@ -461,11 +472,13 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
*///End - Commented by jaimin on 17/07/2008 (AD89SUN025)
valueXmlString.append("<tran_date>").append(currDate).append("</tran_date>\r\n");
/*--Commented by pawan - 11/10/10 unnecessary S.O.P are not required
System.out.println("EmpCodeaprv::::["+empCodeAprv+"]");
System.out.println("EmpCodeaprv(FNAME)::::["+fName+"]");
System.out.println("EmpCodeaprv(LNAME)::::["+lName+"]");
System.out.println("Tran Date=["+currDate+"]");
*/
//End Commented by Pawan - 11/10/10
valueXmlString.append("</Detail1>\r\n");
}
......@@ -478,14 +491,15 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
//String reliveDateStr="";//Remarked by Raj (AD90SUN017)- 13/05/2010
String firstName="";
String lastName="";
String approverfirstName = ""; //Added by Raj (AD90SUN017)- 12/05/2010
String approverlastName = ""; //Added by Raj (AD90SUN017)- 12/05/2010
String approverfirstName = ""; //Added by Raj (AD90SUN017)- 13/05/2010
String approverlastName = ""; //Added by Raj (AD90SUN017)- 13/05/2010
Object date = null;
loginSite = "";//Added by jaimin on 17/07/2008 (AD89SUN025)
String sepFound = "N"; // Added by Raj - Req.ID: ADM5000192 - 27/05/08
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getApplDateFormat());
java.sql.Date rDate = null;//new java.sql.Date();
String resiDate = ""; //Declared by Pawan on 09/10/10 [AD01SUN009]
//sql = "SELECT RESI_DATE FROM SEPARATION WHERE EMP_CODE = '"+columnValue.trim()+"'"; // Remarked by Raj - Req. ID. ADM5000192 - 27/05/08
sepFound = "N"; // Added by Raj - Req.ID: ADM5000192 - 27/05/08
//sql = "SELECT RESI_DATE FROM SEPARATION WHERE EMP_CODE = '"+columnValue.trim()+"' AND STATUS = 'C'"; // Added STATUS CLAUSE IN WHERE CONDITION by Raj - Req.ID: ADM5000192 - 27/05/08 ////Remarked by Raj (AD90SUN017)- 08/05/2010
......@@ -500,13 +514,14 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
dateStr=sdf1.format(date).toString();
sepFound = "Y"; // Added by Raj - Req.ID: ADM5000192 - 27/05/08
//Added below by Raj (AD90SUN017)- 08/05/2010
status = rsSep.getString("STATUS");
sepMode = rsSep.getString("SEPARATION_MODE");
reason = rsSep.getString("REASON");
vacNoCreated = rsSep.getString("VAC_NO__CREATED");
confDate = rsSep.getString("CONF_DATE");
empCodeConf = rsSep.getString("EMP_CODE__CONF");
reliveDate = rsSep.getString("RELIEVE_DATE");
resiDate = checkNull(rsSep.getString("RESI_DATE"));//Added by Pawan on 09/10/10 [AD01SUN009]
status = checkNull(rsSep.getString("STATUS"));
sepMode = checkNull(rsSep.getString("SEPARATION_MODE"));
reason = checkNull(rsSep.getString("REASON"));
vacNoCreated = checkNull(rsSep.getString("VAC_NO__CREATED"));
confDate = checkNull(rsSep.getString("CONF_DATE"));
empCodeConf = checkNull(rsSep.getString("EMP_CODE__CONF"));
reliveDate = checkNull(rsSep.getString("RELIEVE_DATE"));
//Addition ended by Raj (AD90SUN017)- 08/05/2010
}
rsSep.close();
......@@ -520,7 +535,15 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
}
if ( reliveDate != null && reliveDate.trim().length() > 0 )
{
reliveDate = genericUtility.getValidDateTimeString(reliveDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
//Commented by Pawan 11/10/10 [AD01SUN009]
//reliveDate = genericUtility.getValidDateTimeString(reliveDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
reliveDate = genericUtility.getValidDateString(reliveDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
}
if ( resiDate != null && resiDate.trim().length() > 0 )//Added by Pawan on 09/10/10 [AD01SUN009]
{
// Modified by Piyush for testing - 09/10/2010
//resiDate = genericUtility.getValidDateTimeString(resiDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
resiDate = genericUtility.getValidDateString(resiDate,genericUtility.getDBDateFormat(),genericUtility.getApplDateFormat() );
}
valueXmlString.append("<sep_status>").append(status).append("</sep_status>\r\n");
valueXmlString.append("<separation_mode>").append(sepMode).append("</separation_mode>\r\n");
......@@ -535,24 +558,27 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
rsSep = stmtSep.executeQuery(sql);
while (rsSep.next())
{
approverfirstName=(rsSep.getString(1)==null?"":rsSep.getString(1));
approverlastName=(rsSep.getString(2)==null?"":rsSep.getString(2));
//09/10/10 Changed by Pawan 09/10/10 [AD01SUN009] to check value coming from database whether it is null or not . if null then checkNull() method will return empty string.
//approverfirstName=(rsSep.getString(1)==null?"":rsSep.getString(1));
//approverlastName=(rsSep.getString(2)==null?"":rsSep.getString(2));//09/10/10
approverfirstName=checkNull(rsSep.getString(1));
approverlastName=checkNull(rsSep.getString(2));
}
stmtSep.close();
valueXmlString.append("<emp_fname_sep_conf>").append(approverfirstName).append("</emp_fname_sep_conf>\r\n");
valueXmlString.append("<emp_lname_sep_conf>").append(approverlastName).append("</emp_lname_sep_conf>\r\n");
//Addition ended by Raj (AD90SUN017)- 08/05/2010
System.out.println("EmpCode:::["+currentColumn+"]");
System.out.println("ResiDate(Database):::["+rDate+"]");
System.out.println("APPLICATION DATE FORMAT::["+dateStr+"]");
System.out.println("Seperation Found::["+sepFound+"]"); // Added by Raj - Req.ID: ADM5000192 - 27/05/08
//java.sql.Date reliveDate = null; //Remarked by Raj (AD90SUN017)- 12/05/2010
//java.sql.Date reliveDate = null; //Remarked by Raj (AD90SUN017)- 13/05/2010
if (sepFound != null && sepFound == "Y") // If condition is Added by Raj - Req.ID: ADM5000192 - 27/05/08
{
//sql = "SELECT EMP_SITE,RELIEVE_DATE,EMP_FNAME,EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+columnValue.trim()+"'" ; //Remarked and added below by Raj (AD90SUN017)- 12/05/2010
sql = "SELECT EMP_SITE,EMP_FNAME,EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+columnValue.trim()+"'" ; //Added by Raj (AD90SUN017)- 12/05/2010
//sql = "SELECT EMP_SITE,RELIEVE_DATE,EMP_FNAME,EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+columnValue.trim()+"'" ; //Remarked and added below by Raj (AD90SUN017)- 13/05/2010
sql = "SELECT EMP_SITE,EMP_FNAME,EMP_LNAME FROM EMPLOYEE WHERE EMP_CODE = '"+columnValue.trim()+"'" ; //Added by Raj (AD90SUN017)- 13/05/2010
System.out.println("Sql For Employee***["+sql+"]");
stmtSep = connSep.createStatement();
rsSep = stmtSep.executeQuery(sql);
......@@ -560,20 +586,20 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
{
loginSite = (rsSep.getString(1)==null?"":rsSep.getString(1));
//reliveDate = rsSep.getDate(2); //Remarked by Raj (AD90SUN017)- 12/05/2010
//reliveDate = rsSep.getDate(2); //Remarked by Raj (AD90SUN017)- 13/05/2010
firstName=(rsSep.getString(2)==null?"":rsSep.getString(2));
lastName=(rsSep.getString(3)==null?"":rsSep.getString(3));
//date = sdf.parse(reliveDate.toString()); //Remarked by Raj (AD90SUN017)- 12/05/2010
//reliveDateStr=sdf1.format(date).toString(); //Remarked by Raj (AD90SUN017)- 12/05/2010
//date = sdf.parse(reliveDate.toString()); //Remarked by Raj (AD90SUN017)- 13/05/2010
//reliveDateStr=sdf1.format(date).toString(); //Remarked by Raj (AD90SUN017)- 13/05/2010
}
System.out.println("Employee Site code:::["+loginSite+"]");
// System.out.println("Relive Date :::["+reliveDate+"]");
//System.out.println("Relive Date :::["+reliveDate+"]");
System.out.println("Employee First Name:::["+firstName+"]");
System.out.println("Employee Last Name :::["+lastName+"]");
stmtSep.close();
//System.out.println("ReliveDateStr in Appl Format:::["+reliveDateStr+"]"); //Remarked by Raj (AD90SUN017)- 12/05/2010
//System.out.println("ReliveDateStr in Appl Format:::["+reliveDateStr+"]"); //Remarked by Raj (AD90SUN017)- 13/05/2010
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE ='" +loginSite+ "'";
System.out.println("Sql for site descr "+sql);
......@@ -597,7 +623,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
//Start - Added by jaimin on 17/07/2008 (AD89SUN025)
valueXmlString.append("<emp_fname>").append(firstName).append("</emp_fname>\r\n");
valueXmlString.append("<emp_lname>").append(lastName).append("</emp_lname>\r\n");
valueXmlString.append("<resi_date>").append(dateStr).append("</resi_date>\r\n");
//valueXmlString.append("<resi_date>").append(dateStr).append("</resi_date>\r\n");Remarked by Pawan on 09/10/10 [AD01SUN009]
valueXmlString.append("<resi_date>").append(resiDate).append("</resi_date>\r\n"); //Remarked by Pawan 09/10/10 [AD01SUN009]
valueXmlString.append("<site_code>").append(loginSite).append("</site_code>\r\n");
//valueXmlString.append("<relieve_date>").append(reliveDateStr).append("</relieve_date>\r\n"); //Remarked by Raj (AD90SUN017)- 11/05/2010
valueXmlString.append("<site_descr>").append(siteDescr).append("</site_descr>\r\n");
......@@ -605,7 +632,7 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
valueXmlString.append("</Detail1>\r\n");
}
break;
case 2:
......@@ -621,7 +648,6 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
System.out.println("Exception ::"+e.getMessage());
e.printStackTrace();
}
//Added below by Raj (AD90SUN017)- 12/05/2010
finally
{
try
......@@ -644,8 +670,16 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
}
catch(Exception e) {}
}
//Addition ended by Raj (AD90SUN017)- 12/05/2010
return valueXmlString.toString();
}//END OF ITEMCHNGE
//Added checkNull() method 09/10/10 [AD01SUN009] to check the string that it is not null.
private String checkNull(String dataStr)
{
if (dataStr == null )
{
dataStr = "";
}
return dataStr;
}
}
\ No newline at end of file
package ibase.webitm.ejb.adm;
/*
authored by Pawan 10/7/2010 to confirm the transaction
*/
import ibase.webitm.utility.*;
//import ibase.utility.*;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.text.*;
import java.util.*;
import java.math.*;
import java.util.Date;
import java.text.*;
import java.sql.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import java.io.*;
import java.io.File;
import java.sql.*;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
import ibase.webitm.utility.*;
import ibase.system.config.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants;
import ibase.webitm.utility.GenericUtility;
public class SepCloseConf extends ActionHandlerEJB implements SepCloseConfLocal,SepCloseConfRemote //SessionBean
@javax.ejb.Stateless
public class SepCloseConf extends ActionHandlerEJB implements SepCloseConfLocal, SepCloseConfRemote
{
/*public void ejbCreate() throws RemoteException, CreateException
{
System.out.println("Entering the EJB of confirmation[(SepCloseConfEJB)]...............");
}
public void ejbRemove()
{
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
}*/
public String confirm( String tranId, String xtraParams, String forcedFlag ) throws RemoteException,ITMException
{
System.out.println("SepCloseConf Called........");
int ctr = 0;
String empCode = "";
String status = "";
String tranIdFFS = "";
String resiDate = "";
String separationMode = "";
String reason = "";
String vacNoCreated = "";
String empCodeConf = "";
String deleteSepOnClose = "";
String relieveDate = "";
String confDate = "";
String sql = "";
public String confirm(String tranID,String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String result = "";
try
{
System.out.println("Confirming SepClose....");
result = confirmSepCloseConf(tranID,xtraParams);
}
catch(Exception e)
{
System.out.println("Exception ::"+e.getMessage());
throw new ITMException(e);
}
System.out.println("Returning Result ::"+result);
return result;
}
private String confirmSepCloseConf(String tranID,String xtraParams)throws RemoteException,ITMException
{
Connection con = null;
Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String empCodeApprv = "";
java.util.Date chgDate = null;
String chgUser = "";
String chgTerm = "";
String update = "";
int upd;
String retString = "";
GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
ConnDriver connDriver = new ConnDriver();
ValidatorEJB ve = new ValidatorEJB();
String empCode = ve.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
System.out.println("Emp code="+xtraParams);
ResultSet rSet = null ;
Connection connectionObject = null;
String errString = "";
String loginEmpCode = "";
String sepCloseStatus = "";
boolean isError = false;
int updCnt = 0;
AdmCommon admCommon = null;
ITMDBAccessLocal itmdbAccessLocal = null ;
try
{
con = connDriver.getConnectDB("DriverITM");
System.out.println("Confirm Called.....");
}
catch(Exception ex){System.out.println("[Exception:]"+ex);}
AppConnectParm appConnect = new AppConnectParm();
Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p);
itmdbAccessLocal = (ITMDBAccessLocal)ctx.lookup("ibase/ITMDBAccessEJB/local");
// TESTING FOR CONFIRM FIELD
if(dupConf( tranID, con))
{
retString = itmDBAccessEJB.getErrorString("","VTCREDIT01","","",con);
System.out.println("enter into confirm");
ConnDriver connDriver = new ConnDriver();
connectionObject = connDriver.getConnectDB("DriverValidator");
connectionObject.setAutoCommit(false);
sql = "SELECT EMP_CODE, RESI_DATE , CASE WHEN STATUS IS NULL THEN ' ' ELSE STATUS END AS STATUS FROM SEPARATION_CLOSE WHERE TRAN_ID = '"+tranId+"'";
stmt = connectionObject.createStatement();
rSet = stmt.executeQuery(sql);
if (rSet.next())
{
empCode = rSet.getString("EMP_CODE");
resiDate = rSet.getString("RESI_DATE");
sepCloseStatus = rSet.getString("STATUS");
}
if ( rSet != null )
{
rSet.close();
rSet = null;
}
if (sepCloseStatus.equalsIgnoreCase("X") )
{
isError = true;
errString = itmdbAccessLocal.getErrorString("","VTCREDIT01","");
return errString;
}
sql = "SELECT COUNT(*) FROM FULLFINAL_HDR WHERE EMP_CODE = '"+empCode+"' AND CONFIRMED = 'Y'";
rSet = stmt.executeQuery(sql);
}
else
{
// CONFIRM THE SEPARATION_CLOSE TABLE BY UPDATING THE STATUS FIELD
try
if( rSet.next() )
{
update = "UPDATE SEPARATION_CLOSE SET STATUS = 'X' WHERE TRAN_ID = ? ";
pstmt = con.prepareStatement(update);
pstmt.setString(1,tranID);
upd = pstmt.executeUpdate();
ctr = rSet.getInt(1);
if( ctr > 0 )
{
isError = true;
errString = itmdbAccessLocal.getErrorString("","VTFFS1","");
return errString;
}
}
catch(SQLException se2)
if ( rSet != null )
{
System.out.println("SQLException :[SepCloseConf][Excuting Query Failed]" + update + se2.getMessage());
rSet.close();
rSet = null;
}
catch(Exception ex2)
sql = "SELECT STATUS, RELIEVE_DATE, SEPARATION_MODE, REASON, VAC_NO__CREATED, CONF_DATE, EMP_CODE__CONF FROM SEPARATION WHERE EMP_CODE = ? AND RESI_DATE = ?";
pstmt = connectionObject.prepareStatement( sql );
pstmt.setString(1,empCode);
pstmt.setTimestamp( 2,Timestamp.valueOf( resiDate ) );
rSet = pstmt.executeQuery();
if( rSet.next() )
{
status = rSet.getString("STATUS");
relieveDate = rSet.getString("RELIEVE_DATE");
separationMode = rSet.getString("SEPARATION_MODE");
reason = rSet.getString("REASON");
vacNoCreated = rSet.getString("VAC_NO__CREATED");
confDate = rSet.getString("CONF_DATE");
empCodeConf = rSet.getString("EMP_CODE__CONF");
}
if( pstmt != null )
{
retString = "Not Confirmed";
System.out.println("Exception ::"+ex2.getMessage());
ex2.printStackTrace();
pstmt.close();
pstmt = null;
}
}
return retString;
}
private boolean dupConf(String tarnID,Connection con) throws ITMException
{
Statement stmt = null;
ResultSet rs = null;
String sql="";
boolean flag = false;
try
{
sql = " SELECT COUNT(*) FROM SEPARATION_CLOSE" +
" WHERE TRAN_ID = '"+ tarnID +"' AND STATUS = 'X' ";
System.out.println("[ConfirmSepCloseEJB:] [dupConf] EXECUTE SELECT: "+sql);
if ( rSet != null )
{
rSet.close();
rSet = null;
}
if( status != null && !status.equalsIgnoreCase("C") )
{
isError = true;
errString = itmdbAccessLocal.getErrorString("","VTSEPNTCON","");
return errString;
}
GenericUtility genericUtility = GenericUtility.getInstance();
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
sql = "UPDATE SEPARATION_CLOSE SET STATUS = 'A', RELIEVE_DATE = ?, SEPARATION_MODE = ?, REASON = ?, VAC_NO__CREATED = ?, SEP_STATUS = ?, CONF_DATE_SEP = ?, EMP_CODE__CONF_SEP = ?, EMP_CODE__APRV = ? WHERE TRAN_ID = ?";
pstmt = connectionObject.prepareStatement( sql );
pstmt.setTimestamp(1, Timestamp.valueOf( relieveDate ) );
pstmt.setString(2, separationMode);
pstmt.setString(3, reason);
pstmt.setString(4, vacNoCreated);
pstmt.setString(5, status);
pstmt.setTimestamp(6,Timestamp.valueOf( confDate ) );
pstmt.setString(7, empCodeConf);
pstmt.setString(8, loginEmpCode);
pstmt.setString(9, tranId);
updCnt = pstmt.executeUpdate();
if ( updCnt > 0 )
{
System.out.println("SEPARATION_CLOSE Updated Successfully ::"+updCnt);
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if ( rSet != null )
{
rSet.close();
rSet = null;
}
stmt = con.createStatement();
rs = stmt.executeQuery(sql);
if(rs.next())
admCommon = new AdmCommon();
deleteSepOnClose = admCommon.getEnv("999999", "DELSEPONCLOSE", connectionObject);
if( deleteSepOnClose !=null && deleteSepOnClose.equalsIgnoreCase("NULLFOUND") )
{
if(rs.getInt(1)!= 0)
isError = true;
errString = itmdbAccessLocal.getErrorString("","VSENVAR1","");
return errString;
}
else if( deleteSepOnClose !=null && !deleteSepOnClose.equalsIgnoreCase("Y") )
{
deleteSepOnClose = "N";
}
if( deleteSepOnClose.equalsIgnoreCase("Y") )
{
sql = "DELETE FROM SEPARATION WHERE EMP_CODE = ? AND RESI_DATE = ?";
pstmt = connectionObject.prepareStatement( sql );
pstmt.setString(1,empCode);
pstmt.setTimestamp(2,Timestamp.valueOf( resiDate ) );
pstmt.executeUpdate();
}
else
{
sql = "UPDATE SEPARATION SET STATUS = 'X' WHERE EMP_CODE = ? AND RESI_DATE = ?";
pstmt = connectionObject.prepareStatement( sql );
pstmt.setString(1,empCode);
pstmt.setTimestamp(2,Timestamp.valueOf( resiDate ) );
pstmt.executeUpdate();
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if ( rSet != null )
{
rSet.close();
rSet = null;
}
sql = "SELECT TRAN_ID FROM FULLFINAL_HDR WHERE EMP_CODE = '"+empCode+"' AND CONFIRMED != 'X'";
rSet = stmt.executeQuery(sql);
if( rSet.next() )
{
tranIdFFS = rSet.getString("tran_id");
sql = "DELETE FROM FULLFINAL_DET WHERE TRAN_ID = '"+tranIdFFS+"'";
updCnt = stmt.executeUpdate(sql);
if ( updCnt > 0 )
{
flag = true;
System.out.println("deleted from FULLFINAL_DET Successfully ::"+updCnt);
}
sql = "UPDATE FULLFINAL_HDR SET CONFIRMED = 'X', TOTAL_AMT = 0, IT_AMT = 0, AMOUNT = 0 WHERE TRAN_ID = '"+tranIdFFS+"'";
updCnt = stmt.executeUpdate(sql);
if ( updCnt > 0 )
{
System.out.println("FULLFINAL_HDR Updated Successfully ::"+updCnt);
}
}
if ( rSet != null )
{
rSet.close();
rSet = null;
}
sql = "UPDATE EMPLOYEE SET RESI_DATE = NULL, RELIEVE_DATE = NULL WHERE EMP_CODE = '"+empCode+"'";
updCnt = stmt.executeUpdate(sql);
if ( updCnt > 0 )
{
System.out.println("EMPLOYEE Updated Successfully ::"+updCnt);
}
rs.close();
stmt.close();
}
catch(SQLException e)
catch(Exception e)
{
System.out.println("Exception : ConfirmGl_openEJB [dupConf]:==>\n"+e.getMessage());
isError = true;
try
{
connectionObject.rollback();
}
catch(Exception e1)
{
e1.printStackTrace();
}
e.printStackTrace();
throw new ITMException(e);
}
return flag;
finally
{
try
{
System.out.println("Commiting and Closing Connection..........");
if ( !(isError) )
{
connectionObject.commit();
errString = itmdbAccessLocal.getErrorString("","SEPCLCONF","");
}
else
{
connectionObject.rollback();
}
if( stmt != null )
{
stmt.close();
stmt = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if ( rSet != null )
{
rSet.close();
rSet = null;
}
if( connectionObject != null && ! connectionObject.isClosed() )
{
connectionObject.close();
connectionObject = null;
}
}
catch( Exception e)
{
e.printStackTrace();
}
}
return errString;
}
}
\ No newline at end of file
}
package ibase.webitm.ejb.adm;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.*;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.Local; // added for ejb3
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
@Local // added for ejb3
public interface SepCloseConfLocal extends ActionHandlerLocal //,EJBObject
@javax.ejb.Local
public interface SepCloseConfLocal extends ActionHandlerLocal
{
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
\ No newline at end of file
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.adm;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.*;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.Remote; // added for ejb3
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandlerRemote;
@Remote // added for ejb3
public interface SepCloseConfRemote extends ActionHandlerRemote //,EJBObject
@javax.ejb.Remote
public interface SepCloseConfRemote extends ActionHandlerRemote
{
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.adm;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface SepCloseLocal extends ValidatorLocal //,EJBObject
//Changed by Pawan 10/5/2010[AD01SUN009] to migrate from ejb2 to ejb3
@javax.ejb.Local
public interface SepCloseLocal extends ValidatorLocal
{
public String wfValData() throws RemoteException,ITMException;
......
package ibase.webitm.ejb.adm;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface SepCloseRemote extends ValidatorRemote //,EJBObject
//Changed by Pawan 10/5/2010[AD01SUN009] to migrate from ejb2 to ejb3
//public interface SepClose extends Validator,EJBObject
@javax.ejb.Remote
public interface SepCloseRemote extends ValidatorRemote
{
public String wfValData() throws RemoteException,ITMException;
......
......@@ -11,6 +11,8 @@ import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import ibase.system.config.*;
import java.sql.*;
// Changed by Dhiraj 07/10/10 [AD01SUN008]
import java.text.SimpleDateFormat;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
......@@ -18,30 +20,7 @@ import javax.ejb.Stateless; // added for ejb3
public class ShiftPattern extends ValidatorEJB implements ShiftPatternLocal,ShiftPatternRemote //SessionBean
{
String returnValue12 = "";
/*
public void ejbCreate() throws RemoteException, CreateException
{
try
{
System.out.println("ValidatorEJB ejbCreate called.........");
}
catch (Exception e)
{
System.out.println("Exception :ValidatorEJB :ejbCreate :==>"+e);
throw new CreateException();
}
}
public void ejbRemove()
{
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
}
*/
public String wfValData() throws RemoteException,ITMException
{
return "";
......@@ -129,13 +108,21 @@ public String wfValData() throws RemoteException,ITMException
try
{
conn = connDriver.getConnectDB("DriverITM");
AppConnectParm appConnect = new AppConnectParm();
// Changed by Dhiraj 07/10/10 [AD01SUN008]. start
/*AppConnectParm appConnect = new AppConnectParm();
Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p);
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup("ITMDBAccess");
*/
// Changed by Dhiraj 07/10/10 [AD01SUN008]. end
//itmDBAccess = itmDBAccessHome.create();
connectionObject = itmDBAccessLocal.getConnection(); //added for ejb3
stmt = connectionObject.createStatement();
// Changed by Dhiraj 07/10/10 [AD01SUN008] start
/*connectionObject = itmDBAccessLocal.getConnection(); //added for ejb3
stmt = connectionObject.createStatement();
*/
stmt = conn.createStatement();
// Changed by Dhiraj 07/10/10 [AD01SUN008] end
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
if(objContext != null && objContext.trim().length()>0)
{
......@@ -153,7 +140,9 @@ public String wfValData() throws RemoteException,ITMException
{
if(childNode.getFirstChild() == null)
{
errString = itmDBAccess.getErrorString("shift_pattern","VTSPCANT",userId,errString,connectionObject);
//Changed by Dhiraj 07/10/10 [AD01SUN008]
//errString = itmDBAccess.getErrorString("shift_pattern","VTSPCANT",userId,errString,connectionObject);
errString = getErrorString("shift_pattern","VTSPCANT",userId);
}
else
{
......@@ -183,7 +172,11 @@ public String wfValData() throws RemoteException,ITMException
System.out.println("count :---------------------"+count);
if (count == 0)
{
errString = itmDBAccess.getErrorString("shift_pattern","VTWSNOTM",userId,errString,connectionObject);
//Changed by Dhiraj 07/10/10 [AD01SUN008]
//errString = itmDBAccess.getErrorString("shift_pattern","VTWSNOTM",userId,errString,connectionObject);
errString = getErrorString("shift_pattern","VTWSNOTM",userId);
}
}
......@@ -251,6 +244,11 @@ public String wfValData() throws RemoteException,ITMException
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
// Changed by Dhiraj 07/10/10 [AD01SUN008].start
String loginSite = "";
String siteCodeDescr = "";
// Changed by Dhiraj 07/10/10 [AD01SUN008] .end
StringBuffer valueXmlString = new StringBuffer();
ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = GenericUtility.getInstance();
......@@ -268,9 +266,19 @@ public String wfValData() throws RemoteException,ITMException
System.out.println("xtraParamsitemchange:---------------"+xtraParams);
site_code = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"site_code");
valueXmlString.append("<site_code>").append(site_code).append("</site_code>\r\n");
java.sql.Date toDay =new java.sql.Date(System.currentTimeMillis());
valueXmlString.append("<start_date>").append(toDay).append("</start_date>\r\n");
//Changed by Dhiraj 07/10/10 [AD01SUN008]. start
//java.sql.Date toDay =new java.sql.Date(System.currentTimeMillis());
java.util.Date toDay = new java.util.Date();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
String dbDtStr = sdf.format(toDay);
// Changed by Dhiraj 07/10/10 [AD01SUN008]. end
//valueXmlString.append("<start_date>").append(toDay).append("</start_date>\r\n");
valueXmlString.append("<start_date>").append(dbDtStr).append("</start_date>\r\n");
System.out.println("Start_date:-------------------------"+toDay);
}
else if (currentColumn.trim().equals("shift_pattern"))
......@@ -298,6 +306,8 @@ public String wfValData() throws RemoteException,ITMException
}
valueXmlString.append("</Detail1>\r\n");
valueXmlString.append("</Root>\r\n");
}
......
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
import java.util.*;
import java.util.Date;
import java.text.*;
import java.sql.*;
import org.w3c.dom.*;
import javax.ejb.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.*;
import ibase.webitm.ejb.*;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.system.config.*;
@Stateless
public class ShiftPatternProcIC extends ValidatorEJB implements ShiftPatternProcICLocal,ShiftPatternProcICRemote
{
public String itemChanged() throws RemoteException,ITMException
{
return "";
}
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String valueXmlString = "";
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
if(xmlString != null && xmlString.trim().length()!=0)
{
dom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length()!=0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length()!=0)
{
dom2 = genericUtility.parseString(xmlString2);
}
valueXmlString = itemChanged(dom,dom1,dom2,objContext,currentColumn,editFlag,xtraParams);
}
catch(Exception e)
{
throw new ITMException(e);
}
return valueXmlString.toString();
}
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String columnValue = "";
String sql = "";
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String loginSite = "";
String empFname = "";
String empLname = "";
String deptDescr = "";
String siteDescr = "";
String shiftDescr = "";
StringBuffer valueXmlString = new StringBuffer();
ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
conn = connDriver.getConnectDB("DriverITM");
columnValue = genericUtility.getColumnValue(currentColumn,dom);
System.out.println("columnValue :"+columnValue);
valueXmlString.append("<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></Header>\r\n");
valueXmlString.append("<Detail1>\r\n");
if (currentColumn.trim().equals("itm_default"))
{
String shiftPattern = getColumnValue("shift_pattern",dom);
String shiftTo = getColumnValue("shift_to",dom);
valueXmlString.append("<shift_pattern protect = '1'> ").append(shiftPattern == null ? "":shiftPattern).append("</shift_pattern>\r\n");
valueXmlString.append("<shift_to protect = '1'> ").append(shiftTo == null ? "" : shiftTo).append("</shift_to>\r\n");
loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSite");
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);
while (rs.next())
{
siteDescr = rs.getString("DESCR");
}
rs.close();
stmt.close();
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");
valueXmlString.append("<dept_code__to>").append("ZZ").append("</dept_code__to>\r\n");
valueXmlString.append("<emp_code__fr>").append("00").append("</emp_code__fr>\r\n");
valueXmlString.append("<emp_code__to>").append("ZZ").append("</emp_code__to>");
}
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);
while (rs.next())
{
empFname = rs.getString("EMP_FNAME");
empLname = rs.getString("EMP_LNAME");
}
rs.close();
stmt.close();
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);
while (rs.next())
{
empFname = rs.getString("EMP_FNAME");
empLname = rs.getString("EMP_LNAME");
}
rs.close();
stmt.close();
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);
while (rs.next())
{
deptDescr = rs.getString("descr");
}
rs.close();
stmt.close();
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);
while (rs.next())
{
deptDescr = rs.getString("descr");
}
rs.close();
stmt.close();
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);
while (rs.next())
{
siteDescr = rs.getString("descr");
}
rs.close();
stmt.close();
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");
}
else if (currentColumn.trim().equals("site_code__to"))
{
String siteCode = getColumnValue("site_code__to", dom);
sql = "select descr from site where site_code = '"+siteCode+"' ";
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
while (rs.next())
{
siteDescr = rs.getString("descr");
}
rs.close();
stmt.close();
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");
}
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);
while (rs.next())
{
shiftDescr = rs.getString("descr");
}
rs.close();
stmt.close();
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("</Detail1>\r\n");
valueXmlString.append("</Root>\r\n");
}
catch(Exception e)
{
throw new ITMException(e);
}
finally
{
try
{
System.out.println("Closing Connection.......");
if (rs != null)
{
rs.close();
rs = null;
}
if (stmt != null)
{
stmt.close();
stmt = null;
}
if (conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception se)
{
throw new ITMException(se);
}
}
return valueXmlString.toString();
}
}
package ibase.webitm.ejb.adm;import java.rmi.RemoteException;import org.w3c.dom.*;import ibase.webitm.utility.ITMException;import ibase.webitm.ejb.*;import javax.ejb.Local; @Local public interface ShiftPatternProcICLocal extends ValidatorLocal { public String itemChanged() throws RemoteException,ITMException; public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException; public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;}
\ No newline at end of file
package ibase.webitm.ejb.adm;import java.rmi.RemoteException;import org.w3c.dom.*;import ibase.webitm.utility.ITMException;import ibase.webitm.ejb.*;import javax.ejb.Remote; @Remote public interface ShiftPatternProcICRemote extends ValidatorRemote { public String itemChanged() throws RemoteException,ITMException; public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException; public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;}
\ No newline at end of file
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;//import javax.ejb.EJBObject; import org.w3c.dom.*; import ibase.webitm.utility.ITMException; import ibase.webitm.ejb.*; import javax.ejb.Remote; // added for ejb3 @Remote // added for ejb3 public interface ShiftPatternRemote extends ValidatorRemote //,EJBObject { public String itemChanged() throws RemoteException,ITMException; public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException; public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException; }
\ No newline at end of file
package ibase.webitm.ejb.adm;import java.rmi.RemoteException;//import javax.ejb.EJBObject; import org.w3c.dom.*; import ibase.webitm.utility.ITMException; import ibase.webitm.ejb.*; import javax.ejb.Remote; // added for ejb3 @Remote // added for ejb3 public interface ShiftPatternRemote extends ValidatorRemote //,EJBObject { public String itemChanged() throws RemoteException,ITMException; public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException; public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException; }
\ No newline at end of file
......
......@@ -3,12 +3,6 @@
*/
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.util.*;
import java.sql.*;
......@@ -16,11 +10,22 @@ import java.text.SimpleDateFormat;
import org.w3c.dom.*;
import javax.ejb.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import ibase.utility.CommonConstants;
import ibase.system.config.*;
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10].start
import javax.naming.InitialContext;
@Stateless
//public class ShiftProcessEJB extends ProcessEJB implements SessionBean //Commented By Gulzar - 15/01/10()
public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftProcessRemote //Added By Gulzar - 15/01/10()
import javax.ejb.Stateless;
@Stateless
//public class ShiftProcessEJB extends ProcessEJB implements SessionBean
public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftProcessRemote
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10].end
{
/* UPDATED BY NISAR ON 17/12/07 FOR REQUEST ID : AD7SUN0016 */
String sql = null;
......@@ -41,20 +46,17 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//InvAllocTrace invallocTrace = new InvAllocTrace();
GenericUtility genericUtility = GenericUtility.getInstance();
//GenericUtility genericUtility = new GenericUtility(); //COMMENTED BY ALKA 24/07/07 AS GENERIC UTILITY NOT INITIALIASED PROPERLY.
//Commented and Changes below by Gulzar- 15/01/10
//ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
ITMDBAccessLocal itmDBAccessLocal = null;
InitialContext ctx = null;
CommonConstants commonConstants = new CommonConstants();
String chgUser = null;
String chgTerm = null;
/*--Commented by Gulzar- 15/01/10 for ejb3
public void ejbCreate() throws RemoteException, CreateException
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10].start
//ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
/*public void ejbCreate() throws RemoteException, CreateException
{
try
{
......@@ -78,7 +80,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{
}
*/
//End Commented by Gulzar - 15/01/10
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10].end
public String process() throws RemoteException,ITMException
{
return "";
......@@ -90,18 +92,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
Document headerDom = null;
Document detailDom = null;
String userId = "";
try
{
if ( itmDBAccessLocal == null )
{
ctx = getInitialContext();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" );
}
}
catch (Exception e)
{
e.printStackTrace();
}
try
{
System.out.println("xtraParams :: " + xtraParams);
......@@ -132,9 +123,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
catch (Exception e)
{
System.out.println("Exception :ShiftProcessEJB : process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
//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);
//changed by Dhiraj 05/10/10 [AD01SUN008] - Exception should throw
//rtrStr = itmDBAccessEJB.getErrorString("","VTPROUNSUC",userId);
throw new ITMException(e);
}
return rtrStr;
}
......@@ -211,13 +202,18 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
HashMap empEventsMap = new HashMap();
int shiftIndexFr = 0;//Added by jaimin on 16/06/2008 (AD89SUN014)
int shiftIndexTo = 0;//Added by Jaimin on 16/06/2008 (AD89SUN014)
//Changed by Dhiraj 06/10/10 [AD01SUN008]
ITMDBAccessLocal itmdbAccessLocal = null;
try
{
if ( itmDBAccessLocal == null )
{
ctx = getInitialContext();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" );
}
//Changed by Dhiraj 06/10/10 [AD01SUN008].start
AppConnectParm appConnect = new AppConnectParm();
Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p);
itmdbAccessLocal = (ITMDBAccessLocal)ctx.lookup("ibase/ITMDBAccessEJB/local");
//Changed by Dhiraj 06/10/10 [AD01SUN008].end
connDriver = new ConnDriver();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat());
conn = connDriver.getConnectDB("DriverITM");
......@@ -228,7 +224,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
chgUser = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
//termId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termID"); //COMMENTED BY ALKA 25/07/07 AS VARIABLE termID CHANGED TO GLOBAL VARIABLE chgTerm
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termID");
//chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"termID");//Gulzar - 07/10/10 termID value pass as 'BASE'
chgTerm = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"chgTerm");//Gulzar - 07/10/10
}
Node hdrNode = null;
......@@ -462,6 +459,50 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
}
//End Added - Gulzar - 05/08/09
*/
//Start added Gulzar - 03/06/10[]
String updateSql = "";
ResultSet rsTmp = null;
int selCnt = 0;
int updCnt = 0;
java.sql.Date prevFrDate = null;
java.sql.Date nextToDate = null;
PreparedStatement pstmtTemp = null;
prevFrDate = getPrevDate(frSqlDate);
System.out.println("prevFrDate::"+prevFrDate);
updateSql = "UPDATE WORK_SHIFT SET TO_DT = ? WHERE EMP_CODE = '"+emp+"' "+
"AND ? BETWEEN FROM_DT AND TO_DT AND FROM_DT <> ? ";
pstmtTemp = conn.prepareStatement(updateSql);
pstmtTemp.setDate( 1, prevFrDate );
pstmtTemp.setDate( 2, frSqlDate );
pstmtTemp.setDate( 3, frSqlDate );
updCnt = pstmtTemp.executeUpdate();
pstmtTemp.clearParameters();
if ( updCnt > 0 )
{
System.out.println("Updated Successfully updCnt=["+updCnt+"]");
}
pstmtTemp.close();
pstmtTemp = null;
nextToDate = getNextDate(toSqlDate);
System.out.println("nextToDate::"+nextToDate);
updateSql = "UPDATE WORK_SHIFT SET FROM_DT = ? WHERE EMP_CODE = '"+emp+"' "+
"AND ? BETWEEN FROM_DT AND TO_DT AND TO_DT <> ? ";
pstmtTemp = conn.prepareStatement(updateSql);
pstmtTemp.setDate( 1, nextToDate );
pstmtTemp.setDate( 2, toSqlDate );
pstmtTemp.setDate( 3, toSqlDate );
updCnt = pstmtTemp.executeUpdate();
pstmtTemp.clearParameters();
if ( updCnt > 0 )
{
System.out.println("Updated Successfully updCnt=["+updCnt+"]");
}
pstmtTemp.close();
pstmtTemp = null;
//End added Gulzar - 03/06/10[]
sql = "DELETE FROM WORK_SHIFT WHERE EMP_CODE = ? "
+"AND FROM_DT BETWEEN ? AND ? "
......@@ -583,7 +624,11 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{
System.out.println("stShiftDate "+stShiftDate+" edShiftDate "+edShiftDate);
//errString = insertUpdateWorkShift(empInfo, emp,stShiftDate,edShiftDate,frPatternCodeList.get(ctr).toString(),toPatternCodeList.get(ctr).toString(),holiTblNo,conn);//Commented by jaimin on 16/06/2008 (AD89SUN014)
errString = insertUpdateWorkShift(empInfo, emp,stShiftDate,edShiftDate,frPatternCodeList.get(ctr).toString(),toPatternCodeList.get(ctr).toString(),holiTblNo,shiftIndexFr,conn);//Added by jaimin on 16/06/2008 (AD89SUN014)
//Changed by Dhiraj 06/10/10 [AD01SUN008]
/*errString = insertUpdateWorkShift(empInfo, emp,stShiftDate,edShiftDate,frPatternCodeList.get(ctr).toString(),toPatternCodeList.get(ctr).toString(),holiTblNo,shiftIndexFr,conn);//Added by jaimin on 16/06/2008 (AD89SUN014)
*/
errString = insertUpdateWorkShift(empInfo, emp,stShiftDate,edShiftDate,frPatternCodeList.get(ctr).toString(),toPatternCodeList.get(ctr).toString(),holiTblNo,shiftIndexFr,conn,itmdbAccessLocal);//Added by jaimin on 16/06/2008 (AD89SUN014)
if(errString.length() > 0){
conn.rollback();
return errString;
......@@ -650,7 +695,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//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, toSqlDate1, lastPatternCodeStr, lastPatternCodeStr,holiTblNo ,Integer.parseInt(lastShiftIndexStr),conn);//Added by jaimin on 16/06/2008 (AD89SUN014)
//Reference of ITMDBAccessLocal is passed to the function - dhiraj - 06/10/10[AD01SUN008]
//errString = insertUpdateWorkShift(empInfo, emp, stShiftDate, toSqlDate1, 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, itmdbAccessLocal);//Added by jaimin on 16/06/2008 (AD89SUN014)
if(errString.length() > 0)
{
......@@ -676,16 +723,21 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
if (cnt == 0)
{
System.out.println("Record not found for process ........");
//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
//Changed by Dhiraj 06/10/10 [AD01SUN008]
//errString = itmDBAccessEJB.getErrorString("","VTRDNTFD","","",conn);
errString = itmdbAccessLocal.getErrorString("","VTRDNTFD","","",conn);
return errString;
}
else
{
System.out.println("Process complete");
conn.commit();
// changed by Dhiraj 11/10/10 [AD01SUN008].start
// errString = itmDBAccessEJB.getErrorString("","VTPCOMPT","","",conn);
// return errString;
errString = itmdbAccessLocal.getErrorString("","VTPCOMPT","","",conn);
return errString;
// changed by Dhiraj 11/10/10 [AD01SUN008].end
}
}
}
......@@ -717,20 +769,21 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{
try
{
if(pstmtn1!=null)
{
pstmtn1.close();
pstmtn1=null;
}
if(pstmtn3!=null)
{
pstmtn3.close();
pstmtn3=null;
}
if(conn != null)
{
conn.close();
conn = null;
if(pstmtn1!=null)
{
pstmtn1.close();
pstmtn1=null;
}
if(pstmtn3!=null)
{
pstmtn3.close();
pstmtn3=null;
}
}
}
catch(Exception e)
......@@ -751,8 +804,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{
}
private String insertUpdateWorkShift(EmpInfo empInfo, String empCode, java.sql.Date shiftStDate, java.sql.Date shiftEndDate, String frpatternCode, String topatterenCode, String holiTblNo,Connection conn) throws Exception
//Reference of ITMDBAccessLocal is passed to the function - dhiraj - 06/10/10[AD01SUN008]
//private String insertUpdateWorkShift(EmpInfo empInfo, String empCode, java.sql.Date shiftStDate, java.sql.Date shiftEndDate, String frpatternCode, String topatterenCode, String holiTblNo,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,Connection conn, ITMDBAccessLocal itmdbAccessLocal ) throws Exception
{
String insertSql ="",updateSql = "",errString = "";
PreparedStatement pstmtn5 = null,pstmtn6=null,pstmtInsert = null,pstmtUpdate = null;
......@@ -768,28 +822,34 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.sql.Date stDate = null;
java.util.Date shiftOfDate = null ;
java.util.Date joiningDate = null;
//added by satya on 07/06/10 [AD90SUN028].start
String genShiftHol = null ;
//added by satya on 07/06/10 [AD90SUN028].end
try{
if ( itmDBAccessLocal == null )
{
ctx = getInitialContext();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" );
}
try
{
stmt = conn.createStatement();
if(frpatternCode == null)
{
//errString = itmDBAccessEJB.getErrorString("","VTPATTERNU","");//commented by Gulzar for ejb3 - 15/01/10
errString = itmDBAccessLocal.getErrorString("","VTPATTERNU","");//Added by Gulzar for ejb3 - 15/01/10
//changed by Dhiraj 05/10/10 [AD01SUN008]
//errString = itmDBAccessEJB.getErrorString("","VTPATTERNU","");
errString = itmdbAccessLocal.getErrorString("","VTPATTERNU","");
return errString ;
}
sql = "SELECT SHIFT_PATTERN,START_DATE,NO_OF_DAYS FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+frpatternCode+"'";
//changed by satya on 07/06/10 [AD90SUN028].START
//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, GEN_SHIFT_HOL FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+frpatternCode+"'";
//changed by satya on 07/06/10 [AD90SUN028].END
rsin1 = stmt.executeQuery(sql);
if(rsin1.next())
{
shiftPattern = rsin1.getString( "SHIFT_PATTERN" );
stDate = rsin1.getDate( "START_DATE" );
noOfDays = rsin1.getInt( "NO_OF_DAYS" );
//added by satya on 07/06/10 [AD90SUN028].start
genShiftHol = rsin1.getString( "GEN_SHIFT_HOL" );
//added by satya on 07/06/10 [AD90SUN028].end
}
rsin1.close();
rsin1 = null;
......@@ -821,23 +881,27 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//next line commented and modified line added by msalam on 25/02/08
//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 )
//uncommented and changed by satya on 07/06/10 [AD90SUN028].START
if (genShiftHol != null && genShiftHol.equalsIgnoreCase("Y"))
{
//added by nisar on 17/12/07 for requestId : AD7SUN0016
//next line commented and modified line added by msalam on 25/02/08
//insertIntoWorkShiftForHoliday(empCode,shiftStDate2,shiftStDate2,"H",frpatternCode,conn);
System.out.println( "From 720" );
insertIntoWorkShiftForHoliday( empCode, shiftStDate, shiftStDate2, holidayType, frpatternCode, conn );
//code ended by nisar on 17/12/07 for requestId : AD7SUN0016
shiftStDate = shiftStDate2;
shiftStDate2 = new java.sql.Date(shiftStDate2.getTime()+(24*60*60*1000));
System.out.println("shiftStDate2 :: " + shiftStDate2);
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
}
*/
//End Changes by Gulzar - 24/11/09 (AD89SUN117)
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
while( isHolidayForType(shiftStDate2, holidayType, holiTblNo,conn) && shiftStDate2.compareTo( toPrdDate ) <= 0 )
{
//added by nisar on 17/12/07 for requestId : AD7SUN0016
//next line commented and modified line added by msalam on 25/02/08
//insertIntoWorkShiftForHoliday(empCode,shiftStDate2,shiftStDate2,"H",frpatternCode,conn);
System.out.println( "From 720" );
insertIntoWorkShiftForHoliday( empCode, shiftStDate, shiftStDate2, holidayType, frpatternCode, conn );
//code ended by nisar on 17/12/07 for requestId : AD7SUN0016
shiftStDate = shiftStDate2;
//shiftStDate2 = new java.sql.Date(shiftStDate2.getTime()+(24*60*60*1000));
shiftStDate2 = getNextDate( shiftStDate2 );
System.out.println("shiftStDate2 :: " + shiftStDate2);
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
}
}
//uncommented and changed by satya on 07/06/10 [AD90SUN028].END
if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 ))
{
......@@ -948,19 +1012,23 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
}
*/
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 )
//changed by satya on 07/06/10 [AD90SUN028].start
if (genShiftHol != null && genShiftHol.equalsIgnoreCase("Y"))
{
System.out.println( "From 839" );
insertIntoWorkShiftForHoliday( empCode, previousDate, stDate, holidayType, frpatternCode, conn );
previousDate = stDate;
stDate = new java.sql.Date( stDate.getTime() + ( 24*60*60*1000 ) );
System.out.println("stDate :: " + stDate);
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
}
*/
//End Changes - Gulzar - 24/11/09
while( isHolidayForType( stDate, holidayType, holiTblNo,conn ) && stDate.compareTo( toPrdDate ) <= 0 )
{
System.out.println( "From 839" );
insertIntoWorkShiftForHoliday( empCode, previousDate, stDate, holidayType, frpatternCode, conn );
previousDate = stDate;
//stDate = new java.sql.Date( stDate.getTime() + ( 24*60*60*1000 ) );//Gulzar - 07/06/10
stDate = getNextDate( stDate );//Gulzar - 07/06/10
System.out.println("stDate :: " + stDate);
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
}
}
//changed by satya on 07/06/10[AD90SUN028].end
//end by msalam on 250208
shiftOfDate = stDate;
......@@ -994,13 +1062,17 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
rsevent = null;
pstmtevent.close();
pstmtevent = null;
sql = "SELECT SHIFT_PATTERN,START_DATE,NO_OF_DAYS FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+newPatternCode+"'";
//changed by satya on 07/06/10 [AD90SUN028].start
//sql = "SELECT SHIFT_PATTERN,START_DATE,NO_OF_DAYS FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+newPatternCode+"'";
sql = "SELECT SHIFT_PATTERN, START_DATE, NO_OF_DAYS, GEN_SHIFT_HOL FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+newPatternCode+"'";
//changed by satya on 07/06/10 [AD90SUN028].end
pstmtevent = conn.prepareStatement(sql);
rsevent = pstmtevent.executeQuery();
newPatternCode = null;
if(rsevent.next())
{
newPatternCode = rsevent.getString("SHIFT_PATTERN");
genShiftHol = rsevent.getString("GEN_SHIFT_HOL");
}
rsevent.close();
rsevent = null;
......@@ -1031,21 +1103,26 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
*/
java.util.Date tempShiftOfDate = shiftOfDate;
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 ) )
//changed by satya on 07/06/10 [AD90SUN028].start
if (genShiftHol != null && genShiftHol.equalsIgnoreCase("Y"))
{
System.out.println( "From 917" );
insertIntoWorkShiftForHoliday( empCode, ( new java.sql.Date( previousDate.getTime() ) ),
( new java.sql.Date( tempShiftOfDate.getTime() ) ), holidayType, frpatternCode, conn );
stDate = new java.sql.Date(shiftOfDate.getTime()+(24*60*60*1000));
previousDate = tempShiftOfDate;
tempShiftOfDate = new java.sql.Date(tempShiftOfDate.getTime()+(24*60*60*1000));
System.out.println( "In isHolidayForType at 912 tempShiftOfDate :: " + tempShiftOfDate );
holidayType = getHolidayTypeForDate( tempShiftOfDate, holiTblNo, conn );
}
*/
//End Changes by Gulzar - 24/11/09 (AD89SUN117)
holidayType = getHolidayTypeForDate( (java.util.Date)shiftOfDate, holiTblNo, conn );
while( isHolidayForType( tempShiftOfDate, holidayType, holiTblNo,conn ) )
{
System.out.println( "From 917" );
insertIntoWorkShiftForHoliday( empCode, ( new java.sql.Date( previousDate.getTime() ) ),
( new java.sql.Date( tempShiftOfDate.getTime() ) ), holidayType, frpatternCode, conn );
//stDate = new java.sql.Date(shiftOfDate.getTime()+(24*60*60*1000));//Gulzar - 07/06/10
stDate = getNextDate( new java.sql.Date( shiftOfDate.getTime() ) );//Gulzar - 07/06/10
previousDate = tempShiftOfDate;
//tempShiftOfDate = new java.sql.Date(tempShiftOfDate.getTime()+(24*60*60*1000)); //Gulzar - 07/06/10
tempShiftOfDate = getNextDate( new java.sql.Date( tempShiftOfDate.getTime() ) );//Gulzar - 07/06/10
System.out.println( "In isHolidayForType at 912 tempShiftOfDate :: " + tempShiftOfDate );
holidayType = getHolidayTypeForDate( tempShiftOfDate, holiTblNo, conn );
}
}
//changed by satya on 07/06/10 [AD90SUN028].end
//end by msalam on 250208
//shiftOfDate = shiftOfDate1;
......@@ -1133,8 +1210,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
if(stDate != null && stDate.compareTo(shiftStDate) > 0)
{
System.out.println("Pattern is not Valid for the Processing Month........");
//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
//Changed by Dhiraj 06/10/10 [AD01SUN008]
//errString = itmDBAccessEJB.getErrorString("","VTINVPATRN","","",conn);
errString = itmdbAccessLocal.getErrorString("","VTINVPATRN","","",conn);
conn.rollback();
return errString;
}
......@@ -1191,7 +1269,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//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
//Reference of ITMDBAccessLocal is passed to the function - dhiraj - 06/10/10[AD01SUN008]
//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, ITMDBAccessLocal itmdbAccessLocal ) throws Exception
{
System.out.println("insertUpdateWorkShift is called...............");
String insertSql ="",updateSql = "",errString = "";
......@@ -1209,26 +1289,35 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.util.Date shiftOfDate = null ;
java.util.Date joiningDate = null;
try{
if ( itmDBAccessLocal == null )
{
ctx = getInitialContext();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" );
}
String tempShift = "XXX";
//Added by satya on 07/06/10 [AD90SUN028].start
String genShiftHol = null;
//Added by satya on 07/06/10 [AD90SUN028].end
try
{
stmt = conn.createStatement();
if(frpatternCode == null)
{
//errString = itmDBAccessEJB.getErrorString("","VTPATTERNU","");//commented by Gulzar for ejb3 - 15/01/10
errString = itmDBAccessLocal.getErrorString("","VTPATTERNU","");//Added by Gulzar for ejb3 - 15/01/10
//Changed by Dhiraj 06/10/10 [AD01SUN008]
//errString = itmDBAccessEJB.getErrorString("","VTPATTERNU","");
errString = itmdbAccessLocal.getErrorString("","VTPATTERNU","");
return errString ;
}
sql = "SELECT SHIFT_PATTERN,START_DATE,NO_OF_DAYS FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+frpatternCode+"'";
//changed by satya on 07/06/10[AD90SUN028].start
//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, GEN_SHIFT_HOL FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+frpatternCode+"'";
//changed by satya on 07/06/10 [AD90SUN028].start
rsin1 = stmt.executeQuery(sql);
if(rsin1.next())
{
shiftPattern = rsin1.getString( "SHIFT_PATTERN" );
stDate = rsin1.getDate( "START_DATE" );
noOfDays = rsin1.getInt( "NO_OF_DAYS" );
//added by satya on 07/06/10 [AD90SUN028].start
genShiftHol = rsin1.getString("GEN_SHIFT_HOL");
//added by satya on 07/06/10 [AD90SUN028].end
}
rsin1.close();
rsin1 = null;
......@@ -1259,28 +1348,30 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//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
//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 )
//uncommented and changed by satya on 07/06/10 [AD90SUN028].start
if ( genShiftHol != null && genShiftHol.equalsIgnoreCase("Y") )
{
//added by nisar on 17/12/07 for requestId : AD7SUN0016
//next line commented and modified line added by msalam on 25/02/08
//insertIntoWorkShiftForHoliday(empCode,shiftStDate2,shiftStDate2,"H",frpatternCode,conn);
System.out.println( "From 720" );
insertIntoWorkShiftForHoliday( empCode, shiftStDate, shiftStDate2, holidayType, frpatternCode, conn );
//code ended by nisar on 17/12/07 for requestId : AD7SUN0016
shiftStDate = shiftStDate2;
//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);
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
}
*/
//End changes - Gulzar - 24/11/09
while( isHolidayForType(shiftStDate2, holidayType, holiTblNo,conn) && shiftStDate2.compareTo( toPrdDate ) <= 0 )
{
//added by nisar on 17/12/07 for requestId : AD7SUN0016
//next line commented and modified line added by msalam on 25/02/08
//insertIntoWorkShiftForHoliday(empCode,shiftStDate2,shiftStDate2,"H",frpatternCode,conn);
System.out.println( "From 720" );
insertIntoWorkShiftForHoliday( empCode, shiftStDate, shiftStDate2, holidayType, frpatternCode, conn );
//code ended by nisar on 17/12/07 for requestId : AD7SUN0016
shiftStDate = shiftStDate2;
//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);
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn );
}
}
//uncommented and changed by satya on 07/06/10 [AD90SUN028].end
if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 ))
{
System.out.println("In Continue..");
......@@ -1391,22 +1482,25 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
}
*/
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 )
//added by satya on 07/06/10 [AD90SUN028].start
if ( genShiftHol != null && genShiftHol.equalsIgnoreCase("Y") )
{
System.out.println( "From 839" );
insertIntoWorkShiftForHoliday( empCode, previousDate, stDate, holidayType, frpatternCode, conn );
previousDate = stDate;
//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);
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
}
*/
while( isHolidayForType( stDate, holidayType, holiTblNo,conn ) && stDate.compareTo( toPrdDate ) <= 0 )
{
System.out.println( "From 839" );
insertIntoWorkShiftForHoliday( empCode, previousDate, stDate, holidayType, frpatternCode, conn );
previousDate = stDate;
//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);
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
}
//End Changes by Gulzar - 24/11/09 (AD89SUN117)
}
//added by satya on 07/06/10 [AD90SUN028].start
//end by msalam on 250208
shiftOfDate = stDate;
......@@ -1440,13 +1534,19 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
rsevent = null;
pstmtevent.close();
pstmtevent = null;
sql = "SELECT SHIFT_PATTERN,START_DATE,NO_OF_DAYS FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+newPatternCode+"'";
//changed by satya on 07/06/10 [AD90SUN028].start
//sql = "SELECT SHIFT_PATTERN,START_DATE,NO_OF_DAYS FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+newPatternCode+"'";
sql = "SELECT SHIFT_PATTERN, START_DATE, NO_OF_DAYS, GEN_SHIFT_HOL FROM SHIFT_PATTERN WHERE PATTERN_CODE = '"+newPatternCode+"'";
//changed by satya on 07/06/10 [AD90SUN028].end
pstmtevent = conn.prepareStatement(sql);
rsevent = pstmtevent.executeQuery();
newPatternCode = null;
if(rsevent.next())
{
newPatternCode = rsevent.getString("SHIFT_PATTERN");
//added by satya on 07/06/10 [AD90SUN028].start
genShiftHol = rsevent.getString("GEN_SHIFT_HOL");
//added by satya on 07/06/10 [AD90SUN028].end
}
rsevent.close();
rsevent = null;
......@@ -1477,26 +1577,28 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
*/
java.util.Date tempShiftOfDate = shiftOfDate;
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 ) )
//uncommented and changed by satya on 07/06/10 [AD90SUN028].end
if (genShiftHol != null && genShiftHol.equalsIgnoreCase("Y"))
{
System.out.println( "From 917" );
insertIntoWorkShiftForHoliday( empCode, ( new java.sql.Date( previousDate.getTime() ) ),
( new java.sql.Date( tempShiftOfDate.getTime() ) ), holidayType, frpatternCode, conn );
//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;
//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 );
holidayType = getHolidayTypeForDate( tempShiftOfDate, holiTblNo, conn );
}
*/
//End Changes by Gulzar - 24/11/09 (AD89SUN117)
holidayType = getHolidayTypeForDate( (java.util.Date)shiftOfDate, holiTblNo, conn );
while( isHolidayForType( tempShiftOfDate, holidayType, holiTblNo,conn ) )
{
System.out.println( "From 917" );
insertIntoWorkShiftForHoliday( empCode, ( new java.sql.Date( previousDate.getTime() ) ),
( new java.sql.Date( tempShiftOfDate.getTime() ) ), holidayType, frpatternCode, conn );
//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;
//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 );
holidayType = getHolidayTypeForDate( tempShiftOfDate, holiTblNo, conn );
}
}
//uncommented and changed by satya on 07/06/10 [AD90SUN028].end
//end by msalam on 250208
//shiftOfDate = shiftOfDate1;
......@@ -1505,6 +1607,13 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("At 626 Shift:: " + shift);
}
}
//Start Added Gulzar - 03/06/10[]
if ( shift != null && !shift.trim().equalsIgnoreCase(tempShift) )
{
shiftStDate = shiftStDate2;
tempShift = shift;
}
//End Added Gulzar - 03/06/10[]
//added by tarani
// ADDED BY DURGA SINGH THAKUR 30/03/2007
sql = "SELECT COUNT(*) FROM WORK_SHIFT WHERE FROM_DT = ? AND SHIFT = '"+shift+"' AND EMP_CODE = '"+empCode+"'";//QUERY IS COMMENTED BY DURGA 02/04/07
......@@ -1514,10 +1623,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//pstmtn6.setDate(2, shiftStDate2);//ADDED EXTRA PARAMETER LINE BY DURGA 02/04/07
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 SHIFT "+shift+"\n");
System.out.println("PARAMETER IN UPDATE QUERY EMP_CODE "+empCode+"\n");
System.out.println("PARAMETER IN UPDATE QUERY SHIFT START DATE "+shiftStDate2+"\n");
System.out.println("PARAMETER IN UPDATE QUERY SHIFT START DATE(FROM_DT) =["+shiftStDate+"]");
System.out.println("PARAMETER IN UPDATE QUERY SHIFT =["+shift+"]");
System.out.println("PARAMETER IN UPDATE QUERY EMP_CODE ["+empCode+"]");
System.out.println("PARAMETER IN UPDATE QUERY SHIFT TO DATE(TO_DT) =["+shiftStDate2+"]");
rsin2 = pstmtn6.executeQuery();
if(rsin2.next())
{
......@@ -1591,8 +1700,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
if(stDate != null && stDate.compareTo(shiftStDate) > 0)
{
System.out.println("Pattern is not Valid for the Processing Month........");
//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
//Changed by Dhiraj 06/10/10 [WS01SUN008]
//errString = itmDBAccessEJB.getErrorString("","VTINVPATRN","","",conn);
errString = itmdbAccessLocal.getErrorString("","VTINVPATRN","","",conn);
conn.rollback();
return errString;
}
......@@ -1709,18 +1819,19 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
ArrayList shiftTime = new ArrayList();
ArrayList shiftTime1 = new ArrayList();
String shiftNew = "";
System.out.println("\n\n PASSED Parameter...");
System.out.println("\n\n SHIFTINDEX ["+shiftIndex+"]");
System.out.println("\n\n CURRDATE "+fromDate+"]");
System.out.println("\n\n PATTERNCODE ["+patternCode+"]");
System.out.println("\n\n SHIFTPATTERN ["+shiftPattern+"]");
System.out.println("\n\n SHIFTSTDATE ["+shiftStDate+"]");
System.out.println("PASSED Parameter...");
System.out.println("SHIFTINDEX =["+shiftIndex+"]");
System.out.println("CURRDATE =["+fromDate+"]");
System.out.println("PATTERNCODE =["+patternCode+"]");
System.out.println("SHIFTPATTERN =["+shiftPattern+"]");
System.out.println("SHIFTSTDATE =["+shiftStDate+"]");
long numberOfDay = 0 ;
try
{
patternList = GenericUtility.getInstance().getTokenList(shiftPattern,";");
System.out.println("\n\n\n\n PatternList(Original) "+patternList);
System.out.println("PatternList(Original) "+patternList);
for(int j = 0 ; j < patternList.size()-1 ; j++)
{
patString = patternList.get(j).toString();
......@@ -1733,7 +1844,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
}
shiftNew =(String)shiftTime.get(shiftIndex-1);
System.out.println("\n\n NEW SHIFT IN SHIFT DATE "+shiftNew+"\n\n");
System.out.println("NEW SHIFT IN SHIFT DATE "+shiftNew+"\n\n");
int j = 0,i = 0;
......@@ -1751,22 +1862,26 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("POSITION "+i+" "+shiftTime1.get(i));
}*/
System.out.println("\n\n change patternList: "+shiftTime1+"********");
System.out.println("change patternList: "+shiftTime1+"********");
/*--Start Commented and Changes below by Gulzar - 06/07/10[]
timeDiff = fromDate.getTime() - shiftOfDate.getTime();
timeDiff = (timeDiff/(60*60*24*1000));
noDays = new Long(timeDiff).intValue();
noDays = Math.abs(noDays);
*/
noDays = daysDiff( fromDate, shiftOfDate );
//End Changes by Gulzar - 06/07/10[]
System.out.println("\n\n NUMBER OF DAYS BETWEEN DATE__FROM AND SHIFTOFDATE IS ["+noDays+"]");
System.out.println("NUMBER OF DAYS BETWEEN DATE__FROM AND SHIFTOFDATE IS ["+noDays+"]");
j = shiftTime1.size();
System.out.println("\n\n SIZE OF ARRAYLIST SHIFTTIME IS J :["+j+"]");
System.out.println("SIZE OF ARRAYLIST SHIFTTIME IS J :["+j+"]");
while( noDays >= j)
{
noDays = noDays%j ;
}
System.out.println("\n\n INDEX OF FETCHING IS :["+noDays+"]");
System.out.println("INDEX OF FETCHING IS :["+noDays+"]");
shiftNew = (String)shiftTime1.get(noDays).toString();
System.out.println("\n\n SHIFT INDEX AT FROM DATE "+fromDate+" is "+shiftNew);
System.out.println("SHIFT INDEX AT FROM DATE "+fromDate+" is ["+shiftNew+"]");
}
catch(Exception e)
......@@ -1798,6 +1913,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//java.sql.Date shiftDateNew = shiftStDate;
ArrayList shiftTime = new ArrayList();
ArrayList shiftTime1 = new ArrayList();
//Changed by Dhiraj 05/10/10 [AD01SUN008]
//ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
//ITMDBAccessEJB itmDBAccessEJB = null;
String shiftNew = "";
System.out.println("\n\n PASSED VALUE SHIFTINDEX "+shiftIndex);
System.out.println("\n\n PASSED VALUE CURRDATE "+fromDate);
......@@ -1838,6 +1956,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{
shiftTime1.add(shiftTime.get(i));
}
/*--Start Commented and Changes below by Gulzar - 06/07/10[]
for(i= 0; i< shiftTime1.size(); i++)
{
System.out.println("POSITION "+i+" "+shiftTime1.get(i));
......@@ -1848,6 +1967,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
timeDiff = (timeDiff/(60*60*24*1000));
noDays = new Long(timeDiff).intValue();
noDays = Math.abs(noDays);
*/
noDays = daysDiff( fromDate, shiftOfDate );
//End Changes by Gulzar - 06/07/10[]
System.out.println("\n\n NUMBER OF DAYS BETWEEN DATE__FROM AND SHIFTOFDATE IS "+noDays);
j = shiftTime1.size();
......@@ -1883,7 +2005,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
Timestamp ts = new Timestamp(shiftDate.getTime()) ;
String sqlStr = 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("Hol Type in isHoliday :: " + holidayType);
try{
......@@ -1909,10 +2033,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
try
{
if(rs!=null)
{
rs.close();
rs = null;
}
{
rs.close();
rs = null;
}
if(stmt != null)
{
stmt.close();
......@@ -1931,7 +2055,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
String insertSql = null;
String updateSql = null;
int cnt = 0;
SimpleDateFormat sdf = null;
try
......@@ -2012,30 +2136,21 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtUpdate.close();
pstmtUpdate=null;
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try
if(pstmtInsert!=null)
{
if(pstmtInsert!=null)
{
pstmtInsert.close();
pstmtInsert=null;
}
if(pstmtUpdate!=null)
{
pstmtUpdate.close();
pstmtUpdate=null;
}
pstmtInsert.close();
pstmtInsert=null;
}
catch (Exception e1)
if(pstmtUpdate!=null)
{
pstmtUpdate.close();
pstmtUpdate=null;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}//end of insertIntoWorkShiftForHoliday()//added by nisar on 17/12/07
//ADDED BY MSALAM ON 250208 TO GET HOLIDAY DAY TYPE
private String getHolidayTypeForDate( java.util.Date shiftDate, String holiTblNo, Connection conn)
......@@ -2045,6 +2160,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
PreparedStatement stmt = null;
ResultSet rs = null;
String holType = null;
System.out.println("Holiday type for date :: " + shiftDate);
try{
//sqlStr = "select Hol_Type from holiday where Hol_Date = ? and HOL_TBLNO ='" + holiTblNo + "'";//Commentd by jaimin on 17/06/2008 (AD89SUN016)
......@@ -2072,10 +2188,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
try
{
if(rs!=null)
{
rs.close();
rs = null;
}
{
rs.close();
rs = null;
}
if(stmt != null)
{
stmt.close();
......@@ -2124,26 +2240,48 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
return nextShiftDate;
}
//End Added - Gulzar - 17/09/09
//Added - Gulzar - 15/01/10
protected InitialContext getInitialContext()throws ITMException
//Start added gulzar - 03/06/10[]
private java.sql.Date getPrevDate( java.sql.Date currShiftDate )
{
InitialContext ctx = null;
java.util.Date uDate1 = null;
java.sql.Date nextShiftDate = null;
try
{
AppConnectParm appConnect = new AppConnectParm();
ctx = new InitialContext(appConnect.getProperty());
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(ITMException itme)
catch( Exception e )
{
System.out.println("ITMException :[SprsItemReorg] :getInitialContext :==>");
throw itme;
e.printStackTrace();
}
catch(Exception e)
return nextShiftDate;
}
//End added gulzar - 03/06/10[]
//Start added gulzar - 06/07/10[]
public int daysDiff( java.util.Date dateTo, java.util.Date dateFrom )
{
int noOfDays = 0;
try
{
System.out.println("Exception :[SprsItemReorg] :getInitialContext :==>");
throw new ITMException(e);
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.setTime( dateFrom );
int fromDayNo = 0;
int toDayNo = 0;
fromDayNo = cal.get(cal.DAY_OF_YEAR);
cal.setTime( dateTo );
toDayNo = cal.get(cal.DAY_OF_YEAR);
noOfDays = (toDayNo - fromDayNo);
//System.out.println("Total No Of Days between ["+dateFrom+"] and ["+dateTo+"] is ["+noOfDays+"]");
}
catch ( Exception e )
{
e.printStackTrace();
}
return ctx;
return noOfDays;
}
//End Added - Gulzar - 15/01/10
//End added gulzar - 06/07/10[]
}
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10]
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface ShiftProcessLocal extends ibase.webitm.ejb.ProcessLocal //,EJBObject
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10].start
import javax.ejb.Local;
@Local
//public interface ShiftProcess extends ibase.webitm.ejb.Process,EJBObject
public interface ShiftProcessLocal extends ibase.webitm.ejb.ProcessLocal
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10].end
{
public String process() throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
......
package ibase.webitm.ejb.adm;
import java.rmi.RemoteException;
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10]
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface ShiftProcessRemote extends ibase.webitm.ejb.ProcessRemote //,EJBObject
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10].start
import javax.ejb.Remote;
@Remote
//public interface ShiftProcess extends ibase.webitm.ejb.Process,EJBObject
public interface ShiftProcessRemote extends ibase.webitm.ejb.ProcessRemote
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10].end
{
public String process() throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
......
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