Commit 6abba1b5 authored by arawankar's avatar arawankar

Added component for Pre cancel of employee detail change


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@187413 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4f32a8ab
package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.ejb.Stateless;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandlerEJB;
@Stateless
public class EmpDetChgCancPrv extends ActionHandlerEJB implements EmpDetChgCancPrvRemote,EmpDetChgCancPrvLocal
{
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String actionHandler(String tranId, String xtraParams, String forcedFlag)throws RemoteException, ITMException
{
Connection conn = null;
String retString = null;
try
{
System.out.println("Inside Class EmpDetChgCancPrv [actionHandler] Method");
conn = getConnection();
retString = actionHandler(tranId, xtraParams, forcedFlag, conn);
System.out.println("retString---["+retString+"]");
if (retString.indexOf("Errors") != -1)
{
conn.rollback();
}
}
catch(Exception e)
{
System.out.println("Inside EmpDetChgCancPrv [actionHandler] Method :" +e.getMessage());
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
if (conn!=null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception in connection closing [PayrVouchCanc][confirm]["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
}
}
return retString;
}
public String actionHandler(String tranId, String xtraParams, String forcedFlag, Connection conn) throws RemoteException, ITMException
{
String sql = "" , retString = "",status = "",loginCode = "" ,confirmed = "";
PreparedStatement pstmt = null;
ResultSet resultSet = null;
try
{
loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("loginCode---["+loginCode+"]");
sql = "select status ,confirmed from employee_det_change where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
resultSet = pstmt.executeQuery();
if(resultSet.next())
{
confirmed = resultSet.getString("confirmed");
status = resultSet.getString("status");
}
System.out.println("Transaction Confirmed/Cancelled--["+tranId+"]["+status+"]");
if(resultSet != null)
{
resultSet.close();
resultSet = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if("X".equalsIgnoreCase(status))
{
retString = itmDBAccessEJB.getErrorString( "", "VTCANC2" , loginCode);
return retString;
}
else if("C".equalsIgnoreCase(status))
{
retString = itmDBAccessEJB.getErrorString( "", "VTCONF8" , loginCode);
return retString;
}
else
{
System.out.println("Transaction is Neither Confirmed Nor Cancelled so in else block!!!!");
retString = itmDBAccessEJB.getErrorString( "", "VTINVCANC1" , loginCode);//Warning Message shows
}
}
catch(Exception se)
{
System.out.println("SQL Exception from [EmpDetChgCancPrv][confirm][" + se.getMessage()+ "]");
se.printStackTrace();
throw new ITMException(se);
}
finally
{
try
{
if(resultSet != null)
{
resultSet.close();
resultSet = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch( Exception e )
{
System.out.println("Exception in connection closing [PayrVouchCanc][confirm]["+e.getMessage()+"]");
e.printStackTrace();
}
}
return retString;
}
}
package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
@Local
public interface EmpDetChgCancPrvLocal extends ActionHandlerLocal
{
public String actionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String actionHandler(String tranId, String xtraParams, String forcedFlag, Connection conn) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.adm.adv;
import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Remote;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandlerRemote;
@Remote
public interface EmpDetChgCancPrvRemote extends ActionHandlerRemote
{
public String actionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
public String actionHandler(String tranId, String xtraParams, String forcedFlag, Connection conn) 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