Commit c2b32ee1 authored by prahate's avatar prahate

EJB Component for Bank Guarantee.[F15DSUN018]


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98417 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e3885d17
This diff is collapsed.
/********************************************************
Title : BankGauranteeLocal
Date : 22/JUL/15
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface BankGuaranteeICLocal extends ValidatorLocal
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) 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;
}
/********************************************************
Title : BankGauranteeRemote
Date : 22/JUL/15
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface BankGuaranteeICRemote extends ValidatorRemote
{
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) 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;
}
/********************************************************
Title : BankGuaranteeClose
Date : 29/JUL/15
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.fin.adv;
import java.rmi.RemoteException;
import java.sql.*;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import javax.ejb.Stateless;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
@Stateless
public class BankGuaranteeClose extends ActionHandlerEJB implements BankGuaranteeCloseLocal,BankGuaranteeCloseRemote
{
public String close(String tranId,String xtraParams,String forcedFlag) throws RemoteException,ITMException
{
System.out.println("Inside Close Method");
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "", sql1 = "";
ConnDriver connDriver = null;
String status = "",confirm="";
int updateCount=0;
ITMDBAccessEJB itmDBAccess = null;
ibase.utility.E12GenericUtility genericUtility = null;
genericUtility = new ibase.utility.E12GenericUtility();
itmDBAccess = new ITMDBAccessEJB();
connDriver = null;
String errString = "";
ValidatorEJB validatorEJB = null;
ITMDBAccessEJB itmDBAccessEJB = null;
try
{
itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB();
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
System.out.println("Tran Id>>>>>>"+tranId);
sql = "select status,confirmed from lc_voucher where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if (rs.next())
{
status = rs.getString("status");
confirm = rs.getString("confirmed");
}
System.out.println("Status@@@@@@@@" + status);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if (status != null && status.equalsIgnoreCase("C"))
{
System.out.println("The Selected transaction is already Closed");
errString = itmDBAccessEJB.getErrorString("", "VTMCLOSE1", "","", conn);
return errString;
}
else /* (status != null && status.equalsIgnoreCase("O") */
{
if(confirm != null && confirm.equalsIgnoreCase("N"))
{
System.out.println("Transaction not confirmed");
errString = itmDBAccessEJB.getErrorString("", "VTMCONF4", "","", conn);
return errString;
}
else
{
System.out.println("Inside Status's Confirm to update status");
sql = "update lc_voucher set status = 'C', status_date = ? where tran_id = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setDate(1, new java.sql.Date(new java.util.Date().getTime()));
pstmt.setString(2, tranId);
updateCount = pstmt.executeUpdate();
System.out.println("no of row update = " + updateCount);
System.out.println("Status Date"+ new java.sql.Date(new java.util.Date().getTime()));
System.out.println("tranId@@@@@@@@@" + tranId);
pstmt.close();
pstmt = null;
if(updateCount > 0)
{
System.out.println(">>The selected transaction Closed Successfully");
errString = itmDBAccessEJB.getErrorString("","VTEXCL001 ","","",conn);
}
}
}
}
catch(Exception e)
{
System.out.println("Exception ::"+e.getMessage());
errString = GenericUtility.getInstance().createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
System.out.println(">>>>>In finally errString:"+errString);
if(errString != null && errString.trim().length() > 0)
{
if(errString.indexOf("VTEXCL001") > -1)
{
System.out.println("Comitted");
conn.commit();
}
else
{
conn.rollback();
}
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
catch(Exception e)
{
System.out.println("Exception : "+e);e.printStackTrace();
throw new ITMException(e);
}
}
return errString;
}//end of close method
}//end of class
/********************************************************
Title : BankGuaranteeCloseLocal
Date : 29/JUL/15
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.fin.adv;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.*;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.Local; // added for ejb3
@Local
public interface BankGuaranteeCloseLocal extends ActionHandlerLocal//,EJBObject
{
public String close(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
\ No newline at end of file
/********************************************************
Title : BankGuaranteeCloseRemote
Date : 29/JUL/15
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.fin.adv;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.*;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface BankGuaranteeCloseRemote extends ActionHandlerRemote//, EJBObject
{
public String close(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
/********************************************************
Title : BankGauranteeConf
Date : 23/JUL/15
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.fin.adv;
import java.rmi.RemoteException;
import java.sql.*;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import javax.ejb.Stateless;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.dis.DistCommon;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
@Stateless
public class BankGuaranteeConf extends ActionHandlerEJB implements BankGuaranteeConfLocal,BankGuaranteeConfRemote
{
public String confirm(String tranId,String xtraParams,String forcedFlag) throws RemoteException,ITMException
{
System.out.println("Inside Confirm Method");
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "",sql1="";
String siteCode="";
ConnDriver connDriver = null;
String loginEmpCode = "";
String confirm = "",empCodeAprv="" ;
String errString = "";
int updateCount=0;
ValidatorEJB validatorEJB = null;
ITMDBAccessEJB itmDBAccessEJB = null;
try
{
itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB();
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
conn.setAutoCommit(false);
empCodeAprv = validatorEJB.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
System.out.println("empCodeAprv@@@@@@@"+empCodeAprv);
sql = "select confirmed from lc_voucher where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
confirm = rs.getString("confirmed");
}
System.out.println("Confirm@@@@@@@@"+confirm);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(confirm != null && confirm.equalsIgnoreCase("Y"))
{
System.out.println("This tansaction is already confirmed");
errString = itmDBAccessEJB.getErrorString("","VTINVCONF2","","",conn);
return errString;
}
else /*(confirm != null && confirm.equalsIgnoreCase("N"))*/
{
sql = "update lc_voucher set confirmed = 'Y', conf_date = ?,emp_code__aprv = ? where tran_id = ?";
// sql = "update lc_voucher set confirmed = 'Y', conf_date = ? where tran_id = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setDate(1, new java.sql.Date(new java.util.Date().getTime()));
pstmt.setString(2, empCodeAprv);
pstmt.setString(3, tranId);
updateCount = pstmt.executeUpdate();
System.out.println("no of row update: "+updateCount);
System.out.println("Date@@@@@@@@@"+new java.sql.Date(new java.util.Date().getTime()));
System.out.println("Employee Approved Code>>> "+empCodeAprv);
System.out.println("tranId@@@@@@@@@"+tranId);
pstmt.close();
pstmt = null;
if(updateCount > 0)
{
System.out.println(">>The selected transaction is confirmed");
errString = itmDBAccessEJB.getErrorString("","VTCICONF3 ","","",conn);
}
}
}
catch(Exception e)
{
System.out.println("Exception ::"+e.getMessage());
errString = GenericUtility.getInstance().createErrorString(e);
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
System.out.println(">>>>>In finally errString:"+errString);
if(errString != null && errString.trim().length() > 0)
{
if(errString.indexOf("VTCICONF3") > -1)
{
conn.commit();
System.out.println("Commit Completed");
}
else
{
conn.rollback();
}
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
conn.close();
}
catch(Exception e)
{
System.out.println("Exception : "+e);e.printStackTrace();
throw new ITMException(e);
}
}
return errString;
}//end of confirm method
}//end of class
/********************************************************
Title : BankGauranteeConfLocal
Date : 23/JUL/15
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.fin.adv;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import javax.ejb.Local; // added for ejb3
@Local
public interface BankGuaranteeConfLocal extends ActionHandlerLocal//,EJBObject
{
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException,ITMException;
}
/********************************************************
Title : BankGauranteeConfRemote
Date : 23/JUL/15
Developer: Pankaj R.
********************************************************/
package ibase.webitm.ejb.fin.adv;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import java.sql.*;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.Remote; // added for ejb3
@Remote // added for ejb3
public interface BankGuaranteeConfRemote extends ActionHandlerRemote//, EJBObject
{
public String confirm(String tranID, String xtraParams, String forcedFlag) 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