Commit 5d82b2ce authored by awarekar's avatar awarekar

1. On change of supp_type, all the data will set from supplier_default.

2. On change of contact_code, respective contact_type will check and all the data will set from supplier_default. 

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@191177 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2f710f93
...@@ -8,27 +8,29 @@ ...@@ -8,27 +8,29 @@
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
//import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
import java.text.SimpleDateFormat;
import java.util.*;
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 java.sql.ResultSetMetaData;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import javax.ejb.Stateless;
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;
import javax.ejb.Stateless;
@Stateless import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
//import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException;
@Stateless
public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemote { public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemote {
//GenericUtility genericUtility = GenericUtility.getInstance(); //GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility= new E12GenericUtility(); E12GenericUtility genericUtility= new E12GenericUtility();
...@@ -61,7 +63,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -61,7 +63,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
String suppName = ""; String suppName = "";
...@@ -100,7 +102,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -100,7 +102,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
ResultSet rs = null; ResultSet rs = null;
ConnDriver connDriver = new ConnDriver(); ConnDriver connDriver = new ConnDriver();
int currentFormNo = 0; int currentFormNo = 0;
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
String commTable = ""; String commTable = "";
String labOurInvolved = "", pfRegNo = "", lwfNo = "", pTaxNo = "", eciNo = "",esicRegNo = "", ssi = "", msmeRegDate = "", msmeRegNo = "", msmeType = "";//Changed By Nasruddin 21-SEp-16 String labOurInvolved = "", pfRegNo = "", lwfNo = "", pTaxNo = "", eciNo = "",esicRegNo = "", ssi = "", msmeRegDate = "", msmeRegNo = "", msmeType = "";//Changed By Nasruddin 21-SEp-16
try try
...@@ -109,7 +111,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -109,7 +111,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
//Changes and Commented By Bhushan on 09-06-2016 :START //Changes and Commented By Bhushan on 09-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM"); //conn = connDriver.getConnectDB("DriverITM");
conn = getConnection(); conn = getConnection();
//Changes and Commented By Bhushan on 09-06-2016 :END //Changes and Commented By Bhushan on 09-06-2016 :END
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
{ {
...@@ -127,12 +129,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -127,12 +129,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("supp_code")) if(childNodeName.equalsIgnoreCase("supp_code"))
{ {
suppCode = genericUtility.getColumnValue("supp_code", dom); suppCode = genericUtility.getColumnValue("supp_code", dom);
keyFlag = findValue(conn, "key_flag", "transetup", "tran_window", "w_supplier"); keyFlag = findValue(conn, "key_flag", "transetup", "tran_window", "w_supplier");
if(!("A".equalsIgnoreCase(keyFlag)) && (suppCode == null || suppCode.trim().length() == 0)) if(!("A".equalsIgnoreCase(keyFlag)) && (suppCode == null || suppCode.trim().length() == 0))
{ {
errCode = "VTSUPCDNLL"; errCode = "VTSUPCDNLL";
errList.add(errCode); errList.add(errCode);
...@@ -153,7 +155,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -153,7 +155,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
} }
else if(childNodeName.equalsIgnoreCase("supp_name")) else if(childNodeName.equalsIgnoreCase("supp_name"))
{ {
suppName = genericUtility.getColumnValue("supp_name", dom); suppName = genericUtility.getColumnValue("supp_name", dom);
suppCode = genericUtility.getColumnValue("supp_code", dom); suppCode = genericUtility.getColumnValue("supp_code", dom);
if(suppName == null || suppName.trim().length() == 0) if(suppName == null || suppName.trim().length() == 0)
...@@ -179,7 +181,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -179,7 +181,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
//---- End ---- //---- End ----
if(count > 0) if(count > 0)
{ {
errCode = "VTSUPNMVLD"; errCode = "VTSUPNMVLD";
...@@ -189,11 +191,11 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -189,11 +191,11 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
} }
else if(childNodeName.equalsIgnoreCase("supp_type")) else if(childNodeName.equalsIgnoreCase("supp_type"))
{ {
suppType = genericUtility.getColumnValue("supp_type", dom); suppType = genericUtility.getColumnValue("supp_type", dom);
if(suppType == null || suppType.trim().length() == 0) if(suppType == null || suppType.trim().length() == 0)
{ {
errCode = "VMSUPPTP"; errCode = "VMSUPPTP";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
...@@ -202,12 +204,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -202,12 +204,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
{ {
groupCode = genericUtility.getColumnValue("group_code", dom); groupCode = genericUtility.getColumnValue("group_code", dom);
keyFlag = findValue(conn, "key_flag", "transetup", "tran_window", "w_supplier"); keyFlag = findValue(conn, "key_flag", "transetup", "tran_window", "w_supplier");
if(!("A".equalsIgnoreCase(keyFlag)) && (groupCode == null || groupCode.trim().length() == 0)) if(!("A".equalsIgnoreCase(keyFlag)) && (groupCode == null || groupCode.trim().length() == 0))
{ {
errCode = "VMGRPCD"; errCode = "VMGRPCD";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
}/* }/*
Changed By Nasruddin 21-SEP-16 STARt Changed By Nasruddin 21-SEP-16 STARt
else if(childNodeName.equalsIgnoreCase("supp_code__pay")) else if(childNodeName.equalsIgnoreCase("supp_code__pay"))
...@@ -231,7 +233,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -231,7 +233,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}*/ }*/
else if(childNodeName.equalsIgnoreCase("supp_code__pay")) else if(childNodeName.equalsIgnoreCase("supp_code__pay"))
{ {
...@@ -281,12 +283,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -281,12 +283,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
payTo = genericUtility.getColumnValue("pay_to", dom); payTo = genericUtility.getColumnValue("pay_to", dom);
suppCode = genericUtility.getColumnValue("supp_code", dom); suppCode = genericUtility.getColumnValue("supp_code", dom);
keyFlag = findValue(conn, "key_flag", "transetup", "tran_window", "w_supplier"); keyFlag = findValue(conn, "key_flag", "transetup", "tran_window", "w_supplier");
if(!("A".equalsIgnoreCase(keyFlag)) && (payTo == null || payTo.trim().length() == 0)) if(!("A".equalsIgnoreCase(keyFlag)) && (payTo == null || payTo.trim().length() == 0))
{ {
errCode = "VEPAYTO"; errCode = "VEPAYTO";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
else if(!(payTo.equals(suppCode))) else if(!(payTo.equals(suppCode)))
{ {
existFlag = isExist("supplier", "supp_code", payTo, conn); existFlag = isExist("supplier", "supp_code", payTo, conn);
...@@ -299,7 +301,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -299,7 +301,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
}*/ }*/
//Modified by Anjali R. on[26/04/2018][No such a column as "pay_to" in supplier master ][End] //Modified by Anjali R. on[26/04/2018][No such a column as "pay_to" in supplier master ][End]
//Changed By Nasruddin 21-SEP-16 END //Changed By Nasruddin 21-SEP-16 END
else if(childNodeName.equalsIgnoreCase("curr_code")) else if(childNodeName.equalsIgnoreCase("curr_code"))
{ {
...@@ -342,10 +344,10 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -342,10 +344,10 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(count != 0) if(count != 0)
{ {
// Error : Currency cannot be changed, amt exists in sundrybal. // Error : Currency cannot be changed, amt exists in sundrybal.
errCode = "VXCURRCD1"; errCode = "VXCURRCD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
...@@ -375,11 +377,11 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -375,11 +377,11 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
Comment BY Nasruddin 21_sep-16 END*/ Comment BY Nasruddin 21_sep-16 END*/
} }
else if(childNodeName.equalsIgnoreCase("cr_term")) else if(childNodeName.equalsIgnoreCase("cr_term"))
{ {
crTerm = genericUtility.getColumnValue("cr_term", dom); crTerm = genericUtility.getColumnValue("cr_term", dom);
existFlag = isExist("crterm", "cr_term", crTerm, conn); existFlag = isExist("crterm", "cr_term", crTerm, conn);
if ("FALSE".equals(existFlag)) if ("FALSE".equals(existFlag))
...@@ -402,7 +404,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -402,7 +404,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
} }
else if(childNodeName.equalsIgnoreCase("tax_class")) else if(childNodeName.equalsIgnoreCase("tax_class"))
{ {
taxClass = genericUtility.getColumnValue("tax_class", dom); taxClass = genericUtility.getColumnValue("tax_class", dom);
...@@ -513,7 +515,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -513,7 +515,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
{ {
errCode = "VMSITECD1"; errCode = "VMSITECD1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
if(siteCode != null && siteCode.trim().length() > 0) if(siteCode != null && siteCode.trim().length() > 0)
{ {
...@@ -571,7 +573,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -571,7 +573,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
} }
/* Comment By Nasruddin 21-SEp-16 START /* Comment By Nasruddin 21-SEp-16 START
* *
else if(childNodeName.equalsIgnoreCase("tran_code")) else if(childNodeName.equalsIgnoreCase("tran_code"))
{ {
tranCode = genericUtility.getColumnValue("tran_code", dom); tranCode = genericUtility.getColumnValue("tran_code", dom);
...@@ -586,7 +588,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -586,7 +588,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
} }
} }
else if(childNodeName.equalsIgnoreCase("tax_env")) else if(childNodeName.equalsIgnoreCase("tax_env"))
{ {
taxEnv = genericUtility.getColumnValue("tax_env", dom); taxEnv = genericUtility.getColumnValue("tax_env", dom);
...@@ -618,9 +620,9 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -618,9 +620,9 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
//Changed By Nasruddin khan [19/JUL/16] START //Changed By Nasruddin khan [19/JUL/16] START
else if( childNodeName.equalsIgnoreCase("comm_table")) else if( childNodeName.equalsIgnoreCase("comm_table"))
{ {
commTable = checkNull(this.genericUtility.getColumnValue("comm_table", dom)); commTable = checkNull(this.genericUtility.getColumnValue("comm_table", dom));
if( commTable != null && commTable.trim().length() > 0){ if( commTable != null && commTable.trim().length() > 0){
count = 0; count = 0;
sql = "select count(1) as count from comm_hdr where comm_table = ?"; sql = "select count(1) as count from comm_hdr where comm_table = ?";
...@@ -644,10 +646,10 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -644,10 +646,10 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
}//Changed By Nasruddin khan [19/JUL/16] END }//Changed By Nasruddin khan [19/JUL/16] END
// Changed By Nasruddin Start 21-SEP-16 START // Changed By Nasruddin Start 21-SEP-16 START
else if(childNodeName.equalsIgnoreCase("pf_reg_no")) else if(childNodeName.equalsIgnoreCase("pf_reg_no"))
{ {
...@@ -764,7 +766,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -764,7 +766,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
// Changed By Nasruddin Start 21-SEP-16 end // Changed By Nasruddin Start 21-SEP-16 end
} }
break; //end case 1 validation. break; //end case 1 validation.
case 2: case 2:
parentNodeList = dom.getElementsByTagName("Detail2"); parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
...@@ -838,10 +840,10 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -838,10 +840,10 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
} }
} }
} }
break; // end case 2 validation. break; // end case 2 validation.
} }
int errListSize = errList.size(); int errListSize = errList.size();
int cnt = 0; int cnt = 0;
String errFldName = null; String errFldName = null;
...@@ -889,12 +891,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -889,12 +891,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
{ {
try try
{ {
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -905,7 +907,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -905,7 +907,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
conn = null; conn = null;
} }
connDriver = null; connDriver = null;
} }
catch(Exception d) catch(Exception d)
{ {
d.printStackTrace(); d.printStackTrace();
...@@ -924,7 +926,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -924,7 +926,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
Document dom2 = null; Document dom2 = null;
String valueXmlString = ""; String valueXmlString = "";
try try
{ {
dom = parseString(xmlString); dom = parseString(xmlString);
dom1 = parseString(xmlString1); dom1 = parseString(xmlString1);
if(xmlString2.trim().length() > 0 ) if(xmlString2.trim().length() > 0 )
...@@ -971,6 +973,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -971,6 +973,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
String descr1 = ""; String descr1 = "";
String suppCode = ""; String suppCode = "";
String contactCode = ""; String contactCode = "";
String contactType="";
String suppName = ""; String suppName = "";
String fullName = ""; String fullName = "";
String sql = ""; String sql = "";
...@@ -989,14 +992,14 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -989,14 +992,14 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
Node childNode = null; Node childNode = null;
String suppType = "" , suppTypeDescr = ""; // Added by sarita on 15MAY2018 String suppType = "" , suppTypeDescr = ""; // Added by sarita on 15MAY2018
try try
{ {
//Changes and Commented By Bhushan on 09-06-2016 :START //Changes and Commented By Bhushan on 09-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM"); //conn = connDriver.getConnectDB("DriverITM");
conn = getConnection(); conn = getConnection();
//Changes and Commented By Bhushan on 09-06-2016 :END //Changes and Commented By Bhushan on 09-06-2016 :END
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver = null; connDriver = null;
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext.trim()); currentFormNo = Integer.parseInt(objContext.trim());
...@@ -1007,20 +1010,20 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1007,20 +1010,20 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
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();
ctr = 0; ctr = 0;
valueXmlString.append("<Detail1>"); valueXmlString.append("<Detail1>");
if(currentColumn.trim().equalsIgnoreCase("supp_code")) if(currentColumn.trim().equalsIgnoreCase("supp_code"))
{ {
System.out.println(">>>supp_code itemchange:"); System.out.println(">>>supp_code itemchange:");
suppCode = genericUtility.getColumnValue("supp_code", dom); suppCode = genericUtility.getColumnValue("supp_code", dom);
descr = genericUtility.getColumnValue("supp_code__pay", dom); descr = genericUtility.getColumnValue("supp_code__pay", dom);
if(descr == null || descr.trim().length() == 0) if(descr == null || descr.trim().length() == 0)
{ {
valueXmlString.append("<supp_code__pay>").append("<![CDATA[" + suppCode +"]]>").append("</supp_code__pay>"); valueXmlString.append("<supp_code__pay>").append("<![CDATA[" + suppCode +"]]>").append("</supp_code__pay>");
} }
...@@ -1035,11 +1038,11 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1035,11 +1038,11 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
suppCode = genericUtility.getColumnValue("supp_code", dom); suppCode = genericUtility.getColumnValue("supp_code", dom);
contactCode = genericUtility.getColumnValue("contact_code", dom); contactCode = genericUtility.getColumnValue("contact_code", dom);
suppName = checkNull(genericUtility.getColumnValue("supp_name", dom)); suppName = checkNull(genericUtility.getColumnValue("supp_name", dom));
if(suppName.trim().length() == 0) if(suppName.trim().length() == 0)
{ {
sql = " select name, sh_name, cont_pers, cont_pfx, addr1, addr2,addr3, city, pin, state_code, count_code, tele1, tele2, tele3, "+ sql = " select name, sh_name, cont_pers, cont_pfx, addr1, addr2,addr3, city, pin, state_code, count_code, tele1, tele2, tele3, "+
" tele_ext, fax, email_addr, edi_addr from contact where contact_code = ?"; " tele_ext, fax, email_addr, edi_addr,contact_type from contact where contact_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, contactCode); pstmt.setString(1, contactCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -1061,15 +1064,17 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1061,15 +1064,17 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
tele3 = rs.getString("tele3"); tele3 = rs.getString("tele3");
teleExt = rs.getString("tele_ext"); teleExt = rs.getString("tele_ext");
fax = rs.getString("fax"); fax = rs.getString("fax");
//Added by Amey W[To get contact_type from contact master] 25/9/18
contactType = checkNull(rs.getString("contact_type"));
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
altAdd = findValue(conn, "alt_addr1", "supplier", "supp_code", suppCode); altAdd = findValue(conn, "alt_addr1", "supplier", "supp_code", suppCode);
if(altAdd == null || altAdd.trim().length() == 0) if(altAdd == null || altAdd.trim().length() == 0)
{ {
valueXmlString.append("<alt_addr1>").append("<![CDATA[" + checkNull(addr1) +"]]>").append("</alt_addr1>"); valueXmlString.append("<alt_addr1>").append("<![CDATA[" + checkNull(addr1) +"]]>").append("</alt_addr1>");
valueXmlString.append("<alt_addr2>").append("<![CDATA[" + checkNull(addr2) +"]]>").append("</alt_addr2>"); valueXmlString.append("<alt_addr2>").append("<![CDATA[" + checkNull(addr2) +"]]>").append("</alt_addr2>");
...@@ -1078,6 +1083,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1078,6 +1083,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
valueXmlString.append("<alt_pin>").append("<![CDATA[" + checkNull(pin) +"]]>").append("</alt_pin>"); valueXmlString.append("<alt_pin>").append("<![CDATA[" + checkNull(pin) +"]]>").append("</alt_pin>");
valueXmlString.append("<state_code__alt>").append("<![CDATA[" + checkNull(stateCode) +"]]>").append("</state_code__alt>"); valueXmlString.append("<state_code__alt>").append("<![CDATA[" + checkNull(stateCode) +"]]>").append("</state_code__alt>");
} }
valueXmlString.append("<supp_name>").append("<![CDATA[" + checkNull(name) +"]]>").append("</supp_name>"); valueXmlString.append("<supp_name>").append("<![CDATA[" + checkNull(name) +"]]>").append("</supp_name>");
valueXmlString.append("<full_name>").append("<![CDATA[" + checkNull(name) +"]]>").append("</full_name>"); valueXmlString.append("<full_name>").append("<![CDATA[" + checkNull(name) +"]]>").append("</full_name>");
valueXmlString.append("<chq_name>").append("<![CDATA[" + checkNull(name) +"]]>").append("</chq_name>"); valueXmlString.append("<chq_name>").append("<![CDATA[" + checkNull(name) +"]]>").append("</chq_name>");
...@@ -1096,6 +1102,17 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1096,6 +1102,17 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
valueXmlString.append("<tele3>").append("<![CDATA[" + checkNull(tele3) +"]]>").append("</tele3>"); valueXmlString.append("<tele3>").append("<![CDATA[" + checkNull(tele3) +"]]>").append("</tele3>");
valueXmlString.append("<tele_ext>").append("<![CDATA[" + checkNull(teleExt) +"]]>").append("</tele_ext>"); valueXmlString.append("<tele_ext>").append("<![CDATA[" + checkNull(teleExt) +"]]>").append("</tele_ext>");
valueXmlString.append("<fax>").append("<![CDATA[" + checkNull(fax) +"]]>").append("</fax>"); valueXmlString.append("<fax>").append("<![CDATA[" + checkNull(fax) +"]]>").append("</fax>");
//Added by AMEY on 25/09/2018 [start] to get data from supplier default master from supp_type from respective contact code
if (contactType != null && contactType.trim().length() > 0)
{
StringBuffer supplierDefaultData = setSupplierDefaultData(contactType,conn);
if( supplierDefaultData != null && supplierDefaultData.length() > 0 )
{
valueXmlString.append( supplierDefaultData );
}
}
//Added by AMEY on 25/09/2018 [end] to get data from supplier default master from supp_type from respective contact code
} }
} }
else if(currentColumn.trim().equalsIgnoreCase("full_name")) else if(currentColumn.trim().equalsIgnoreCase("full_name"))
...@@ -1105,7 +1122,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1105,7 +1122,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
{ {
name = mid(fullName,1,40); name = mid(fullName,1,40);
} }
valueXmlString.append("<supp_name>").append("<![CDATA[" + name +"]]>").append("</supp_name>"); valueXmlString.append("<supp_name>").append("<![CDATA[" + name +"]]>").append("</supp_name>");
} }
//Added by Pooja S. on 6 sept 18[Itemchange of reas_code__bklist] Start //Added by Pooja S. on 6 sept 18[Itemchange of reas_code__bklist] Start
else if(currentColumn.trim().equalsIgnoreCase("reas_code__bklist")) else if(currentColumn.trim().equalsIgnoreCase("reas_code__bklist"))
...@@ -1130,7 +1147,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1130,7 +1147,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
valueXmlString.append("<bklist_reason>").append("<![CDATA[" + checkNull(lsDescr) + "]]>").append("</bklist_reason>"); valueXmlString.append("<bklist_reason>").append("<![CDATA[" + checkNull(lsDescr) + "]]>").append("</bklist_reason>");
} }
//Added by Pooja S. on 6 sept 18[Itemchange of reas_code__bklist] End //Added by Pooja S. on 6 sept 18[Itemchange of reas_code__bklist] End
else if(currentColumn.trim().equalsIgnoreCase("supp_name")) else if(currentColumn.trim().equalsIgnoreCase("supp_name"))
{ {
suppName =genericUtility.getColumnValue("supp_name", dom); suppName =genericUtility.getColumnValue("supp_name", dom);
chqName =genericUtility.getColumnValue("chq_name", dom); chqName =genericUtility.getColumnValue("chq_name", dom);
...@@ -1146,7 +1163,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1146,7 +1163,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
//Added by sarita on 15MAY2018 [start] to show description of selected type //Added by sarita on 15MAY2018 [start] to show description of selected type
else if(currentColumn.trim().equalsIgnoreCase("supp_type")) else if(currentColumn.trim().equalsIgnoreCase("supp_type"))
{ {
suppType = genericUtility.getColumnValue("supp_type", dom); suppType = genericUtility.getColumnValue("supp_type", dom);
System.out.println("suppType == ["+suppType+"]"); System.out.println("suppType == ["+suppType+"]");
...@@ -1156,18 +1173,31 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1156,18 +1173,31 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
suppTypeDescr = rs.getString("descr"); suppTypeDescr = rs.getString("descr");
System.out.println("Descr is :::" +suppTypeDescr); System.out.println("Descr is :::" +suppTypeDescr);
} }
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
valueXmlString.append("<supp_type_descr>").append("<![CDATA[" + suppTypeDescr + "]]>").append("</supp_type_descr>"); valueXmlString.append("<supp_type_descr>").append("<![CDATA[" + suppTypeDescr + "]]>").append("</supp_type_descr>");
//Added by AMEY W on 12/09/2018 [start] to get data from supplier default master from supp_type
if (suppType != null && suppType.trim().length() > 0)
{
StringBuffer supplierDefaultData = setSupplierDefaultData( suppType, conn );
System.out.println("Back to method 1" );
if( supplierDefaultData != null && supplierDefaultData.length() > 0 )
{
System.out.println("data found x==>" + supplierDefaultData);
valueXmlString.append(supplierDefaultData);
}
}
//Added by AMEY W on 12/09/2018 [end] to get data from supplier default master from supp_type
} }
//Added by sarita on 15MAY2018 [end] to show description of selected type //Added by sarita on 15MAY2018 [end] to show description of selected type
else if(currentColumn.trim().equalsIgnoreCase("cr_term")) else if(currentColumn.trim().equalsIgnoreCase("cr_term"))
{ {
System.out.println(">>>>>>>>>>Itemchange cr_term:"); System.out.println(">>>>>>>>>>Itemchange cr_term:");
crTerm = genericUtility.getColumnValue("cr_term", dom); crTerm = genericUtility.getColumnValue("cr_term", dom);
...@@ -1183,7 +1213,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1183,7 +1213,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
valueXmlString.append("<credit_prd>").append("<![CDATA[" + crDays + "]]>").append("</credit_prd>"); valueXmlString.append("<credit_prd>").append("<![CDATA[" + crDays + "]]>").append("</credit_prd>");
} }
} }
else if(currentColumn.trim().equalsIgnoreCase("stan_code")) else if(currentColumn.trim().equalsIgnoreCase("stan_code"))
{ {
System.out.println(">>>>>>>>>>stan_code itemchange:"); System.out.println(">>>>>>>>>>stan_code itemchange:");
stanCode =genericUtility.getColumnValue("stan_code", dom); stanCode =genericUtility.getColumnValue("stan_code", dom);
...@@ -1201,7 +1231,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1201,7 +1231,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
sql = " select descr,count_code from state where state_code = ?"; sql = " select descr,count_code from state where state_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,stateCode); pstmt.setString(1,stateCode);
...@@ -1214,12 +1244,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1214,12 +1244,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
rs.close(); rs.close();
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
valueXmlString.append("<station_descr>").append("<![CDATA[" + checkNull(descr) + "]]>").append("</station_descr>"); valueXmlString.append("<station_descr>").append("<![CDATA[" + checkNull(descr) + "]]>").append("</station_descr>");
valueXmlString.append("<state_code>").append("<![CDATA[" + checkNull(stateCode) + "]]>").append("</state_code>"); valueXmlString.append("<state_code>").append("<![CDATA[" + checkNull(stateCode) + "]]>").append("</state_code>");
valueXmlString.append("<state_descr>").append("<![CDATA[" + checkNull(descr1) + "]]>").append("</state_descr>"); valueXmlString.append("<state_descr>").append("<![CDATA[" + checkNull(descr1) + "]]>").append("</state_descr>");
valueXmlString.append("<count_code>").append("<![CDATA[" + checkNull(countCode) + "]]>").append("</count_code>"); valueXmlString.append("<count_code>").append("<![CDATA[" + checkNull(countCode) + "]]>").append("</count_code>");
cityHdr =genericUtility.getColumnValue("city", dom); //change cityHdr and pinHdr variable by sagar on 23/09/14 cityHdr =genericUtility.getColumnValue("city", dom); //change cityHdr and pinHdr variable by sagar on 23/09/14
pinHdr =genericUtility.getColumnValue("pin", dom); pinHdr =genericUtility.getColumnValue("pin", dom);
//Commented by sarita on 15MAY2018[start] to perform itemchnage for city and pin code even if value exists //Commented by sarita on 15MAY2018[start] to perform itemchnage for city and pin code even if value exists
/*if(cityHdr == null || cityHdr.trim().length() == 0) /*if(cityHdr == null || cityHdr.trim().length() == 0)
...@@ -1230,9 +1260,9 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1230,9 +1260,9 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
{*/ {*/
valueXmlString.append("<pin>").append("<![CDATA[" + checkNull(pin) + "]]>").append("</pin>"); valueXmlString.append("<pin>").append("<![CDATA[" + checkNull(pin) + "]]>").append("</pin>");
//} //}
//Commented by sarita on 15MAY2018[end] to perform itemchnage for city and pin code even if value exists //Commented by sarita on 15MAY2018[end] to perform itemchnage for city and pin code even if value exists
} }
else if(currentColumn.trim().equalsIgnoreCase("tran_code")) else if(currentColumn.trim().equalsIgnoreCase("tran_code"))
{ {
tranCode =genericUtility.getColumnValue("tran_code", dom); tranCode =genericUtility.getColumnValue("tran_code", dom);
tranName = findValue(conn, "tran_name", "transporter", "tran_code", tranCode); tranName = findValue(conn, "tran_name", "transporter", "tran_code", tranCode);
...@@ -1240,15 +1270,15 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1240,15 +1270,15 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
break; //end case 1 for itemchange. break; //end case 1 for itemchange.
case 2: case 2:
parentNodeList = dom.getElementsByTagName("Detail2"); parentNodeList = dom.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
ctr = 0; ctr = 0;
valueXmlString.append("<Detail2>"); valueXmlString.append("<Detail2>");
System.out.println(">>>currentColumn In case 2:"+currentColumn); System.out.println(">>>currentColumn In case 2:"+currentColumn);
if (currentColumn.trim().equalsIgnoreCase("reg_code")) if (currentColumn.trim().equalsIgnoreCase("reg_code"))
...@@ -1273,12 +1303,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1273,12 +1303,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
{ {
try try
{ {
if(rs != null) if(rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if(pstmt != null) if(pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
...@@ -1293,12 +1323,75 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1293,12 +1323,75 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
catch(Exception d) catch(Exception d)
{ {
d.printStackTrace(); d.printStackTrace();
} }
} }
//------- End ------- //------- End -------
return valueXmlString.toString(); return valueXmlString.toString();
}
//Added by AMEY on 25/09/2018 [start] to get data from supplier default master from supp_type
/**
*
* @param suppType
* @param conn
* @return
*/
private StringBuffer setSupplierDefaultData( String suppType, Connection conn )
{
StringBuffer valueXmlString = new StringBuffer();
PreparedStatement pstmt = null;
ResultSet rs = null ;
String sql="";
String colName="";
String colValue="";
try
{
sql = "select * from supplier_default where supp_type = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, suppType);
rs = pstmt.executeQuery();
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
if (rs.next())
{
for (int i = 1; i <= columnCount; i++)
{
colName = rsmd.getColumnName(i).toLowerCase();
colValue = checkNull(rs.getString(colName));
if (colValue != null && colValue.trim().length() > 0)
{
if( ! ( (colName.equalsIgnoreCase("chg_date")) || (colName.equalsIgnoreCase("chg_user")) || (colName.equalsIgnoreCase("chg_term")) ) )
{
valueXmlString.append("<" + colName + ">").append("<![CDATA[" + colValue + "]]>").append("</" + colName + ">");
}
}
}
}
}
catch (Exception e)
{
System.out.println("Supplier.setSupplierDefaultData() : ["+ e.getMessage() +"]");
}
finally
{
try
{
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch (SQLException e)
{
System.out.println(e);
}
}
return valueXmlString;
} }
//Added by AMEY on 25/09/2018 [end] to get data from supplier default master from supp_type
public String getfinparm(String pCode , String varName ,Connection conn) public String getfinparm(String pCode , String varName ,Connection conn)
{ {
...@@ -1347,12 +1440,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1347,12 +1440,12 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
} }
// ---- End ---- // ---- End ----
if(addValue == null || addValue.trim().length() == 0) if(addValue == null || addValue.trim().length() == 0)
{ {
return varValue; return varValue;
} }
else else
{ {
return varValue.trim()+";"+addValue.trim(); return varValue.trim()+";"+addValue.trim();
} }
...@@ -1388,7 +1481,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1388,7 +1481,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
//------- End ------- //------- End -------
if(count == 0) if(count == 0)
{ {
errCode = "VMCCTR1"; errCode = "VMCCTR1";
...@@ -1409,7 +1502,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1409,7 +1502,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
// ---- End ---- // ---- End ----
if(count == 0) if(count == 0)
{ {
sql = "select count(*) from accounts_cctr where acct_code = ? "; sql = "select count(*) from accounts_cctr where acct_code = ? ";
...@@ -1426,7 +1519,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1426,7 +1519,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
//---- End ---- //---- End ----
if(count > 0) if(count > 0)
{ {
...@@ -1467,7 +1560,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1467,7 +1560,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
} }
//---- End ---- //---- End ----
return errCode; return errCode;
} }
...@@ -1529,7 +1622,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1529,7 +1622,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
//Changed By PriyankaC on 23April2018..[START] //Changed By PriyankaC on 23April2018..[START]
//else if(siteSpec != null && !siteSpec.equals("Y")) //else if(siteSpec != null && !siteSpec.equals("Y"))
else if(siteSpec != null && siteSpec.equals("Y")) else if(siteSpec != null && siteSpec.equals("Y"))
//Changed By PriyankaC on 23April2018..[END] //Changed By PriyankaC on 23April2018..[END]
{ {
sql = "select count(*) from site_account where site_code = ? and acct_code = ?"; sql = "select count(*) from site_account where site_code = ? and acct_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -1545,14 +1638,14 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1545,14 +1638,14 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if(count == 0) if(count == 0)
{ {
errCode = "VMACCT3"; errCode = "VMACCT3";
} }
} }
} }
else else
{ {
errCode = "VMACCT1"; errCode = "VMACCT1";
...@@ -1585,13 +1678,13 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1585,13 +1678,13 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
} }
//---- End ---- //---- End ----
return errCode; return errCode;
} }
public String mid(String fname ,int i , int j) public String mid(String fname ,int i , int j)
{ {
String name = fname.substring(1, 40); String name = fname.substring(1, 40);
return name; return name;
} }
private String checkNull(String input) private String checkNull(String input)
{ {
...@@ -1601,7 +1694,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1601,7 +1694,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
return input; return input;
} }
private String isExist(String table, String field, String value, Connection conn) throws SQLException private String isExist(String table, String field, String value, Connection conn) throws SQLException
{ {
String sql = "", retStr = ""; String sql = "", retStr = "";
...@@ -1684,7 +1777,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1684,7 +1777,7 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
} }
} }
//---- End ---- //---- End ----
System.out.println("returning String from findValue " + findValue); System.out.println("returning String from findValue " + findValue);
return findValue; return findValue;
} }
...@@ -1693,23 +1786,23 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1693,23 +1786,23 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
private String errorType(Connection conn , String errorCode) private String errorType(Connection conn , String errorCode)
{ {
String msgType = ""; String msgType = "";
PreparedStatement pstmt = null ; PreparedStatement pstmt = null ;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
String sql = "SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?"; String sql = "SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,errorCode); pstmt.setString(1,errorCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()) while(rs.next())
{ {
msgType = rs.getString("MSG_TYPE"); msgType = rs.getString("MSG_TYPE");
} }
} }
catch(Exception ex) catch(Exception ex)
{ {
ex.printStackTrace(); ex.printStackTrace();
} }
finally finally
{ {
try try
...@@ -1729,10 +1822,10 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo ...@@ -1729,10 +1822,10 @@ public class Supplier extends ValidatorEJB implements SupplierLocal,SupplierRemo
{ {
e.printStackTrace(); e.printStackTrace();
} }
} }
return msgType; return msgType;
} }
} }
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