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;
import java.text.SimpleDateFormat;
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.utility.ITMException;
......@@ -37,53 +39,57 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
String payTable = "", grade = "", adCode = "";
String newDate = "";
String userId = "";
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
Document dom = 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;
try
{
con.setAutoCommit( false );
genericUtility = GenericUtility.getInstance();
//genericUtility = GenericUtility.getInstance(); // Modified By Sana S on 01/08/2019
dom = genericUtility.parseString(domString);
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
calendar = Calendar.getInstance();
System.out.println("domString StdPayStruPrs ["+domString+"]");
if(editFlag.equalsIgnoreCase("A"))
{
effDate = checkNull(genericUtility.getColumnValue("eff_date", dom));
if(effDate != null && effDate.length() > 0)
{
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
effDateDB = Date.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
System.out.println("effDateDB :: " + effDateDB);
java.util.Date myDate = sdf.parse(effDate);
calendar.setTime(myDate);
calendar.add(Calendar.DAY_OF_YEAR, -1);
newDate = sdf.format(calendar.getTime());
newDateDB = Date.valueOf(genericUtility.getValidDateString(newDate, genericUtility.getApplDateFormat(), getDBDateFormat()));
payTable = checkNull(genericUtility.getColumnValue("pay_table", dom));
grade = checkNull(genericUtility.getColumnValue("grade", dom));
adCode = checkNull(genericUtility.getColumnValue("ad_code", dom));
System.out.println(" newDate :: " + newDate);
System.out.println(" newDateDB :: " + newDateDB);
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 >= ?";
pstmt = con.prepareStatement(sql);
......@@ -93,9 +99,9 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
pstmt.setDate(4, effDateDB);
pstmt.setDate(5, effDateDB);
rs = pstmt.executeQuery();
System.out.println(" SQL :: " + sql);
if(rs.next())
{
cnt = rs.getInt("ROWCOUNT");
......@@ -110,9 +116,9 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
pstmt.close();
pstmt = null;
}
System.out.println("Existing RowCount :: " + cnt);
if (cnt > 0)
{
int updCount = 0;
......@@ -132,7 +138,8 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
}
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();
}
}
......@@ -148,10 +155,10 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
System.out.println("Before rollback");
con.rollback();
}
catch(SQLException sqle)
{
System.out.println(sqle);
System.out.println(sqle);
}
throw new ITMException(e);
}
......@@ -178,19 +185,19 @@ public class StdPayStruPrs extends ValidatorEJB implements StdPayStruPrsRemote,
System.out.println("Before rollback");
con.rollback();
}
catch(SQLException sqle)
{
System.out.println(sqle);
System.out.println(sqle);
}
throw new ITMException(e);
}
}
System.out.println("Return string :"+retString);
return retString;
}
private String checkNull(String input)
{
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