Commit 98f01022 authored by manohar's avatar manohar

This commit was generated by cvs2svn to compensate for changes in r38, which

included commits to RCS files with non-trunk default branches.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91103 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5c0996cb
This diff is collapsed.
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 AssetRegisterICLocal extends ValidatorLocal
{
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 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 AssetRegisterICRemote extends ValidatorRemote
{
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 ibase.webitm.utility.*;
import ibase.utility.CommonConstants;
import ibase.webitm.ejb.*;
import ibase.system.config.*;
import java.rmi.RemoteException;
import java.util.*;
import java.text.*;
import java.sql.*;
import javax.ejb.*;
import java.util.Calendar;
import java.util.Date;
import javax.naming.InitialContext;
import ibase.system.config.AppConnectParm;
//import ibase.webitm.ejb.MasterStatefulEJB;
//import ibase.webitm.ejb.MasterStatefulLocal;
@Stateless // added for ejb3
public class ConfirmAssetRegisterIC extends ActionHandlerEJB implements ConfirmAssetRegisterICRemote,ConfirmAssetRegisterICLocal
{
GenericUtility genericUtility = GenericUtility.getInstance();
String errorString = null;
/* public void ejbCreate() throws RemoteException, CreateException
{
System.out.println("Create Method Called....");
}
public void ejbRemove()
{
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
} */
public String actionHandler() throws RemoteException,ITMException
{
System.out.println("actionHandler() Method Called....");
return "";
}
public String actionHandler(String xmlString, String xtraParams, String objContext) throws RemoteException,ITMException
{
String retString = null;
System.out.println("Xtra Params : " + xtraParams);
//genericUtility = GenericUtility.getInstance();
try
{
retString = actionConfirm(xmlString, xtraParams);
}
catch(Exception e)
{
System.out.println("Exception :actionHandler(String xmlString):" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning from actionHandler"+retString);
return (retString);
}
private String actionConfirm(String tranID, String xtraParams) throws RemoteException,ITMException, Exception
{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
int cnt = 0;
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
ConnDriver connDriver = new ConnDriver();
String sql = "";
String userId ="";
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
java.sql.Timestamp currDate = null;
String returnString = null;
try
{
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;
sql = "SELECT count(1) from ASSET_SHIFTDET"
+" where tran_id = ? ";
pstmt = conn.prepareStatement( sql );
pstmt.setString(1,tranID);
rs = pstmt.executeQuery();
if( rs.next() )
{
cnt = rs.getInt( 1 );
}
System.out.println(" COUNT =====> [" + cnt + "]");
if( cnt == 0 )
{
returnString = itmDBAccessEJB.getErrorString("","ASTNOTCONF",userId);
}
else
{
sql = " Update asset_shift set "
+ " confirmed = 'Y',"
+ " conf_date = ?"
+ " where tran_id = ? " ;
System.out.println("sql....."+sql);
pstmt = conn.prepareStatement(sql);
pstmt.setTimestamp(1,getCurrdateAppFormat() );
pstmt.setString(2,tranID);
pstmt.executeUpdate();
conn.commit();
returnString = itmDBAccessEJB.getErrorString("","CONFSUCC",userId);
}
}
catch(Exception e)
{
System.out.println("ConfirmAssetRegisterICEJB..."+e.getMessage());
e.printStackTrace();
try
{
conn.rollback();
}
catch(Exception e1)
{
System.out.println("ConfirmAssetRegisterICEJB..."+e1.getMessage());
e1.printStackTrace();
}
}
finally
{
try
{
conn.commit();
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception e)
{
System.out.println("Exception ConfirmAssetRegisterICEJB....... :\n"+e.getMessage());
}
}
System.out.println("retString ::"+returnString);
return returnString;
}
private Timestamp getCurrdateAppFormat()
{
String s = "";
Timestamp timestamp = null;
GenericUtility genericUtility = GenericUtility.getInstance();
try
{
java.util.Date date = null;
timestamp = new Timestamp(System.currentTimeMillis());
SimpleDateFormat simpledateformat = new SimpleDateFormat(genericUtility.getDBDateFormat());
date = simpledateformat.parse(timestamp.toString());
timestamp = Timestamp.valueOf(simpledateformat.format(date).toString() + " 00:00:00.0");
}
catch(Exception exception)
{
System.out.println("Exception in getCurrdateAppFormat " + exception.getMessage());
}
return timestamp;
}
}
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
//import ibase.webitm.ejb.ActionHandler;
import javax.ejb.Local; // added for ejb3
import ibase.webitm.ejb.ActionHandlerLocal;// added for ejb3
@Local // added for ejb3
public interface ConfirmAssetRegisterICLocal extends ActionHandlerLocal
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String xmlString, String xtraParams, String objContext) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
//import ibase.webitm.ejb.ActionHandler;
import javax.ejb.Remote; // added for ejb3
import ibase.webitm.ejb.ActionHandlerRemote;// added for ejb3
@Remote // added for ejb3
public interface ConfirmAssetRegisterICRemote extends ActionHandlerRemote
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String xmlString, String xtraParams, String objContext) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.util.*;
import java.sql.*;
import java.text.SimpleDateFormat;
import org.w3c.dom.*;
import javax.ejb.*;
import javax.naming.InitialContext;
import ibase.system.config.*;
import ibase.webitm.utility.ITMException;
import ibase.webitm.ejb.*;
import ibase.webitm.utility.GenericUtility;
import javax.ejb.Stateless;
@Stateless // added for ejb3
public class DefaultAssetRegisterIC extends ActionHandlerEJB implements DefaultAssetRegisterICRemote,DefaultAssetRegisterICLocal
{
/* public void ejbCreate() throws RemoteException, CreateException {}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){} */
public String actionHandler() throws RemoteException,ITMException{return "";}
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException
{
String retString = "";
Document dom = null;
try
{
GenericUtility genericUtility = GenericUtility.getInstance();
if(xmlString != null && xmlString.trim().length()!=0)
{
System.out.println("XML String :"+xmlString);
dom = genericUtility.parseString(xmlString);
}
}
catch(Exception e)
{
System.out.println("Exception :DefaultAssetRegisterICEJB :actionHandler(String xmlString):" + e.getMessage() + ":");
throw new ITMException(e);
}
return retString;
}
public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException
{
Connection conn=null;
GenericUtility genericUtility = GenericUtility.getInstance();
Document dom = null;
Document dom1 = null;
String retString = null;
try
{
if(xmlString != null && xmlString.trim().length()!=0)
{
System.out.println("XML String:::"+xmlString);
dom = GenericUtility.getInstance().parseString(xmlString);
}
if(xmlString1 != null && xmlString1.trim().length()!=0)
{
System.out.println("XML String1:::"+xmlString1);
dom1 = GenericUtility.getInstance().parseString(xmlString1);
}
if (actionType.equalsIgnoreCase("Default"))
{
try
{
if(conn==null)
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
DatabaseMetaData dbmd = conn.getMetaData();
System.out.println("DriverName["+dbmd.getDriverName() );
System.out.println("DriverURI["+dbmd.getURL() );
System.out.println("DriverUSER["+dbmd.getUserName());
//System.out.println("ApplDateFormat["+genericUtility. ());
System.out.println("DBDateFormat["+genericUtility.getDBDateFormat() );
connDriver = null;
}
}
catch (Exception e)
{
e.printStackTrace();
}
retString = actionDefault(dom, dom1, objContext, xtraParams);
}
}
catch(Exception e)
{
System.out.println("Exception :Dispatch :actionHandler(String xmlString):" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning String from DefaultAssetRegisterICEJB : actionHandler"+retString);
return retString;
}
private String actionDefault(Document dom, Document dom1, String objContext, String xtraParams) throws RemoteException, ITMException
{
GenericUtility genericUtility = GenericUtility.getInstance();
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
StringBuffer valueXmlString = null;
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n");
int currentFormNo = 0;
String sql1 = "";
String itemserhdr = null;
String sitecodehdr = null;
String assetcode = null;
String assetdescr = null;
String itemcode = null;
String itemdescr = null;
try
{
if(conn==null)
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
connDriver=null;
}
if(objContext != null && objContext.trim().length()>0)
{
currentFormNo = Integer.parseInt(objContext);
}
itemserhdr = genericUtility.getColumnValue( "item_grp", dom1 );
sitecodehdr = genericUtility.getColumnValue( "site_code", dom1 );
sql1 = "select ar.asset_code, ar.descr , ar.item_code, m.descr "
+" from asset_register ar, item m"
+" where ar.item_code = m.item_code"
+" and ar.item_ser = '"+itemserhdr+"'"
+" and ar.site_code = '"+sitecodehdr+"'";
System.out.println("sql1 is :"+sql1);
pstmt = conn.prepareStatement(sql1);
rs = pstmt.executeQuery();
while (rs.next())
{
assetcode = rs.getString(1) == null ? "" :rs.getString(1);
assetdescr = rs.getString(2) == null ? "" :rs.getString(2);
itemcode = rs.getString(3) == null ? "" :rs.getString(3);
itemdescr = rs.getString(4) == null ? "" :rs.getString(4);
valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<asset_code>").append("<![CDATA[").append(assetcode).append("]]>").append("</asset_code>\r\n");
valueXmlString.append("<descr>").append("<![CDATA[").append(assetdescr).append("]]>").append("</descr>\r\n");
valueXmlString.append("<item_code>").append("<![CDATA[").append(itemcode).append("]]>").append("</item_code>\r\n");
valueXmlString.append("<descr_item>").append("<![CDATA[").append(itemdescr).append("]]>").append("</descr_item>\r\n");
valueXmlString.append("</Detail>\r\n");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
valueXmlString.append("</Root>\r\n");
}
catch(SQLException sqx)
{
System.out.println("The Exception caught from DefaultAssetRegisterICEJB :"+sqx);
throw new ITMException(sqx);
}
catch(Exception e)
{
System.out.println("The Exception caught from DefaultAssetRegisterICEJB :"+e);
throw new ITMException(e);
}
finally
{
try
{
conn.close();
conn = null;
}catch(Exception e){}
}
System.out.println("valueXmlString.toString() :"+valueXmlString.toString());
return valueXmlString.toString();
}
public String actionHandlerTransform(String actionType, String xmlString,
String xmlString1, String objContext, String xtraParams,
String selDataStr) throws RemoteException, ITMException
{
Document dom = null;
Document dom1 = null;
Document selDataDom = null;
String retString = null;
try
{
if (xmlString != null && xmlString.trim().length() != 0) {
dom = GenericUtility.getInstance().parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() != 0)
{
dom1 = GenericUtility.getInstance().parseString(xmlString1);
}
if(selDataStr != null && selDataStr.length() > 0)
{
selDataDom = GenericUtility.getInstance().parseString(selDataStr);
}
if (actionType.equalsIgnoreCase("Default"))
{
retString = makeTransform(dom, dom1, objContext, xtraParams,selDataDom);
}
}
catch (Exception e)
{
System.out.println("Exception :DefaultAssetRegisterICEJB :actionHandlerTransform(String xmlString):"
+ e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
System.out.println("returning String from DefaultAssetRegisterICEJB : actionHandlerTransform"
+ retString);
return retString;
}
private String makeTransform(Document dom, Document dom1, String objContext, String xtraParams, Document selDataDom)throws ITMException
{
StringBuffer valueXmlString = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root>\r\n");
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
Node currDetail = null, currDetail1 = null;
ConnDriver connDriver = new ConnDriver();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance();
String astcode_trans = null;
String astdescr_trans = null;
String itmcode_trans = null;
String itmdescr_trans = null;
try
{
conn = connDriver.getConnectDB("DriverITM");
connDriver = null;
NodeList detailList = selDataDom.getElementsByTagName("Detail");
int noOfDetails = detailList.getLength();
for (int ctr = 0; ctr < noOfDetails; ctr++)
{
valueXmlString.append("<Detail>\r\n");
currDetail1 = detailList.item(ctr);
astcode_trans = genericUtility.getColumnValueFromNode("asset_code", currDetail1);
astdescr_trans = genericUtility.getColumnValueFromNode("descr", currDetail1);
itmcode_trans = genericUtility.getColumnValueFromNode("item_code", currDetail1);
itmdescr_trans = genericUtility.getColumnValueFromNode("descr_item", currDetail1);
valueXmlString.append("<asset_code>").append("<![CDATA[").append(astcode_trans).append("]]>").append("</asset_code>\r\n");
valueXmlString.append("<descr>").append("<![CDATA[").append(astdescr_trans).append("]]>").append("</descr>\r\n");
valueXmlString.append("</Detail>");
//valueXmlString.append("<item_code>").append("<![CDATA[").append(itmcode_trans).append("]]>").append("</item_code>\r\n");
//valueXmlString.append("<descr>").append("<![CDATA[").append(itmdescr_trans).append("]]>").append("</descr>\r\n");
}// for end
valueXmlString.append("</Root>");
}// end try
catch (ITMException itme) {
itme.printStackTrace();
throw itme;
} catch (Exception e) {
e.printStackTrace();
throw new ITMException(e);
} finally {
try {
conn.close();
conn = null;
} catch (Exception e) {
}
}
System.out.println("valueXmlString from :" + valueXmlString.toString());
return valueXmlString.toString();
}
}//end of Ejb
\ No newline at end of file
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
//import ibase.webitm.ejb.ActionHandler;
import ibase.webitm.ejb.ActionHandlerLocal;// added for ejb3
import javax.ejb.Local; // added for ejb3
@Local // added for ejb3
public interface DefaultAssetRegisterICLocal extends ActionHandlerLocal
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException;
}
\ No newline at end of file
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
//import javax.ejb.EJBObject;
import ibase.webitm.utility.ITMException;
//import ibase.webitm.ejb.ActionHandler;
import javax.ejb.Remote; // added for ejb3
import ibase.webitm.ejb.ActionHandlerRemote;// added for ejb3
@Remote // added for ejb3
public interface DefaultAssetRegisterICRemote extends ActionHandlerRemote
{
public String actionHandler() throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String objContext, String xtraParams) throws RemoteException,ITMException;
public String actionHandler(String actionType, String xmlString, String xmlString1, String objContext, 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