Commit 27e68b9f authored by msharma's avatar msharma

Connection is passed as parameter


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93974 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 920b1572
...@@ -32,7 +32,29 @@ import javax.ejb.Stateless; ...@@ -32,7 +32,29 @@ import javax.ejb.Stateless;
@Stateless @Stateless
public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLocal,ReceiptAdvConfRemote public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLocal,ReceiptAdvConfRemote
{ {
public String confirm(String tranId,String xtraParams,String forcedFlag) throws RemoteException,ITMException public String confirm(String tranID,String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
String retString = "";
boolean isConn= false;
Connection conn = null;
try
{
retString = confirm( tranID, xtraParams, forcedFlag, conn );
if ( retString != null && retString.length() > 0 )
{
throw new Exception("Exception while calling confirm for tran Id:["+tranID+"]");
}
}
catch(Exception exception)
{
System.out.println("Exception in [InvHoldConfEJB] getCurrdateAppFormat " + exception.getMessage());
}
return retString;
}
public String confirm(String tranId,String xtraParams,String forcedFlag, Connection conn) throws RemoteException,ITMException
{ {
System.out.println("confirm called........"); System.out.println("confirm called........");
String sql = ""; String sql = "";
...@@ -41,8 +63,8 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -41,8 +63,8 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
String errString = "" ; String errString = "" ;
String tranSer = ""; String tranSer = "";
String loginEmpCode = ""; String loginEmpCode = "";
Connection conn = null; //Connection conn = null;
ConnDriver connDriver = null; //ConnDriver connDriver = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
FinCommon finCommon = null; FinCommon finCommon = null;
...@@ -50,16 +72,26 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -50,16 +72,26 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
ITMDBAccessEJB itmDBAccessEJB = null; ITMDBAccessEJB itmDBAccessEJB = null;
ValidatorEJB validatorEJB = null; ValidatorEJB validatorEJB = null;
System.out.println("tran id = "+tranId); System.out.println("tran id = "+tranId);
boolean connStatus=false;
try try
{ {
if ( conn == null )//changed by Gulzar - 25/11/11
{
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
connStatus = true;
}
finCommon = new FinCommon(); finCommon = new FinCommon();
genericUtility = new GenericUtility(); genericUtility = new GenericUtility();
itmDBAccessEJB = new ITMDBAccessEJB(); itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB(); validatorEJB = new ValidatorEJB();
connDriver = new ConnDriver(); //connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); //conn = connDriver.getConnectDB("DriverITM");
connDriver = null; //connDriver = null;
conn.setAutoCommit(false); //conn.setAutoCommit(false);
loginEmpCode = validatorEJB.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); loginEmpCode = validatorEJB.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
sql = "select confirmed ,site_code from receipt where tran_id = ?"; sql = "select confirmed ,site_code from receipt where tran_id = ?";
...@@ -156,19 +188,24 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -156,19 +188,24 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
} }
finally finally
{ {
if(conn!=null)
{
try try
{ {
if(errString != null && errString.trim().length() > 0) if(errString != null && errString.trim().length() > 0)
{ {
if(errString.indexOf("VTCICONF3") > -1) if( conn != null && !conn.isClosed() && connStatus )
{ {
conn.commit(); if(errString.indexOf("VTCICONF3") > -1)
} {
else conn.commit();
{ }
conn.rollback(); else
{
conn.rollback();
}
conn.close();
conn = null;
} }
} }
if(rs != null) if(rs != null)
...@@ -181,14 +218,14 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -181,14 +218,14 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
conn.close(); //conn.close();
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception : "+e);e.printStackTrace(); System.out.println("Exception : "+e);e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
}
} }
return errString; return errString;
} //end of confirm method } //end of confirm method
...@@ -2265,7 +2302,9 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo ...@@ -2265,7 +2302,9 @@ public class ReceiptAdvConf extends ActionHandlerEJB implements ReceiptAdvConfLo
netAmountBc = (double) Double.parseDouble( "" + RcpHdrMap.get("net_amt__bc")); netAmountBc = (double) Double.parseDouble( "" + RcpHdrMap.get("net_amt__bc"));
acctCodeCf = (String)RcpHdrMap.get("acct_code__cf"); acctCodeCf = (String)RcpHdrMap.get("acct_code__cf");
rcpMode = (String)RcpHdrMap.get("rcp_mode"); rcpMode = (String)RcpHdrMap.get("rcp_mode");
//Added by Manoj dtd 09/12/2013 to set Accound code Adv and cctrCode Adv
acctCode=(String)RcpHdrMap.get("acct_code__adv");
cctrCode=(String)RcpHdrMap.get("cctr_code__adv");
//added by akhilesh on 31/july/13 for tax provision //added by akhilesh on 31/july/13 for tax provision
sql =" select case when sum(tax_amt) is null then 0 else sum(tax_amt) end as taxAmt " sql =" select case when sum(tax_amt) is null then 0 else sum(tax_amt) end as taxAmt "
......
...@@ -8,10 +8,13 @@ package ibase.webitm.ejb.fin.adv; ...@@ -8,10 +8,13 @@ package ibase.webitm.ejb.fin.adv;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Local; import javax.ejb.Local;
@Local @Local
public interface ReceiptAdvConfLocal extends ActionHandlerLocal public interface ReceiptAdvConfLocal 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;
public String confirm( String tranId, String xtraParams,String forcedFlag, Connection conn ) throws RemoteException,ITMException;
} }
...@@ -8,9 +8,12 @@ package ibase.webitm.ejb.fin.adv; ...@@ -8,9 +8,12 @@ package ibase.webitm.ejb.fin.adv;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection;
import javax.ejb.Remote; import javax.ejb.Remote;
@Remote @Remote
public interface ReceiptAdvConfRemote extends ActionHandlerRemote public interface ReceiptAdvConfRemote 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;
public String confirm( 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