Commit 5f6d8370 authored by cpatil's avatar cpatil

for receivable_trn item_default


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92393 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 78cfb0d3
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.text.*;
import java.util.Date;
import java.sql.*;
import java.text.SimpleDateFormat;
import org.w3c.dom.*;
import javax.ejb.*;
import ibase.webitm.utility.*;
import ibase.system.config.*;
import ibase.webitm.ejb.*;
@Stateless // added for ejb3
public class ReceivablesTransIC extends ValidatorEJB implements ReceivablesTransICRemote,ReceivablesTransICLocal
{
GenericUtility genericUtility = GenericUtility.getInstance();
/* public void ejbCreate() throws RemoteException, CreateException
{
System.out.println("ReceivablesTransPrcICEJB is in Process..........");
}
public void ejbRemove()
{
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
} */
public String itemChanged() throws RemoteException,ITMException
{
return "";
}
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("xmlString" + xmlString);
dom = parseString(xmlString);
System.out.println("xmlString1" + xmlString1);
dom1 = parseString(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)
{
System.out.println("Exception : [ReceivablesTransPrcICEJB][itemChanged] :==>\n"+e.getMessage());
}
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Connection conn = null;
ConnDriver connDriver = new ConnDriver();
PreparedStatement pStmt = null;
ResultSet rs = null;
int currentFormNo = 0;
StringBuffer valueXmlString = new StringBuffer();
String columnValue = null,loginSite="";
NodeList parentNodeList = null;
Node parentNode = null;
Node childNode = null;
NodeList childNodeList = null;
String childNodeName = null;
int childNodeListLength = 0;
int ctr = 0;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
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));
System.out.println("[" + currentColumn + "] ==> '" + columnValue + "'");
if (currentColumn.trim().equals( "itm_default" ))
{
valueXmlString.append("<site_code>").append("<![CDATA["+ loginSite +"]]>").append("</site_code>");
valueXmlString.append("<process_date>").append("<![CDATA["+ getCurrdateAppFormat() +"]]>").append("</process_date>");
}
valueXmlString.append("</Detail1>");
valueXmlString.append("</Root>");
break;
////////////////
}//END OF TRY
}
catch(Exception e)
{
System.out.println("Exception ::"+ e.getMessage());
e.printStackTrace();
}
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 currAppdate ="";
java.sql.Timestamp currDate = null;
try
{
/*
Object date = null;
currDate =new java.sql.Timestamp(System.currentTimeMillis()) ;
System.out.println(genericUtility.getDBDateFormat());
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getDBDateFormat());
date = sdf.parse(currDate.toString());
currDate = java.sql.Timestamp.valueOf(sdf.format(date).toString() + " 00:00:00.0");
currAppdate = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(currDate).toString();
*/
currDate =new java.sql.Timestamp(System.currentTimeMillis()) ;
System.out.println(genericUtility.getApplDateFormat());
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
currAppdate = new SimpleDateFormat(genericUtility.getApplDateFormat()).format(currDate);
System.out.println("@@@@@@@@@@@currAppdate ["+currAppdate+"]");
}
catch(Exception e)
{
System.out.println("Exception in getCurrdateAppFormat"+e.getMessage());
}
return (currAppdate);
}
private String getNodeValue( Node currDet, String fldName, boolean isAttribute )
{
String fldValue = null;
boolean isFound = false;
NodeList currNodes = currDet.getChildNodes();
int currDetLen = currNodes.getLength();
for(int detIdx = 0; detIdx < currDetLen && !isFound ; detIdx++ )
{
Node currNode = currNodes.item( detIdx );
String nodeName = currNode.getNodeName();
if( isAttribute == true )
{
if ( nodeName.equalsIgnoreCase( "attribute" ) )
{
fldValue = currNode.getAttributes().getNamedItem( fldName ).getNodeValue();
isFound = true;
}
}
else if ( currNode.getNodeType() == Node.ELEMENT_NODE && nodeName.equalsIgnoreCase( fldName ) )
{
fldValue = currNode.getFirstChild() != null ? currNode.getFirstChild().getNodeValue().trim() : null;
isFound = true;
}
}
return fldValue;
}
}
package ibase.webitm.ejb.fin;
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
import ibase.webitm.ejb.ValidatorLocal;// added for ejb3
@Local // added for ejb3
public interface ReceivablesTransICLocal extends ValidatorLocal
{
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.*;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import javax.ejb.Remote; // added for ejb3
import ibase.webitm.ejb.ValidatorRemote;// added for ejb3
@Remote // added for ejb3
public interface ReceivablesTransICRemote extends ValidatorRemote
{
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