Commit 26ef0798 authored by smane's avatar smane

FreightListIC.java file updated by sagar changes made in genCode method


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94389 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 082b4ec6
...@@ -322,13 +322,9 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -322,13 +322,9 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} }
}// end for }// end for
break; // case 1 end break; // case 1 end
} }
int errListSize = errList.size(); int errListSize = errList.size();
...@@ -401,10 +397,8 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -401,10 +397,8 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
errString = errStringXml.toString(); errString = errStringXml.toString();
return errString; return errString;
} }
//end of validation //end of validation
// Start method for item change
// method for item change
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
{ {
Document dom = null; Document dom = null;
...@@ -438,7 +432,6 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -438,7 +432,6 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
return valueXmlString; return valueXmlString;
} }
// method for item change // method for item change
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
{ {
...@@ -550,7 +543,6 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -550,7 +543,6 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
break; break;
} }
valueXmlString.append("</Root>"); valueXmlString.append("</Root>");
} }
...@@ -588,7 +580,6 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -588,7 +580,6 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
} }
return valueXmlString.toString(); return valueXmlString.toString();
} }
private String checkNull(String input) private String checkNull(String input)
{ {
if(input == null) if(input == null)
...@@ -597,8 +588,6 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -597,8 +588,6 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
} }
return input; return input;
} }
private String errorType(Connection conn , String errorCode) throws ITMException private String errorType(Connection conn , String errorCode) throws ITMException
{ {
String msgType = ""; String msgType = "";
...@@ -650,23 +639,42 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -650,23 +639,42 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
private String getGenCodeDescr(Connection conn,String fieldName,String fieldVal) throws ITMException private String getGenCodeDescr(Connection conn,String fieldName,String fieldVal) throws ITMException
{ {
String descr = null; String descr = "";
String sql="";
PreparedStatement pstmt=null; PreparedStatement pstmt=null;
ResultSet rs=null; ResultSet rs=null;
try try
{ {
String sql="select descr from gencodes where MOD_NAME = ? and fld_name = ? and fld_value = ?"; System.out.println(">>>>Check for gencode W_FRT_LIST:"+fieldVal);
sql="select descr from gencodes where MOD_NAME = ? and fld_name = ? and fld_value = ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setString(1, "X"); pstmt.setString(1, "W_FRT_LIST");
pstmt.setString(2, fieldName); pstmt.setString(2, fieldName);
pstmt.setString(3, fieldVal); pstmt.setString(3, fieldVal);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next())
{
descr=rs.getString(1);
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if(descr==null || descr.trim().length() == 0 )
{
System.out.println(">>>>Check for gencode X:"+fieldVal);
sql="select descr from gencodes where MOD_NAME = ? and fld_name = ? and fld_value = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, "X");
pstmt.setString(2, fieldName);
pstmt.setString(3, fieldVal);
rs=pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
descr=rs.getString(1); descr=rs.getString(1);
} }
}
descr=checkNull(descr); descr=checkNull(descr);
descr=descr.trim(); descr=descr.trim();
System.out.println(">>>>>>getGenCodeDescr"+descr); System.out.println(">>>>>>getGenCodeDescr"+descr);
...@@ -676,19 +684,15 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -676,19 +684,15 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
System.out.println("[FreightListIC] SQLException : getGenCodeDescr(): \n SQLException Occured =>>"+se.getMessage()); System.out.println("[FreightListIC] SQLException : getGenCodeDescr(): \n SQLException Occured =>>"+se.getMessage());
se.printStackTrace(); se.printStackTrace();
throw new ITMException(se); throw new ITMException(se);
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("[FreightListIC] Exception : getGenCodeDescr(): \n Exception Occured =>>"+e.getMessage()); System.out.println("[FreightListIC] Exception : getGenCodeDescr(): \n Exception Occured =>>"+e.getMessage());
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
{ {
try try
{ {
if(rs!=null){ if(rs!=null){
...@@ -706,23 +710,17 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -706,23 +710,17 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
se.printStackTrace(); se.printStackTrace();
throw new ITMException(se); throw new ITMException(se);
} }
} }
return descr; return descr;
} }
private int getDBRowCount(Connection conn, String table_name, String whrCondCol, String whrCondVal) private int getDBRowCount(Connection conn, String table_name, String whrCondCol, String whrCondVal)
{ {
int count=-1; int count=-1;
if(conn!=null)
if(conn!=null){ {
ResultSet rs=null; ResultSet rs=null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
String sql="select count(1) from "+table_name+" where "+whrCondCol+" = ?"; String sql="select count(1) from "+table_name+" where "+whrCondCol+" = ?";
System.out.println("SQL in getDBRowCount method : "+sql); System.out.println("SQL in getDBRowCount method : "+sql);
try try
...@@ -744,7 +742,9 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -744,7 +742,9 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
{ {
System.out.println("Exception In getDBRowCount method of FreightListIC Class : "+ex.getMessage()); System.out.println("Exception In getDBRowCount method of FreightListIC Class : "+ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
}finally{ }
finally
{
try{ try{
...@@ -763,16 +763,18 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F ...@@ -763,16 +763,18 @@ public class FreightListIC extends ValidatorEJB implements FreightListICLocal, F
se.printStackTrace(); se.printStackTrace();
} }
} }
}else }
else
{ {
try try
{ {
throw new SQLException("Connection passed to FreightListIC.getDBRowCount() method is null"); throw new SQLException("Connection passed to FreightListIC.getDBRowCount() method is null");
} catch (SQLException e) { }
catch (SQLException e)
{
e.printStackTrace(); e.printStackTrace();
} }
} }
return count; return count;
} }
} }
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