Commit 65120263 authored by pchavan's avatar pchavan

VALIDATION AND ITEM CHANGE ON INSURANCE LINK BUTTON.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@200364 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9af7c1ff
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import javax.ejb.Stateless; // added for ejb3
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException;
@Stateless // added for ejb3
public class InsuranceButtionIC extends ValidatorEJB implements BankLimitChkICLocal,BankLimitChkICRemote
{
E12GenericUtility genericUtility = new E12GenericUtility();
UtilMethods utilMethods = UtilMethods.getInstance();
public String wfValData() throws RemoteException,ITMException
{
return "";
}
public String itemChanged() throws RemoteException,ITMException
{
return "";
}
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String errString = null;
System.out.println("Validation Start..........");
try
{
System.out.println("xmlString:::"+xmlString);
dom = parseString(xmlString);
dom1 = parseString(xmlString1);
if (xmlString2.trim().length() > 0 )
{
dom2 = parseString(xmlString2);
}
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
}
catch(Exception e)
{
throw new ITMException( e );
}
return (errString);
}
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
String errString = " ";
NodeList parentNodeList = null;
NodeList childNodeList = null;
Node parentNode = null;
Node childNode = null;
int ctr = 0;
String columnValue = null;
String childNodeName = null;
String errCode = null;
String userId = null,loginSite = null;
String prdtCode = null;
int cnt = 0;
int currentFormNo = 0;
int childNodeListLength;
Connection conn = null;
PreparedStatement pstmt=null;
ResultSet rs = null;
try
{
conn = getConnection();
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
switch(currentFormNo)
{
case 1 :
System.out.println("VALIDATION FOR DETAIL [ 1 ]..........");
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
}
break;
case 2 :
System.out.println("VALIDATION FOR DETAIL [ 2 ]..........");
parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
cnt = 0;
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
}
break;
}
}
catch(Exception e)
{
System.out.println("Exception ::" +e);
e.printStackTrace();
errCode = "VALEXCEP";
errString = getErrorString( "", errCode, userId );
}
finally
{
try
{
if(conn != null)
{
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if( rs != null )
{
rs.close();
rs = null;
}
conn.close();
}
conn = null;
}
catch(Exception d)
{
d.printStackTrace();
}
System.out.println(" < ExprProcessIcEJB > CONNECTION IS CLOSED");
}
System.out.println("ErrString ::" + errString);
return errString;
}
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
Document dom1 = null;
Document dom2 = null;
String valueXmlString = null;
try
{
System.out.println("Calling ItemChange...," );
dom = parseString(xmlString);
System.out.println("xmlString" + xmlString);
dom1 = parseString(xmlString1);
System.out.println("xmlString1" + xmlString1);
if (xmlString2.trim().length() > 0 )
{
System.out.println("xmlString2" + xmlString2);
dom2 = parseString("<Root>" + xmlString2+ "</Root>");
}
valueXmlString = itemChanged(dom,dom1,dom2,objContext,currentColumn,editFlag,xtraParams);
}
catch(Exception e)
{
throw new ITMException(e);
}
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
SimpleDateFormat sdf=null;
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
PreparedStatement pstmt = null, pstmt1 = null;
ResultSet rs = null;
String sql = null;
int currentFormNo = 0;
StringBuffer valueXmlString = new StringBuffer();
String columnValue = null;
NodeList parentNodeList = null;
Node parentNode = null;
Node childNode = null;
NodeList childNodeList = null;
String childNodeName = null;
int childNodeListLength = 0;
int ctr = 0;
String loginSite = null,currDateTs=null;
String policyNo = "" ,agentName ="";
try
{
conn = getConnection();
connDriver = null;
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
System.out.println("[BankLimitChkICEJB.java] [itemChanged] :currentFormNo ....." +currentFormNo);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
Timestamp currDate = new Timestamp(System.currentTimeMillis());
currDateTs = sdf.format(currDate).toString();
System.out.println("Current Form No ["+currentFormNo+"]");
switch (currentFormNo)
{
case 1:
valueXmlString.append("<Detail1>");
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
ctr = 0;
childNodeListLength = childNodeList.getLength();
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if(childNodeName.equals(currentColumn))
{
if (childNode.getFirstChild() != null)
{
columnValue=childNode.getFirstChild().getNodeValue().trim();
}
}
ctr++;
}while(ctr < childNodeListLength && !childNodeName.equals(currentColumn));
if (currentColumn.trim().equals("policy_no" ))
{
policyNo = checkNull(genericUtility.getColumnValue( "policy_no", dom));
System.out.println("Policy Number====="+policyNo);
if(policyNo!=null && policyNo.trim().length()>0)
{
sql = "select agent_code from insurance where policy_no= ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1,policyNo);
rs = pstmt.executeQuery();
if( rs.next() )
{
agentName = rs.getString("agent_code");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
valueXmlString.append("<agent_code>").append("<![CDATA[" + agentName+ "]]>").append("</agent_code>");
}
}
valueXmlString.append("</Detail1>");
break;
}//end of switch-case
valueXmlString.append("</Root>");
}
catch(SQLException sqle)
{
System.out.println("Exception sqle ::"+ sqle.getMessage());
}
catch(Exception e)
{
//System.out.println("Exception ::"+ e.getMessage());
e.printStackTrace();
throw new ITMException( e );
}
finally
{
try
{
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if ( conn != null )
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception ::" + e);
e.printStackTrace();
}
}
return valueXmlString.toString();
}//END OF ITEMCHANGE
private String getCurrdateAppFormat()
{
String s = "";
// GenericUtility genericUtility = GenericUtility.getInstance();
try
{
java.util.Date date = null;
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
System.out.println(genericUtility.getDBDateFormat());
SimpleDateFormat simpledateformat = new SimpleDateFormat(genericUtility.getDBDateFormat());
date = simpledateformat.parse(timestamp.toString());
timestamp = Timestamp.valueOf(simpledateformat.format(date).toString() + " 00:00:00.0");
s = (new SimpleDateFormat(genericUtility.getApplDateFormat())).format(timestamp).toString();
}
catch(Exception exception)
{
System.out.println("Exception in getCurrdateAppFormat " + exception.getMessage());
}
return s;
}
private String checkNull(String input)
{
return input == null ? "" : input;
}
}
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.sys.*;
import java.rmi.RemoteException;
import org.w3c.dom.*;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface InsuranceButtionICLocal extends ValidatorLocal//, EJBObject
{
public String wfValData() throws RemoteException,ITMException;
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() 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 javax.ejb.Remote; // added for ejb3
import org.w3c.dom.Document;
import ibase.webitm.ejb.ValidatorRemote;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
@Remote // added for ejb3
public interface InsuranceButtionICRemote extends ValidatorRemote//, EJBObject
{
public String wfValData() throws RemoteException,ITMException;
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() 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