Commit 814eb7da authored by agaikwad's avatar agaikwad

Request_id-F15ISUN017

Customer Bank


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99812 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f1850874
This diff is collapsed.
package ibase.webitm.ejb.fin;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessLocal;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandlerEJB;
import java.sql.*;
import java.util.StringTokenizer;
import javax.ejb.Stateless;
import java.rmi.RemoteException;
@Stateless
public class CustBankConf extends ActionHandlerEJB implements CustBankConfLocal,CustBankConfRemote
{
public String confirm(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
System.out.println("--------------confirm method of CustBankConf ------------- : "+tranId);
String retString = "";
try
{
retString = confirmCBank(tranId,xtraParams,forcedFlag);
}
catch(Exception e)
{
System.out.println("Exception :CustBankConf :confirm():" + e.getMessage() + ":");
retString = GenericUtility.getInstance().createErrorString(e);
e.printStackTrace();
}
return retString;
}
private String confirmCBank(String tranId,String xtraParams,String forcedFlag)
{
System.out.println("---------Class : CustBankConf-->> confirm method called-----------");
String CustCode = null;
String bankcode = null;
ResultSet rs=null;
Connection conn=null;
ConnDriver ConnDriver = new ConnDriver();
PreparedStatement pstmt=null;
String errString="",sql="",ActiveYN="";
int updCnt=0;
ITMDBAccessLocal itmdbAccess=new ITMDBAccessEJB();
try
{
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverValidator");
conn.setAutoCommit(false);
String confirmed="";
String split[]=tranId.split(":");
CustCode=split[0].trim();
bankcode=split[1];
sql = "select confirmed,active_yn from customer_bank WHERE cust_code = ? and bank_code__ben = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, CustCode);
pstmt.setString(2, bankcode);
rs = pstmt.executeQuery();
if( rs.next() )
{
confirmed =rs.getString(1)==null ? "N":rs.getString(1);
ActiveYN=rs.getString(2)==null ? "Y" : rs.getString(2);
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if ( rs != null )
{
rs.close();
rs = null;
}
if( confirmed != null && confirmed.equalsIgnoreCase("Y") )
{
System.out.println("transaction is already confirmmmm");
errString = itmdbAccess.getErrorString("", "VTALLCONF ", "", "", conn);
return errString;
}
if( ActiveYN != null && ActiveYN.equalsIgnoreCase("N") )
{
System.out.println("deactivated transaction can not be confirmmm");
errString = itmdbAccess.getErrorString("", "VMDECTRA", "", "", conn);
return errString;
}
GenericUtility genericUtility=new GenericUtility();
String loginCode=genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode");
System.out.println("Login Code ------->> "+loginCode);
sql="update customer_bank set confirmed = ?,conf_date = ?, emp_code__aprv = ? where cust_code = ? and bank_code__ben = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, "Y");
pstmt.setDate(2, new java.sql.Date(System.currentTimeMillis()));
pstmt.setString(3,loginCode);
pstmt.setString(4, CustCode);
pstmt.setString(5, bankcode);
updCnt=pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update count is"+ updCnt);
if (updCnt > 0)
{
System.out.println("successfully confirmed");
errString = itmdbAccess.getErrorString("", "VTCONFIRM ", "", "", conn);
conn.commit();
}
}
catch(SQLException se)
{
System.out.println("SQLException : class CustBankConf : ");
se.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e){
System.out.println("Exception : Occure during rollback........");e.printStackTrace();
}
}
catch(Exception e)
{
try
{
conn.rollback();
}
catch (Exception e1)
{
}
e.printStackTrace();
System.out.println("Exception Class [StrgCustBankConf]::"+e.getMessage());
}
finally
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn!=null)
{
conn.close();
conn=null;
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}
System.out.println("[CustBankConf]errstring :"+errString);
return errString;
}
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface CustBankConfLocal extends ActionHandlerLocal //,EJBObject
{
public String confirm(String xmlString, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface CustBankConfRemote extends ActionHandlerRemote//,EJBObject
{
public String confirm(String xmlString, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ITMDBAccessLocal;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ActionHandlerEJB;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.ejb.Stateless;
@Stateless
public class CustBankDeactivate extends ActionHandlerEJB implements CustBankDeactivateLocal,CustBankDeactivateRemote
{
public String actionHandler(String tranId, String xtraParams, String forcedFlag) throws RemoteException,ITMException
{
System.out.println("--------------confirm method of CustBankDeactivate ------------- : ");
String retString = "";
try
{
retString = deactive(tranId,xtraParams,forcedFlag);
}
catch(Exception e)
{
System.out.println("Exception :CustBankDeactivate :confirm():" + e.getMessage() + ":");
retString = GenericUtility.getInstance().createErrorString(e);
e.printStackTrace();
}
return retString;
}
private String deactive(String tranId,String xtraParams,String forcedFlag)
{
System.out.println("---------Class : CustBankDeactivate-->> deactive method called-----------");
String CustCode = null;
String bankcode = null;
ResultSet rs=null;
Connection conn=null;
ConnDriver ConnDriver = new ConnDriver();
PreparedStatement pstmt=null;
String errString="",sql="",ActiveYN="";
int updCnt=0;
ITMDBAccessLocal itmdbAccess=new ITMDBAccessEJB();
try
{
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverValidator");
conn.setAutoCommit(false);
String confirmed="";
String split[]=tranId.split(":");
CustCode=split[0];
bankcode=split[1];
sql = "select confirmed,active_yn from customer_bank WHERE cust_code = ? and bank_code__ben = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, CustCode);
pstmt.setString(2, bankcode);
rs = pstmt.executeQuery();
if( rs.next() )
{
confirmed =rs.getString(1)==null ? "N":rs.getString(1);
ActiveYN=rs.getString(2)==null ? "Y" : rs.getString(2);
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if ( rs != null )
{
rs.close();
rs = null;
}
if( ActiveYN != null && ActiveYN.equalsIgnoreCase("N") )
{
//deactivate transaction can not confirm
System.out.println("transaction is already deactivated");
errString = itmdbAccess.getErrorString("", "VMDETPTAL", "", "", conn);
return errString;
}
GenericUtility genericUtility=new GenericUtility();
String loginCode=genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
System.out.println("Login Code ------->> "+loginCode);
sql="update customer_bank set active_yn = ? where cust_code = ? and bank_code__ben = ? ";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, "N");
pstmt.setString(2, CustCode);
pstmt.setString(3, bankcode);
updCnt=pstmt.executeUpdate();
pstmt.close();
pstmt = null;
System.out.println("Update count is"+ updCnt);
if (updCnt > 0)
{
System.out.println("successfully deactivated");
errString = itmdbAccess.getErrorString("", "VMDETRASU", "", "", conn);
conn.commit();
}
}
catch(SQLException se)
{
System.out.println("SQLException : class CustBankDeactivate : ");
se.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e){
System.out.println("Exception : Occure during rollback........");e.printStackTrace();
}
}
catch(Exception e)
{
try
{
conn.rollback();
}
catch (Exception e1)
{
}
e.printStackTrace();
System.out.println("Exception Class [CustBankDeactivate]::"+e.getMessage());
}
finally
{
try
{
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (conn!=null)
{
conn.close();
conn=null;
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}
System.out.println("[CustBankDeactivate]errstring :"+errString);
return errString;
}
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.ejb.ActionHandlerLocal;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface CustBankDeactivateLocal extends ActionHandlerLocal //,EJBObject
{
public String actionHandler(String xmlString, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.ejb.ActionHandlerRemote;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface CustBankDeactivateRemote extends ActionHandlerRemote//,EJBObject
{
public String actionHandler(String xmlString, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import ibase.webitm.utility.ITMException;
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorLocal;
import javax.ejb.Local;
@Local
public interface CustBankLocal extends ValidatorLocal {
public String wfValData() throws RemoteException, ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
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.fin;
import java.rmi.RemoteException;
import org.w3c.dom.Document;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote;
import ibase.webitm.ejb.ValidatorRemote;
@Remote
public interface CustBankRemote extends ValidatorRemote {
public String wfValData() throws RemoteException, ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException, ITMException;
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
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