Commit 2ba6b280 authored by caluka's avatar caluka

Generalized Master validation connection to be passed in genvalidate and genval[D16CSUN013]


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103279 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5ebe235f
This diff is collapsed.
...@@ -14,6 +14,7 @@ import java.rmi.RemoteException; ...@@ -14,6 +14,7 @@ import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
...@@ -31,7 +32,7 @@ import org.w3c.dom.Document; ...@@ -31,7 +32,7 @@ import org.w3c.dom.Document;
* Window - Preferences - Java - Code Style - Code Templates * Window - Preferences - Java - Code Style - Code Templates
*/ */
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3 @Stateless // added for ejb3
public class GenValidate extends ValidatorEJB implements GenValidateLocal , GenValidateRemote // SessionBean{ public class GenValidate extends ValidatorEJB implements GenValidateLocal , GenValidateRemote // SessionBean{
...@@ -64,8 +65,34 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen ...@@ -64,8 +65,34 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen
public void setSessionContext(SessionContext arg0) public void setSessionContext(SessionContext arg0)
{ {
} }
//Start Added by chandrshekar 06-sep-2016
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException
{
String errString = "";
Connection conn = null;
boolean isConn= false;
try
{
errString = this.wfValData(xmlString,xmlString1,xmlString2,objContext,winName, xtraParams, conn);
System.out.println("errString:::::"+errString);
}
catch(Exception e)
{
System.out.println("Exception in [GenValidate] confirm " + e.getMessage());
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return errString;
}
//End Added by chandrshekar 06-sep-2016
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams, Connection conn) throws RemoteException
{ {
String finalStr = ""; String finalStr = "";
String errFldName=""; String errFldName="";
...@@ -75,8 +102,18 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen ...@@ -75,8 +102,18 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen
HashMap<String , String > errorMap= new HashMap<String, String>(); HashMap<String , String > errorMap= new HashMap<String, String>();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
// finalStr = mergeXml(xmlString, xmlString1, xmlString2); // finalStr = mergeXml(xmlString, xmlString1, xmlString2);
boolean isLocalConn= false;
try try
{ {
if(conn==null)
{
System.out.println(" create isLocalConn for wfValData ");
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
isLocalConn=true;
}
//***ConnDriver connDriver = new ConnDriver(); //***ConnDriver connDriver = new ConnDriver();
//***conn = connDriver.getConnectDB("DriverITM"); //***conn = connDriver.getConnectDB("DriverITM");
//**connDriver = null; //**connDriver = null;
...@@ -96,7 +133,7 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen ...@@ -96,7 +133,7 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen
//****errCode = genVal.genVal(winName,objContext,dom, focusedRow, conn); //****errCode = genVal.genVal(winName,objContext,dom, focusedRow, conn);
GenVal genVal = new GenVal(); GenVal genVal = new GenVal();
//errCode = genVal.genVal(winName,objContext,dom, focusedRow);//comment added by sagar on 25/12/14 //errCode = genVal.genVal(winName,objContext,dom, focusedRow);//comment added by sagar on 25/12/14
errorMap = genVal.genVal(winName,objContext,dom, focusedRow);//code added by sagar on 25/12/14 errorMap = genVal.genVal(winName,objContext,dom, focusedRow,conn);//code added by sagar on 25/12/14
genVal = null; genVal = null;
//changed by msalam on 27/09/07 end //changed by msalam on 27/09/07 end
/*if (errCode != null && errCode.trim().length() > 0) /*if (errCode != null && errCode.trim().length() > 0)
...@@ -146,6 +183,22 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen ...@@ -146,6 +183,22 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen
{ {
e.printStackTrace(); e.printStackTrace();
} }
finally
{
if(isLocalConn && conn !=null){
try
{
System.out.println("closing local connection>>>"+isLocalConn);
conn.close();
conn = null;
} catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/*finally /*finally
{ {
try try
...@@ -164,10 +217,35 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen ...@@ -164,10 +217,35 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen
errString = errStringXml.toString(); //code added by sagar on 25/12/14 errString = errStringXml.toString(); //code added by sagar on 25/12/14
return errString; return errString;
} }
//Start Added by chandrshekar 06-sep-2016
//added by priyanka on 31/12/14 to execute genValidation based o form no on accept button
public String wfValData1(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException public String wfValData1(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException
{
String errString = "";
Connection conn = null;
boolean isConn= false;
try
{
errString = wfValData1(xmlString,xmlString1,xmlString2,objContext,winName, xtraParams, conn);
System.out.println("errString:::::"+errString);
}
catch(Exception e)
{
System.out.println("Exception in [GenValidate] confirm " + e.getMessage());
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return errString;
}
//End Added by chandrshekar 06-sep-2016
//added by priyanka on 31/12/14 to execute genValidation based o form no on accept button
public String wfValData1(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams, Connection conn) throws RemoteException
{ {
String finalStr = ""; String finalStr = "";
String errFldName=""; String errFldName="";
...@@ -177,8 +255,18 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen ...@@ -177,8 +255,18 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen
HashMap<String , String > errorMap= new HashMap<String, String>(); HashMap<String , String > errorMap= new HashMap<String, String>();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
// finalStr = mergeXml(xmlString, xmlString1, xmlString2); // finalStr = mergeXml(xmlString, xmlString1, xmlString2);
boolean isLocalConn= false;
try try
{ {
if(conn==null)
{
System.out.println(" create isLocalConn for wfValData1 ");
ConnDriver connDriver = null;
connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
isLocalConn=true;
}
//***ConnDriver connDriver = new ConnDriver(); //***ConnDriver connDriver = new ConnDriver();
//***conn = connDriver.getConnectDB("DriverITM"); //***conn = connDriver.getConnectDB("DriverITM");
//**connDriver = null; //**connDriver = null;
...@@ -199,7 +287,7 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen ...@@ -199,7 +287,7 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen
//****errCode = genVal.genVal(winName,objContext,dom, focusedRow, conn); //****errCode = genVal.genVal(winName,objContext,dom, focusedRow, conn);
GenVal genVal = new GenVal(); GenVal genVal = new GenVal();
//errCode = genVal.genVal(winName,objContext,dom, focusedRow);//comment added by sagar on 25/12/14 //errCode = genVal.genVal(winName,objContext,dom, focusedRow);//comment added by sagar on 25/12/14
errorMap = genVal.genVal(winName,objContext,dom, focusedRow,true);//code added by sagar on 25/12/14 errorMap = genVal.genVal(winName,objContext,dom, focusedRow,true,conn);//code added by sagar on 25/12/14
genVal = null; genVal = null;
//changed by msalam on 27/09/07 end //changed by msalam on 27/09/07 end
/*if (errCode != null && errCode.trim().length() > 0) /*if (errCode != null && errCode.trim().length() > 0)
...@@ -248,6 +336,20 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen ...@@ -248,6 +336,20 @@ public class GenValidate extends ValidatorEJB implements GenValidateLocal , Gen
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
}finally
{
if(isLocalConn){
try
{
conn.close();
conn = null;
} catch (SQLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} }
/*finally /*finally
{ {
......
...@@ -10,6 +10,7 @@ import ibase.webitm.ejb.*; ...@@ -10,6 +10,7 @@ import ibase.webitm.ejb.*;
//import javax.ejb.EJBObject; //import javax.ejb.EJBObject;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection;
/** /**
* @author ashah * @author ashah
...@@ -25,7 +26,8 @@ public interface GenValidateLocal extends ValidatorLocal //extends EJBObject ...@@ -25,7 +26,8 @@ public interface GenValidateLocal extends ValidatorLocal //extends EJBObject
{ {
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException; public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException;
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams, Connection conn) throws RemoteException;
public String wfValData1(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException; public String wfValData1(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException;
public String wfValData1(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams, Connection conn) throws RemoteException;
} }
...@@ -11,6 +11,7 @@ import ibase.webitm.ejb.*; ...@@ -11,6 +11,7 @@ import ibase.webitm.ejb.*;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection;
/** /**
* @author ashah * @author ashah
...@@ -26,7 +27,7 @@ public interface GenValidateRemote extends ValidatorRemote //extends EJBObject { ...@@ -26,7 +27,7 @@ public interface GenValidateRemote extends ValidatorRemote //extends EJBObject {
{ {
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException; public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException;
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams,Connection conn) throws RemoteException;
public String wfValData1(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException; public String wfValData1(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams) throws RemoteException;
public String wfValData1(String xmlString, String xmlString1, String xmlString2, String objContext, String winName, String xtraParams,Connection conn) throws RemoteException;
} }
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