Commit f39a9034 authored by manohar's avatar manohar

reference to ValidatorEJB methods without connection parameter removed


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102121 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a8883b2d
...@@ -15,10 +15,12 @@ import ibase.webitm.utility.*; ...@@ -15,10 +15,12 @@ import ibase.webitm.utility.*;
import java.util.HashMap; import java.util.HashMap;
import ibase.webitm.ejb.*; import ibase.webitm.ejb.*;
import org.w3c.dom.*; import org.w3c.dom.*;
import ibase.webitm.ejb.dis.DistCommon;
public class FinCommon public class FinCommon
{ {
ValidatorEJB validator = new ValidatorEJB(); ValidatorEJB validator = new ValidatorEJB();
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
public String sundrybalOpnUpd(HashMap sundrybalMap, Connection conn)throws ITMException public String sundrybalOpnUpd(HashMap sundrybalMap, Connection conn)throws ITMException
{ {
...@@ -1914,7 +1916,8 @@ public class FinCommon ...@@ -1914,7 +1916,8 @@ public class FinCommon
{ {
if (sundryType .equalsIgnoreCase("C")) if (sundryType .equalsIgnoreCase("C"))
{ {
errCode = validator.isCustomer(siteCode,sundryCode,refSer, conn); //errCode = validator.isCustomer(siteCode,sundryCode,refSer, conn);
errCode = isCustomer(siteCode,sundryCode,refSer, conn);
} }
else if (sundryType.equalsIgnoreCase("R")) else if (sundryType.equalsIgnoreCase("R"))
{ {
...@@ -1922,7 +1925,8 @@ public class FinCommon ...@@ -1922,7 +1925,8 @@ public class FinCommon
} }
else if (sundryType.equalsIgnoreCase("B")) else if (sundryType.equalsIgnoreCase("B"))
{ {
errCode = validator.isBankCode(siteCode,sundryCode,refSer); //errCode = validator.isBankCode(siteCode,sundryCode,refSer);
errCode = isBankCode(siteCode,sundryCode,refSer, conn);
} }
else if (sundryType.equalsIgnoreCase("L")) else if (sundryType.equalsIgnoreCase("L"))
{ {
...@@ -2284,7 +2288,10 @@ public class FinCommon ...@@ -2284,7 +2288,10 @@ public class FinCommon
try try
{ {
varValue = validator.getEnvDis("999999", "SITE_SPECIFIC_SUPP", conn); DistCommon distCommon = new DistCommon();
//varValue = validator.getEnvDis("999999", "SITE_SPECIFIC_SUPP", conn);
varValue = distCommon.getDisparams("999999", "SITE_SPECIFIC_SUPP", conn);
distCommon = null;
if (varValue.equalsIgnoreCase("Y")) if (varValue.equalsIgnoreCase("Y"))
{ {
sql = "SELECT COUNT(*) FROM SITE_SUPPLIER WHERE SITE_CODE = ? AND SUPP_CODE = ?"; sql = "SELECT COUNT(*) FROM SITE_SUPPLIER WHERE SITE_CODE = ? AND SUPP_CODE = ?";
...@@ -2440,7 +2447,10 @@ public class FinCommon ...@@ -2440,7 +2447,10 @@ public class FinCommon
try try
{ {
varValue = validator.getEnvDis("999999", "SITE_SPECIFIC_SPERS", conn); DistCommon distCommon = new DistCommon();
varValue = distCommon.getDisparams("999999", "SITE_SPECIFIC_SPERS", conn);
distCommon = null;
//varValue = validator.getEnvDis("999999", "SITE_SPECIFIC_SPERS", conn);
if (varValue.equalsIgnoreCase("Y")) if (varValue.equalsIgnoreCase("Y"))
{ {
sql = "SELECT COUNT(*) FROM SITE_SALES_PERS WHERE SITE_CODE = ? AND SALES_PERS = ?"; sql = "SELECT COUNT(*) FROM SITE_SALES_PERS WHERE SITE_CODE = ? AND SALES_PERS = ?";
...@@ -8153,7 +8163,7 @@ public class FinCommon ...@@ -8153,7 +8163,7 @@ public class FinCommon
double exchRate = 0,drAmt = 0,crAmt = 0,tempDrAmt = 0,tempCrAmt = 0; double exchRate = 0,drAmt = 0,crAmt = 0,tempDrAmt = 0,tempCrAmt = 0;
Timestamp tranDate = null,effDate = null,postDate = null,chgDate = null; Timestamp tranDate = null,effDate = null,postDate = null,chgDate = null;
ITMDBAccessEJB itmDBAccessEJB = null; ITMDBAccessEJB itmDBAccessEJB = null;
ValidatorEJB validatorEJB = null; //ValidatorEJB validatorEJB = null;
// GenericUtility genericUtility = null; // GenericUtility genericUtility = null;
SimpleDateFormat sdf = null; SimpleDateFormat sdf = null;
HashMap glTran = null; HashMap glTran = null;
...@@ -8167,7 +8177,7 @@ public class FinCommon ...@@ -8167,7 +8177,7 @@ public class FinCommon
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
stmt = conn.createStatement(); stmt = conn.createStatement();
itmDBAccessEJB = new ITMDBAccessEJB(); itmDBAccessEJB = new ITMDBAccessEJB();
validatorEJB = new ValidatorEJB(); //validatorEJB = new ValidatorEJB();
tranDate = (Timestamp)glTrace.get("tran_date"); tranDate = (Timestamp)glTrace.get("tran_date");
effDate = (Timestamp)glTrace.get("eff_date"); effDate = (Timestamp)glTrace.get("eff_date");
...@@ -9890,6 +9900,7 @@ public class FinCommon ...@@ -9890,6 +9900,7 @@ public class FinCommon
double rndTo = 0d; double rndTo = 0d;
String errCode = ""; String errCode = "";
String rndOff = ""; String rndOff = "";
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
StringBuffer valueXml = new StringBuffer(); StringBuffer valueXml = new StringBuffer();
...@@ -9978,7 +9989,8 @@ public class FinCommon ...@@ -9978,7 +9989,8 @@ public class FinCommon
if (bankCntr > 0) if (bankCntr > 0)
{ {
errCode = "VTCHQ4"; errCode = "VTCHQ4";
errString = validator.getErrorString("TRAN_ID",errCode,chgUser);//errCode //errString = validator.getErrorString("TRAN_ID",errCode,chgUser);//errCode
errString = itmDBAccessEJB.getErrorString("TRAN_ID",errCode,chgUser,"",conn);
break; break;
} }
} }
...@@ -9994,7 +10006,8 @@ public class FinCommon ...@@ -9994,7 +10006,8 @@ public class FinCommon
else else
{ {
errCode = "VTKEYSTR"; errCode = "VTKEYSTR";
errString = validator.getErrorString("TRAN_ID",errCode,chgUser);//errCode //errString = validator.getErrorString("TRAN_ID",errCode,chgUser);//errCode
errString = itmDBAccessEJB.getErrorString("TRAN_ID",errCode,chgUser,"",conn);
break; break;
} }
rsTemp.close(); rsTemp.close();
...@@ -10006,7 +10019,9 @@ public class FinCommon ...@@ -10006,7 +10019,9 @@ public class FinCommon
if ( newTranId != null && newTranId.trim().equals("ERROR") ) if ( newTranId != null && newTranId.trim().equals("ERROR") )
{ {
errCode = "VTTRANID"; errCode = "VTTRANID";
errString = validator.getErrorString("TRAN_ID",errCode,chgUser);//errCode //errString = validator.getErrorString("TRAN_ID",errCode,chgUser);//errCode
errString = itmDBAccessEJB.getErrorString("TRAN_ID",errCode,chgUser,"",conn);
break; break;
} }
...@@ -10057,7 +10072,8 @@ public class FinCommon ...@@ -10057,7 +10072,8 @@ public class FinCommon
if ( cnt == 0) if ( cnt == 0)
{ {
errCode = "VTBKLOGUPD"; errCode = "VTBKLOGUPD";
errString = validator.getErrorString("TRAN_ID",errCode,chgUser);//errCode //errString = validator.getErrorString("TRAN_ID",errCode,chgUser);//errCode
errString = itmDBAccessEJB.getErrorString("TRAN_ID",errCode,chgUser,"",conn);
} }
break; break;
} }
...@@ -11828,4 +11844,265 @@ public class FinCommon ...@@ -11828,4 +11844,265 @@ public class FinCommon
} }
return errCode; return errCode;
} }
public String isBankCode(String siteCode,String bankCode,String modName, Connection con) throws RemoteException,ITMException
{
String errCode = "",colValue; //$NON-NLS-1$
long counter;
//Connection con = null;
Statement stmt1 = null;
Statement stmt2 = null;
Statement stmt3 = null;
ResultSet rs1 = null;
ResultSet rs2 = null;
ResultSet rs3 = null;
String sql1 = ""; //$NON-NLS-1$
try
{
//con = getConnection();
sql1 = "SELECT COUNT(1) FROM BANK WHERE BANK_CODE = '" + bankCode + "'"; //$NON-NLS-1$ //$NON-NLS-2$
stmt1 = con.createStatement();
rs1 = stmt1.executeQuery(sql1);
if (rs1.next())
{
counter = rs1.getLong(1);
if (counter == 0)
{
errCode = "VMBANK1"; //$NON-NLS-1$
}
}
else
{
sql1 = "SELECT SITE_CODE FROM BANK WHERE BANK_CODE = '" + bankCode + "'"; //$NON-NLS-1$ //$NON-NLS-2$
stmt2 = con.createStatement();
rs2 = stmt1.executeQuery(sql1);
if(rs2.next())
{
colValue = rs2.getString(1);
if (!colValue.trim().equals(siteCode))
{
sql1 = "SELECT COUNT(1) FROM SITE_BANK WHERE SITE_CODE ='" + siteCode + "' AND BANK_CODE = '" + bankCode + "'"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
stmt3 = con.createStatement();
rs3 = stmt1.executeQuery(sql1);
if (rs3.next())
{
counter = rs3.getLong(1);
if (counter == 0)
{
errCode = "VMBANKMIS1"; //$NON-NLS-1$
}
}
}
}
errCode = "VMBANK1"; //$NON-NLS-1$
}
// rs1.close();
// stmt1.close();
// rs2.close();
// stmt2.close();
// rs3.close();
// stmt3.close();
//con.close();
}
catch(Exception e)
{
System.out.println("Exception : ValidatorEJB : isBankCode :==>\n"+e.getMessage()); //$NON-NLS-1$
e.printStackTrace();
errCode = e.getMessage();
throw new ITMException(e);
}
return errCode;
}
public String isSiteCode(String siteCode,String modName, Connection con) throws Exception,RemoteException,ITMException
{
String errCode = ""; //$NON-NLS-1$
long counter;
String sql1 = ""; //$NON-NLS-1$
//Connection con = null;
Statement stmt1 = null;
ResultSet rs1 = null;
try
{
//con = getConnection();
sql1 = "SELECT COUNT(1) FROM SITE WHERE SITE_CODE = '" + siteCode + "'" ; //$NON-NLS-1$ //$NON-NLS-2$
stmt1 = con.createStatement();
rs1 = stmt1.executeQuery(sql1);
if (rs1.next())
{
counter = rs1.getLong(1);
if (counter == 0)
{
errCode = "VMSITE1"; //$NON-NLS-1$
}
}
rs1.close();
stmt1.close();
//con.close();
}
catch(Exception e)
{
System.out.println("Exception : ValidatorEJB : isSiteCode :==>\n"+e.getMessage()); //$NON-NLS-1$
e.printStackTrace();
errCode = e.getMessage();
throw new ITMException(e);
}
return errCode;
}
public String isFinEntity(String finEntity,String modName, Connection con) throws Exception, RemoteException,ITMException
{
String errCode = ""; //$NON-NLS-1$
long counter;
String sql1 = ""; //$NON-NLS-1$
//Connection con = null;
Statement stmt1 = null;
ResultSet rs1 = null;
try
{
//con = getConnection();
sql1 = "SELECT COUNT(1) FROM FINENT WHERE FIN_ENTITY = '" + finEntity + "'" ; //$NON-NLS-1$ //$NON-NLS-2$
stmt1 = con.createStatement();
rs1 = stmt1.executeQuery(sql1);
if (rs1.next())
{
counter = rs1.getLong(1);
if (counter == 0)
{
errCode = "VMFENTY1"; //$NON-NLS-1$
}
}
// rs1.close();
stmt1.close();
//con.close();
}
catch(Exception e)
{
System.out.println("Exception : ValidatorEJB : isFinEntity :==>\n"+e.getMessage()); //$NON-NLS-1$
e.printStackTrace();
errCode = e.getMessage();
throw new ITMException(e);
}
return errCode;
}
public String isCustomer(String siteCode, String custCode, String modName, Connection conn) throws RemoteException,ITMException
{
String active = ""; //$NON-NLS-1$
String errCode=""; //$NON-NLS-1$
String blackList = ""; //$NON-NLS-1$
String sql21 = ""; //$NON-NLS-1$
Statement stmt21 = null;
ResultSet rs21 =null;
StringBuffer sql22 = null;
Statement stmt22 = null;
ResultSet rs22 =null;
String sql23 = ""; //$NON-NLS-1$
Statement stmt23 = null;
ResultSet rs23 =null;
String sql24 = ""; //$NON-NLS-1$
Statement stmt24 = null;
ResultSet rs24 =null;
try
{
sql21 = "SELECT VAR_VALUE FROM DISPARM WHERE PRD_CODE = '999999' AND VAR_NAME = 'SITE_SPECIFIC_CUST'"; //$NON-NLS-1$
stmt21 = conn.createStatement();
rs21 = stmt21.executeQuery(sql21);
if (rs21.next())
{
//Commented and Changes done by Gaurav Singh on 07-Sep-2015 to check null for avoiding nullPointerException [ Start ]
String disparmVal = (rs21.getString(1) == null)?"":rs21.getString(1).trim();
//if (rs21.getString(1).equals("Y")) //$NON-NLS-1$
if ("Y".equals(disparmVal))
{
sql22 = new StringBuffer();
sql22.append("SELECT ACTIVE_YN FROM SITE_CUSTOMER "); //$NON-NLS-1$
sql22.append("WHERE SITE_CODE = '").append(siteCode); //$NON-NLS-1$
sql22.append("' AND CUST_CODE = '").append(custCode).append("'"); //$NON-NLS-1$ //$NON-NLS-2$
stmt22 = conn.createStatement();
rs22 = stmt22.executeQuery(sql22.toString());
if (rs22.next())
{
active = (rs22.getString(1) == null)?"":rs22.getString(1).trim();
if (active.length() > 0)
{
//if (active.equals("N")) //$NON-NLS-1$
if ("N".equals(active))
{
errCode = "VTCUST7"; //$NON-NLS-1$
}
else if (active.trim().length()==0)
{
errCode = "VTCUSTCD2"; //$NON-NLS-1$
}
}
else
{
errCode = "VTCUSTCD2"; //$NON-NLS-1$
}
}
else
{
errCode = "VTCUSTCD2"; //$NON-NLS-1$
}
rs22.close();
stmt22.close();
}
}
rs21.close();
stmt21.close();
sql23 = "SELECT CASE WHEN COUNT(1) IS NULL THEN 0 ELSE COUNT(1) END FROM CUSTOMER WHERE CUST_CODE = '" + custCode + "'"; //$NON-NLS-1$ //$NON-NLS-2$
stmt23 = conn.createStatement();
rs23 = stmt23.executeQuery(sql23);
if (rs23.next())
{
if (rs23.getInt(1) == 0)
{
errCode = "VTCUSTCD1"; //$NON-NLS-1$
}
}
rs23.close();
stmt23.close();
if (errCode == null && errCode.length() == 0)
{
sql24 = "SELECT BLACK_LISTED FROM CUSTOMER WHERE CUST_CODE = '" + custCode + "'"; //$NON-NLS-1$ //$NON-NLS-2$
stmt24 = conn.createStatement();
rs24 = stmt24.executeQuery(sql24);
if (rs24.next())
{
blackList = rs24.getString(1);
//if ( blackList != null && blackList.trim().length() == 0 )
if ( blackList == null || blackList.trim().length() == 0 )
{
blackList = "N"; //$NON-NLS-1$
}
}
else
{
blackList = "N"; //$NON-NLS-1$
}
//if (blackList.equals("Y")) //$NON-NLS-1$
if (blackList != null && "Y".equals(blackList))
{
//if(modName.equals("S-RET") || modName.equals("MDRCRD") || modName.equals("MDRCRC") || modName.equals("DRNRCP") || modName.equals("CRNRCP") || modName.equals("RCP") || modName.equals("R-DIS") || modName.equals("M-RCP")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
if( (modName != null && ("S-RET".equals(modName) || "MDRCRD".equals(modName) || "MDRCRC".equals(modName) || "DRNRCP".equals(modName) || "CRNRCP".equals(modName) || "RCP".equals(modName) || "R-DIS".equals(modName) || "M-RCP".equals(modName) )))
errCode = "VTCUSTCD6"; //$NON-NLS-1$
else
errCode = "VTCUSTCD3"; //$NON-NLS-1$
}
rs24.close();
stmt24.close();
//Commented and Changes done by Gaurav Singh on 07-Sep-2015 to check null for avoiding nullPointerException [ End ]
}
}
catch(Exception e)
{
System.out.println("Exception : ValidatorEJB : isCustomer :==>\n"+e.getMessage()); //$NON-NLS-1$
e.printStackTrace();
errCode = e.getMessage();
throw new ITMException(e);
}
return errCode;
}
} }
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