Commit a66d064b authored by sghate's avatar sghate

*Done Changes on SiteStanPayTbl Master Component.

SiteStanPayTbl.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@204881 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e3cdf2b7
package ibase.webitm.ejb.adm; package ibase.webitm.ejb.adm;
//modified by Shital on 30/07/2019 [Start]
import ibase.system.config.ConnDriver; //import ibase.system.config.ConnDriver;
//modified by Shital on 30/07/2019 [End]
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility; //modified by Shital on 30/07/2019 [Start]
//import ibase.webitm.utility.GenericUtility;
//modified by Shital on 30/07/2019 [End]
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import javax.ejb.Stateless;
//modified by Shital on 30/07/2019 [Start]
//import javax.ejb.Stateless;
//modified by Shital on 30/07/2019 [End]
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
//modified by Shital on 30/07/2019 [Start]
//@Stateless
//modified by Shital on 30/07/2019 [End]
@Stateless
public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ,SiteStanPayTblRemote public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ,SiteStanPayTblRemote
{ {
//modified by Shital on 30/07/2019 [Start]
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
//modified by Shital on 30/07/2019 [End]
public String wfValData() throws RemoteException,ITMException public String wfValData() throws RemoteException,ITMException
{ {
...@@ -27,7 +41,9 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -27,7 +41,9 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
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
{ {
System.out.println("Came Inside 1 wfValData:::"); System.out.println("Came Inside 1 wfValData:::");
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 30/07/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 30/07/2019 [End]
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
...@@ -70,7 +86,9 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -70,7 +86,9 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
System.out.println("Exception : [SiteStanPayTbl][wfValData(String xmlString)] : ==>\n"+e.getMessage()); System.out.println("Exception : [SiteStanPayTbl][wfValData(String xmlString)] : ==>\n"+e.getMessage());
e.printStackTrace(); e.printStackTrace();
errString = genericUtility.createErrorString(e); errString = genericUtility.createErrorString(e);
//modified by Shital on 30/07/2019 [Start]
throw new ITMException(e);
//modified by Shital on 30/07/2019 [End]
} }
return (errString); return (errString);
} }
...@@ -80,20 +98,27 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -80,20 +98,27 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
System.out.println("Came Inside 2 wfValData:::"); System.out.println("Came Inside 2 wfValData:::");
String errString = ""; String errString = "";
Connection conn = null; Connection conn = null;
//modified by Shital on 30/07/2019 [Start]
GenericUtility genericUtility = GenericUtility.getInstance(); //GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 30/07/2019 [End]
try try
{ {
ConnDriver connDriver = new ConnDriver(); //modified by Shital on 30/07/2019 [Start]
conn = connDriver.getConnectDB("Driver"); //ConnDriver connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("Driver");
conn = getConnection();
//modified by Shital on 30/07/2019 [End]
conn.setAutoCommit(false); conn.setAutoCommit(false);
errString = wfValData( dom, dom1, dom2, objContext, editFlag, xtraParams,conn); errString = wfValData( dom, dom1, dom2, objContext, editFlag, xtraParams,conn);
} }
catch ( Exception e ) catch ( Exception e )
{ {
e.printStackTrace(); e.printStackTrace();
errString = genericUtility.createErrorString(e); errString = genericUtility.createErrorString(e);
//modified by Shital on 30/07/2019 [Start]
throw new ITMException(e);
//modified by Shital on 30/07/2019 [End]
} }
finally finally
{ {
...@@ -107,6 +132,9 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -107,6 +132,9 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
} }
catch(Exception e1) catch(Exception e1)
{ {
//modified by Shital on 30/07/2019 [Start]
e1.printStackTrace();
//modified by Shital on 30/07/2019 [End]
System.out.println( "Exception : [SiteStanPayTbl][wfValData(String xmlString)] : ==>\n"+e1.getMessage()); System.out.println( "Exception : [SiteStanPayTbl][wfValData(String xmlString)] : ==>\n"+e1.getMessage());
throw new ITMException(e1); throw new ITMException(e1);
} }
...@@ -128,7 +156,8 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -128,7 +156,8 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
int count = 0; int count = 0;
int ctr,currentFormNo=0; int ctr = 0;
int currentFormNo = 0;
int childNodeListLength; int childNodeListLength;
String siteCode = ""; String siteCode = "";
...@@ -136,8 +165,9 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -136,8 +165,9 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
String stanCode = ""; String stanCode = "";
String payTable = ""; String payTable = "";
//modified by Shital on 30/07/2019 [Start]
GenericUtility genericUtility = GenericUtility.getInstance(); //GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 30/07/2019 [End]
try try
{ {
...@@ -151,277 +181,351 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -151,277 +181,351 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
} }
switch(currentFormNo) switch(currentFormNo)
{ {
case 1: case 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);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("site_code"))
{ {
childNode = childNodeList.item(ctr); //modified by Shital on 30/07/2019 [Start]
childNodeName = childNode.getNodeName(); //siteCode = getColumnValue("site_code",dom1,objContext);
if (childNodeName.equalsIgnoreCase("site_code")) siteCode = checkNull(genericUtility.getColumnValue("site_code",dom1,objContext));
//modified by Shital on 30/07/2019 [End]
System.out.println("value of site_code:::: "+siteCode);
System.out.println("Inside validation of site_code ");
if ((childNode.getFirstChild() == null)||(childNode.getFirstChild() != null && childNode.getFirstChild().getNodeValue() == null))
{
System.out.println("site code null");
//modified by Shital on 30/07/2019 [Start]
//errString = getErrorString("site_code","VMSITENULL",userId);
errString = itmDBAccessEJB.getErrorString("site_code", "VMSITENULL", userId, "", conn);
//modified by Shital on 30/07/2019 [End]
break;
}
else
{ {
siteCode = getColumnValue("site_code",dom1,objContext); // To check site code is present or not
System.out.println("value of site_code:::: "+siteCode); sql = "SELECT COUNT(*) AS COUNT FROM SITE WHERE SITE_CODE = ?" ;
System.out.println("Inside validation of site_code "); pstmt = conn.prepareStatement(sql);
if ((childNode.getFirstChild() == null)||(childNode.getFirstChild() != null && childNode.getFirstChild().getNodeValue() == null)) pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if( rs.next() )
{ {
System.out.println("site code null"); count = rs.getInt("COUNT");
errString = getErrorString("site_code","VMSITENULL",userId);
break;
} }
else System.out.println("value of count in site_code:::: "+count);
if ( rs != null )
{ {
// To check site code is present or not rs.close();
sql = "SELECT COUNT(*) AS COUNT FROM SITE WHERE SITE_CODE = ?" ; rs = null;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count in site_code:::: "+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count == 0)
{
System.out.println("Site_code is not valid");
errString = getErrorString("site_code","VMSITEINVD",userId);
break;
}
} }
if ( pstmt != null )
} //END IF (site_code)
else if (childNodeName.equalsIgnoreCase("state_code"))
{
stateCode = getColumnValue("state_code",dom1,objContext);
System.out.println("value of state_code:::: "+stateCode);
System.out.println("Inside validation of state_code ");
if ((childNode.getFirstChild() == null)||(childNode.getFirstChild() != null && childNode.getFirstChild().getNodeValue() == null))
{ {
System.out.println("state code null"); pstmt.close();
errString = getErrorString("state_code","VMSTATNULL",userId); pstmt = null;
}
if(count == 0)
{
System.out.println("Site_code is not valid");
//modified by Shital on 30/07/2019 [Start]
//errString = getErrorString("site_code","VMSITEINVD",userId);
errString = itmDBAccessEJB.getErrorString("site_code", "VMSITEINVD", userId, "", conn);
//modified by Shital on 30/07/2019 [End]
break; break;
} }
else }
} //END IF (site_code)
else if (childNodeName.equalsIgnoreCase("state_code"))
{
//modified by Shital on 30/07/2019 [Start]
//stateCode = getColumnValue("state_code",dom1,objContext);
stateCode = checkNull(genericUtility.getColumnValue("state_code",dom1,objContext));
//modified by Shital on 30/07/2019 [Start]
System.out.println("value of state_code:::: "+stateCode);
System.out.println("Inside validation of state_code ");
if ((childNode.getFirstChild() == null)||(childNode.getFirstChild() != null && childNode.getFirstChild().getNodeValue() == null))
{
System.out.println("state code null");
//modified by Shital on 30/07/2019 [Start]
//errString = getErrorString("state_code","VMSTATNULL",userId);
errString = itmDBAccessEJB.getErrorString("state_code", "VMSTATNULL", userId, "", conn);
//modified by Shital on 30/07/2019 [End]
break;
}
else
{
// To check state code is present or not
sql = "SELECT COUNT(*) AS COUNT FROM STATE WHERE STATE_CODE = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stateCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count in state_code:::: "+count);
if ( rs != null )
{ {
// To check state code is present or not rs.close();
sql = "SELECT COUNT(*) AS COUNT FROM STATE WHERE STATE_CODE = ?" ; rs = null;
pstmt = conn.prepareStatement(sql); }
pstmt.setString(1,stateCode); if ( pstmt != null )
rs = pstmt.executeQuery(); {
if( rs.next() ) pstmt.close();
{ pstmt = null;
count = rs.getInt("COUNT"); }
} if(count == 0)
System.out.println("value of count in state_code:::: "+count); {
if ( rs != null ) System.out.println("State_code is not valid");
{ //modified by Shital on 30/07/2019 [Start]
rs.close(); //errString = getErrorString("state_code","VMSTATINVD",userId);
rs = null; errString = itmDBAccessEJB.getErrorString("state_code", "VMSTATINVD", userId, "", conn);
} //modified by Shital on 30/07/2019 [End]
if ( pstmt != null ) break;
{
pstmt.close();
pstmt = null;
}
if(count == 0)
{
System.out.println("State_code is not valid");
errString = getErrorString("state_code","VMSTATINVD",userId);
break;
}
} }
}
} //END IF (state_code) } //END IF (state_code)
else if (childNodeName.equalsIgnoreCase("stan_code"))
else if (childNodeName.equalsIgnoreCase("stan_code"))
{
//modified by Shital on 30/07/2019 [Start]
//stanCode = getColumnValue("stan_code",dom1,objContext);
//stateCode = getColumnValue("state_code",dom1,objContext);
stanCode = checkNull(genericUtility.getColumnValue("stan_code",dom1,objContext));
stateCode = checkNull(genericUtility.getColumnValue("state_code",dom1,objContext));
//modified by Shital on 30/07/2019 [End]
System.out.println("value of stan_code:::: "+stanCode);
System.out.println("value of state_code:::: "+stateCode);
System.out.println("Inside validation of stan_code ");
if ((childNode.getFirstChild() == null)||(childNode.getFirstChild() != null && childNode.getFirstChild().getNodeValue() == null))
{
System.out.println("station code null");
//modified by Shital on 30/07/2019 [Start]
//errString = getErrorString("stan_code","VMSTANNULL",userId);
errString = itmDBAccessEJB.getErrorString("stan_code", "VMSTANNULL", userId, "", conn);
//modified by Shital on 30/07/2019 [End]
break;
}
else if(stateCode != null && (stanCode != null && stanCode.trim().length() > 0))
{ {
stanCode = getColumnValue("stan_code",dom1,objContext); // To check stan code is present or not
stateCode = getColumnValue("state_code",dom1,objContext); sql = "SELECT COUNT(*) AS COUNT FROM STATION WHERE STAN_CODE = ?" ;
System.out.println("value of stan_code:::: "+stanCode); pstmt = conn.prepareStatement(sql);
System.out.println("value of state_code:::: "+stateCode); pstmt.setString(1,stanCode);
System.out.println("Inside validation of stan_code "); rs = pstmt.executeQuery();
if ((childNode.getFirstChild() == null)||(childNode.getFirstChild() != null && childNode.getFirstChild().getNodeValue() == null)) if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count in stan_code:::: "+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{ {
System.out.println("station code null"); pstmt.close();
errString = getErrorString("stan_code","VMSTANNULL",userId); pstmt = null;
}
if(count == 0)
{
System.out.println("Stan_code is not valid");
//modified by Shital on 30/07/2019 [Start]
//errString = getErrorString("stan_code","VMSTANINVD",userId);
errString = itmDBAccessEJB.getErrorString("stan_code", "VMSTANINVD", userId, "", conn);
//modified by Shital on 30/07/2019 [End]
break; break;
} }
else if(stateCode != null && (stanCode != null && stanCode.trim().length()>0))
sql = "SELECT COUNT(*) AS COUNT FROM STATION WHERE STAN_CODE = ? AND STATE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stanCode);
pstmt.setString(2,stateCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count in stan_code:::: "+count);
if ( rs != null )
{ {
// To check stan code is present or not rs.close();
sql = "SELECT COUNT(*) AS COUNT FROM STATION WHERE STAN_CODE = ?" ; rs = null;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stanCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count in stan_code:::: "+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count == 0)
{
System.out.println("Stan_code is not valid");
errString = getErrorString("stan_code","VMSTANINVD",userId);
break;
}
sql = "SELECT COUNT(*) AS COUNT FROM STATION WHERE STAN_CODE = ? AND STATE_CODE = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stanCode);
pstmt.setString(2,stateCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count in stan_code:::: "+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count == 0)
{
System.out.println("Stan_code is not valid");
errString = getErrorString("stan_code","VMSTANSTCD",userId);
break;
}
} }
//Added by Hemlata[17/07/2014][to validate duplicate entry for SITE_STAN_PAYTBL][start] if ( pstmt != null )
//Added by Radheshyam[01/03/2014][to validate duplicate entry for SITE_STAN_PAYTBL][start] {
siteCode = getColumnValue("site_code",dom1,objContext); pstmt.close();
stateCode = getColumnValue("state_code",dom1,objContext); pstmt = null;
stanCode = getColumnValue("stan_code",dom1,objContext);
System.out.println("value of count in siteCode:::: "+siteCode);
System.out.println("value of count in stateCode:::: "+stateCode);
System.out.println("value of count in stan_code:::: "+stanCode);
sql = "SELECT COUNT(*) AS COUNT FROM SITE_STAN_PAYTBL WHERE site_code = ? AND STATE_CODE = ? AND STAN_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
pstmt.setString(2,stateCode);
pstmt.setString(3,stanCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count :::: "+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count > 0)
{
System.out.println("Duplicate Entries");
//errString = getErrorString("stan_code","VMSTANDUPL",userId);
errString = getErrorString("stan_code","VMSTNPTBL1",userId);
break;
}
//Added by Radheshyam[01/03/2014][to validate duplicate entry for SITE_STAN_PAYTBL][End]
// Added by Hemlata[17/07/2014][to validate duplicate entry for SITE_STAN_PAYTBL][End]
} }
if(count == 0)
//END IF (stan_code)
else if (childNodeName.equalsIgnoreCase("pay_table"))
{
payTable = getColumnValue("pay_table",dom1,objContext);
System.out.println("value of pay_table:::: "+payTable);
System.out.println("Inside validation of pay_table ");
if ((childNode.getFirstChild() == null)||(childNode.getFirstChild() != null && childNode.getFirstChild().getNodeValue() == null))
{ {
System.out.println("pay_tabel null"); System.out.println("Stan_code is not valid");
errString = getErrorString("pay_table","VMPAYTBNUL",userId); //modified by Shital on 30/07/2019 [Start]
//errString = getErrorString("stan_code","VMSTANSTCD",userId);
errString = itmDBAccessEJB.getErrorString("stan_code", "VMSTANSTCD", userId, "", conn);
//modified by Shital on 30/07/2019 [End]
break; break;
} }
else }
//Added by Hemlata[17/07/2014][to validate duplicate entry for SITE_STAN_PAYTBL][start]
//Added by Radheshyam[01/03/2014][to validate duplicate entry for SITE_STAN_PAYTBL][start]
//modified by Shital on 30/07/2019 [Start]
//siteCode = getColumnValue("site_code",dom1,objContext);
//stateCode = getColumnValue("state_code",dom1,objContext);
//stanCode = getColumnValue("stan_code",dom1,objContext);
siteCode = checkNull(genericUtility.getColumnValue("site_code",dom1,objContext));
stateCode = checkNull(genericUtility.getColumnValue("state_code",dom1,objContext));
stanCode = checkNull(genericUtility.getColumnValue("stan_code",dom1,objContext));
//modified by Shital on 30/07/2019 [End]
System.out.println("value of count in siteCode:::: "+siteCode);
System.out.println("value of count in stateCode:::: "+stateCode);
System.out.println("value of count in stan_code:::: "+stanCode);
sql = "SELECT COUNT(*) AS COUNT FROM SITE_STAN_PAYTBL WHERE site_code = ? AND STATE_CODE = ? AND STAN_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
pstmt.setString(2,stateCode);
pstmt.setString(3,stanCode);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count :::: "+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count > 0)
{
System.out.println("Duplicate Entries");
//errString = getErrorString("stan_code","VMSTANDUPL",userId);
//modified by Shital on 30/07/2019 [Start]
//errString = getErrorString("stan_code","VMSTNPTBL1",userId);
errString = itmDBAccessEJB.getErrorString("stan_code", "VMSTNPTBL1", userId, "", conn);
//modified by Shital on 30/07/2019 [End]
break;
}
//Added by Radheshyam[01/03/2014][to validate duplicate entry for SITE_STAN_PAYTBL][End]
// Added by Hemlata[17/07/2014][to validate duplicate entry for SITE_STAN_PAYTBL][End]
}
//END IF (stan_code)
else if (childNodeName.equalsIgnoreCase("pay_table"))
{
//modified by Shital on 30/07/2019 [Start]
//payTable = getColumnValue("pay_table",dom1,objContext)
payTable = checkNull(genericUtility.getColumnValue("pay_table",dom1,objContext));
//modified by Shital on 30/07/2019 [End]
System.out.println("value of pay_table:::: "+payTable);
System.out.println("Inside validation of pay_table ");
if ((childNode.getFirstChild() == null)||(childNode.getFirstChild() != null && childNode.getFirstChild().getNodeValue() == null))
{
System.out.println("pay_tabel null");
//modified by Shital on 30/07/2019 [Start]
//errString = getErrorString("pay_table","VMPAYTBNUL",userId);
errString = itmDBAccessEJB.getErrorString("pay_table", "VMPAYTBNUL", userId, "", conn);
//modified by Shital on 30/07/2019 [End]
break;
}
else
{
// To check stan code is present or not
sql = "SELECT COUNT(*) AS COUNT FROM PAYTABLE WHERE PAY_TABLE = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,payTable);
rs = pstmt.executeQuery();
if( rs.next() )
{ {
// To check stan code is present or not count = rs.getInt("COUNT");
sql = "SELECT COUNT(*) AS COUNT FROM PAYTABLE WHERE PAY_TABLE = ?" ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,payTable);
rs = pstmt.executeQuery();
if( rs.next() )
{
count = rs.getInt("COUNT");
}
System.out.println("value of count in paytable:::: "+count);
if ( rs != null )
{
rs.close();
rs = null;
}
if ( pstmt != null )
{
pstmt.close();
pstmt = null;
}
if(count == 0)
{
System.out.println("Pay table is not valid");
errString = getErrorString("pay_table","VMPTBLINVD",userId);
break;
}
} }
System.out.println("value of count in paytable:::: "+count);
} //END IF (pay_table) if ( rs != null )
{
}//END FOR rs.close();
break; rs = null;
}//END SWITCH }
}//END TRY if ( pstmt != null )
catch(Exception e) {
{ pstmt.close();
System.out.println("Exception ::"+ e.getMessage()); pstmt = null;
throw new ITMException(e); }
} if(count == 0)
finally {
System.out.println("Pay table is not valid");
//modified by Shital on 30/07/2019 [Start]
//errString = getErrorString("pay_table","VMPTBLINVD",userId);
errString = itmDBAccessEJB.getErrorString("pay_table", "VMPTBLINVD", userId, "", conn);
//modified by Shital on 30/07/2019 [End]
break;
}
}
} //END IF (pay_table)
}//END FOR
break;
}//END SWITCH
}//END TRY
catch(Exception e)
{
//modified by Shital on 30/07/2019 [Start]
e.printStackTrace();
//modified by Shital on 30/07/2019 [End]
System.out.println("Exception ::"+ e.getMessage());
throw new ITMException(e);
}
finally
{
try
{ {
try //modified by Shital on 30/07/2019 [Start]
if (rs != null)
{ {
rs.close();
rs = null;
} }
catch(Exception d) if (pstmt != null)
{ {
pstmt.close();
pstmt = null;
} }
if (conn != null)
{
conn.close();
conn = null;
}
//modified by Shital on 30/07/2019 [End]
} }
System.out.println("ErrString ::"+ errString); catch(Exception d)
return errString; {
}//END OF VALIDATION //modified by Shital on 30/07/2019 [Start]
d.printStackTrace();
throw new ITMException(d);
//modified by Shital on 30/07/2019 [End]
}
}
System.out.println("ErrString ::"+ errString);
return errString;
}//END OF VALIDATION
public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException public String itemChanged(String xmlString, String xmlString1,String xmlString2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
...@@ -429,21 +533,23 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -429,21 +533,23 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
String errString = null; String errString = null;
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 30/07/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 30/07/2019 [End]
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+"]");
if (xmlString != null && xmlString.trim().length()!=0) if (xmlString != null && xmlString.trim().length() != 0)
{ {
dom = genericUtility.parseString(xmlString); dom = genericUtility.parseString(xmlString);
} }
if (xmlString1 != null && xmlString1.trim().length()!=0) if (xmlString1 != null && xmlString1.trim().length() != 0)
{ {
dom1 = genericUtility.parseString(xmlString1); dom1 = genericUtility.parseString(xmlString1);
} }
if (xmlString2 != null && xmlString2.trim().length()!=0) if (xmlString2 != null && xmlString2.trim().length() != 0)
{ {
dom2 = genericUtility.parseString(xmlString2); dom2 = genericUtility.parseString(xmlString2);
} }
...@@ -452,18 +558,26 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -452,18 +558,26 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
} }
catch (Exception e) catch (Exception e)
{ {
//modified by Shital on 30/07/2019 [Start]
e.printStackTrace();
//modified by Shital on 30/07/2019 [End]
System.out.println ( "Exception :SiteStanPayTbl :" + e.getMessage() + ":" ); System.out.println ( "Exception :SiteStanPayTbl :" + e.getMessage() + ":" );
errString = genericUtility.createErrorString(e); errString = genericUtility.createErrorString(e);
//modified by Shital on 30/07/2019 [Start]
throw new ITMException(e);
//modified by Shital on 30/07/2019 [End]
} }
System.out.println ( "returning from SiteStanPayTbl " ); System.out.println ( "returning from SiteStanPayTbl " );
return errString; return errString;
} }
public String itemChanged(Document dom, Document dom1,Document dom2, 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
{ {
Connection conn = null; Connection conn = null;
ConnDriver connDriver = new ConnDriver(); //modified by Shital on 30/07/2019 [Start]
//ConnDriver connDriver = new ConnDriver();
//modified by Shital on 30/07/2019 [End]
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = ""; String sql = "";
...@@ -471,235 +585,277 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -471,235 +585,277 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
String stateDescr = ""; String stateDescr = "";
String stanDescr = ""; String stanDescr = "";
String payTableDescr = ""; String payTableDescr = "";
String loginSite = "";
String siteCode = "";
String stateCode = "";
String payTable = "";
String stanCode = "";
StringBuffer valueXmlString = new StringBuffer(); StringBuffer valueXmlString = new StringBuffer();
int currentFormNo = 0; int currentFormNo = 0;
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 30/07/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 30/07/2019 [End]
AdmCommon admCommon = new AdmCommon();
try try
{ {
conn = connDriver.getConnectDB("Driver"); //modified by Shital on 30/07/2019 [Start]
//conn = connDriver.getConnectDB("Driver");
conn = getConnection();
//modified by Shital on 30/07/2019 [End]
conn.setAutoCommit(false); conn.setAutoCommit(false);
if(objContext != null && objContext.trim().length() > 0) if(objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
System.out.println("[SiteStanPayTbl] [itemChanged] :currentFormNo ....." +currentFormNo); System.out.println("[SiteStanPayTbl] [itemChanged] :currentFormNo ....." +currentFormNo);
valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>"); valueXmlString = new StringBuffer("<?xml version=\"1.0\"?><Root><header><editFlag>");
valueXmlString.append(editFlag).append("</editFlag></header>"); valueXmlString.append(editFlag).append("</editFlag></header>");
System.out.println("In Detail1"); System.out.println("In Detail1");
System.out.println("Current Form No ["+currentFormNo+"]"); System.out.println("Current Form No ["+currentFormNo+"]");
System.out.println("Current column is["+currentColumn+"]"); System.out.println("Current column is["+currentColumn+"]");
System.out.println("xtraparam is ["+xtraParams+"]"); System.out.println("xtraparam is ["+xtraParams+"]");
String objNameDefault = ""; String objNameDefault = "";
switch (currentFormNo) switch (currentFormNo)
{ {
case 1: case 1:
// Modifide by Piyush on 25/03/2013 to make workable from ITM // Modifide by Piyush on 25/03/2013 to make workable from ITM
//valueXmlString.append("<Detail1 domID='1' dbID='' objContext='1' objName='"+objNameDefault+"' selected='Y'>\r\n"); //valueXmlString.append("<Detail1 domID='1' dbID='' objContext='1' objName='"+objNameDefault+"' selected='Y'>\r\n");
valueXmlString.append("<Detail1>\r\n"); valueXmlString.append("<Detail1>\r\n");
if(currentColumn.trim().equalsIgnoreCase("itm_default")) if(currentColumn.trim().equalsIgnoreCase("itm_default"))
{
//modified by Shital on 30/07/2019 [Start]
//String loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSite");
loginSite = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSite"));
//modified by Shital on 30/07/2019 [End]
sql = null;
siteDescr = "";
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,loginSite);
rs = pstmt.executeQuery();
if( rs.next())
{
siteDescr = checkNull(rs.getString("DESCR"));
}
if( rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<site_code><![CDATA[").append(loginSite).append("]]></site_code>\r\n");
valueXmlString.append("<site_descr><![CDATA[").append(siteDescr).append("]]></site_descr>\r\n");
valueXmlString.append("<stan_code><![CDATA[").append(" ").append("]]></stan_code>\r\n");
//modified by Shital on 30/07/2019 [Start]
admCommon.setNodeValue(dom, "site_code", loginSite);
admCommon.setNodeValue(dom, "site_descr", siteDescr);
admCommon.setNodeValue(dom, "stan_code", " ");
//modified by Shital on 30/07/2019 [End]
}
else if (currentColumn.trim().equalsIgnoreCase("site_code"))
{
System.out.println("Current column is"+currentColumn);
System.out.println("INSIDE site_code");
//modified by Shital on 30/07/2019 [Start]
//String siteCode = getColumnValue("site_code",dom,"1");
siteCode = checkNull(genericUtility.getColumnValue("site_code",dom,"1"));
//modified by Shital on 30/07/2019 [End]
System.out.println("value of site_code:::::"+siteCode);
if(siteCode != null && siteCode.length() > 0)
{
sql = null;
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if( rs.next())
{ {
String loginSite = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginSite"); siteDescr = checkNull(rs.getString("DESCR"));
sql = null;
siteDescr = "";
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,loginSite);
rs = pstmt.executeQuery();
if( rs.next())
{
siteDescr = checkNull(rs.getString("DESCR"));
}
if( rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<site_code><![CDATA[").append(loginSite).append("]]></site_code>\r\n");
valueXmlString.append("<site_descr><![CDATA[").append(siteDescr).append("]]></site_descr>\r\n");
valueXmlString.append("<stan_code><![CDATA[").append(" ").append("]]></stan_code>\r\n");
} }
else if (currentColumn.trim().equalsIgnoreCase("site_code")) if( rs != null )
{ {
System.out.println("Current column is"+currentColumn); rs.close();
System.out.println("INSIDE site_code"); rs = null;
String siteCode = getColumnValue("site_code",dom,"1");
System.out.println("value of site_code:::::"+siteCode);
if(siteCode != null && siteCode.length() > 0)
{
sql = null;
sql = "SELECT DESCR FROM SITE WHERE SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
rs = pstmt.executeQuery();
if( rs.next())
{
siteDescr = checkNull(rs.getString("DESCR"));
}
if( rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<site_descr><![CDATA[").append(siteDescr).append("]]></site_descr>\r\n");
}
else
{
valueXmlString.append("<site_descr><![CDATA[").append("").append("]]></site_descr>\r\n");
}
} }
else if (currentColumn.trim().equalsIgnoreCase("state_code")) if( pstmt != null )
{ {
System.out.println("Current column is"+currentColumn); pstmt.close();
System.out.println("INSIDE state_code"); pstmt = null;
String stateCode = getColumnValue("state_code",dom,"1"); }
System.out.println("value of state_code:::::"+stateCode); valueXmlString.append("<site_descr><![CDATA[").append(siteDescr).append("]]></site_descr>\r\n");
//modified by Shital on 30/07/2019 [Start]
if(stateCode != null && stateCode.length() > 0) admCommon.setNodeValue(dom, "site_descr", siteDescr);
{ //modified by Shital on 30/07/2019 [End]
sql = null; }
sql = "SELECT DESCR FROM STATE WHERE STATE_CODE = ?"; else
{
pstmt = conn.prepareStatement(sql); valueXmlString.append("<site_descr><![CDATA[").append("").append("]]></site_descr>\r\n");
pstmt.setString(1,stateCode); //modified by Shital on 30/07/2019 [Start]
rs = pstmt.executeQuery(); admCommon.setNodeValue(dom, "site_descr", "");
//modified by Shital on 30/07/2019 [End]
if( rs.next()) }
{ }
stateDescr = checkNull(rs.getString("DESCR"));
} else if (currentColumn.trim().equalsIgnoreCase("state_code"))
{
if( rs != null ) System.out.println("Current column is"+currentColumn);
{ System.out.println("INSIDE state_code");
rs.close(); //modified by Shital on 30/07/2019 [Start]
rs = null; //String stateCode = getColumnValue("state_code",dom,"1");
} stateCode = checkNull(genericUtility.getColumnValue("state_code",dom,"1"));
if( pstmt != null ) //modified by Shital on 30/07/2019 [End]
{ System.out.println("value of state_code:::::"+stateCode);
pstmt.close();
pstmt = null; if(stateCode != null && stateCode.length() > 0)
} {
sql = null;
valueXmlString.append("<state_descr><![CDATA[").append(stateDescr).append("]]></state_descr>\r\n"); sql = "SELECT DESCR FROM STATE WHERE STATE_CODE = ?";
} pstmt = conn.prepareStatement(sql);
else pstmt.setString(1,stateCode);
{ rs = pstmt.executeQuery();
valueXmlString.append("<state_descr><![CDATA[").append("").append("]]></state_descr>\r\n"); if( rs.next())
} {
stateDescr = checkNull(rs.getString("DESCR"));
} }
if( rs != null )
{
else if (currentColumn.trim().equalsIgnoreCase("stan_code")) rs.close();
{ rs = null;
System.out.println("Current column is"+currentColumn); }
System.out.println("INSIDE stan_code"); if( pstmt != null )
String stanCode = getColumnValue("stan_code",dom,"1"); {
System.out.println("value of site_code:::::"+stanCode); pstmt.close();
pstmt = null;
if(stanCode != null && stanCode.length() > 0) }
{ valueXmlString.append("<state_descr><![CDATA[").append(stateDescr).append("]]></state_descr>\r\n");
sql = null; //modified by Shital on 30/07/2019 [Start]
sql = "SELECT DESCR FROM STATION WHERE STAN_CODE = ?"; admCommon.setNodeValue(dom, "state_descr", stateDescr);
//modified by Shital on 30/07/2019 [End]
pstmt = conn.prepareStatement(sql); }
pstmt.setString(1,stanCode); else
rs = pstmt.executeQuery(); {
valueXmlString.append("<state_descr><![CDATA[").append("").append("]]></state_descr>\r\n");
if( rs.next()) //modified by Shital on 30/07/2019 [Start]
{ admCommon.setNodeValue(dom, "state_descr", "");
stanDescr = checkNull(rs.getString("DESCR")); //modified by Shital on 30/07/2019 [End]
} }
}
if( rs != null )
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<station_descr><![CDATA[").append(stanDescr).append("]]></station_descr>\r\n");
}
else
{
valueXmlString.append("<station_descr><![CDATA[").append("").append("]]></station_descr>\r\n");
}
else if (currentColumn.trim().equalsIgnoreCase("stan_code"))
{
System.out.println("Current column is"+currentColumn);
System.out.println("INSIDE stan_code");
//modified by Shital on 30/07/2019 [Start]
//String stanCode = genericUtility.getColumnValue("stan_code",dom,"1");
stanCode = checkNull(genericUtility.getColumnValue("stan_code",dom,"1"));
//modified by Shital on 30/07/2019 [End]
System.out.println("value of site_code:::::"+stanCode);
if(stanCode != null && stanCode.length() > 0)
{
sql = null;
sql = "SELECT DESCR FROM STATION WHERE STAN_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stanCode);
rs = pstmt.executeQuery();
if( rs.next())
{
stanDescr = checkNull(rs.getString("DESCR"));
} }
if( rs != null )
else if (currentColumn.trim().equalsIgnoreCase("pay_table")) {
{ rs.close();
System.out.println("Current column is"+currentColumn); rs = null;
System.out.println("INSIDE pay_table"); }
String payTable = getColumnValue("pay_table",dom,"1"); if( pstmt != null )
System.out.println("value of site_code:::::"+payTable); {
pstmt.close();
if(payTable != null && payTable.length() > 0) pstmt = null;
{ }
sql = null; valueXmlString.append("<station_descr><![CDATA[").append(stanDescr).append("]]></station_descr>\r\n");
sql = "SELECT DESCR FROM PAYTABLE WHERE PAY_TABLE = ?"; //modified by Shital on 30/07/2019 [Start]
admCommon.setNodeValue(dom, "station_descr",stanDescr);
pstmt = conn.prepareStatement(sql); //modified by Shital on 30/07/2019 [End]
pstmt.setString(1,payTable); }
rs = pstmt.executeQuery(); else
{
if( rs.next()) valueXmlString.append("<station_descr><![CDATA[").append("").append("]]></station_descr>\r\n");
{ //modified by Shital on 30/07/2019 [Start]
payTableDescr = checkNull(rs.getString("DESCR")); admCommon.setNodeValue(dom, "station_descr","");
} //modified by Shital on 30/07/2019 [End]
}
if( rs != null ) }
{
rs.close();
rs = null;
}
if( pstmt != null )
{
pstmt.close();
pstmt = null;
}
valueXmlString.append("<paytable_descr><![CDATA[").append(payTableDescr).append("]]></paytable_descr>\r\n");
}
else
{
valueXmlString.append("<paytable_descr><![CDATA[").append("").append("]]></paytable_descr>\r\n");
}
else if (currentColumn.trim().equalsIgnoreCase("pay_table"))
{
System.out.println("Current column is"+currentColumn);
System.out.println("INSIDE pay_table");
//modified by Shital on 30/07/2019 [Start]
//String payTable = checkNull(getColumnValue("pay_table",dom,"1"));
payTable = checkNull(genericUtility.getColumnValue("pay_table",dom,"1"));
//modified by Shital on 30/07/2019 [End]
System.out.println("value of site_code:::::"+payTable);
if(payTable != null && payTable.length() > 0)
{
sql = null;
sql = "SELECT DESCR FROM PAYTABLE WHERE PAY_TABLE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,payTable);
rs = pstmt.executeQuery();
if( rs.next())
{
payTableDescr = checkNull(rs.getString("DESCR"));
}
if( rs != null )
{
rs.close();
rs = null;
} }
valueXmlString.append("</Detail1>\r\n"); if( pstmt != null )
{
break; pstmt.close();
pstmt = null;
}
valueXmlString.append("<paytable_descr><![CDATA[").append(payTableDescr).append("]]></paytable_descr>\r\n");
//modified by Shital on 30/07/2019 [Start]
admCommon.setNodeValue(dom, "paytable_descr",payTableDescr);
//modified by Shital on 30/07/2019 [End]
}
else
{
valueXmlString.append("<paytable_descr><![CDATA[").append("").append("]]></paytable_descr>\r\n");
//modified by Shital on 30/07/2019 [Start]
admCommon.setNodeValue(dom, "paytable_descr","");
//modified by Shital on 30/07/2019 [End]
}
}
valueXmlString.append("</Detail1>\r\n");
break;
}//END OF SWITCH }//END OF SWITCH
}//END OF TRY }//END OF TRY
catch(Exception e) catch(Exception e)
{ {
//modified by Shital on 30/07/2019 [Start]
e.printStackTrace();
//modified by Shital on 30/07/2019 [End]
System.out.println("Exception in SiteStanPayTbl::"+ e.getMessage()); System.out.println("Exception in SiteStanPayTbl::"+ e.getMessage());
throw new ITMException(e); throw new ITMException(e);
} }
...@@ -722,10 +878,12 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -722,10 +878,12 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
conn.close(); conn.close();
conn = null; conn = null;
} }
} }
catch(Exception e1) catch(Exception e1)
{ {
//modified by Shital on 30/07/2019 [Start]
e1.printStackTrace();
//modified by Shital on 30/07/2019 [End]
System.out.println("Exception in SiteStanPayTbl::"+ e1.getMessage()); System.out.println("Exception in SiteStanPayTbl::"+ e1.getMessage());
throw new ITMException(e1); throw new ITMException(e1);
} }
...@@ -733,7 +891,6 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal ...@@ -733,7 +891,6 @@ public class SiteStanPayTbl extends ValidatorEJB implements SiteStanPayTblLocal
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
System.out.println("valueXmlString"+valueXmlString.toString()); System.out.println("valueXmlString"+valueXmlString.toString());
return valueXmlString.toString(); return valueXmlString.toString();
}//END OF ITEMCHANGE }//END OF ITEMCHANGE
private String checkNull( String input ) private String checkNull( String input )
......
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