Commit 3702642c authored by sghate's avatar sghate

shital : Done changes on WorkLocationMaster.java

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@206839 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9ae24189
...@@ -5,13 +5,18 @@ ...@@ -5,13 +5,18 @@
Date : 03-SEP-2014 Date : 03-SEP-2014
Developer : CHETNA SHAHU Developer : CHETNA SHAHU
Purpose : Define the work loactions for employee Purpose : Define the work loactions for employee
********************************************************/ ********************************************************/
package ibase.webitm.ejb.adm; package ibase.webitm.ejb.adm;
import ibase.system.config.ConnDriver; //modified by Shital on 09/08/2019 [Start]
//import ibase.system.config.ConnDriver;
//modified by Shital on 09/08/2019 [End]
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility; //modified by Shital on 09/08/2019 [Start]
//import ibase.webitm.utility.GenericUtility;
//modified by Shital on 09/08/2019 [End]
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -21,20 +26,25 @@ import java.sql.ResultSet; ...@@ -21,20 +26,25 @@ import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
//modified by Shital on 09/08/2019 [Start]
import javax.ejb.Stateless; //import javax.ejb.Stateless;
//modified by Shital on 09/08/2019 [End]
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;
@Stateless //modified by Shital on 09/08/2019 [Start]
//@Stateless
//modified by Shital on 09/08/2019 [End]
public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMasterLocal,WorkLocationMasterRemote { public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMasterLocal,WorkLocationMasterRemote
{
//modified by Shital on 09/08/2019 [Start]
GenericUtility genericUtility = GenericUtility.getInstance(); //GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//modified by Shital on 09/08/2019 [End]
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
String errString = ""; String errString = "";
...@@ -43,7 +53,6 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -43,7 +53,6 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
Document dom2 = null; Document dom2 = null;
try try
{ {
if (xmlString != null && xmlString.trim().length() > 0 ) if (xmlString != null && xmlString.trim().length() > 0 )
{ {
dom = parseString(xmlString); dom = parseString(xmlString);
...@@ -63,13 +72,16 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -63,13 +72,16 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
} }
catch(Exception e) catch(Exception e)
{ {
//modified by Shital on 09/08/2019 [Start]
e.printStackTrace();
//modified by Shital on 09/08/2019 [End]
throw new ITMException(e); throw new ITMException(e);
} }
return(errString); return(errString);
} }
public String wfValData(Document curDom, Document hdrDom, Document allDom, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(Document curDom, Document hdrDom, Document allDom, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
String userId = ""; String userId = "";
String errorType = ""; String errorType = "";
String childNodeName = null; String childNodeName = null;
String errCode = ""; String errCode = "";
...@@ -78,42 +90,45 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -78,42 +90,45 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
String stateCode = ""; String stateCode = "";
String active = ""; String active = "";
String errString = ""; String errString = "";
int currentFormNo = 0; int currentFormNo = 0;
int childNodeListLength; int childNodeListLength;
int ctr=0; int ctr = 0;
int count = 0; int count = 0;
boolean flag = false; boolean flag = false;
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
Node parentNode = null; Node parentNode = null;
Node childNode = null; Node childNode = null;
ArrayList<String> errList = new ArrayList<String>(); ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>(); ArrayList<String> errFields = new ArrayList<String>();
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null ; PreparedStatement pstmt = null ;
ResultSet rs = null; ResultSet rs = null;
ConnDriver connDriver = new ConnDriver(); //modified by Shital on 09/08/2019 [Start]
//ConnDriver connDriver = new ConnDriver();
//modified by Shital on 09/08/2019 [End]
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try try
{ {
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = connDriver.getConnectDB("DriverITM"); //modified by Shital on 09/08/2019 [Start]
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//modified by Shital on 09/08/2019 [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)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
System.out.println("Current Form No. :- "+currentFormNo); System.out.println("Current Form No. :- "+currentFormNo);
switch(currentFormNo) switch(currentFormNo)
{ {
case 1 : case 1 :
...@@ -121,11 +136,12 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -121,11 +136,12 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeListLength; ctr ++) for(ctr = 0; ctr < childNodeListLength; ctr ++)
{ {
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
if(childNodeName.equalsIgnoreCase("work_loc_code") && editFlag.equalsIgnoreCase("A") ) if(childNodeName.equalsIgnoreCase("work_loc_code") && editFlag.equalsIgnoreCase("A") )
{ {
wrkLocCode = checkNull(genericUtility.getColumnValue("work_loc_code", curDom)); wrkLocCode = checkNull(genericUtility.getColumnValue("work_loc_code", curDom));
...@@ -139,10 +155,23 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -139,10 +155,23 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
{ {
keyFlag = rs.getString("KEY_FLAG"); keyFlag = rs.getString("KEY_FLAG");
} }
rs.close(); //modified by Shital on 09/08/2019 [Start]
rs = null; //rs.close();
pstmt.close(); //rs = null;
pstmt = null; //pstmt.close();
//pstmt = null;
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//modified by Shital on 09/08/2019 [End]
if (keyFlag == null || keyFlag.trim().length() == 0 || keyFlag.equalsIgnoreCase("M")) if (keyFlag == null || keyFlag.trim().length() == 0 || keyFlag.equalsIgnoreCase("M"))
{ {
errCode = "VMWRKLOC01"; errCode = "VMWRKLOC01";
...@@ -161,10 +190,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -161,10 +190,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
} }
} }
} //work_loc_code end } //work_loc_code end
else if(childNodeName.equalsIgnoreCase("descr")) // Work Location for Description else if(childNodeName.equalsIgnoreCase("descr")) // Work Location for Description
{ {
descr = checkNull(genericUtility.getColumnValue("descr", curDom)); descr = checkNull(genericUtility.getColumnValue("descr", curDom));
if(descr == null || descr.trim().length() == 0) if(descr == null || descr.trim().length() == 0)
{ {
errCode = "VMWRKLOC03"; errCode = "VMWRKLOC03";
...@@ -172,10 +201,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -172,10 +201,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} // End of descr } // End of descr
else if(childNodeName.equalsIgnoreCase("city")) // Validation for state_code else if(childNodeName.equalsIgnoreCase("city")) // Validation for state_code
{ {
String city = checkNull(genericUtility.getColumnValue("city", curDom)); String city = checkNull(genericUtility.getColumnValue("city", curDom));
if(city == null || city.trim().length() == 0) if(city == null || city.trim().length() == 0)
{ {
errCode = "VMWRKLOC05"; errCode = "VMWRKLOC05";
...@@ -193,10 +222,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -193,10 +222,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
} }
} }
} // End of city } // End of city
else if(childNodeName.equalsIgnoreCase("state_code")) // Validation for state_code else if(childNodeName.equalsIgnoreCase("state_code")) // Validation for state_code
{ {
stateCode = checkNull(genericUtility.getColumnValue("state_code", curDom)); stateCode = checkNull(genericUtility.getColumnValue("state_code", curDom));
if(stateCode == null || stateCode.trim().length() == 0) if(stateCode == null || stateCode.trim().length() == 0)
{ {
errCode = "VESTATCD1"; errCode = "VESTATCD1";
...@@ -214,10 +243,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -214,10 +243,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
} }
} }
} // End of state_code } // End of state_code
else if(childNodeName.equalsIgnoreCase("active")) // Validation for active else if(childNodeName.equalsIgnoreCase("active")) // Validation for active
{ {
active = checkNull(genericUtility.getColumnValue("active", curDom)); active = checkNull(genericUtility.getColumnValue("active", curDom));
if(active == null || active.trim().length() == 0) if(active == null || active.trim().length() == 0)
{ {
errCode = "VMWRKLOC04"; errCode = "VMWRKLOC04";
...@@ -226,9 +255,9 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -226,9 +255,9 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
} }
} // End of active } // End of active
} }
break; break;
} }
int errListSize = errList.size(); int errListSize = errList.size();
count = 0; count = 0;
String errFldName = null; String errFldName = null;
...@@ -240,19 +269,21 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -240,19 +269,21 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
errCode = errList.get(count); errCode = errList.get(count);
errFldName = errFields.get(count); errFldName = errFields.get(count);
System.out.println("errCode .........." + errCode); System.out.println("errCode .........." + errCode);
// errString = getErrorString(errFldName, errCode, userId); // errString = getErrorString(errFldName, errCode, userId);
//Commented and added by Varsha V on 20-Jul-18 for calling connection method //modified by Shital on 09/08/2019 [Start]
//errString = itmDBAccessEJB.getErrorString(errFldName, errCode, userId); //errString = itmDBAccessEJB.getErrorString(errFldName, errCode, userId);
errString = itmDBAccessEJB.getErrorString(errFldName,errCode,userId,"",conn); errString = itmDBAccessEJB.getErrorString(errFldName, errCode, userId, "", conn);
//modified by Shital on 09/08/2019 [End]
System.out.println("errString........"+errString); System.out.println("errString........"+errString);
//Commented and added by Varsha V on 20-Jul-18 for calling connection method
//modified by Shital on 09/08/2019 [Start]
//errString = itmDBAccessEJB.getErrorString("", errCode, userId); //errString = itmDBAccessEJB.getErrorString("", errCode, userId);
errString = itmDBAccessEJB.getErrorString("",errCode,userId,"",conn); errString = itmDBAccessEJB.getErrorString("", errCode, userId, "", conn);
//modified by Shital on 09/08/2019 [End]
System.out.println("errString........"+errString); System.out.println("errString........"+errString);
errorType = errorType(conn , errCode); errorType = errorType(conn , errCode);
return errString; return errString;
} }
errList.clear(); errList.clear();
errList = null; errList = null;
...@@ -275,7 +306,8 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -275,7 +306,8 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
{ {
try try
{ {
if(conn != null) //modified by Shital on 09/08/2019 [Start]
/*if(conn != null)
{ {
if(rs != null) if(rs != null)
{ {
...@@ -289,7 +321,24 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -289,7 +321,24 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
} }
conn.close(); conn.close();
} }
conn = null; conn = null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
//modified by Shital on 09/08/2019 [End]
} }
catch(Exception d) catch(Exception d)
{ {
...@@ -306,9 +355,9 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -306,9 +355,9 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
String valueXmlString = ""; String valueXmlString = "";
try try
{ {
if(xmlString != null && xmlString.trim().length() > 0) if(xmlString != null && xmlString.trim().length() > 0)
...@@ -331,6 +380,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -331,6 +380,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception : [DistributionRoute][itemChanged( String, String )] :==>\n" + e.getMessage()); System.out.println("Exception : [DistributionRoute][itemChanged( String, String )] :==>\n" + e.getMessage());
//modified by Shital on 09/08/2019 [Start]
e.printStackTrace();
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
} }
return valueXmlString; return valueXmlString;
} }
...@@ -344,9 +397,9 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -344,9 +397,9 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
String stateCodeDescr = ""; String stateCodeDescr = "";
String stateCode = ""; String stateCode = "";
String userId = ""; String userId = "";
String tranDate=""; String tranDate = "";
String termId = ""; String termId = "";
StringBuffer valueXmlString = new StringBuffer(); StringBuffer valueXmlString = new StringBuffer();
int ctr = 0; int ctr = 0;
int currentFormNo = 0; int currentFormNo = 0;
...@@ -358,25 +411,36 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -358,25 +411,36 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null ; ResultSet rs = null ;
ConnDriver connDriver = new ConnDriver();
AdmCommon admCommon = new AdmCommon();
//modified by Shital on 09/08/2019 [Start]
//ConnDriver connDriver = new ConnDriver();
//modified by Shital on 09/08/2019 [End]
try try
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 09/08/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 09/08/2019 [End]
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode"); userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
termId = getValueFromXTRA_PARAMS(xtraParams,"termId"); termId = getValueFromXTRA_PARAMS(xtraParams,"termId");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
conn = connDriver.getConnectDB("DriverITM"); //modified by Shital on 09/08/2019 [Start]
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver=null; //connDriver=null;
if(objContext != null && objContext.trim().length()>0) //modified by Shital on 09/08/2019 [End]
if(objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
valueXmlString = new StringBuffer("<?xml version = \"1.0\"?> <Root> <header> <editFlag>"); valueXmlString = new StringBuffer("<?xml version = \"1.0\"?> <Root> <header> <editFlag>");
valueXmlString.append(editFlag).append("</editFlag> </header>"); valueXmlString.append(editFlag).append("</editFlag> </header>");
switch(currentFormNo) switch(currentFormNo)
{ {
case 1 : case 1 :
...@@ -390,18 +454,27 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -390,18 +454,27 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
ctr ++; ctr ++;
}while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn)); }
while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn));
System.out.println("currentColumn = "+currentColumn); System.out.println("currentColumn = "+currentColumn);
if(currentColumn.trim().equalsIgnoreCase("itm_default") ) if(currentColumn.trim().equalsIgnoreCase("itm_default") )
{ {
tranDate = simpleDateFormat.format(timestamp).toString(); tranDate = simpleDateFormat.format(timestamp).toString();
System.out.println("Tran Date 111: "+tranDate.toString()); System.out.println("Tran Date 111: "+tranDate.toString());
valueXmlString.append("<active>").append("<![CDATA[Y]]>").append("</active>"); valueXmlString.append("<active>").append("<![CDATA[Y]]>").append("</active>");
valueXmlString.append("<chg_user>").append("<![CDATA["+userId+"]]>").append("</chg_user>"); valueXmlString.append("<chg_user>").append("<![CDATA["+userId+"]]>").append("</chg_user>");
valueXmlString.append("<chg_date>").append("<![CDATA[" + tranDate.trim() +"]]>").append("</chg_date>\r\n"); valueXmlString.append("<chg_date>").append("<![CDATA[" + tranDate.trim() +"]]>").append("</chg_date>\r\n");
valueXmlString.append("<chg_term>").append("<![CDATA[" + termId +"]]>").append("</chg_term>\r\n"); valueXmlString.append("<chg_term>").append("<![CDATA[" + termId +"]]>").append("</chg_term>\r\n");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "active", "Y");
admCommon.setNodeValue(dom, "chg_user", userId);
admCommon.setNodeValue(dom, "chg_date", tranDate);
admCommon.setNodeValue(dom, "chg_term", termId);
//modified by Shital on 09/08/2019 [End]
} }
else if(currentColumn.trim().equalsIgnoreCase("city")) //Item change for city else if(currentColumn.trim().equalsIgnoreCase("city")) //Item change for city
{ {
city = checkNull(genericUtility.getColumnValue("city", dom)); city = checkNull(genericUtility.getColumnValue("city", dom));
...@@ -416,26 +489,52 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -416,26 +489,52 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
stateCode = rs.getString(1); stateCode = rs.getString(1);
stateCodeDescr = rs.getString(2); stateCodeDescr = rs.getString(2);
} }
rs.close(); //modified by Shital on 09/08/2019 [Start]
rs = null; //rs.close();
pstmt.close(); //rs = null;
pstmt = null; //pstmt.close();
//pstmt = null;
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//modified by Shital on 09/08/2019 [End]
valueXmlString.append("<city>").append("<![CDATA[" + city +"]]>").append("</city>\r\n");
valueXmlString.append("<state_code>").append("<![CDATA[" + stateCode +"]]>").append("</state_code>\r\n");
valueXmlString.append("<state_descr>").append("<![CDATA[" + stateCodeDescr +"]]>").append("</state_descr>\r\n");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "city", city);
admCommon.setNodeValue(dom, "state_code", stateCode);
admCommon.setNodeValue(dom, "state_descr", stateCodeDescr);
//modified by Shital on 09/08/2019 [End]
valueXmlString.append("<city>").append("<![CDATA[" + city +"]]>").append("</city>\r\n");
valueXmlString.append("<state_code>").append("<![CDATA[" + stateCode +"]]>").append("</state_code>\r\n");
valueXmlString.append("<state_descr>").append("<![CDATA[" + stateCodeDescr +"]]>").append("</state_descr>\r\n");
} }
else else
{ {
valueXmlString.append("<city>").append("<![CDATA[]]>").append("</city>\r\n"); valueXmlString.append("<city>").append("<![CDATA[]]>").append("</city>\r\n");
valueXmlString.append("<state_code>").append("<![CDATA[]]>").append("</state_code>\r\n"); valueXmlString.append("<state_code>").append("<![CDATA[]]>").append("</state_code>\r\n");
valueXmlString.append("<state_descr>").append("<![CDATA[]]>").append("</state_descr>\r\n"); valueXmlString.append("<state_descr>").append("<![CDATA[]]>").append("</state_descr>\r\n");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "city", "");
admCommon.setNodeValue(dom, "state_code", "");
admCommon.setNodeValue(dom, "state_descr", "");
//modified by Shital on 09/08/2019 [End]
}//end of city }//end of city
} }
else if(currentColumn.trim().equalsIgnoreCase("state_code")) //Item change for state_code else if(currentColumn.trim().equalsIgnoreCase("state_code")) //Item change for state_code
{ {
stateCode = checkNull(genericUtility.getColumnValue("state_code", dom)); stateCode = checkNull(genericUtility.getColumnValue("state_code", dom));
if(stateCode != null && stateCode.trim().length() > 0) if(stateCode != null && stateCode.trim().length() > 0)
{ {
sql = "SELECT STATE.DESCR AS STATE_DESCR FROM STATE WHERE STATE.STATE_CODE = ? "; sql = "SELECT STATE.DESCR AS STATE_DESCR FROM STATE WHERE STATE.STATE_CODE = ? ";
...@@ -446,31 +545,48 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -446,31 +545,48 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
{ {
stateCodeDescr = rs.getString("STATE_DESCR"); stateCodeDescr = rs.getString("STATE_DESCR");
} }
rs.close(); //modified by Shital on 09/08/2019 [Start]
rs = null; //rs.close();
pstmt.close(); //rs = null;
pstmt = null; //pstmt.close();
//pstmt = null;
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
//modified by Shital on 09/08/2019 [End]
valueXmlString.append("<state_code>").append("<![CDATA[" + stateCode +"]]>").append("</state_code>\r\n");
valueXmlString.append("<state_descr>").append("<![CDATA[" + stateCodeDescr +"]]>").append("</state_descr>\r\n");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "state_code", stateCode);
admCommon.setNodeValue(dom, "state_descr", stateCodeDescr);
//modified by Shital on 09/08/2019 [End]
valueXmlString.append("<state_code>").append("<![CDATA[" + stateCode +"]]>").append("</state_code>\r\n");
valueXmlString.append("<state_descr>").append("<![CDATA[" + stateCodeDescr +"]]>").append("</state_descr>\r\n");
} }
else else
{ {
valueXmlString.append("<state_code>").append("<![CDATA[ ]>").append("</state_code>\r\n"); valueXmlString.append("<state_code>").append("<![CDATA[ ]>").append("</state_code>\r\n");
valueXmlString.append("<state_descr>").append("<![CDATA[ ]>").append("</state_descr>\r\n"); valueXmlString.append("<state_descr>").append("<![CDATA[ ]>").append("</state_descr>\r\n");
//modified by Shital on 09/08/2019 [Start]
admCommon.setNodeValue(dom, "state_code", " ");
admCommon.setNodeValue(dom, "state_descr", " ");
//modified by Shital on 09/08/2019 [End]
}//end of state_code }//end of state_code
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
break; break;
} }
valueXmlString.append("</Root>"); valueXmlString.append("</Root>");
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -480,10 +596,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -480,10 +596,10 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
} }
finally finally
{ {
try try
{ {
if(conn != null) //modified by Shital on 09/08/2019 [Start]
/*if(conn != null)
{ {
if(rs != null) if(rs != null)
{ {
...@@ -494,15 +610,34 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -494,15 +610,34 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
conn.close(); conn.close();
} }
conn = null; conn = null;*/
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
//modified by Shital on 09/08/2019 [End]
} }
catch(Exception d) catch(Exception d)
{ {
d.printStackTrace(); d.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(d);
//modified by Shital on 09/08/2019 [End]
} }
} }
return valueXmlString.toString(); return valueXmlString.toString();
...@@ -516,7 +651,7 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -516,7 +651,7 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
return input; return input;
} }
private String errorType(Connection conn , String errorCode) private String errorType(Connection conn , String errorCode) throws ITMException
{ {
String msgType = "E"; String msgType = "E";
PreparedStatement pstmt = null ; PreparedStatement pstmt = null ;
...@@ -535,6 +670,9 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -535,6 +670,9 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
catch(Exception ex) catch(Exception ex)
{ {
ex.printStackTrace(); ex.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(ex);
//modified by Shital on 09/08/2019 [End]
} }
finally finally
{ {
...@@ -554,48 +692,46 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -554,48 +692,46 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
} }
} }
return msgType; return msgType;
} }
public boolean isRecordExist(Connection conn , String tableName, String condition)throws ITMException
public boolean isRecordExist(Connection conn , String tableName, String condition)
{ {
PreparedStatement pstmt = null ; PreparedStatement pstmt = null ;
ResultSet rs = null; ResultSet rs = null;
String sql=""; String sql = "";
boolean isExist=false; boolean isExist = false;
int recCount=0; int recCount = 0;
try try
{ {
sql = " SELECT COUNT(*) FROM "+tableName +" "+condition; sql = " SELECT COUNT(*) FROM "+tableName +" "+condition;
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
recCount=rs.getInt(1); recCount=rs.getInt(1);
} }
if(recCount>0) if(recCount > 0)
{ {
isExist=true; isExist=true;
} }
else else
{ {
isExist=false; isExist=false;
} }
} }
catch(Exception ex) catch(Exception ex)
{ {
ex.printStackTrace(); ex.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(ex);
//modified by Shital on 09/08/2019 [End]
} }
finally finally
{ {
...@@ -615,12 +751,13 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas ...@@ -615,12 +751,13 @@ public class WorkLocationMaster extends ValidatorEJB implements WorkLocationMas
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
//modified by Shital on 09/08/2019 [Start]
throw new ITMException(e);
//modified by Shital on 09/08/2019 [End]
} }
} }
System.out.print("---------Final--isExist-------"+isExist); System.out.print("---------Final--isExist-------"+isExist);
return isExist; return isExist;
} }
} }
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