Commit ce91d90a authored by agaikwad's avatar agaikwad

Request Id-D16JSUN012


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@105245 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 71e83f2e
package ibase.webitm.ejb.sys;
import java.rmi.RemoteException;
import java.util.*;
import java.util.Date;
import java.text.*;
import java.sql.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.*;
import ibase.system.config.*;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.TransIDGenerator;//TID
import ibase.utility.CommonConstants;//TID
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
public class CreateXml extends ValidatorEJB implements CreateXmlLocal , CreateXmlRemote // SessionBean
{
/*public void ejbCreate() throws RemoteException, CreateException
{
System.out.println("Enter in to the the FileFltEJB........................");
}
public void ejbRemove()
{
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
}*/
public String wfValData() throws RemoteException,ITMException
{
return "";
}
public String itemChanged() throws RemoteException,ITMException
{
return "";
}
public String itemChanged(String xmlString, String xmlString1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
Document dom1 = null;
String valueXmlString = "";
try
{
dom = parseString(xmlString); //returns the DOM Object for the passed XML Stirng
System.out.println("xmlString" + xmlString);
dom1 = parseString(xmlString1); //returns the DOM Object for the passed XML Stirng
valueXmlString = itemChanged(dom,dom1,objContext,currentColumn,editFlag,xtraParams);
}
catch(Exception e)
{
System.out.println("Exception : [FileFltEJB][itemChanged(String,String)] :==>\n"+e.getMessage());
}
return valueXmlString;
}
public String itemChanged(Document dom, Document dom1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{
int ctr =0;
int currentFormNo = 0;
String errCode = "";
Connection conn = null;
Statement st = null;
ResultSet rs = null;
String errString = "";
StringBuffer valueXmlString = new StringBuffer();
String sql = "";
String columnValue = "";
String format = "";
NodeList parentNodeList = null;
Node parentNode = null;
Node childNode = null;
NodeList childNodeList = null;
String childNodeName = "";
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance();
StringBuffer retString = new StringBuffer();
String winName = "";
String filePath ="";
try
{
conn = getConnection(); //THIS FUNCTION IS TO CONNECT WITH ORACLE....
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
System.out.println("[FileFltEJB] [itemChanged] :currentFormNo ....." +currentFormNo);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>");
valueXmlString.append("<Detail>");
System.out.println("FORM NO-------------"+currentFormNo);
switch (currentFormNo)
{
case 1:
/* SEARCHING THE DOM FOR THE INCOMING COLUMN VALUE START*/
parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
ctr = 0;
int 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("itm_default"))
{
if (columnValue != null)
{
try
{
// no code
}
catch(Exception e)
{
System.out.println("Exception :[CreateXml[itemChanged::case 1] :==>\n"+e.getMessage());
throw new ITMException(e);
}
}
}
valueXmlString.append("</Detail>");
break;
}//END OF SWITCH
valueXmlString.append("</Root>");
}//END OF TRY
catch(Exception e)
{
System.out.println("Exception ::"+e.getMessage());
}
finally
{
try
{
conn.close();
conn = null;
}catch(Exception s){}
}
return valueXmlString.toString();
}//END OF ITEMCHNGE
}
\ No newline at end of file
package ibase.webitm.ejb.sys;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import ibase.webitm.utility.ITMException;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface CreateXmlLocal extends ValidatorLocal//, EJBObject
{
public String wfValData() throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
}
/*
window name : w_generate_xml
*/
package ibase.webitm.ejb.sys;
import ibase.webitm.ejb.dis.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import java.io.*;
import java.rmi.RemoteException;
import java.util.*;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.sql.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.utility.UserInfoBean;
import ibase.utility.E12GenericUtility;
import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants;
import ibase.ejb.*;
import ibase.system.config.*;
import java.util.*;
import java.lang.*;
import javax.annotation.*;
import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3
public class CreateXmlPrc extends ProcessEJB implements CreateXmlPrcLocal , CreateXmlPrcRemote // SessionBean
{
Connection conn = null;
ITMDBAccessEJB itmDBAccessEJB = null;
CommonConstants commonConstants;
E12GenericUtility genericUtility = null; //new E12GenericUtility();
String userId = "";
String logInSite = "";
String xtraParam = "";
/*public void ejbRemove()
{
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
}*/
public String process() throws RemoteException,ITMException
{
return "";
}
//process()
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException
{
xtraParam = xtraParams;
String retStr = "";
Document detailDom = null;
Document headerDom = null;
try
{
genericUtility = new E12GenericUtility();
if(xmlString != null && xmlString.trim().length()!=0)
{
headerDom = genericUtility.parseString(xmlString);
}
if(xmlString2 != null && xmlString2.trim().length()!=0)
{
detailDom = genericUtility.parseString(xmlString2);
}
retStr = process(headerDom, detailDom, windowName, xtraParams);
genericUtility = null;
}
catch (Exception e)
{
System.out.println("Exception :CreateBatchPrcEJB :process(String xmlString, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
return retStr;
}
public String process(Document headerDom, Document detailDom, String windowName, String xtraParams) throws RemoteException,ITMException
{
String childNodeName = "";
String errCode = null;
String errString = null;
int parentNodeListLength = 0;
int childNodeListLength = 0;
NodeList parentNodeList = null;
NodeList childNodeList = null;
java.io.File file = null;
Node parentNode = null;
Node childNode = null;
String refId = "";
String winName = "", objName = "";
xtraParam = xtraParams;
try
{
itmDBAccessEJB = new ITMDBAccessEJB();
/*ConnDriver conndriver = new ConnDriver();
conn = conndriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
*/
commonConstants = new CommonConstants();
genericUtility = new E12GenericUtility();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId");
logInSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSiteCode");
parentNodeList = headerDom.getElementsByTagName("Detail1");
parentNodeListLength = parentNodeList.getLength();
System.out.println("ParentNodeListLength:::::::::::::::::::::::"+parentNodeListLength);
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{
parentNode = parentNodeList.item(selectedRow);
childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength();
System.out.println("ChildNodeListLength:::::::::::::: "+ childNodeListLength);
for (int childRow = 0; childRow < childNodeListLength; childRow++)
{
childNode = childNodeList.item(childRow);
childNodeName = childNode.getNodeName();
if (childNodeName.equals("win_name"))
{
winName = (childNode.getFirstChild().getNodeValue()).trim();
System.out.println("winName::::::::::: "+ winName);
}
if (childNodeName.equals("ref_id"))
{
refId = (childNode.getFirstChild().getNodeValue()).trim();
System.out.println("refId ["+ refId + "]");
}
}
}
objName = winName.substring(2);
AppConnectParm appConnect = new AppConnectParm();
InitialContext ctx = new InitialContext( appConnect.getProperty() );
CommonDBAccessLocal commonDBAccessLocal = (CommonDBAccessLocal)ctx.lookup("ibase/CommonDBAccessEJB/local");
UserInfoBean userInfo = commonDBAccessLocal.createUserInfo( userId );
System.out.println("EDI : userInfo ["+userInfo.toString()+"]");
E12GenerateEDILocal generateEDILocal = (E12GenerateEDILocal)ctx.lookup("ibase/E12GenerateEDIEJB/local");
generateEDILocal.generateEdi(objName, refId, "", userInfo, xtraParams);
generateEDILocal = null;
}//try end
catch(Exception e)
{
System.out.println("Exception :process(String xmlString2, String xmlString2, String windowName, String xtraParams):" + e.getMessage() + ":");
throw new ITMException(e);
}
finally
{
try
{
if( genericUtility != null )
{
genericUtility = null;
}
/*if( conn != null )
{
conn.close();
conn = null;
}*/
}
catch(Exception e){}
}
return errString;
}
}//END OF EJB
\ No newline at end of file
package ibase.webitm.ejb.sys;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ProcessLocal;
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface CreateXmlPrcLocal extends ibase.webitm.ejb.ProcessLocal//, EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String process(Document dom, Document dom2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String getData(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String getData(Document dom, Document dom2, String windowNamem, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.sys;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.ProcessRemote;
public interface CreateXmlPrcRemote extends ibase.webitm.ejb.ProcessRemote//, EJBObject
{
public String process() throws RemoteException,ITMException;
public String process(Document dom, Document dom2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String process(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String getData(String xmlString, String xmlString2, String windowName, String xtraParams) throws RemoteException,ITMException;
public String getData(Document dom, Document dom2, String windowNamem, String xtraParams) throws RemoteException,ITMException;
}
package ibase.webitm.ejb.sys;
import ibase.webitm.ejb.*;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.ejb.*;
import ibase.webitm.utility.ITMException;
public interface CreateXmlRemote extends ValidatorRemote//, EJBObject
{
public String wfValData() throws RemoteException,ITMException;
public String wfValData(String xmlString, String xmlString1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String wfValData(Document dom, Document dom1, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged() throws RemoteException,ITMException;
public String itemChanged(String xmlString, String xmlString1, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException;
public String itemChanged(Document dom, Document dom1, 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