Commit a21af837 authored by vdhoble's avatar vdhoble

Domestic Receipt Changes -F14ISUN011


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99474 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b2ab2646
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.util.*;
import java.util.Date;
import java.text.DateFormat;
import java.sql.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import java.text.SimpleDateFormat;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.*;
import ibase.system.config.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.GenericUtility;
import ibase.utility.CommonConstants;
@javax.ejb.Stateless
public class GenRcpPreSave extends ValidatorEJB implements GenRcpPreSaveLocal, GenRcpPreSaveRemote
{
public String preSave()throws RemoteException,ITMException
{
return "";
}
public String preSave( String domString, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException
{
String retString = "";
String objName = "";
String eventDate = "";
String sprsCode = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
Document preSaveXmlDom = null;
boolean isError = false;
boolean isLocalConn = false;
try
{
System.out.println("domString ReceiptGenWizPreSaveEJB ["+domString+"]");
retString = callWfValData( domString, xtraParams);//Call the validate component to validate the offline DCR
}
catch(Exception e)
{
System.out.println("Exception :WsfaDSRWizPreSaveEJB : :==>\n"+e.getMessage());
throw new ITMException(e);
}
finally
{
try
{
if (rs!= null)
{
rs.close();
rs = null;
}
if(pstmt!=null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
System.out.println("Exception :WsfaDSRWizPreSaveEJB : :==>\n"+e.getMessage());
throw new ITMException(e);
}
}
System.out.println("Return string :"+retString);
return retString;
}
public String checkNull(String input)
{
if (input == null || "null".equalsIgnoreCase(input))
{
input= "";
}
return input.trim();
}
private String callWfValData( String domString, String xtraParams) throws ITMException
{
String retString = "";
String errString = "";
//String presavexmlString = "";
PreparedStatement pStmt = null;
int updateCnt = 0;
try
{
System.out.println("Calling wfValData method for validations.............");
GenericUtility genericUtility = GenericUtility.getInstance();
AppConnectParm appConnect = new AppConnectParm();
Properties p = appConnect.getProperty();
InitialContext ctx = new InitialContext(p);
GenReceiptICLocal genRcp = (GenReceiptICLocal)ctx.lookup("ibase/GenReceiptIC/local");
// domString = "<>" + domString + "</>";
//StringBuffer errStringXml = new StringBuffer("<DocumentRoot>\r\n<description>Datawindow Root</description>\r\n<group0>\r\n<description>Group0 description</description>\r\n<Header0>\r\n<description>Header0 members</description>\r\n");
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
String dom1 = domString.substring(0, domString.indexOf("<Detail")) + "<Root>";
String dom2 = domString.substring(domString.indexOf("<Detail"), domString.indexOf("</Header0>")) + "</Root>";
String dom3 = domString.substring(domString.indexOf("</Header0>")) ;
domString = dom1 + dom2 + dom3;
System.out.println( "domString ::::: "+ domString);
Document preSaveXmlDom = genericUtility.parseString(domString);
Node parentNode = preSaveXmlDom.getElementsByTagName("Root").item(0);
//Node parentNode = preSaveXmlDom.getElementsByTagName("DocumentRoot").item(0);
NodeList detailNodeList = parentNode.getChildNodes();
int noOfDetails = detailNodeList.getLength();
System.out.println("noOfDetails =["+noOfDetails+"]");
for(int i = 0; i < noOfDetails; i++)
{
Node detailNode = detailNodeList.item(i);
if( detailNode.getNodeType() != Node.ELEMENT_NODE )
{
continue;
}
String nodeName = detailNode.getNodeName();
System.out.println("nodeName =["+nodeName+"]");
if(nodeName.startsWith("Detail") )
{
String currObjContext = nodeName.substring("Detail".length());
System.out.println("currObjContext =["+currObjContext+"]");
if(currObjContext != null && currObjContext.trim().length() > 0)
{
retString = genRcp.wfValDataPreSave(preSaveXmlDom, preSaveXmlDom, preSaveXmlDom, currObjContext, "", xtraParams);
System.out.println("retString =["+retString+"]");
//Changed by Gaurav Singh 28-May-2015
if( retString != null && retString.indexOf("<Errors>") != -1 )
{
//return retString;
String bufurErrString = retString.substring( retString.indexOf("<Errors>") + 8,retString.indexOf("</Errors>"));
errStringXml.append(bufurErrString);
System.out.println("errStringXml .........."+errStringXml);
}
/*else
{
//retString = "";
errStringXml = new StringBuffer( "" );
}*/
}
}
}//End of for loop
errStringXml.append("</Errors></Root>\r\n");
errString = errStringXml.toString();
System.out.println("errString ::::::::::"+errString);
if(errString.indexOf("<error") == -1)
{
errString = "";
}
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
}
catch(Exception e1)
{
}
}
//return retString;
return errString;
}
}
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
import java.util.ArrayList;
import java.sql.Connection;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
@javax.ejb.Local
public interface GenRcpPreSaveLocal extends ValidatorLocal//, EJBObject
{
public String preSave()throws RemoteException,ITMException;
public String preSave( String domString, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.fin;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
import java.util.ArrayList;
import java.sql.Connection;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
@javax.ejb.Remote
public interface GenRcpPreSaveRemote extends ValidatorLocal//, EJBObject
{
public String preSave()throws RemoteException,ITMException;
public String preSave( String domString, String editFlag, String xtraParams, Connection conn ) throws RemoteException,ITMException;
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import org.w3c.dom.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.ITMException;
......@@ -19,6 +20,8 @@ public interface GenReceiptICLocal extends ValidatorLocal
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValDataPreSave(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;
......
......@@ -18,6 +18,8 @@ public interface GenReceiptICRemote extends ValidatorRemote
public String wfValData(Document dom, Document dom1,Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValDataPreSave(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;
......
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