Commit 06926414 authored by gahmad's avatar gahmad

changes from cust_code to site_code in validation method


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91554 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d40400a4
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.text.*; import java.text.*;
import java.sql.*; import java.sql.*;
import org.w3c.dom.*; import org.w3c.dom.*;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import ibase.webitm.utility.*; import ibase.webitm.utility.*;
import ibase.system.config.*; import ibase.system.config.*;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import javax.ejb.Stateless; // added for ejb3 import javax.ejb.Stateless; // added for ejb3
@Stateless // added for ejb3 @Stateless // added for ejb3
public class InvHoldRelIC extends ValidatorEJB implements InvHoldRelICLocal , InvHoldRelICRemote // SessionBean public class InvHoldRelIC extends ValidatorEJB implements InvHoldRelICLocal , InvHoldRelICRemote // SessionBean
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
/*public void ejbCreate() throws RemoteException, CreateException /*public void ejbCreate() throws RemoteException, CreateException
{ {
System.out.println("EpaymentICEJB is in Process.........."); System.out.println("EpaymentICEJB is in Process..........");
} }
public void ejbRemove() public void ejbRemove()
{ {
} }
public void ejbActivate() public void ejbActivate()
{ {
} }
public void ejbPassivate() public void ejbPassivate()
{ {
}*/ }*/
public String wfValData() throws RemoteException,ITMException public String wfValData() throws RemoteException,ITMException
{ {
return ""; return "";
} }
public String itemChanged() throws RemoteException,ITMException public String itemChanged() throws RemoteException,ITMException
{ {
return ""; return "";
} }
public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(String xmlString, String xmlString1,String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
String errString = null; String errString = null;
System.out.println("Validation Start.........."); System.out.println("Validation Start..........");
try try
{ {
System.out.println( "xmlString::: " + xmlString ); System.out.println( "xmlString::: " + xmlString );
System.out.println( "xmlString1:::" + xmlString1 ); System.out.println( "xmlString1:::" + xmlString1 );
System.out.println( "xmlString2:::" + xmlString2 ); System.out.println( "xmlString2:::" + xmlString2 );
dom = parseString(xmlString); dom = parseString(xmlString);
dom1 = parseString(xmlString1); dom1 = parseString(xmlString1);
if (xmlString2.length() > 0 ) if (xmlString2.length() > 0 )
{ {
dom2 = parseString(xmlString2); dom2 = parseString(xmlString2);
} }
errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams); errString = wfValData(dom,dom1,dom2,objContext,editFlag,xtraParams);
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception : EpaymentICEJB : wfValData(String xmlString) : ==>\n"+e.getMessage()); System.out.println("Exception : EpaymentICEJB : wfValData(String xmlString) : ==>\n"+e.getMessage());
} }
return (errString); return (errString);
} }
public String wfValData(Document dom, Document dom1,Document dom2, 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
{ {
String errString = " "; String errString = " ";
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
int ctr = 0; int ctr = 0;
String childNodeName = null; String childNodeName = null;
String errCode = null; String errCode = null;
String userId = null; String userId = null;
int cnt = 0; int cnt = 0;
int currentFormNo = 0; int currentFormNo = 0;
int childNodeListLength; int childNodeListLength;
Connection conn = null; Connection conn = null;
PreparedStatement pstmt=null; PreparedStatement pstmt=null;
ResultSet rs = null; ResultSet rs = null;
String sql = null; String sql = null;
String tranIdHold = null; String tranIdHold = null;
String lineNo = null; String lineNo = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
try try
{ {
System.out.println( "wfValData called" ); System.out.println( "wfValData called" );
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode"); userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"); getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
genericUtility = GenericUtility.getInstance(); genericUtility = GenericUtility.getInstance();
if(objContext != null && objContext.length()>0) if(objContext != null && objContext.length()>0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
switch(currentFormNo) switch(currentFormNo)
{ {
case 1 : case 1 :
System.out.println("VALIDATION FOR DETAIL [ 1 ].........."); System.out.println("VALIDATION FOR DETAIL [ 1 ]..........");
parentNodeList = dom.getElementsByTagName("Detail1"); parentNodeList = dom.getElementsByTagName("Detail1");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr++) for(ctr = 0; ctr < childNodeListLength; ctr++)
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if ( childNodeName.equalsIgnoreCase( "site_code" ) ) if ( childNodeName.equalsIgnoreCase( "site_code" ) )
{ {
String siteCode = null; String siteCode = null;
siteCode = genericUtility.getColumnValue( "cust_code", dom, "1" ); //Commented and changed the "cust_code" to "site_code" - Gulzar - 02/12/11
//siteCode = genericUtility.getColumnValue( "cust_code", dom, "1" );
if( siteCode != null ) siteCode = genericUtility.getColumnValue( "site_code", dom, "1" );
{ //End changes by gulzar - 02/12/11
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start
/* if( siteCode != null )
sql = " SELECT COUNT(*) FROM site WHERE site_code ='" + siteCode.trim() + "'"; {
System.out.println( " SQL FOR custCode ====> " + sql ); //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start
pstmt = conn.prepareStatement( sql ); /*
rs = pstmt.executeQuery(); sql = " SELECT COUNT(*) FROM site WHERE site_code ='" + siteCode.trim() + "'";
*/ System.out.println( " SQL FOR custCode ====> " + sql );
sql = " SELECT COUNT(*) FROM site WHERE site_code = ?"; pstmt = conn.prepareStatement( sql );
System.out.println( " SQL FOR custCode ====> " + sql ); rs = pstmt.executeQuery();
pstmt = conn.prepareStatement( sql ); */
pstmt.setString(1,siteCode); sql = " SELECT COUNT(*) FROM site WHERE site_code = ?";
rs = pstmt.executeQuery(); System.out.println( " SQL FOR custCode ====> " + sql );
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end pstmt = conn.prepareStatement( sql );
pstmt.setString(1,siteCode);
cnt = 0; rs = pstmt.executeQuery();
if( rs.next() ) //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end
{
cnt = rs.getInt( 1 ); cnt = 0;
} if( rs.next() )
System.out.println(" COUNT =====> [" + cnt + "]"); {
if( cnt == 0 ) cnt = rs.getInt( 1 );
{ }
System.out.println(" ====> Site invalid or not found <==== "); System.out.println(" COUNT =====> [" + cnt + "]");
errCode = "VMINVSITE"; if( cnt == 0 )
errString = getErrorString( "SITE_CODE", errCode, userId ); {
} System.out.println(" ====> Site invalid or not found <==== ");
rs.close(); errCode = "VMINVSITE";
rs = null; errString = getErrorString( "SITE_CODE", errCode, userId );
}
pstmt.close(); rs.close();
pstmt = null; rs = null;
}
} pstmt.close();
if ( childNodeName.equalsIgnoreCase( "emp_code__aprv" ) ) pstmt = null;
{ }
String empCode = null; }
empCode = genericUtility.getColumnValue( "emp_code__aprv", dom, "1" ); if ( childNodeName.equalsIgnoreCase( "emp_code__aprv" ) )
if( empCode != null && empCode.length() > 0 ) {
{ String empCode = null;
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start empCode = genericUtility.getColumnValue( "emp_code__aprv", dom, "1" );
/* if( empCode != null && empCode.length() > 0 )
sql = " SELECT COUNT(*) FROM Employee WHERE emp_code ='" + empCode.trim() + "'"; {
System.out.println( " SQL FOR empCode ====> " + sql ); //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start
pstmt = conn.prepareStatement( sql ); /*
rs = pstmt.executeQuery(); sql = " SELECT COUNT(*) FROM Employee WHERE emp_code ='" + empCode.trim() + "'";
*/ System.out.println( " SQL FOR empCode ====> " + sql );
sql = " SELECT COUNT(*) FROM Employee WHERE emp_code = ?"; pstmt = conn.prepareStatement( sql );
System.out.println( " SQL FOR custCode ====> " + sql ); rs = pstmt.executeQuery();
pstmt = conn.prepareStatement( sql ); */
pstmt.setString(1,empCode); sql = " SELECT COUNT(*) FROM Employee WHERE emp_code = ?";
rs = pstmt.executeQuery(); System.out.println( " SQL FOR custCode ====> " + sql );
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end pstmt = conn.prepareStatement( sql );
cnt = 0; pstmt.setString(1,empCode);
if( rs.next() ) rs = pstmt.executeQuery();
{ //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end
cnt = rs.getInt( 1 ); cnt = 0;
} if( rs.next() )
System.out.println(" COUNT =====> [" + cnt + "]"); {
if( cnt == 0 ) cnt = rs.getInt( 1 );
{ }
System.out.println(" ====> Employee invalid or not found <==== "); System.out.println(" COUNT =====> [" + cnt + "]");
errCode = "VMINVEMP"; if( cnt == 0 )
errString = getErrorString( "EMP_CODE", errCode, userId ); {
} System.out.println(" ====> Employee invalid or not found <==== ");
rs.close(); errCode = "VMINVEMP";
rs = null; errString = getErrorString( "EMP_CODE", errCode, userId );
}
pstmt.close(); rs.close();
pstmt = null; rs = null;
}
} pstmt.close();
} //END OF CASE1 pstmt = null;
break; }
case 2 : }
System.out.println("VALIDATION FOR DETAIL [ 2 ].........."); } //END OF CASE1
parentNodeList = dom.getElementsByTagName("Detail2"); break;
parentNode = parentNodeList.item(0); case 2 :
childNodeList = parentNode.getChildNodes(); System.out.println("VALIDATION FOR DETAIL [ 2 ]..........");
childNodeListLength = childNodeList.getLength(); parentNodeList = dom.getElementsByTagName("Detail2");
for(ctr = 0; ctr < childNodeListLength; ctr++) parentNode = parentNodeList.item(0);
{ childNodeList = parentNode.getChildNodes();
cnt = 0; childNodeListLength = childNodeList.getLength();
childNode = childNodeList.item(ctr); for(ctr = 0; ctr < childNodeListLength; ctr++)
childNodeName = childNode.getNodeName(); {
cnt = 0;
errCode = null; childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if( childNodeName.equalsIgnoreCase( "tran_id__hold" ) || childNodeName.equalsIgnoreCase( "LINE_NO__HOLD" ) )
{ errCode = null;
tranIdHold = genericUtility.getColumnValue( "tran_id__hold", dom, "2" );
lineNo = genericUtility.getColumnValue( "line_no__hold", dom, "2" ); if( childNodeName.equalsIgnoreCase( "tran_id__hold" ) || childNodeName.equalsIgnoreCase( "LINE_NO__HOLD" ) )
if( tranIdHold != null && tranIdHold.length() > 0 ) {
{ tranIdHold = genericUtility.getColumnValue( "tran_id__hold", dom, "2" );
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start lineNo = genericUtility.getColumnValue( "line_no__hold", dom, "2" );
/* if( tranIdHold != null && tranIdHold.length() > 0 )
sql = "select count( 1 ) cnt from inv_hold_det where tran_id = '" + tranIdHold + "' "; {
pstmt = conn.prepareStatement( sql ); //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start
rs = pstmt.executeQuery(); /*
*/ sql = "select count( 1 ) cnt from inv_hold_det where tran_id = '" + tranIdHold + "' ";
sql = "select count( 1 ) cnt from inv_hold_det where tran_id = ?"; pstmt = conn.prepareStatement( sql );
pstmt = conn.prepareStatement( sql ); rs = pstmt.executeQuery();
pstmt.setString(1,tranIdHold); */
rs = pstmt.executeQuery(); sql = "select count( 1 ) cnt from inv_hold_det where tran_id = ?";
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end pstmt = conn.prepareStatement( sql );
pstmt.setString(1,tranIdHold);
if( rs.next() ) rs = pstmt.executeQuery();
{ //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end
cnt = rs.getInt( "cnt" );
} if( rs.next() )
{
rs.close(); cnt = rs.getInt( "cnt" );
rs = null; }
pstmt.close(); rs.close();
pstmt = null; rs = null;
if( cnt == 0 ) pstmt.close();
{ pstmt = null;
errCode = "VTTRANINV";
} if( cnt == 0 )
if( errCode == null ) {
{ errCode = "VTTRANINV";
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start }
/* if( errCode == null )
sql = "select count( 1 ) cnt from inv_hold where tran_id = '" + tranIdHold + "' and confirmed = 'Y' "; {
pstmt = conn.prepareStatement( sql ); //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start
rs = pstmt.executeQuery(); /*
*/ sql = "select count( 1 ) cnt from inv_hold where tran_id = '" + tranIdHold + "' and confirmed = 'Y' ";
sql = "select count( 1 ) cnt from inv_hold where tran_id = ? and confirmed = 'Y' "; pstmt = conn.prepareStatement( sql );
pstmt = conn.prepareStatement( sql ); rs = pstmt.executeQuery();
pstmt.setString(1,tranIdHold); */
rs = pstmt.executeQuery(); sql = "select count( 1 ) cnt from inv_hold where tran_id = ? and confirmed = 'Y' ";
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end pstmt = conn.prepareStatement( sql );
pstmt.setString(1,tranIdHold);
if( rs.next() ) rs = pstmt.executeQuery();
{ //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end
cnt = rs.getInt( "cnt" );
} if( rs.next() )
{
rs.close(); cnt = rs.getInt( "cnt" );
rs = null; }
pstmt.close(); rs.close();
pstmt = null; rs = null;
if( cnt == 0 ) pstmt.close();
{ pstmt = null;
errCode = "VTTRANUNC";
} if( cnt == 0 )
} {
} errCode = "VTTRANUNC";
else }
{ }
errCode = "VTTRANBLK"; }
} else
if( errCode != null ) {
{ errCode = "VTTRANBLK";
errString = getErrorString( "tran_id__hold", errCode, userId ); }
}else if( lineNo != null && lineNo.length() > 0 ) if( errCode != null )
{ {
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start errString = getErrorString( "tran_id__hold", errCode, userId );
/* }else if( lineNo != null && lineNo.length() > 0 )
sql = "select count( 1 ) cnt from inv_hold_det where tran_id = '" + tranIdHold + "' and line_no = " + lineNo; {
pstmt = conn.prepareStatement( sql ); //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start
rs = pstmt.executeQuery(); /*
*/ sql = "select count( 1 ) cnt from inv_hold_det where tran_id = '" + tranIdHold + "' and line_no = " + lineNo;
sql = "SELECT COUNT( 1 ) CNT FROM INV_HOLD_DET WHERE TRAN_ID = ? AND LINE_NO = ?"; pstmt = conn.prepareStatement( sql );
pstmt = conn.prepareStatement( sql ); rs = pstmt.executeQuery();
pstmt.setString(1,tranIdHold); */
pstmt.setString(2,lineNo); sql = "SELECT COUNT( 1 ) CNT FROM INV_HOLD_DET WHERE TRAN_ID = ? AND LINE_NO = ?";
rs = pstmt.executeQuery(); pstmt = conn.prepareStatement( sql );
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end pstmt.setString(1,tranIdHold);
if( rs.next() ) pstmt.setString(2,lineNo);
{ rs = pstmt.executeQuery();
cnt = rs.getInt( "cnt" ); //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end
} if( rs.next() )
{
rs.close(); cnt = rs.getInt( "cnt" );
rs = null; }
pstmt.close(); rs.close();
pstmt = null; rs = null;
if( cnt == 0 ) pstmt.close();
{ pstmt = null;
errCode = "VTLINEINV";
} if( cnt == 0 )
} {
else errCode = "VTLINEINV";
{ }
errCode = "VTLINEBLK"; }
} else
if( errCode != null ) {
{ errCode = "VTLINEBLK";
errString = getErrorString( "line_no__hold", errCode, userId ); }
}else if ( ( tranIdHold != null && tranIdHold.length() > 0 ) && ( lineNo != null && lineNo.length() > 0 ) ) if( errCode != null )
{ {
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start errString = getErrorString( "line_no__hold", errCode, userId );
/* }else if ( ( tranIdHold != null && tranIdHold.length() > 0 ) && ( lineNo != null && lineNo.length() > 0 ) )
sql = "select count( 1 ) cnt from inv_hold_det where tran_id = '" + tranIdHold + "' and line_no = " + lineNo + " and HOLD_STATUS = 'R'"; {
pstmt = conn.prepareStatement( sql ); //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start
rs = pstmt.executeQuery(); /*
*/ sql = "select count( 1 ) cnt from inv_hold_det where tran_id = '" + tranIdHold + "' and line_no = " + lineNo + " and HOLD_STATUS = 'R'";
sql = "SELECT COUNT( 1 ) CNT FROM INV_HOLD_DET WHERE TRAN_ID = ? AND LINE_NO = ? AND HOLD_STATUS = 'R'"; pstmt = conn.prepareStatement( sql );
pstmt = conn.prepareStatement( sql ); rs = pstmt.executeQuery();
pstmt.setString(1,tranIdHold); */
pstmt.setString(2,lineNo); sql = "SELECT COUNT( 1 ) CNT FROM INV_HOLD_DET WHERE TRAN_ID = ? AND LINE_NO = ? AND HOLD_STATUS = 'R'";
rs = pstmt.executeQuery(); pstmt = conn.prepareStatement( sql );
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end pstmt.setString(1,tranIdHold);
pstmt.setString(2,lineNo);
if( rs.next() ) rs = pstmt.executeQuery();
{ //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end
cnt = rs.getInt( "cnt" );
} if( rs.next() )
{
rs.close(); cnt = rs.getInt( "cnt" );
rs = null; }
pstmt.close(); rs.close();
pstmt = null; rs = null;
if( cnt > 0 ) pstmt.close();
{ pstmt = null;
errCode = "VTTRNCNFED";
} if( cnt > 0 )
} {
if( errCode != null ) errCode = "VTTRNCNFED";
{ }
errString = getErrorString( "line_no__hold", errCode, userId ); }
} if( errCode != null )
else {
{ errString = getErrorString( "line_no__hold", errCode, userId );
NodeList allLines = null; }
NodeList allTranIds = null; else
{
String tranIdH = null; NodeList allLines = null;
String lineNoH = null; NodeList allTranIds = null;
int recCnt = 0;
System.out.println( " tranIdHold, lineNoHold :: ( " + tranIdHold + ", " + lineNo + " )" ); String tranIdH = null;
allLines = dom2.getElementsByTagName("line_no__hold"); String lineNoH = null;
allTranIds = dom2.getElementsByTagName("tran_id__hold"); int recCnt = 0;
System.out.println( " tranIdHold, lineNoHold :: ( " + tranIdHold + ", " + lineNo + " )" );
int noOfLines = allLines.getLength(); allLines = dom2.getElementsByTagName("line_no__hold");
allTranIds = dom2.getElementsByTagName("tran_id__hold");
for( int idx = 0; idx < noOfLines ; idx++ )
{ int noOfLines = allLines.getLength();
if ( allTranIds.item( idx ).getFirstChild() != null )
{ for( int idx = 0; idx < noOfLines ; idx++ )
tranIdH = ( allTranIds.item( idx ).getFirstChild() ).getNodeValue(); {
} if ( allTranIds.item( idx ).getFirstChild() != null )
if ( allLines.item( idx ).getFirstChild() != null ) {
{ tranIdH = ( allTranIds.item( idx ).getFirstChild() ).getNodeValue();
lineNoH = ( allLines.item( idx ).getFirstChild() ).getNodeValue(); }
} if ( allLines.item( idx ).getFirstChild() != null )
System.out.println( " tranIdH :: ( " + tranIdH + ", " + lineNoH + " )" ); {
if( tranIdH.equals( tranIdHold ) && lineNoH.equals( lineNo ) ) lineNoH = ( allLines.item( idx ).getFirstChild() ).getNodeValue();
{ }
recCnt++; System.out.println( " tranIdH :: ( " + tranIdH + ", " + lineNoH + " )" );
} if( tranIdH.equals( tranIdHold ) && lineNoH.equals( lineNo ) )
} {
if( recCnt > 1 ) recCnt++;
{ }
errCode = "VTDUPENTRY"; }
errString = getErrorString( "line_no__hold", errCode, userId ); if( recCnt > 1 )
} {
} errCode = "VTDUPENTRY";
} errString = getErrorString( "line_no__hold", errCode, userId );
}//END FOR OF CASE2 }
break; }
}//END SWITCH }
}//END TRY }//END FOR OF CASE2
catch(Exception e) break;
{ }//END SWITCH
System.out.println("Exception ::" +e); }//END TRY
e.printStackTrace(); catch(Exception e)
errString = e.getMessage(); {
} System.out.println("Exception ::" +e);
finally e.printStackTrace();
{ errString = e.getMessage();
try }
{ finally
if(conn != null) {
{ try
if( pstmt != null ) {
{ if(conn != null)
pstmt.close(); {
pstmt = null; if( pstmt != null )
} {
pstmt.close();
if( rs != null ) pstmt = null;
{ }
rs.close();
rs = null; if( rs != null )
} {
conn.close(); rs.close();
} rs = null;
conn = null; }
} conn.close();
catch(Exception d) }
{ conn = null;
d.printStackTrace(); }
} catch(Exception d)
System.out.println(" < ExprProcessIcEJB > CONNECTION IS CLOSED"); {
} d.printStackTrace();
System.out.println("ErrString ::" + errString); }
System.out.println(" < ExprProcessIcEJB > CONNECTION IS CLOSED");
return errString; }
}//END OF VALIDATION System.out.println("ErrString ::" + errString);
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException return errString;
{ }//END OF VALIDATION
Document dom = null;
Document dom1 = null; public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
Document dom2 = null; {
String valueXmlString = null; Document dom = null;
try Document dom1 = null;
{ Document dom2 = null;
dom = parseString(xmlString); String valueXmlString = null;
System.out.println("xmlString" + xmlString); try
dom1 = parseString(xmlString1); {
System.out.println("xmlString1" + xmlString1); dom = parseString(xmlString);
if (xmlString2.length() > 0 ) System.out.println("xmlString" + xmlString);
{ dom1 = parseString(xmlString1);
System.out.println("xmlString2" + xmlString2); System.out.println("xmlString1" + xmlString1);
dom2 = parseString("<Root>" + xmlString2+ "</Root>"); if (xmlString2.length() > 0 )
} {
valueXmlString = itemChanged(dom,dom1,dom2,objContext,currentColumn,editFlag,xtraParams); System.out.println("xmlString2" + xmlString2);
} dom2 = parseString("<Root>" + xmlString2+ "</Root>");
catch(Exception e) }
{ valueXmlString = itemChanged(dom,dom1,dom2,objContext,currentColumn,editFlag,xtraParams);
System.out.println("Exception : [EpaymentICEJB][itemChanged(String,String)] :==>\n"+e.getMessage()); }
} catch(Exception e)
return valueXmlString; {
} System.out.println("Exception : [EpaymentICEJB][itemChanged(String,String)] :==>\n"+e.getMessage());
}
public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException return valueXmlString;
{ }
Connection conn = null;
ConnDriver connDriver = new ConnDriver(); public String itemChanged(Document dom, Document dom1,Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
PreparedStatement vPStmt = null; {
ResultSet vRs = null; Connection conn = null;
String sql = null; ConnDriver connDriver = new ConnDriver();
int currentFormNo = 0; PreparedStatement vPStmt = null;
StringBuffer valueXmlString = new StringBuffer(); ResultSet vRs = null;
String columnValue = null; String sql = null;
int currentFormNo = 0;
NodeList parentNodeList = null; StringBuffer valueXmlString = new StringBuffer();
Node parentNode = null; String columnValue = null;
Node childNode = null;
NodeList childNodeList = null; NodeList parentNodeList = null;
String childNodeName = null; Node parentNode = null;
int childNodeListLength = 0; Node childNode = null;
int ctr = 0; NodeList childNodeList = null;
String childNodeName = null;
String loginSite = null; int childNodeListLength = 0;
int ctr = 0;
try
{ String loginSite = null;
conn = connDriver.getConnectDB("DriverITM");
connDriver = null; try
if(objContext != null && objContext.length()>0) {
{ conn = connDriver.getConnectDB("DriverITM");
currentFormNo = Integer.parseInt(objContext); connDriver = null;
} if(objContext != null && objContext.length()>0)
{
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"); currentFormNo = Integer.parseInt(objContext);
}
System.out.println("[EpaymentICEJB] [itemChanged] :currentFormNo ....." +currentFormNo);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>"); loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append(editFlag).append("</editFlag></header>");
valueXmlString.append("<Detail1>"); System.out.println("[EpaymentICEJB] [itemChanged] :currentFormNo ....." +currentFormNo);
System.out.println("Current Form No ["+currentFormNo+"]"); valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
switch (currentFormNo) valueXmlString.append(editFlag).append("</editFlag></header>");
{ valueXmlString.append("<Detail1>");
case 1: System.out.println("Current Form No ["+currentFormNo+"]");
//SEARCHING THE DOM FOR THE INCOMING COLUMN VALUE START switch (currentFormNo)
parentNodeList = dom.getElementsByTagName("Detail1"); {
parentNode = parentNodeList.item(0); case 1:
childNodeList = parentNode.getChildNodes(); //SEARCHING THE DOM FOR THE INCOMING COLUMN VALUE START
ctr = 0; parentNodeList = dom.getElementsByTagName("Detail1");
childNodeListLength = childNodeList.getLength(); parentNode = parentNodeList.item(0);
do childNodeList = parentNode.getChildNodes();
{ ctr = 0;
childNode = childNodeList.item(ctr); childNodeListLength = childNodeList.getLength();
childNodeName = childNode.getNodeName(); do
if(childNodeName.equals(currentColumn)) {
{ childNode = childNodeList.item(ctr);
if (childNode.getFirstChild() != null) childNodeName = childNode.getNodeName();
{ if(childNodeName.equals(currentColumn))
columnValue=childNode.getFirstChild().getNodeValue(); {
} if (childNode.getFirstChild() != null)
} {
ctr++; columnValue=childNode.getFirstChild().getNodeValue();
}while(ctr < childNodeListLength && !childNodeName.equals(currentColumn)); }
System.out.println("[" + currentColumn + "] ==> '" + columnValue + "'"); }
if (currentColumn.equals( "itm_default" )) ctr++;
{ }while(ctr < childNodeListLength && !childNodeName.equals(currentColumn));
String siteDescription = null; System.out.println("[" + currentColumn + "] ==> '" + columnValue + "'");
if (currentColumn.equals( "itm_default" ))
loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"); {
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start String siteDescription = null;
/*
sql = "select s.descr site_descr from site s " loginSite = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
+" where s.site_code = '" + loginSite + "'"; //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start
/*
vPStmt = conn.prepareStatement( sql ); sql = "select s.descr site_descr from site s "
vRs = vPStmt.executeQuery(); +" where s.site_code = '" + loginSite + "'";
*/
sql = "SELECT S.DESCR SITE_DESCR FROM SITE S WHERE S.SITE_CODE = ?"; vPStmt = conn.prepareStatement( sql );
vPStmt = conn.prepareStatement( sql ); vRs = vPStmt.executeQuery();
vPStmt.setString(1,loginSite); */
vRs = vPStmt.executeQuery(); sql = "SELECT S.DESCR SITE_DESCR FROM SITE S WHERE S.SITE_CODE = ?";
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end vPStmt = conn.prepareStatement( sql );
vPStmt.setString(1,loginSite);
if( vRs.next() ) vRs = vPStmt.executeQuery();
{ //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end
siteDescription = vRs.getString( "site_descr" );
} if( vRs.next() )
vRs.close(); {
vRs = null; siteDescription = vRs.getString( "site_descr" );
vPStmt.close(); }
vPStmt = null; vRs.close();
vRs = null;
vPStmt.close();
valueXmlString.append("<tran_date>").append("<![CDATA[" + getCurrdateAppFormat() + "]]>").append("</tran_date>"); vPStmt = null;
valueXmlString.append("<confirmed>").append("<![CDATA[" + "N" + "]]>").append("</confirmed>");
valueXmlString.append("<site_code>").append("<![CDATA[" + loginSite + "]]>").append("</site_code>");
valueXmlString.append("<site_descr>").append("<![CDATA[" + ( siteDescription != null ? siteDescription : "" )+ "]]>").append("</site_descr>"); valueXmlString.append("<tran_date>").append("<![CDATA[" + getCurrdateAppFormat() + "]]>").append("</tran_date>");
} valueXmlString.append("<confirmed>").append("<![CDATA[" + "N" + "]]>").append("</confirmed>");
valueXmlString.append("<site_code>").append("<![CDATA[" + loginSite + "]]>").append("</site_code>");
if (currentColumn.equals( "site_code" )) valueXmlString.append("<site_descr>").append("<![CDATA[" + ( siteDescription != null ? siteDescription : "" )+ "]]>").append("</site_descr>");
{ }
//site bank
String vSql = null; if (currentColumn.equals( "site_code" ))
String siteDescr = null; {
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start //site bank
/* String vSql = null;
vSql = "select descr from site where site_code = '" + ( columnValue != null ? columnValue.trim() : "" ) + "'"; String siteDescr = null;
vPStmt = conn.prepareStatement( vSql ); //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.start
vRs = vPStmt.executeQuery(); /*
*/ vSql = "select descr from site where site_code = '" + ( columnValue != null ? columnValue.trim() : "" ) + "'";
vSql = "select descr from site where site_code = ?"; vPStmt = conn.prepareStatement( vSql );
vPStmt = conn.prepareStatement(vSql); vRs = vPStmt.executeQuery();
if(columnValue != null) */
{ vSql = "select descr from site where site_code = ?";
vPStmt.setString(1,columnValue); vPStmt = conn.prepareStatement(vSql);
} if(columnValue != null)
else {
{ vPStmt.setString(1,columnValue);
vPStmt.setString(1,""); }
} else
vRs = vPStmt.executeQuery(); {
//Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end vPStmt.setString(1,"");
}
if( vRs.next() ) vRs = vPStmt.executeQuery();
{ //Changed by Dharmesh on 09/08/11 [WM1ESUN004] to bind variable dynamically instead of statically.end
siteDescr = vRs.getString( "descr" );
} if( vRs.next() )
vRs.close(); {
vRs = null; siteDescr = vRs.getString( "descr" );
vPStmt.close(); }
vPStmt = null; vRs.close();
//end getting site bank vRs = null;
valueXmlString.append("<site_descr>").append("<![CDATA[" + ( siteDescr != null ? siteDescr : "" )+ "]]>").append("</site_descr>"); vPStmt.close();
} vPStmt = null;
valueXmlString.append("</Detail1>"); //end getting site bank
valueXmlString.append("</Root>"); valueXmlString.append("<site_descr>").append("<![CDATA[" + ( siteDescr != null ? siteDescr : "" )+ "]]>").append("</site_descr>");
}//END OF TRY }
} valueXmlString.append("</Detail1>");
catch(Exception e) valueXmlString.append("</Root>");
{ }//END OF TRY
System.out.println("Exception ::"+ e.getMessage()); }
e.printStackTrace(); catch(Exception e)
} {
finally System.out.println("Exception ::"+ e.getMessage());
{ e.printStackTrace();
try }
{ finally
if ( vRs != null ) {
{ try
vRs.close(); {
vRs = null; if ( vRs != null )
} {
if ( vPStmt != null ) vRs.close();
{ vRs = null;
vPStmt.close(); }
vPStmt = null; if ( vPStmt != null )
} {
if ( conn != null ) vPStmt.close();
{ vPStmt = null;
conn.close(); }
conn = null; if ( conn != null )
} {
} conn.close();
catch(Exception e) conn = null;
{ }
System.out.println("Exception ::" + e); }
e.printStackTrace(); catch(Exception e)
} {
} System.out.println("Exception ::" + e);
return valueXmlString.toString(); e.printStackTrace();
}//END OF ITEMCHANGE }
private String getCurrdateAppFormat() }
{ return valueXmlString.toString();
String s = ""; }//END OF ITEMCHANGE
GenericUtility genericUtility = GenericUtility.getInstance(); private String getCurrdateAppFormat()
try {
{ String s = "";
java.util.Date date = null; GenericUtility genericUtility = GenericUtility.getInstance();
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); try
System.out.println(genericUtility.getDBDateFormat()); {
java.util.Date date = null;
SimpleDateFormat simpledateformat = new SimpleDateFormat(genericUtility.getDBDateFormat()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
date = simpledateformat.parse(timestamp.toString()); System.out.println(genericUtility.getDBDateFormat());
timestamp = Timestamp.valueOf(simpledateformat.format(date).toString() + " 00:00:00.0");
s = (new SimpleDateFormat(genericUtility.getApplDateFormat())).format(timestamp).toString(); SimpleDateFormat simpledateformat = new SimpleDateFormat(genericUtility.getDBDateFormat());
} date = simpledateformat.parse(timestamp.toString());
catch(Exception exception) timestamp = Timestamp.valueOf(simpledateformat.format(date).toString() + " 00:00:00.0");
{ s = (new SimpleDateFormat(genericUtility.getApplDateFormat())).format(timestamp).toString();
System.out.println("Exception in getCurrdateAppFormat " + exception.getMessage()); }
} catch(Exception exception)
return s; {
} System.out.println("Exception in getCurrdateAppFormat " + exception.getMessage());
}
return s;
}
} }
\ 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