Commit 6dec288c authored by sanashaikh's avatar sanashaikh

Sana S: Changes related to E12 generic utility and error string on 06 August 2019

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@204714 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 79ce1d90
...@@ -9,7 +9,9 @@ import java.sql.SQLException; ...@@ -9,7 +9,9 @@ import java.sql.SQLException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import ibase.utility.GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
//import ibase.utility.GenericUtility;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
...@@ -37,53 +39,57 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote, ...@@ -37,53 +39,57 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
String payTable = "", grade = "", adCode = ""; String payTable = "", grade = "", adCode = "";
String newDate = ""; String newDate = "";
String userId = ""; String userId = "";
String sql = ""; String sql = "";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
Document dom = null; Document dom = null;
Calendar calendar = null; Calendar calendar = null;
GenericUtility genericUtility = null; //Modified by Sana S. on[1/08/2019][Replace GenericUtility instance with E12GenericUtility class ][Start]
//GenericUtility genericUtility = null;
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
//Modified by Sana S. on[1/08/2019][Replace GenericUtility instance with E12GenericUtility class ][end]
Date newDateDB = null; Date newDateDB = null;
try try
{ {
con.setAutoCommit( false ); con.setAutoCommit( false );
genericUtility = GenericUtility.getInstance(); //genericUtility = GenericUtility.getInstance(); // Modified By Sana S on 01/08/2019
dom = genericUtility.parseString(domString); dom = genericUtility.parseString(domString);
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
calendar = Calendar.getInstance(); calendar = Calendar.getInstance();
System.out.println("domString StdPayStruPrs ["+domString+"]"); System.out.println("domString StdPayStruPrs ["+domString+"]");
if(editFlag.equalsIgnoreCase("A")) if(editFlag.equalsIgnoreCase("A"))
{ {
effDate = checkNull(genericUtility.getColumnValue("eff_date", dom)); effDate = checkNull(genericUtility.getColumnValue("eff_date", dom));
if(effDate != null && effDate.length() > 0) if(effDate != null && effDate.length() > 0)
{ {
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
effDateDB = Date.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat())); effDateDB = Date.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
System.out.println("effDateDB :: " + effDateDB); System.out.println("effDateDB :: " + effDateDB);
java.util.Date myDate = sdf.parse(effDate); java.util.Date myDate = sdf.parse(effDate);
calendar.setTime(myDate); calendar.setTime(myDate);
calendar.add(Calendar.DAY_OF_YEAR, -1); calendar.add(Calendar.DAY_OF_YEAR, -1);
newDate = sdf.format(calendar.getTime()); newDate = sdf.format(calendar.getTime());
newDateDB = Date.valueOf(genericUtility.getValidDateString(newDate, genericUtility.getApplDateFormat(), getDBDateFormat())); newDateDB = Date.valueOf(genericUtility.getValidDateString(newDate, genericUtility.getApplDateFormat(), getDBDateFormat()));
payTable = checkNull(genericUtility.getColumnValue("pay_table", dom)); payTable = checkNull(genericUtility.getColumnValue("pay_table", dom));
grade = checkNull(genericUtility.getColumnValue("grade", dom)); grade = checkNull(genericUtility.getColumnValue("grade", dom));
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom)); adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
System.out.println(" newDate :: " + newDate); System.out.println(" newDate :: " + newDate);
System.out.println(" newDateDB :: " + newDateDB); System.out.println(" newDateDB :: " + newDateDB);
int cnt=0; int cnt=0;
sql = "SELECT COUNT(1) AS ROWCOUNT FROM STD_PAYSTRU WHERE PAY_TABLE = ? AND GRADE = ? AND AD_CODE =? AND EFF_DATE <= ? AND VALID_UPTO >= ?"; sql = "SELECT COUNT(1) AS ROWCOUNT FROM STD_PAYSTRU WHERE PAY_TABLE = ? AND GRADE = ? AND AD_CODE =? AND EFF_DATE <= ? AND VALID_UPTO >= ?";
pstmt = con.prepareStatement(sql); pstmt = con.prepareStatement(sql);
...@@ -93,9 +99,9 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote, ...@@ -93,9 +99,9 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
pstmt.setDate(4, effDateDB); pstmt.setDate(4, effDateDB);
pstmt.setDate(5, effDateDB); pstmt.setDate(5, effDateDB);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
System.out.println(" SQL :: " + sql); System.out.println(" SQL :: " + sql);
if(rs.next()) if(rs.next())
{ {
cnt = rs.getInt("ROWCOUNT"); cnt = rs.getInt("ROWCOUNT");
...@@ -110,9 +116,9 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote, ...@@ -110,9 +116,9 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
System.out.println("Existing RowCount :: " + cnt); System.out.println("Existing RowCount :: " + cnt);
if (cnt > 0) if (cnt > 0)
{ {
int updCount = 0; int updCount = 0;
...@@ -132,7 +138,8 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote, ...@@ -132,7 +138,8 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
} }
if(cnt != updCount) if(cnt != updCount)
{ {
retString = getErrorString("eff_date", "VMSTDPAY11", userId); //retString =getErrorString("eff_date", "VMSTDPAY11", userId);
retString = itmDBAccessEJB.getErrorString("eff_date", "VMSTDPAY11", userId,"",con);// Modified By Sana S [01/08/2019]
con.rollback(); con.rollback();
} }
} }
...@@ -148,10 +155,10 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote, ...@@ -148,10 +155,10 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
System.out.println("Before rollback"); System.out.println("Before rollback");
con.rollback(); con.rollback();
} }
catch(SQLException sqle) catch(SQLException sqle)
{ {
System.out.println(sqle); System.out.println(sqle);
} }
throw new ITMException(e); throw new ITMException(e);
} }
...@@ -178,19 +185,19 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote, ...@@ -178,19 +185,19 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
System.out.println("Before rollback"); System.out.println("Before rollback");
con.rollback(); con.rollback();
} }
catch(SQLException sqle) catch(SQLException sqle)
{ {
System.out.println(sqle); System.out.println(sqle);
} }
throw new ITMException(e); throw new ITMException(e);
} }
} }
System.out.println("Return string :"+retString); System.out.println("Return string :"+retString);
return retString; return retString;
} }
private String checkNull(String input) private String checkNull(String input)
{ {
if (input == null) if (input == null)
......
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