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 ...@@ -16,12 +16,14 @@ import ibase.webitm.utility.TransIDGenerator;//TID
import ibase.utility.CommonConstants;//TID import ibase.utility.CommonConstants;//TID
import ibase.webitm.utility.GenericUtility; //Added by Raj (ADM5000192)- 28/04/2008 import ibase.webitm.utility.GenericUtility; //Added by Raj (ADM5000192)- 28/04/2008
import javax.ejb.Stateless; // added for ejb3 //Changed by Pawan 10/5/2010 [AD01SUN009] to migrate from ejb2 to ejb3 Syntax
//public class SepClose extends ValidatorEJB implements SessionBean
@Stateless // added for ejb3 @javax.ejb.Stateless
public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemote // SessionBean 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 public void ejbCreate() throws RemoteException, CreateException
{ {
System.out.println("SepCloseEjb Process modified On Date 06 November.........."); System.out.println("SepCloseEjb Process modified On Date 06 November..........");
...@@ -34,7 +36,10 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -34,7 +36,10 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
} }
public void ejbPassivate() public void ejbPassivate()
{ {
}*/ }
Changed by Pawan 10/5/2010 [AD01SUN009] to migrate from ejb2 to ejb3. END
*/
public String wfValData() throws RemoteException,ITMException public String wfValData() throws RemoteException,ITMException
{ {
return ""; return "";
...@@ -95,7 +100,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -95,7 +100,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
Node childNode = null; Node childNode = null;
int ctr,currentFormNo=0; int ctr,currentFormNo=0;
int childNodeListLength; 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 userId = getValueFromXTRA_PARAMS(xtraParams,"userId");
String empCodeAprv= getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode"); String empCodeAprv= getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
String loginSite = getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode"); String loginSite = getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
...@@ -297,7 +303,6 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -297,7 +303,6 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
System.out.println("Exception ::"+e); System.out.println("Exception ::"+e);
e.printStackTrace(); e.printStackTrace();
} }
//Added below by Raj (AD90SUN017)- 12/05/2010
finally finally
{ {
try try
...@@ -325,7 +330,6 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -325,7 +330,6 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
} }
catch(Exception e){} catch(Exception e){}
} }
//Addition ended by Raj (AD90SUN017)- 12/05/2010
System.out.println("ErrString ::"+errString); System.out.println("ErrString ::"+errString);
return errString; return errString;
}//END OF VALIDATION }//END OF VALIDATION
...@@ -337,12 +341,18 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -337,12 +341,18 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
String valueXmlString = ""; String valueXmlString = "";
try try
{ {
dom = parseString(xmlString);
System.out.println("xmlString:::" + xmlString); System.out.println("xmlString:::" + xmlString);
System.out.println("xmlString1:::" + xmlString1); System.out.println("xmlString1:::" + xmlString1);
System.out.println("xmlString2:::" + xmlString2); System.out.println("xmlString2:::" + xmlString2);
if (xmlString != null && xmlString.trim().length() > 0 )
{
dom = parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() > 0 )
{
dom1 = parseString(xmlString1); dom1 = parseString(xmlString1);
if (xmlString2.trim().length() > 0 ) }
if (xmlString2 != null && xmlString2.trim().length() > 0 )
{ {
dom2 = parseString(xmlString2); dom2 = parseString(xmlString2);
} }
...@@ -373,7 +383,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -373,7 +383,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
NodeList childNodeList = 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(); GenericUtility genericUtility = GenericUtility.getInstance();
java.util.Date DateX = new java.util.Date(); java.util.Date DateX = new java.util.Date();
String userId = getValueFromXTRA_PARAMS(xtraParams,"userId"); String userId = getValueFromXTRA_PARAMS(xtraParams,"userId");
...@@ -382,7 +393,7 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -382,7 +393,7 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
StringBuffer retString = new StringBuffer(); StringBuffer retString = new StringBuffer();
StringBuffer valueXmlString = new StringBuffer(); StringBuffer valueXmlString = new StringBuffer();
System.out.println("xtraParams::::::::::::::::"+xtraParams); System.out.println("xtraParams::::::::::::::::"+xtraParams);
//Added below by Raj (AD90SUN017)- 12/05/2010 //Added below by Raj (AD90SUN017)- 13/05/2010
String status = ""; String status = "";
String sepMode = ""; String sepMode = "";
String reason = ""; String reason = "";
...@@ -390,7 +401,7 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -390,7 +401,7 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
String confDate = ""; String confDate = "";
String empCodeConf = ""; String empCodeConf = "";
String reliveDate = ""; String reliveDate = "";
//Addition ended by Raj (AD90SUN017)- 12/05/2010 //Addition ended by Raj (AD90SUN017)- 13/05/2010
try try
{ {
...@@ -406,7 +417,7 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -406,7 +417,7 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
switch (currentFormNo) switch (currentFormNo)
{ {
case 1: case 1:
// SEARCHING THE DOM FOR THE INCOMING COLUMN VALUE START //SEARCHING THE DOM FOR THE INCOMING COLUMN VALUE START
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
...@@ -461,11 +472,13 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -461,11 +472,13 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
*///End - Commented by jaimin on 17/07/2008 (AD89SUN025) *///End - Commented by jaimin on 17/07/2008 (AD89SUN025)
valueXmlString.append("<tran_date>").append(currDate).append("</tran_date>\r\n"); 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::::["+empCodeAprv+"]");
System.out.println("EmpCodeaprv(FNAME)::::["+fName+"]"); System.out.println("EmpCodeaprv(FNAME)::::["+fName+"]");
System.out.println("EmpCodeaprv(LNAME)::::["+lName+"]"); System.out.println("EmpCodeaprv(LNAME)::::["+lName+"]");
System.out.println("Tran Date=["+currDate+"]"); System.out.println("Tran Date=["+currDate+"]");
*/
//End Commented by Pawan - 11/10/10
valueXmlString.append("</Detail1>\r\n"); valueXmlString.append("</Detail1>\r\n");
} }
...@@ -478,14 +491,15 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -478,14 +491,15 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
//String reliveDateStr="";//Remarked by Raj (AD90SUN017)- 13/05/2010 //String reliveDateStr="";//Remarked by Raj (AD90SUN017)- 13/05/2010
String firstName=""; String firstName="";
String lastName=""; String lastName="";
String approverfirstName = ""; //Added by Raj (AD90SUN017)- 12/05/2010 String approverfirstName = ""; //Added by Raj (AD90SUN017)- 13/05/2010
String approverlastName = ""; //Added by Raj (AD90SUN017)- 12/05/2010 String approverlastName = ""; //Added by Raj (AD90SUN017)- 13/05/2010
Object date = null; Object date = null;
loginSite = "";//Added by jaimin on 17/07/2008 (AD89SUN025) loginSite = "";//Added by jaimin on 17/07/2008 (AD89SUN025)
String sepFound = "N"; // Added by Raj - Req.ID: ADM5000192 - 27/05/08 String sepFound = "N"; // Added by Raj - Req.ID: ADM5000192 - 27/05/08
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf1 = new SimpleDateFormat(genericUtility.getApplDateFormat());
java.sql.Date rDate = null;//new java.sql.Date(); 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 //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 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 //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 ...@@ -500,13 +514,14 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
dateStr=sdf1.format(date).toString(); dateStr=sdf1.format(date).toString();
sepFound = "Y"; // Added by Raj - Req.ID: ADM5000192 - 27/05/08 sepFound = "Y"; // Added by Raj - Req.ID: ADM5000192 - 27/05/08
//Added below by Raj (AD90SUN017)- 08/05/2010 //Added below by Raj (AD90SUN017)- 08/05/2010
status = rsSep.getString("STATUS"); resiDate = checkNull(rsSep.getString("RESI_DATE"));//Added by Pawan on 09/10/10 [AD01SUN009]
sepMode = rsSep.getString("SEPARATION_MODE"); status = checkNull(rsSep.getString("STATUS"));
reason = rsSep.getString("REASON"); sepMode = checkNull(rsSep.getString("SEPARATION_MODE"));
vacNoCreated = rsSep.getString("VAC_NO__CREATED"); reason = checkNull(rsSep.getString("REASON"));
confDate = rsSep.getString("CONF_DATE"); vacNoCreated = checkNull(rsSep.getString("VAC_NO__CREATED"));
empCodeConf = rsSep.getString("EMP_CODE__CONF"); confDate = checkNull(rsSep.getString("CONF_DATE"));
reliveDate = rsSep.getString("RELIEVE_DATE"); empCodeConf = checkNull(rsSep.getString("EMP_CODE__CONF"));
reliveDate = checkNull(rsSep.getString("RELIEVE_DATE"));
//Addition ended by Raj (AD90SUN017)- 08/05/2010 //Addition ended by Raj (AD90SUN017)- 08/05/2010
} }
rsSep.close(); rsSep.close();
...@@ -520,7 +535,15 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -520,7 +535,15 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
} }
if ( reliveDate != null && reliveDate.trim().length() > 0 ) 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("<sep_status>").append(status).append("</sep_status>\r\n");
valueXmlString.append("<separation_mode>").append(sepMode).append("</separation_mode>\r\n"); valueXmlString.append("<separation_mode>").append(sepMode).append("</separation_mode>\r\n");
...@@ -535,8 +558,11 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -535,8 +558,11 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
rsSep = stmtSep.executeQuery(sql); rsSep = stmtSep.executeQuery(sql);
while (rsSep.next()) while (rsSep.next())
{ {
approverfirstName=(rsSep.getString(1)==null?"":rsSep.getString(1)); //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.
approverlastName=(rsSep.getString(2)==null?"":rsSep.getString(2)); //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(); stmtSep.close();
valueXmlString.append("<emp_fname_sep_conf>").append(approverfirstName).append("</emp_fname_sep_conf>\r\n"); valueXmlString.append("<emp_fname_sep_conf>").append(approverfirstName).append("</emp_fname_sep_conf>\r\n");
...@@ -548,11 +574,11 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -548,11 +574,11 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
System.out.println("APPLICATION DATE FORMAT::["+dateStr+"]"); System.out.println("APPLICATION DATE FORMAT::["+dateStr+"]");
System.out.println("Seperation Found::["+sepFound+"]"); // Added by Raj - Req.ID: ADM5000192 - 27/05/08 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 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,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)- 12/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+"]"); System.out.println("Sql For Employee***["+sql+"]");
stmtSep = connSep.createStatement(); stmtSep = connSep.createStatement();
rsSep = stmtSep.executeQuery(sql); rsSep = stmtSep.executeQuery(sql);
...@@ -560,20 +586,20 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -560,20 +586,20 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
{ {
loginSite = (rsSep.getString(1)==null?"":rsSep.getString(1)); 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)); firstName=(rsSep.getString(2)==null?"":rsSep.getString(2));
lastName=(rsSep.getString(3)==null?"":rsSep.getString(3)); lastName=(rsSep.getString(3)==null?"":rsSep.getString(3));
//date = sdf.parse(reliveDate.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)- 12/05/2010 //reliveDateStr=sdf1.format(date).toString(); //Remarked by Raj (AD90SUN017)- 13/05/2010
} }
System.out.println("Employee Site code:::["+loginSite+"]"); 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 First Name:::["+firstName+"]");
System.out.println("Employee Last Name :::["+lastName+"]"); System.out.println("Employee Last Name :::["+lastName+"]");
stmtSep.close(); 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+ "'"; sql = "SELECT DESCR FROM SITE WHERE SITE_CODE ='" +loginSite+ "'";
System.out.println("Sql for site descr "+sql); System.out.println("Sql for site descr "+sql);
...@@ -597,7 +623,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -597,7 +623,8 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
//Start - Added by jaimin on 17/07/2008 (AD89SUN025) //Start - Added by jaimin on 17/07/2008 (AD89SUN025)
valueXmlString.append("<emp_fname>").append(firstName).append("</emp_fname>\r\n"); valueXmlString.append("<emp_fname>").append(firstName).append("</emp_fname>\r\n");
valueXmlString.append("<emp_lname>").append(lastName).append("</emp_lname>\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("<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("<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"); valueXmlString.append("<site_descr>").append(siteDescr).append("</site_descr>\r\n");
...@@ -621,7 +648,6 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -621,7 +648,6 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
System.out.println("Exception ::"+e.getMessage()); System.out.println("Exception ::"+e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
//Added below by Raj (AD90SUN017)- 12/05/2010
finally finally
{ {
try try
...@@ -644,8 +670,16 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo ...@@ -644,8 +670,16 @@ public class SepClose extends ValidatorEJB implements SepCloseLocal,SepCloseRemo
} }
catch(Exception e) {} catch(Exception e) {}
} }
//Addition ended by Raj (AD90SUN017)- 12/05/2010
return valueXmlString.toString(); return valueXmlString.toString();
}//END OF ITEMCHNGE }//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.*; package ibase.webitm.ejb.adm;
//import ibase.utility.*;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.text.*;
import java.util.*; import java.util.*;
import java.math.*; import java.util.Date;
import java.text.*;
import java.sql.*; import java.sql.*;
import org.w3c.dom.*; import org.w3c.dom.*;
import javax.xml.parsers.*; import javax.xml.parsers.*;
import javax.ejb.*; import javax.ejb.*;
import javax.naming.InitialContext; 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 ibase.webitm.utility.ITMException;
import javax.ejb.Stateless; // added for ejb3 import ibase.webitm.utility.*;
import ibase.system.config.*;
@Stateless // added for ejb3 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 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 = "";
Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rSet = null ;
Connection connectionObject = null;
String errString = "";
String loginEmpCode = "";
String sepCloseStatus = "";
boolean isError = false;
int updCnt = 0;
AdmCommon admCommon = null;
ITMDBAccessLocal itmdbAccessLocal = null ;
/*public void ejbCreate() throws RemoteException, CreateException try
{ {
System.out.println("Entering the EJB of confirmation[(SepCloseConfEJB)]...............");
} AppConnectParm appConnect = new AppConnectParm();
public void ejbRemove() Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p);
itmdbAccessLocal = (ITMDBAccessLocal)ctx.lookup("ibase/ITMDBAccessEJB/local");
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");
} }
public void ejbActivate() if ( rSet != null )
{ {
rSet.close();
rSet = null;
} }
public void ejbPassivate() 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);
public String confirm(String tranID,String xtraParams, String forcedFlag) throws RemoteException,ITMException if( rSet.next() )
{ {
String result = ""; ctr = rSet.getInt(1);
try if( ctr > 0 )
{
System.out.println("Confirming SepClose....");
result = confirmSepCloseConf(tranID,xtraParams);
}
catch(Exception e)
{ {
System.out.println("Exception ::"+e.getMessage()); isError = true;
throw new ITMException(e); errString = itmdbAccessLocal.getErrorString("","VTFFS1","");
return errString;
} }
System.out.println("Returning Result ::"+result);
return result;
} }
private String confirmSepCloseConf(String tranID,String xtraParams)throws RemoteException,ITMException if ( rSet != null )
{ {
Connection con = null; rSet.close();
Statement stmt = null; rSet = null;
PreparedStatement pstmt = null; }
ResultSet rs = null;
sql = "SELECT STATUS, RELIEVE_DATE, SEPARATION_MODE, REASON, VAC_NO__CREATED, CONF_DATE, EMP_CODE__CONF FROM SEPARATION WHERE EMP_CODE = ? AND RESI_DATE = ?";
String empCodeApprv = ""; pstmt = connectionObject.prepareStatement( sql );
java.util.Date chgDate = null; pstmt.setString(1,empCode);
String chgUser = ""; pstmt.setTimestamp( 2,Timestamp.valueOf( resiDate ) );
String chgTerm = ""; rSet = pstmt.executeQuery();
String update = "";
int upd;
String retString = "";
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 )
{
pstmt.close();
pstmt = null;
}
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(); GenericUtility genericUtility = GenericUtility.getInstance();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
ConnDriver connDriver = new ConnDriver();
ValidatorEJB ve = new ValidatorEJB();
String empCode = ve.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
System.out.println("Emp code="+xtraParams);
try 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);
}
con = connDriver.getConnectDB("DriverITM"); if( pstmt != null )
System.out.println("Confirm Called....."); {
pstmt.close();
pstmt = null;
}
if ( rSet != null )
{
rSet.close();
rSet = null;
} }
catch(Exception ex){System.out.println("[Exception:]"+ex);}
admCommon = new AdmCommon();
deleteSepOnClose = admCommon.getEnv("999999", "DELSEPONCLOSE", connectionObject);
// TESTING FOR CONFIRM FIELD if( deleteSepOnClose !=null && deleteSepOnClose.equalsIgnoreCase("NULLFOUND") )
if(dupConf( tranID, con)) {
isError = true;
errString = itmdbAccessLocal.getErrorString("","VSENVAR1","");
return errString;
}
else if( deleteSepOnClose !=null && !deleteSepOnClose.equalsIgnoreCase("Y") )
{ {
retString = itmDBAccessEJB.getErrorString("","VTCREDIT01","","",con); deleteSepOnClose = "N";
System.out.println("enter into confirm"); }
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 else
{ {
// CONFIRM THE SEPARATION_CLOSE TABLE BY UPDATING THE STATUS FIELD sql = "UPDATE SEPARATION SET STATUS = 'X' WHERE EMP_CODE = ? AND RESI_DATE = ?";
try pstmt = connectionObject.prepareStatement( sql );
pstmt.setString(1,empCode);
pstmt.setTimestamp(2,Timestamp.valueOf( resiDate ) );
pstmt.executeUpdate();
}
if( pstmt != null )
{ {
update = "UPDATE SEPARATION_CLOSE SET STATUS = 'X' WHERE TRAN_ID = ? "; pstmt.close();
pstmt = con.prepareStatement(update); pstmt = null;
pstmt.setString(1,tranID);
upd = pstmt.executeUpdate();
} }
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 TRAN_ID FROM FULLFINAL_HDR WHERE EMP_CODE = '"+empCode+"' AND CONFIRMED != 'X'";
rSet = stmt.executeQuery(sql);
if( rSet.next() )
{ {
tranIdFFS = rSet.getString("tran_id");
retString = "Not Confirmed"; sql = "DELETE FROM FULLFINAL_DET WHERE TRAN_ID = '"+tranIdFFS+"'";
System.out.println("Exception ::"+ex2.getMessage()); updCnt = stmt.executeUpdate(sql);
ex2.printStackTrace(); if ( updCnt > 0 )
{
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);
} }
return retString;
} }
private boolean dupConf(String tarnID,Connection con) throws ITMException if ( rSet != null )
{ {
Statement stmt = null; rSet.close();
ResultSet rs = null; rSet = null;
String sql=""; }
boolean flag = false;
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);
}
}
catch(Exception e)
{
isError = true;
try try
{ {
sql = " SELECT COUNT(*) FROM SEPARATION_CLOSE" + connectionObject.rollback();
" WHERE TRAN_ID = '"+ tarnID +"' AND STATUS = 'X' "; }
catch(Exception e1)
System.out.println("[ConfirmSepCloseEJB:] [dupConf] EXECUTE SELECT: "+sql); {
e1.printStackTrace();
stmt = con.createStatement(); }
rs = stmt.executeQuery(sql); e.printStackTrace();
if(rs.next()) throw new ITMException(e);
}
finally
{
try
{ {
if(rs.getInt(1)!= 0) System.out.println("Commiting and Closing Connection..........");
if ( !(isError) )
{ {
flag = true; connectionObject.commit();
errString = itmdbAccessLocal.getErrorString("","SEPCLCONF","");
} }
else
{
connectionObject.rollback();
} }
rs.close(); if( stmt != null )
{
stmt.close(); stmt.close();
stmt = null;
} }
catch(SQLException e) 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)
{ {
System.out.println("Exception : ConfirmGl_openEJB [dupConf]:==>\n"+e.getMessage());
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);
} }
return flag;
} }
return errString;
}
} }
package ibase.webitm.ejb.adm; package ibase.webitm.ejb.adm;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.*; import ibase.webitm.ejb.ActionHandlerLocal;
//import javax.ejb.EJBObject; import ibase.webitm.utility.ITMException;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3 @javax.ejb.Local
public interface SepCloseConfLocal extends ActionHandlerLocal //,EJBObject public interface SepCloseConfLocal extends ActionHandlerLocal
{ {
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException; public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
} }
package ibase.webitm.ejb.adm; package ibase.webitm.ejb.adm;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.*; import ibase.webitm.utility.ITMException;
//import javax.ejb.EJBObject; import ibase.webitm.ejb.ActionHandlerRemote;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3 @javax.ejb.Remote
public interface SepCloseConfRemote extends ActionHandlerRemote //,EJBObject 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; package ibase.webitm.ejb.adm;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import org.w3c.dom.*; import org.w3c.dom.*;
import javax.xml.parsers.*; import javax.xml.parsers.*;
import javax.ejb.*; import javax.ejb.*;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3 //Changed by Pawan 10/5/2010[AD01SUN009] to migrate from ejb2 to ejb3
@javax.ejb.Local
@Local // added for ejb3 public interface SepCloseLocal extends ValidatorLocal
public interface SepCloseLocal extends ValidatorLocal //,EJBObject
{ {
public String wfValData() throws RemoteException,ITMException; public String wfValData() throws RemoteException,ITMException;
......
package ibase.webitm.ejb.adm; package ibase.webitm.ejb.adm;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import org.w3c.dom.*; import org.w3c.dom.*;
import javax.xml.parsers.*; import javax.xml.parsers.*;
import javax.ejb.*; import javax.ejb.*;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3 //Changed by Pawan 10/5/2010[AD01SUN009] to migrate from ejb2 to ejb3
public interface SepCloseRemote extends ValidatorRemote //,EJBObject //public interface SepClose extends Validator,EJBObject
@javax.ejb.Remote
public interface SepCloseRemote extends ValidatorRemote
{ {
public String wfValData() throws RemoteException,ITMException; public String wfValData() throws RemoteException,ITMException;
......
...@@ -11,6 +11,8 @@ import ibase.webitm.ejb.*; ...@@ -11,6 +11,8 @@ import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility; import ibase.webitm.utility.GenericUtility;
import ibase.system.config.*; import ibase.system.config.*;
import java.sql.*; import java.sql.*;
// Changed by Dhiraj 07/10/10 [AD01SUN008]
import java.text.SimpleDateFormat;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3 @Stateless // added for ejb3
...@@ -18,30 +20,7 @@ import javax.ejb.Stateless; // added for ejb3 ...@@ -18,30 +20,7 @@ import javax.ejb.Stateless; // added for ejb3
public class ShiftPattern extends ValidatorEJB implements ShiftPatternLocal,ShiftPatternRemote //SessionBean public class ShiftPattern extends ValidatorEJB implements ShiftPatternLocal,ShiftPatternRemote //SessionBean
{ {
String returnValue12 = ""; 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 public String wfValData() throws RemoteException,ITMException
{ {
return ""; return "";
...@@ -129,13 +108,21 @@ public String wfValData() throws RemoteException,ITMException ...@@ -129,13 +108,21 @@ public String wfValData() throws RemoteException,ITMException
try try
{ {
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
AppConnectParm appConnect = new AppConnectParm(); // Changed by Dhiraj 07/10/10 [AD01SUN008]. start
/*AppConnectParm appConnect = new AppConnectParm();
Properties p = appConnect.getProperty(); Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p); InitialContext ctx = new InitialContext(p);
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup("ITMDBAccess"); itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup("ITMDBAccess");
*/
// Changed by Dhiraj 07/10/10 [AD01SUN008]. end
//itmDBAccess = itmDBAccessHome.create(); //itmDBAccess = itmDBAccessHome.create();
connectionObject = itmDBAccessLocal.getConnection(); //added for ejb3
// Changed by Dhiraj 07/10/10 [AD01SUN008] start
/*connectionObject = itmDBAccessLocal.getConnection(); //added for ejb3
stmt = connectionObject.createStatement(); stmt = connectionObject.createStatement();
*/
stmt = conn.createStatement();
// Changed by Dhiraj 07/10/10 [AD01SUN008] end
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
if(objContext != null && objContext.trim().length()>0) if(objContext != null && objContext.trim().length()>0)
{ {
...@@ -153,7 +140,9 @@ public String wfValData() throws RemoteException,ITMException ...@@ -153,7 +140,9 @@ public String wfValData() throws RemoteException,ITMException
{ {
if(childNode.getFirstChild() == null) 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 else
{ {
...@@ -183,7 +172,11 @@ public String wfValData() throws RemoteException,ITMException ...@@ -183,7 +172,11 @@ public String wfValData() throws RemoteException,ITMException
System.out.println("count :---------------------"+count); System.out.println("count :---------------------"+count);
if (count == 0) 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 ...@@ -251,6 +244,11 @@ public String wfValData() throws RemoteException,ITMException
Connection conn = null; Connection conn = null;
Statement stmt = null; Statement stmt = null;
ResultSet rs = 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(); StringBuffer valueXmlString = new StringBuffer();
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
...@@ -268,9 +266,19 @@ public String wfValData() throws RemoteException,ITMException ...@@ -268,9 +266,19 @@ public String wfValData() throws RemoteException,ITMException
System.out.println("xtraParamsitemchange:---------------"+xtraParams); System.out.println("xtraParamsitemchange:---------------"+xtraParams);
site_code = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"site_code"); site_code = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"site_code");
valueXmlString.append("<site_code>").append(site_code).append("</site_code>\r\n"); 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); System.out.println("Start_date:-------------------------"+toDay);
} }
else if (currentColumn.trim().equals("shift_pattern")) else if (currentColumn.trim().equals("shift_pattern"))
...@@ -298,6 +306,8 @@ public String wfValData() throws RemoteException,ITMException ...@@ -298,6 +306,8 @@ public String wfValData() throws RemoteException,ITMException
} }
valueXmlString.append("</Detail1>\r\n"); valueXmlString.append("</Detail1>\r\n");
valueXmlString.append("</Root>\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; 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; }
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
\ No newline at end of file
......
...@@ -3,12 +3,6 @@ ...@@ -3,12 +3,6 @@
*/ */
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.*;
...@@ -16,11 +10,22 @@ import java.text.SimpleDateFormat; ...@@ -16,11 +10,22 @@ import java.text.SimpleDateFormat;
import org.w3c.dom.*; import org.w3c.dom.*;
import javax.ejb.*; 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; import javax.naming.InitialContext;
import javax.ejb.Stateless;
@Stateless @Stateless
//public class ShiftProcessEJB extends ProcessEJB implements SessionBean //Commented By Gulzar - 15/01/10() //public class ShiftProcessEJB extends ProcessEJB implements SessionBean
public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftProcessRemote //Added By Gulzar - 15/01/10()
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 */ /* UPDATED BY NISAR ON 17/12/07 FOR REQUEST ID : AD7SUN0016 */
String sql = null; String sql = null;
...@@ -41,11 +46,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -41,11 +46,6 @@ 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.
//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();
...@@ -53,8 +53,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -53,8 +53,10 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
String chgUser = null; String chgUser = null;
String chgTerm = null; String chgTerm = null;
/*--Commented by Gulzar- 15/01/10 for ejb3 //Changed by Dhiraj req ID: AD01SUN008 [05/10/10].start
public void ejbCreate() throws RemoteException, CreateException //ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
/*public void ejbCreate() throws RemoteException, CreateException
{ {
try try
{ {
...@@ -78,7 +80,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -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 public String process() throws RemoteException,ITMException
{ {
return ""; return "";
...@@ -90,18 +92,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -90,18 +92,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
Document headerDom = null; Document headerDom = null;
Document detailDom = null; Document detailDom = null;
String userId = ""; String userId = "";
try
{
if ( itmDBAccessLocal == null )
{
ctx = getInitialContext();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" );
}
}
catch (Exception e)
{
e.printStackTrace();
}
try try
{ {
System.out.println("xtraParams :: " + xtraParams); System.out.println("xtraParams :: " + xtraParams);
...@@ -132,9 +123,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -132,9 +123,9 @@ 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);//commented by Gulzar for ejb3 - 15/01/10 //changed by Dhiraj 05/10/10 [AD01SUN008] - Exception should throw
rtrStr = itmDBAccessLocal.getErrorString("","VTPROUNSUC",userId); //Added by Gulzar for ejb3 - 15/01/10 //rtrStr = itmDBAccessEJB.getErrorString("","VTPROUNSUC",userId);
//throw new ITMException(e); throw new ITMException(e);
} }
return rtrStr; return rtrStr;
} }
...@@ -211,13 +202,18 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -211,13 +202,18 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
HashMap empEventsMap = new HashMap(); HashMap empEventsMap = new HashMap();
int shiftIndexFr = 0;//Added by jaimin on 16/06/2008 (AD89SUN014) int shiftIndexFr = 0;//Added by jaimin on 16/06/2008 (AD89SUN014)
int shiftIndexTo = 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 try
{ {
if ( itmDBAccessLocal == null ) //Changed by Dhiraj 06/10/10 [AD01SUN008].start
{
ctx = getInitialContext(); AppConnectParm appConnect = new AppConnectParm();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" ); 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(); connDriver = new ConnDriver();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getDBDateFormat());
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
...@@ -228,7 +224,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -228,7 +224,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
chgUser = 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 //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; Node hdrNode = null;
...@@ -462,6 +459,50 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -462,6 +459,50 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
} }
//End Added - Gulzar - 05/08/09 //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 = ? " sql = "DELETE FROM WORK_SHIFT WHERE EMP_CODE = ? "
+"AND FROM_DT BETWEEN ? AND ? " +"AND FROM_DT BETWEEN ? AND ? "
...@@ -583,7 +624,11 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -583,7 +624,11 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{ {
System.out.println("stShiftDate "+stShiftDate+" edShiftDate "+edShiftDate); 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,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){ if(errString.length() > 0){
conn.rollback(); conn.rollback();
return errString; return errString;
...@@ -650,7 +695,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -650,7 +695,9 @@ 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, 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) if(errString.length() > 0)
{ {
...@@ -676,16 +723,21 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -676,16 +723,21 @@ 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);//commented by Gulzar for ejb3 - 15/01/10 //Changed by Dhiraj 06/10/10 [AD01SUN008]
errString = itmDBAccessLocal.getErrorString("","VTRDNTFD","","",conn);//Added by Gulzar for ejb3 - 15/01/10 //errString = itmDBAccessEJB.getErrorString("","VTRDNTFD","","",conn);
errString = itmdbAccessLocal.getErrorString("","VTRDNTFD","","",conn);
return errString; return errString;
} }
else else
{ {
System.out.println("Process complete"); System.out.println("Process complete");
conn.commit(); conn.commit();
// changed by Dhiraj 11/10/10 [AD01SUN008].start
// errString = itmDBAccessEJB.getErrorString("","VTPCOMPT","","",conn); // errString = itmDBAccessEJB.getErrorString("","VTPCOMPT","","",conn);
// return errString; // return errString;
errString = itmdbAccessLocal.getErrorString("","VTPCOMPT","","",conn);
return errString;
// changed by Dhiraj 11/10/10 [AD01SUN008].end
} }
} }
} }
...@@ -717,6 +769,11 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -717,6 +769,11 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{ {
try try
{ {
if(conn != null)
{
conn.close();
conn = null;
if(pstmtn1!=null) if(pstmtn1!=null)
{ {
pstmtn1.close(); pstmtn1.close();
...@@ -727,10 +784,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -727,10 +784,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtn3.close(); pstmtn3.close();
pstmtn3=null; pstmtn3=null;
} }
if(conn != null)
{
conn.close();
conn = null;
} }
} }
catch(Exception e) catch(Exception e)
...@@ -751,8 +804,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -751,8 +804,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{ {
} }
//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) 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 = ""; String insertSql ="",updateSql = "",errString = "";
PreparedStatement pstmtn5 = null,pstmtn6=null,pstmtInsert = null,pstmtUpdate = null; PreparedStatement pstmtn5 = null,pstmtn6=null,pstmtInsert = null,pstmtUpdate = null;
...@@ -769,27 +823,33 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -769,27 +823,33 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.util.Date shiftOfDate = null ; java.util.Date shiftOfDate = null ;
java.util.Date joiningDate = null; java.util.Date joiningDate = null;
try{ //added by satya on 07/06/10 [AD90SUN028].start
if ( itmDBAccessLocal == null ) String genShiftHol = null ;
{ //added by satya on 07/06/10 [AD90SUN028].end
ctx = getInitialContext();
itmDBAccessLocal = (ITMDBAccessLocal)ctx.lookup( "ibase/ITMDBAccessEJB/local" );
}
try
{
stmt = conn.createStatement(); stmt = conn.createStatement();
if(frpatternCode == null) if(frpatternCode == null)
{ {
//errString = itmDBAccessEJB.getErrorString("","VTPATTERNU","");//commented by Gulzar for ejb3 - 15/01/10 //changed by Dhiraj 05/10/10 [AD01SUN008]
errString = itmDBAccessLocal.getErrorString("","VTPATTERNU","");//Added by Gulzar for ejb3 - 15/01/10 //errString = itmDBAccessEJB.getErrorString("","VTPATTERNU","");
errString = itmdbAccessLocal.getErrorString("","VTPATTERNU","");
return errString ; 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); rsin1 = stmt.executeQuery(sql);
if(rsin1.next()) if(rsin1.next())
{ {
shiftPattern = rsin1.getString( "SHIFT_PATTERN" ); shiftPattern = rsin1.getString( "SHIFT_PATTERN" );
stDate = rsin1.getDate( "START_DATE" ); stDate = rsin1.getDate( "START_DATE" );
noOfDays = rsin1.getInt( "NO_OF_DAYS" ); 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.close();
rsin1 = null; rsin1 = null;
...@@ -821,7 +881,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -821,7 +881,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//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) //uncommented and changed by satya on 07/06/10 [AD90SUN028].START
if (genShiftHol != null && genShiftHol.equalsIgnoreCase("Y"))
{
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn ); 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 )
{ {
...@@ -832,12 +894,14 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -832,12 +894,14 @@ 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)); //shiftStDate2 = new java.sql.Date(shiftStDate2.getTime()+(24*60*60*1000));
shiftStDate2 = getNextDate( shiftStDate2 );
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) //uncommented and changed by satya on 07/06/10 [AD90SUN028].END
if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 )) if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 ))
{ {
...@@ -948,19 +1012,23 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -948,19 +1012,23 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
} }
*/ */
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) //changed by satya on 07/06/10 [AD90SUN028].start
if (genShiftHol != null && genShiftHol.equalsIgnoreCase("Y"))
{
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn ); 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 ) ); //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); System.out.println("stDate :: " + stDate);
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn ); holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn );
} }
*/ }
//End Changes - Gulzar - 24/11/09
//changed by satya on 07/06/10[AD90SUN028].end
//end by msalam on 250208 //end by msalam on 250208
shiftOfDate = stDate; shiftOfDate = stDate;
...@@ -994,13 +1062,17 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -994,13 +1062,17 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
rsevent = null; rsevent = null;
pstmtevent.close(); pstmtevent.close();
pstmtevent = null; 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); pstmtevent = conn.prepareStatement(sql);
rsevent = pstmtevent.executeQuery(); rsevent = pstmtevent.executeQuery();
newPatternCode = null; newPatternCode = null;
if(rsevent.next()) if(rsevent.next())
{ {
newPatternCode = rsevent.getString("SHIFT_PATTERN"); newPatternCode = rsevent.getString("SHIFT_PATTERN");
genShiftHol = rsevent.getString("GEN_SHIFT_HOL");
} }
rsevent.close(); rsevent.close();
rsevent = null; rsevent = null;
...@@ -1031,21 +1103,26 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1031,21 +1103,26 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
*/ */
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) //changed by satya on 07/06/10 [AD90SUN028].start
if (genShiftHol != null && genShiftHol.equalsIgnoreCase("Y"))
{
holidayType = getHolidayTypeForDate( (java.util.Date)shiftOfDate, holiTblNo, conn ); 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)); //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; previousDate = tempShiftOfDate;
tempShiftOfDate = new java.sql.Date(tempShiftOfDate.getTime()+(24*60*60*1000)); //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 ); 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) //changed by satya on 07/06/10 [AD90SUN028].end
//end by msalam on 250208 //end by msalam on 250208
//shiftOfDate = shiftOfDate1; //shiftOfDate = shiftOfDate1;
...@@ -1133,8 +1210,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1133,8 +1210,9 @@ 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);//commented by Gulzar for ejb3 - 15/01/10 //Changed by Dhiraj 06/10/10 [AD01SUN008]
errString = itmDBAccessLocal.getErrorString("","VTINVPATRN","","",conn);//Added by Gulzar for ejb3 - 15/01/10 //errString = itmDBAccessEJB.getErrorString("","VTINVPATRN","","",conn);
errString = itmdbAccessLocal.getErrorString("","VTINVPATRN","","",conn);
conn.rollback(); conn.rollback();
return errString; return errString;
} }
...@@ -1191,7 +1269,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1191,7 +1269,9 @@ 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 //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..............."); System.out.println("insertUpdateWorkShift is called...............");
String insertSql ="",updateSql = "",errString = ""; String insertSql ="",updateSql = "",errString = "";
...@@ -1209,26 +1289,35 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1209,26 +1289,35 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
java.util.Date shiftOfDate = null ; java.util.Date shiftOfDate = null ;
java.util.Date joiningDate = null; java.util.Date joiningDate = null;
try{ String tempShift = "XXX";
if ( itmDBAccessLocal == null ) //Added by satya on 07/06/10 [AD90SUN028].start
String genShiftHol = null;
//Added by satya on 07/06/10 [AD90SUN028].end
try
{ {
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","");//commented by Gulzar for ejb3 - 15/01/10 //Changed by Dhiraj 06/10/10 [AD01SUN008]
errString = itmDBAccessLocal.getErrorString("","VTPATTERNU","");//Added by Gulzar for ejb3 - 15/01/10 //errString = itmDBAccessEJB.getErrorString("","VTPATTERNU","");
errString = itmdbAccessLocal.getErrorString("","VTPATTERNU","");
return errString ; 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); rsin1 = stmt.executeQuery(sql);
if(rsin1.next()) if(rsin1.next())
{ {
shiftPattern = rsin1.getString( "SHIFT_PATTERN" ); shiftPattern = rsin1.getString( "SHIFT_PATTERN" );
stDate = rsin1.getDate( "START_DATE" ); stDate = rsin1.getDate( "START_DATE" );
noOfDays = rsin1.getInt( "NO_OF_DAYS" ); 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.close();
rsin1 = null; rsin1 = null;
...@@ -1260,7 +1349,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1260,7 +1349,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//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) //uncommented and changed by satya on 07/06/10 [AD90SUN028].start
if ( genShiftHol != null && genShiftHol.equalsIgnoreCase("Y") )
{
holidayType = getHolidayTypeForDate( shiftStDate2, holiTblNo, conn ); 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 )
{ {
...@@ -1278,9 +1369,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1278,9 +1369,9 @@ 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 - Gulzar - 24/11/09
//uncommented and changed by satya on 07/06/10 [AD90SUN028].end
if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 )) if( ! (shiftStDate2.compareTo(shiftEndDate) < 0 ))
{ {
System.out.println("In Continue.."); System.out.println("In Continue..");
...@@ -1391,7 +1482,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1391,7 +1482,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
} }
*/ */
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) //added by satya on 07/06/10 [AD90SUN028].start
if ( genShiftHol != null && genShiftHol.equalsIgnoreCase("Y") )
{
holidayType = getHolidayTypeForDate( stDate, holiTblNo, conn ); 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 )
{ {
...@@ -1405,8 +1498,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1405,8 +1498,9 @@ 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 by Gulzar - 24/11/09 (AD89SUN117) //End Changes by Gulzar - 24/11/09 (AD89SUN117)
}
//added by satya on 07/06/10 [AD90SUN028].start
//end by msalam on 250208 //end by msalam on 250208
shiftOfDate = stDate; shiftOfDate = stDate;
...@@ -1440,13 +1534,19 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1440,13 +1534,19 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
rsevent = null; rsevent = null;
pstmtevent.close(); pstmtevent.close();
pstmtevent = null; 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); pstmtevent = conn.prepareStatement(sql);
rsevent = pstmtevent.executeQuery(); rsevent = pstmtevent.executeQuery();
newPatternCode = null; newPatternCode = null;
if(rsevent.next()) if(rsevent.next())
{ {
newPatternCode = rsevent.getString("SHIFT_PATTERN"); 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.close();
rsevent = null; rsevent = null;
...@@ -1477,7 +1577,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1477,7 +1577,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
*/ */
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) //uncommented and changed by satya on 07/06/10 [AD90SUN028].end
if (genShiftHol != null && genShiftHol.equalsIgnoreCase("Y"))
{
holidayType = getHolidayTypeForDate( (java.util.Date)shiftOfDate, holiTblNo, conn ); holidayType = getHolidayTypeForDate( (java.util.Date)shiftOfDate, holiTblNo, conn );
while( isHolidayForType( tempShiftOfDate, holidayType, holiTblNo,conn ) ) while( isHolidayForType( tempShiftOfDate, holidayType, holiTblNo,conn ) )
{ {
...@@ -1495,8 +1597,8 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1495,8 +1597,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) //uncommented and changed by satya on 07/06/10 [AD90SUN028].end
//end by msalam on 250208 //end by msalam on 250208
//shiftOfDate = shiftOfDate1; //shiftOfDate = shiftOfDate1;
...@@ -1505,6 +1607,13 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1505,6 +1607,13 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("At 626 Shift:: " + shift); 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 tarani
// ADDED BY DURGA SINGH THAKUR 30/03/2007 // 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 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 ...@@ -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 //pstmtn6.setDate(2, shiftStDate2);//ADDED EXTRA PARAMETER LINE BY DURGA 02/04/07
System.out.println("Sql At 1444 :: " + 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 SHIFT START DATE(FROM_DT) =["+shiftStDate+"]");
System.out.println("PARAMETER IN UPDATE QUERY SHIFT "+shift+"\n"); System.out.println("PARAMETER IN UPDATE QUERY SHIFT =["+shift+"]");
System.out.println("PARAMETER IN UPDATE QUERY EMP_CODE "+empCode+"\n"); System.out.println("PARAMETER IN UPDATE QUERY EMP_CODE ["+empCode+"]");
System.out.println("PARAMETER IN UPDATE QUERY SHIFT START DATE "+shiftStDate2+"\n"); System.out.println("PARAMETER IN UPDATE QUERY SHIFT TO DATE(TO_DT) =["+shiftStDate2+"]");
rsin2 = pstmtn6.executeQuery(); rsin2 = pstmtn6.executeQuery();
if(rsin2.next()) if(rsin2.next())
{ {
...@@ -1591,8 +1700,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1591,8 +1700,9 @@ 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);//commented by Gulzar for ejb3 - 15/01/10 //Changed by Dhiraj 06/10/10 [WS01SUN008]
errString = itmDBAccessLocal.getErrorString("","VTINVPATRN","","",conn);//Added by Gulzar for ejb3 - 15/01/10 //errString = itmDBAccessEJB.getErrorString("","VTINVPATRN","","",conn);
errString = itmdbAccessLocal.getErrorString("","VTINVPATRN","","",conn);
conn.rollback(); conn.rollback();
return errString; return errString;
} }
...@@ -1709,18 +1819,19 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1709,18 +1819,19 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
ArrayList shiftTime = new ArrayList(); ArrayList shiftTime = new ArrayList();
ArrayList shiftTime1 = new ArrayList(); ArrayList shiftTime1 = new ArrayList();
String shiftNew = ""; String shiftNew = "";
System.out.println("\n\n PASSED Parameter...");
System.out.println("\n\n SHIFTINDEX ["+shiftIndex+"]"); System.out.println("PASSED Parameter...");
System.out.println("\n\n CURRDATE "+fromDate+"]"); System.out.println("SHIFTINDEX =["+shiftIndex+"]");
System.out.println("\n\n PATTERNCODE ["+patternCode+"]"); System.out.println("CURRDATE =["+fromDate+"]");
System.out.println("\n\n SHIFTPATTERN ["+shiftPattern+"]"); System.out.println("PATTERNCODE =["+patternCode+"]");
System.out.println("\n\n SHIFTSTDATE ["+shiftStDate+"]"); System.out.println("SHIFTPATTERN =["+shiftPattern+"]");
System.out.println("SHIFTSTDATE =["+shiftStDate+"]");
long numberOfDay = 0 ; long numberOfDay = 0 ;
try try
{ {
patternList = GenericUtility.getInstance().getTokenList(shiftPattern,";"); 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++) for(int j = 0 ; j < patternList.size()-1 ; j++)
{ {
patString = patternList.get(j).toString(); patString = patternList.get(j).toString();
...@@ -1733,7 +1844,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1733,7 +1844,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
} }
shiftNew =(String)shiftTime.get(shiftIndex-1); 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; int j = 0,i = 0;
...@@ -1751,22 +1862,26 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1751,22 +1862,26 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
System.out.println("POSITION "+i+" "+shiftTime1.get(i)); 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 = fromDate.getTime() - shiftOfDate.getTime();
timeDiff = (timeDiff/(60*60*24*1000)); timeDiff = (timeDiff/(60*60*24*1000));
noDays = new Long(timeDiff).intValue(); noDays = new Long(timeDiff).intValue();
noDays = Math.abs(noDays); 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(); 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) while( noDays >= j)
{ {
noDays = 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(); 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) catch(Exception e)
...@@ -1798,6 +1913,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1798,6 +1913,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
//java.sql.Date shiftDateNew = shiftStDate; //java.sql.Date shiftDateNew = shiftStDate;
ArrayList shiftTime = new ArrayList(); ArrayList shiftTime = new ArrayList();
ArrayList shiftTime1 = new ArrayList(); ArrayList shiftTime1 = new ArrayList();
//Changed by Dhiraj 05/10/10 [AD01SUN008]
//ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
//ITMDBAccessEJB itmDBAccessEJB = null;
String shiftNew = ""; String shiftNew = "";
System.out.println("\n\n PASSED VALUE SHIFTINDEX "+shiftIndex); System.out.println("\n\n PASSED VALUE SHIFTINDEX "+shiftIndex);
System.out.println("\n\n PASSED VALUE CURRDATE "+fromDate); System.out.println("\n\n PASSED VALUE CURRDATE "+fromDate);
...@@ -1838,6 +1956,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1838,6 +1956,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
{ {
shiftTime1.add(shiftTime.get(i)); shiftTime1.add(shiftTime.get(i));
} }
/*--Start Commented and Changes below by Gulzar - 06/07/10[]
for(i= 0; i< shiftTime1.size(); i++) for(i= 0; i< shiftTime1.size(); i++)
{ {
System.out.println("POSITION "+i+" "+shiftTime1.get(i)); System.out.println("POSITION "+i+" "+shiftTime1.get(i));
...@@ -1848,6 +1967,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1848,6 +1967,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
timeDiff = (timeDiff/(60*60*24*1000)); timeDiff = (timeDiff/(60*60*24*1000));
noDays = new Long(timeDiff).intValue(); noDays = new Long(timeDiff).intValue();
noDays = Math.abs(noDays); 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("\n\n NUMBER OF DAYS BETWEEN DATE__FROM AND SHIFTOFDATE IS "+noDays);
j = shiftTime1.size(); j = shiftTime1.size();
...@@ -1883,7 +2005,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -1883,7 +2005,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
Timestamp ts = new Timestamp(shiftDate.getTime()) ; Timestamp ts = new Timestamp(shiftDate.getTime()) ;
String sqlStr = null; String sqlStr = null;
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 Type in isHoliday :: " + holidayType); System.out.println("Hol Type in isHoliday :: " + holidayType);
try{ try{
...@@ -2012,15 +2136,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -2012,15 +2136,6 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtUpdate.close(); pstmtUpdate.close();
pstmtUpdate=null; pstmtUpdate=null;
} }
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try
{
if(pstmtInsert!=null) if(pstmtInsert!=null)
{ {
pstmtInsert.close(); pstmtInsert.close();
...@@ -2032,9 +2147,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -2032,9 +2147,9 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
pstmtUpdate=null; pstmtUpdate=null;
} }
} }
catch (Exception e1) catch(Exception e)
{ {
} e.printStackTrace();
} }
}//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
...@@ -2045,6 +2160,7 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -2045,6 +2160,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 type 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)
...@@ -2124,26 +2240,48 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP ...@@ -2124,26 +2240,48 @@ public class ShiftProcess extends ProcessEJB implements ShiftProcessLocal,ShiftP
return nextShiftDate; return nextShiftDate;
} }
//End Added - Gulzar - 17/09/09 //End Added - Gulzar - 17/09/09
//Added - Gulzar - 15/01/10 //Start added gulzar - 03/06/10[]
protected InitialContext getInitialContext()throws ITMException private java.sql.Date getPrevDate( java.sql.Date currShiftDate )
{ {
InitialContext ctx = null; java.util.Date uDate1 = null;
java.sql.Date nextShiftDate = null;
try try
{ {
AppConnectParm appConnect = new AppConnectParm(); Calendar calObject = Calendar.getInstance();
ctx = new InitialContext(appConnect.getProperty()); 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 :==>"); e.printStackTrace();
throw itme;
} }
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 )
{ {
System.out.println("Exception :[SprsItemReorg] :getInitialContext :==>"); int noOfDays = 0;
throw new ITMException(e); try
{
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; package ibase.webitm.ejb.adm;
import java.rmi.RemoteException; import java.rmi.RemoteException;
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10]
//import javax.ejb.EJBObject; //import javax.ejb.EJBObject;
import org.w3c.dom.*; import org.w3c.dom.*;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3 //Changed by Dhiraj req ID: AD01SUN008 [05/10/10].start
import javax.ejb.Local;
@Local // added for ejb3 @Local
//public interface ShiftProcess extends ibase.webitm.ejb.Process,EJBObject
public interface ShiftProcessLocal extends ibase.webitm.ejb.ProcessLocal //,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() throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException; public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
......
package ibase.webitm.ejb.adm; package ibase.webitm.ejb.adm;
import java.rmi.RemoteException; import java.rmi.RemoteException;
//Changed by Dhiraj req ID: AD01SUN008 [05/10/10]
//import javax.ejb.EJBObject; //import javax.ejb.EJBObject;
import org.w3c.dom.*; import org.w3c.dom.*;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3 //Changed by Dhiraj req ID: AD01SUN008 [05/10/10].start
import javax.ejb.Remote;
@Remote // added for ejb3 @Remote
public interface ShiftProcessRemote extends ibase.webitm.ejb.ProcessRemote //,EJBObject //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() throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) 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