Commit 43efcf39 authored by psawant's avatar psawant

In edit mode when we delete previously added row and add that row again then...

In edit mode when we delete previously added row and add that row again then system is display error as 'Transaction already exists'.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@190729 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 8ba1b64e
...@@ -23,15 +23,14 @@ import ibase.webitm.utility.ITMException; ...@@ -23,15 +23,14 @@ import ibase.webitm.utility.ITMException;
* Session Bean implementation class AccountsIC * Session Bean implementation class AccountsIC
*/ */
@Stateless @Stateless
public class AccountsIC extends ValidatorEJB implements AccountsICRemote, AccountsICLocal public class AccountsIC extends ValidatorEJB implements AccountsICRemote, AccountsICLocal {
{
// changes and commented by sarita on 01/06/2017 // changes and commented by sarita on 01/06/2017
// changed by sarita on 09MAR2018 // changed by sarita on 09MAR2018
E12GenericUtility genericUtility = new E12GenericUtility(); E12GenericUtility genericUtility = new E12GenericUtility();
// GenericUtility genericUtility = GenericUtility.getInstance(); // GenericUtility genericUtility = GenericUtility.getInstance();
// Changed by Pooja S. on 13-AUG-18 // Changed by Pooja S. on 13-AUG-18
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag,String xtraParams, String formName) throws RemoteException, ITMException public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag,String xtraParams, String formName) throws RemoteException, ITMException
{ {
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
...@@ -39,25 +38,25 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -39,25 +38,25 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
String retString = ""; String retString = "";
try try
{ {
if (xmlString != null && xmlString.trim().length() > 0) if (xmlString != null && xmlString.trim().length() > 0)
{ {
dom = genericUtility.parseString(xmlString); dom = genericUtility.parseString(xmlString);
} }
if (xmlString1 != null && xmlString1.trim().length() > 0) if (xmlString1 != null && xmlString1.trim().length() > 0)
{ {
dom1 = genericUtility.parseString(xmlString1); dom1 = genericUtility.parseString(xmlString1);
} }
if (xmlString2 != null && xmlString2.trim().length() > 0) if (xmlString2 != null && xmlString2.trim().length() > 0)
{ {
dom2 = genericUtility.parseString(xmlString2); dom2 = genericUtility.parseString(xmlString2);
} }
retString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams, formName); retString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams, formName);
System.out.println("retString:::" + retString); System.out.println("retString:::" + retString);
}
}
catch (Exception e) catch (Exception e)
{ {
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage()); System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
...@@ -66,13 +65,13 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -66,13 +65,13 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
return retString; return retString;
} }
private String checkNull(String input) private String checkNull(String input)
{ {
return input == null ? "" : input; return input == null ? "" : input;
} }
// Changed by Pooja S. on 13-AUG-18 // Changed by Pooja S. on 13-AUG-18
public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,String xtraParams, String formName) throws RemoteException, ITMException public String wfValData(Document dom, Document dom1, Document dom2, String objContext, String editFlag,String xtraParams, String formName) throws RemoteException, ITMException
{ {
// changes and commented by sarita on 01/06/2017 // changes and commented by sarita on 01/06/2017
// changed by sarita on 09MAR2018 // changed by sarita on 09MAR2018
...@@ -100,50 +99,80 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -100,50 +99,80 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
ArrayList<String> errFields = new ArrayList<String>(); ArrayList<String> errFields = new ArrayList<String>();
String errorType = "", errString = ""; String errorType = "", errString = "";
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
{ {
// changes and commented by sarita for DBConnection on 01/06/2017 :START // changes and commented by sarita for DBConnection on 01/06/2017 :START
// changed by sarita on 09MAR2018 // changed by sarita on 09MAR2018
conn = getConnection(); conn = getConnection();
/* connDriver = new ConnDriver(); /* connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver = null;*/ connDriver = null;*/
// changes and commented by sarita for DBConnection on 01/06/2017 :END // changes and commented by sarita for DBConnection on 01/06/2017 :END
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = genericUtility.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("currentFormNo:::" + currentFormNo); System.out.println("currentFormNo:::" + currentFormNo);
// Changed by Pooja S. on 13-AUG-18 START // Changed by Pooja S. on 13-AUG-18 START
System.out.println("formName:::" + formName); System.out.println("formName:::" + formName);
// switch(currentFormName)
// switch(currentFormName) // {
// { if (currentFormNo == 1 || "accounts".equals(formName))
if (currentFormNo == 1 || "accounts".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{ {
childNode = childNodeList.item(ctr); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
childNodeName = childNode.getNodeName(); parentNode = parentNodeList.item(0);
if ("acct_code__par".equalsIgnoreCase(childNodeName)) childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{ {
acct_code__par = checkNull(genericUtility.getColumnValue("acct_code__par", dom)).trim(); childNode = childNodeList.item(ctr);
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom)).trim(); childNodeName = childNode.getNodeName();
System.out.println("acct_code__par>>>>>" + acct_code__par); if ("acct_code__par".equalsIgnoreCase(childNodeName))
{
acct_code__par = checkNull(genericUtility.getColumnValue("acct_code__par", dom)).trim();
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom)).trim();
System.out.println("acct_code__par>>>>>" + acct_code__par);
if (!(acct_code__par.equalsIgnoreCase(acct_code)))
{
sql = "select count(*) as cnt from accounts where acct_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acct_code__par);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (!(acct_code__par.equalsIgnoreCase(acct_code))) if (cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
} // end if block for acct_code__par
else if ("sgroup_code".equalsIgnoreCase(childNodeName))
{ {
sql = "select count(*) as cnt from accounts where acct_code =?"; sgroup_code = checkNull(genericUtility.getColumnValue("sgroup_code", dom)).trim();
System.out.println("sgroup_code>>>>>" + sgroup_code);
sql = "select count(*) as cnt from acctsgrp where sgroup_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acct_code__par); pstmt.setString(1, sgroup_code);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next())
if (rs.next())
{ {
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
...@@ -158,270 +187,250 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -158,270 +187,250 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
rs = null; rs = null;
} }
if (cnt == 0) if (cnt == 0)
{ {
errCode = "VMACCT1"; errCode = "VMACCTSGR1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} } // end if block for sgroup_code
} // end if block for acct_code__par else if ("curr_code".equalsIgnoreCase(childNodeName))
else if ("sgroup_code".equalsIgnoreCase(childNodeName))
{
sgroup_code = checkNull(genericUtility.getColumnValue("sgroup_code", dom)).trim();
System.out.println("sgroup_code>>>>>" + sgroup_code);
sql = "select count(*) as cnt from acctsgrp where sgroup_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sgroup_code);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (cnt == 0)
{
errCode = "VMACCTSGR1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} // end if block for sgroup_code
else if ("curr_code".equalsIgnoreCase(childNodeName))
{
curr_code = checkNull(genericUtility.getColumnValue("curr_code", dom)).trim();
System.out.println("curr_code>>>>>" + curr_code);
sql = "select count(*) as cnt from currency where curr_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, curr_code);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (cnt == 0)
{ {
errCode = "VMCUR1"; curr_code = checkNull(genericUtility.getColumnValue("curr_code", dom)).trim();
errList.add(errCode); System.out.println("curr_code>>>>>" + curr_code);
errFields.add(childNodeName.toLowerCase());
}
} // end if block for curr_code
else if ("acct_code__ntyp".equalsIgnoreCase(childNodeName))
{
acct_code__ntyp = checkNull(genericUtility.getColumnValue("acct_code__ntyp", dom)).trim();
System.out.println("acct_code__ntyp>>>>>" + acct_code__ntyp);
if (acct_code__ntyp != null && acct_code__ntyp.trim().length() > 0) sql = "select count(*) as cnt from currency where curr_code =?";
{
sql = "select count(*) as cnt from accounts where acct_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acct_code__ntyp); pstmt.setString(1, curr_code);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
cnt = rs.getInt("cnt"); cnt = rs.getInt("cnt");
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
if (cnt == 0) if (cnt == 0)
{ {
errCode = "VMACCT"; errCode = "VMCUR1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} } // end if block for curr_code
} // end if block for acct_code__ntyp
else if ("sundry_type".equalsIgnoreCase(childNodeName)) else if ("acct_code__ntyp".equalsIgnoreCase(childNodeName))
{
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom)).trim();
if ("E".equalsIgnoreCase(editFlag))
{ {
sql = "select sundry_type from accounts where acct_code=?"; acct_code__ntyp = checkNull(genericUtility.getColumnValue("acct_code__ntyp", dom)).trim();
pstmt = conn.prepareStatement(sql); System.out.println("acct_code__ntyp>>>>>" + acct_code__ntyp);
pstmt.setString(1, acct_code);
rs = pstmt.executeQuery();
if (rs.next()) if (acct_code__ntyp != null && acct_code__ntyp.trim().length() > 0)
{ {
sundtype = rs.getString("sundry_type"); sql = "select count(*) as cnt from accounts where acct_code =?";
} pstmt = conn.prepareStatement(sql);
if (pstmt != null) pstmt.setString(1, acct_code__ntyp);
{ rs = pstmt.executeQuery();
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
sql = "select count(acct_code) as cnt from gltrace where acct_code =?"; if (rs.next())
pstmt = conn.prepareStatement(sql); {
pstmt.setString(1, acct_code); cnt = rs.getInt("cnt");
rs = pstmt.executeQuery(); }
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (rs.next()) if (cnt == 0)
{ {
cnt = rs.getInt("cnt"); errCode = "VMACCT";
} errList.add(errCode);
if (pstmt != null) errFields.add(childNodeName.toLowerCase());
{ }
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
} }
} // end if block for acct_code__ntyp
if (cnt > 0) else if ("sundry_type".equalsIgnoreCase(childNodeName))
{
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom)).trim();
if ("E".equalsIgnoreCase(editFlag))
{ {
errCode = "VMACCTSRS1"; sql = "select sundry_type from accounts where acct_code=?";
errList.add(errCode); pstmt = conn.prepareStatement(sql);
errFields.add(childNodeName.toLowerCase()); pstmt.setString(1, acct_code);
rs = pstmt.executeQuery();
if (rs.next())
{
sundtype = rs.getString("sundry_type");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
sql = "select count(acct_code) as cnt from gltrace where acct_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acct_code);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (cnt > 0)
{
errCode = "VMACCTSRS1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} }
} } // end of if block for sundry_type
} // end of if block for sundry_type }
} } // end case1
} // end case1 else if (currentFormNo == 2 || "siteaccount".equals(formName))
else if (currentFormNo == 2 || "siteaccount".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{ {
childNode = childNodeList.item(ctr); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
childNodeName = childNode.getNodeName(); parentNode = parentNodeList.item(0);
if (childNodeName.equalsIgnoreCase("acct_code")) domID1 = parentNode.getAttributes().getNamedItem("domID").getNodeValue();
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{ {
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom)); childNode = childNodeList.item(ctr);
if (acctcode == null || acctcode.length() == 0) childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("acct_code"))
{ {
errCode = "VMACCT1"; String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
errList.add(errCode); if (acctcode == null || acctcode.length() == 0)
errFields.add(childNodeName.toLowerCase()); {
System.out.println("acctcode is not entered"); errCode = "VMACCT1";
break; errList.add(errCode);
} errFields.add(childNodeName.toLowerCase());
System.out.println("acctcode is not entered");
break;
}
}
else if ("site_code".equalsIgnoreCase(childNodeName))
{
String site_code = checkNull(genericUtility.getColumnValue("site_code", dom));
if (site_code == null || site_code.length() == 0) {
errCode = "VTIVSC";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("Sitecode is not entered");
break;
} }
else if (site_code != null && site_code.trim().length() > 0) else if ("site_code".equalsIgnoreCase(childNodeName))
{ {
sql = "select count(*) as cnt from site where site_code =?"; String site_code = checkNull(genericUtility.getColumnValue("site_code", dom));
pstmt = conn.prepareStatement(sql); if (site_code == null || site_code.length() == 0)
pstmt.setString(1, site_code);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{ {
cnt = rs.getInt("cnt"); errCode = "VTIVSC";
} errList.add(errCode);
if (pstmt != null) errFields.add(childNodeName.toLowerCase());
{ System.out.println("Sitecode is not entered");
pstmt.close(); break;
pstmt = null;
} }
if (rs != null) else if (site_code != null && site_code.trim().length() > 0)
{ {
rs.close(); sql = "select count(*) as cnt from site where site_code =?";
rs = null; pstmt = conn.prepareStatement(sql);
} pstmt.setString(1, site_code);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (cnt == 0) if (cnt == 0)
{ {
errCode = "CONSSITENE"; errCode = "CONSSITENE";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
}
} }
} String updateFlag = null;
String updateFlag=null; NodeList siteParentNode = null;
NodeList siteParentNode = null; ArrayList<String> sitecodeall = new ArrayList<String>();
ArrayList<String> sitecodeall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag)) if ("A".equalsIgnoreCase(editFlag))
{
int ctr2 = 0;
int childNodeListLength2 = 0;
siteParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr2 = 0; ctr2 < siteParentNode.getLength(); ctr2++)
{ {
Node parentNode2 = siteParentNode.item(ctr2); int ctr2 = 0;
NodeList childNodeList2 = parentNode2.getChildNodes(); int childNodeListLength2 = 0;
childNodeListLength2 = childNodeList2.getLength(); siteParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (int ctr3 = 0; ctr3 < childNodeListLength2; ctr3++) for (ctr2 = 0; ctr2 < siteParentNode.getLength(); ctr2++)
{ {
Node childNode2 = childNodeList2.item(ctr3); Node parentNode2 = siteParentNode.item(ctr2);
String childNodeName2 = childNode2.getNodeName(); domID = parentNode2.getAttributes().getNamedItem("domID").getNodeValue();
if (childNodeName2.equalsIgnoreCase("attribute")) NodeList childNodeList2 = parentNode2.getChildNodes();
childNodeListLength2 = childNodeList2.getLength();
if(domID.equals(domID1))
{ {
updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue(); System.out.println("Dom ides are equals");
System.out.println("UpdateFlag"+updateFlag); continue;
if ("D".equalsIgnoreCase(updateFlag))
{
break;
}
} }
if (childNodeName2.equalsIgnoreCase("site_code")) for (int ctr3 = 0; ctr3 < childNodeListLength2; ctr3++)
{ {
String siteCode = checkNull(genericUtility.getColumnValueFromNode("site_code", parentNode2)).trim(); Node childNode2 = childNodeList2.item(ctr3);
if (sitecodeall.contains(site_code)) String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("attribute"))
{
updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue();
System.out.println("UpdateFlag" + updateFlag);
if ("D".equalsIgnoreCase(updateFlag))
{
break;
}
}
if (childNodeName2.equalsIgnoreCase("site_code"))
{ {
System.out.println("0 site_code should not be duplicate dom"); String siteCode = checkNull(genericUtility.getColumnValueFromNode("site_code", parentNode2)).trim();
errCode = "VTDUPSITCD"; if ( ! sitecodeall.contains(siteCode))
errList.add(errCode); {
errFields.add(childNodeName.toLowerCase()); sitecodeall.add(siteCode);
break; }
} }
}
}
if ( sitecodeall.contains(site_code))
{
System.out.println("0 site_code should not be duplicate dom");
errCode = "VTDUPSITCD";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else else
{ {
sitecodeall.add(siteCode); sitecodeall.add(siteCode);
...@@ -429,357 +438,374 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -429,357 +438,374 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} }
} }
} }
}
} }
} }
} }
} else if (currentFormNo == 3 || "acctcostcntre".equals(formName))
else if (currentFormNo == 3 || "acctcostcntre".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{ {
childNode = childNodeList.item(ctr); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
childNodeName = childNode.getNodeName(); parentNode = parentNodeList.item(0);
if (childNodeName.equalsIgnoreCase("acct_code")) domID1 = parentNode.getAttributes().getNamedItem("domID").getNodeValue();
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{ {
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom)); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (acctcode == null || acctcode.length() == 0) if (childNodeName.equalsIgnoreCase("acct_code"))
{ {
errCode = "VMACCT1"; String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("acctcode is not entered");
break;
}
}
else if (childNodeName.equalsIgnoreCase("cctr_code"))
{
String costcntrcode = checkNull(genericUtility.getColumnValue("cctr_code", dom));
if (costcntrcode == null || costcntrcode.length() <= 0) if (acctcode == null || acctcode.length() <= 0)
{
errCode = "VMCCTR1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("costcntrcode is not entered");
break;
}
else if (costcntrcode != null && costcntrcode.trim().length() > 0)
{
sql = "select count(*) as cnt from costctr where cctr_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, costcntrcode);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{ {
rs.close(); errCode = "VMACCT1";
rs = null; errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("acctcode is not entered");
break;
} }
}
else if (childNodeName.equalsIgnoreCase("cctr_code"))
{
String costcntrcode = checkNull(genericUtility.getColumnValue("cctr_code", dom));
if (cnt == 0) if (costcntrcode == null || costcntrcode.length() <= 0)
{ {
errCode = "VMCCTR"; errCode = "VMCCTR1";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
System.out.println("costcntrcode is not entered");
break;
} }
} else if (costcntrcode != null && costcntrcode.trim().length() > 0)
String updateFlag=null;
NodeList costParentNode = null;
ArrayList<String> costcntrall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{
int ctr3 = 0;
int childNodeListLength3 = 0;
costParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr3 = 0; ctr3 < costParentNode.getLength(); ctr3++)
{ {
Node parentNode3 = costParentNode.item(ctr3); sql = "select count(*) as cnt from costctr where cctr_code =?";
NodeList childNodeList2 = parentNode3.getChildNodes(); pstmt = conn.prepareStatement(sql);
childNodeListLength3 = childNodeList2.getLength(); pstmt.setString(1, costcntrcode);
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++) rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{ {
Node childNode2 = childNodeList2.item(ctr4); pstmt.close();
String childNodeName2 = childNode2.getNodeName(); pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (childNodeName2.equalsIgnoreCase("attribute")) if (cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
String updateFlag = null;
NodeList costParentNode = null;
ArrayList<String> costcntrall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{
int ctr3 = 0;
int childNodeListLength3 = 0;
costParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr3 = 0; ctr3 < costParentNode.getLength(); ctr3++)
{
Node parentNode3 = costParentNode.item(ctr3);
domID = parentNode3.getAttributes().getNamedItem("domID").getNodeValue();
NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
if(domID.equals(domID1))
{ {
updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue(); System.out.println("Dom ides are equals");
System.out.println("UpdateFlag"+updateFlag); continue;
if ("D".equalsIgnoreCase(updateFlag))
{
break;
}
} }
if (childNodeName2.equalsIgnoreCase("cctr_code")) for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
{ {
String cctr_code = checkNull(genericUtility.getColumnValueFromNode("cctr_code", parentNode3)).trim(); Node childNode2 = childNodeList2.item(ctr4);
if (costcntrall.contains(costcntrcode)) String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("attribute"))
{ {
System.out.println("0 cctr_code should not be duplicate dom"); updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue();
errCode = "VMACCTSRS1"; System.out.println("UpdateFlag" + updateFlag);
errList.add(errCode); if ("D".equalsIgnoreCase(updateFlag))
errFields.add(childNodeName.toLowerCase()); {
break; break;
}
} }
else if (childNodeName2.equalsIgnoreCase("cctr_code"))
{ {
costcntrall.add(cctr_code); String cctr_code = checkNull(genericUtility.getColumnValueFromNode("cctr_code", parentNode3)).trim();
if ( ! costcntrall.contains(cctr_code))
{
costcntrall.add(cctr_code);
}
} }
} }
} }
if (costcntrall.contains(costcntrcode))
{
System.out.println("0 cctr_code should not be duplicate dom");
errCode = "VMACCTSRS1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
} }
} }
} }
} }
} else if (currentFormNo == 4 || "acctanal".equals(formName))
else if (currentFormNo == 4 || "acctanal".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{ {
childNode = childNodeList.item(ctr); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
childNodeName = childNode.getNodeName(); parentNode = parentNodeList.item(0);
if (childNodeName.equalsIgnoreCase("acct_code")) domID1 = parentNode.getAttributes().getNamedItem("domID").getNodeValue();
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{ {
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom)); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (acctcode == null || acctcode.length() <= 0) if (childNodeName.equalsIgnoreCase("acct_code"))
{ {
errCode = "VMACCT1"; String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
errList.add(errCode); if (acctcode == null || acctcode.length() <= 0)
errFields.add(childNodeName.toLowerCase()); {
System.out.println("acctcode is not entered"); errCode = "VMACCT1";
break; errList.add(errCode);
} errFields.add(childNodeName.toLowerCase());
System.out.println("acctcode is not entered");
break;
}
}
else if (childNodeName.equalsIgnoreCase("anal_code"))
{
String analcode = checkNull(genericUtility.getColumnValue("anal_code", dom));
if (analcode == null || analcode.length() == 0)
{
errCode = "VMANAL1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("analcode is not entered");
break;
} }
else if (analcode != null && analcode.trim().length() > 0) else if (childNodeName.equalsIgnoreCase("anal_code"))
{ {
sql = "select count(*) as cnt from analysis where anal_code =?"; String analcode = checkNull(genericUtility.getColumnValue("anal_code", dom));
pstmt = conn.prepareStatement(sql); if (analcode == null || analcode.length() <= 0)
pstmt.setString(1, analcode);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{ {
cnt = rs.getInt("cnt"); errCode = "VMANAL1";
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (cnt == 0)
{
errCode = "VTACCANAL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
System.out.println("analcode is not entered");
break;
} }
} else if (analcode != null && analcode.trim().length() > 0)
String updateFlag=null;
NodeList analParentNode = null;
ArrayList<String> acctanalall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{
int ctr3 = 0;
int childNodeListLength3 = 0;
analParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr3 = 0; ctr3 < analParentNode.getLength(); ctr3++)
{ {
Node parentNode3 = analParentNode.item(ctr3); sql = "select count(*) as cnt from analysis where anal_code =?";
NodeList childNodeList2 = parentNode3.getChildNodes(); pstmt = conn.prepareStatement(sql);
childNodeListLength3 = childNodeList2.getLength(); pstmt.setString(1, analcode);
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++) rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{ {
Node childNode2 = childNodeList2.item(ctr4); pstmt.close();
String childNodeName2 = childNode2.getNodeName(); pstmt = null;
if (childNodeName2.equalsIgnoreCase("attribute")) }
if (rs != null)
{
rs.close();
rs = null;
}
if (cnt == 0)
{
errCode = "VTACCANAL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
String updateFlag = null;
NodeList analParentNode = null;
ArrayList<String> acctanalall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{
int ctr3 = 0;
int childNodeListLength3 = 0;
analParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr3 = 0; ctr3 < analParentNode.getLength(); ctr3++)
{
Node parentNode3 = analParentNode.item(ctr3);
domID = parentNode3.getAttributes().getNamedItem("domID").getNodeValue();
NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
if(domID.equals(domID1))
{ {
updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue(); System.out.println("Dom ides are equals");
System.out.println("UpdateFlag"+updateFlag); continue;
if ("D".equalsIgnoreCase(updateFlag))
{
break;
}
} }
if (childNodeName2.equalsIgnoreCase("anal_code")) for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
{ {
String anal_code = checkNull(genericUtility.getColumnValueFromNode("anal_code", parentNode3)).trim(); Node childNode2 = childNodeList2.item(ctr4);
if (acctanalall.contains(analcode)) String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("attribute"))
{ {
System.out.println("0 anal_code should not be duplicate dom"); updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue();
errCode = "VTSTKALS"; System.out.println("UpdateFlag" + updateFlag);
errList.add(errCode); if ("D".equalsIgnoreCase(updateFlag))
errFields.add(childNodeName.toLowerCase()); {
break; break;
}
} }
else if (childNodeName2.equalsIgnoreCase("anal_code"))
{ {
acctanalall.add(anal_code); String anal_code = checkNull(genericUtility.getColumnValueFromNode("anal_code", parentNode3)).trim();
if ( ! acctanalall.contains(anal_code))
{
acctanalall.add(anal_code);
}
} }
} }
} }
if (acctanalall.contains(analcode))
{
System.out.println("0 anal_code should not be duplicate dom");
errCode = "VTSTKALS";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
} }
} }
} }
} }
} else if (currentFormNo == 5 || "acctdept".equals(formName))
else if (currentFormNo == 5 || "acctdept".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{ {
childNode = childNodeList.item(ctr); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
childNodeName = childNode.getNodeName(); parentNode = parentNodeList.item(0);
if (childNodeName.equalsIgnoreCase("acct_code")) domID1 = parentNode.getAttributes().getNamedItem("domID").getNodeValue();
{ childNodeList = parentNode.getChildNodes();
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom)); childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
if (acctcode == null || acctcode.length() == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("acctcode is not entered");
break;
}
}
else if (childNodeName.equalsIgnoreCase("dept_code"))
{ {
String deptcode = checkNull(genericUtility.getColumnValue("dept_code", dom)); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (deptcode == null || deptcode.length() <= 0) if (childNodeName.equalsIgnoreCase("acct_code"))
{
errCode = "VMDEPT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("deptcode is not entered");
break;
}
else if (deptcode != null && deptcode.trim().length() > 0)
{ {
sql = "select count(*) as cnt from department where dept_code =?"; String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
pstmt = conn.prepareStatement(sql); if (acctcode == null || acctcode.length() == 0)
pstmt.setString(1, deptcode);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{ {
rs.close(); errCode = "VMACCT1";
rs = null;
}
if (cnt == 0)
{
errCode = "VTDEPTNL";
errList.add(errCode); errList.add(errCode);
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
System.out.println("acctcode is not entered");
break;
} }
} }
String updateFlag=null; else if (childNodeName.equalsIgnoreCase("dept_code"))
NodeList deptParentNode = null;
ArrayList<String> acctdeptall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{ {
int ctr3 = 0; String deptcode = checkNull(genericUtility.getColumnValue("dept_code", dom)).trim();
int childNodeListLength3 = 0; if (deptcode == null || deptcode.length() <= 0)
deptParentNode = dom2.getElementsByTagName("Detail" + currentFormNo); {
for (ctr3 = 0; ctr3 < deptParentNode.getLength(); ctr3++) errCode = "VMDEPT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("deptcode is not entered");
break;
}
else if (deptcode != null && deptcode.trim().length() > 0)
{ {
Node parentNode3 = deptParentNode.item(ctr3); sql = "select count(*) as cnt from department where dept_code =?";
NodeList childNodeList2 = parentNode3.getChildNodes(); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, deptcode);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
childNodeListLength3 = childNodeList2.getLength(); if (cnt == 0)
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++) {
errCode = "VTDEPTNL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
String updateFlag = null;
NodeList deptParentNode = null;
ArrayList<String> acctdeptall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{
int ctr3 = 0;
int childNodeListLength3 = 0;
deptParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr3 = 0; ctr3 < deptParentNode.getLength(); ctr3++)
{ {
Node childNode2 = childNodeList2.item(ctr4); Node parentNode3 = deptParentNode.item(ctr3);
String childNodeName2 = childNode2.getNodeName(); domID = parentNode3.getAttributes().getNamedItem("domID").getNodeValue();
if (childNodeName2.equalsIgnoreCase("attribute")) NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
if(domID.equals(domID1))
{ {
updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue(); System.out.println("Dom ides are equals");
System.out.println("UpdateFlag"+updateFlag); continue;
if ("D".equalsIgnoreCase(updateFlag))
{
break;
}
} }
if (childNodeName2.equalsIgnoreCase("dept_code")) for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
{ {
String dept_code = checkNull(genericUtility.getColumnValueFromNode("dept_code", parentNode3)).trim(); Node childNode2 = childNodeList2.item(ctr4);
if (acctdeptall.contains(deptcode)) String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("attribute"))
{ {
System.out.println("0 dept_code should not be duplicate dom"); updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue();
errCode = "VMDEPTPD02"; System.out.println("UpdateFlag" + updateFlag);
errList.add(errCode); if ("D".equalsIgnoreCase(updateFlag))
errFields.add(childNodeName.toLowerCase()); {
break; break;
}
} }
else if (childNodeName2.equalsIgnoreCase("dept_code"))
{ {
acctdeptall.add(dept_code); String dept_code = checkNull(genericUtility.getColumnValueFromNode("dept_code", parentNode3)).trim();
if ( ! acctdeptall.contains(dept_code))
{
acctdeptall.add(dept_code);
}
} }
} }
} }
if (acctdeptall.contains(deptcode))
{
System.out.println("0 dept_code should not be duplicate dom");
errCode = "VMDEPTPD02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
} }
} }
} }
} }
} }
}// end switch // end switch
// Changed by Pooja S. on 13-AUG-18 End // Changed by Pooja S. on 13-AUG-18 End
int errListSize = errList.size(); int errListSize = errList.size();
System.out.println("errListSize::::::::::" + errListSize); System.out.println("errListSize::::::::::" + errListSize);
int count = 0; int count = 0;
String errFldName = null; String errFldName = null;
if (errList != null && errListSize > 0) if (errList != null && errListSize > 0)
{ {
for (count = 0; count < errListSize; count++) for (count = 0; count < errListSize; count++)
{ {
errCode = errList.get(count); errCode = errList.get(count);
errFldName = errFields.get(count); errFldName = errFields.get(count);
...@@ -787,7 +813,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -787,7 +813,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errString = getErrorString(errFldName, errCode, userId); errString = getErrorString(errFldName, errCode, userId);
System.out.println("errString>>>>>>>>>" + errString); System.out.println("errString>>>>>>>>>" + errString);
errorType = errorType(conn, errCode); errorType = errorType(conn, errCode);
if (errString.length() > 0) if (errString.length() > 0)
{ {
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>")); String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>")); bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
...@@ -804,8 +830,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -804,8 +830,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errFields.clear(); errFields.clear();
errFields = null; errFields = null;
errStringXml.append("</Errors> </Root> \r\n"); errStringXml.append("</Errors> </Root> \r\n");
} }
else else
{ {
errStringXml = new StringBuffer(""); errStringXml = new StringBuffer("");
} }
...@@ -816,19 +842,19 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -816,19 +842,19 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage()); System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
{ {
try try
{ {
if (conn != null) if (conn != null)
{ {
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;
...@@ -849,20 +875,20 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -849,20 +875,20 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} }
// Changed by Pooja S. on 13-AUG-18 // Changed by Pooja S. on 13-AUG-18
public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext,String currentColumn, String editFlag, String xtraParams, String formName)throws RemoteException, ITMException public String itemChanged(String xmlString, String xmlString1, String xmlString2, String objContext,String currentColumn, String editFlag, String xtraParams, String formName)throws RemoteException, ITMException
{ {
Document dom = null; Document dom = null;
Document domhr = null; Document domhr = null;
Document domAll = null; Document domAll = null;
String retString = ""; String retString = "";
try try
{ {
System.out.println("************** Inside itemChanged method ****************"); System.out.println("************** Inside itemChanged method ****************");
if (xmlString != null && xmlString.trim().length() > 0) if (xmlString != null && xmlString.trim().length() > 0)
{ {
dom = genericUtility.parseString(xmlString); dom = genericUtility.parseString(xmlString);
} }
if (xmlString1 != null && xmlString1.trim().length() > 0) if (xmlString1 != null && xmlString1.trim().length() > 0)
{ {
domhr = genericUtility.parseString(xmlString1); domhr = genericUtility.parseString(xmlString1);
} }
...@@ -873,7 +899,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -873,7 +899,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
// Changed by Pooja S. on 13-AUG-18 // Changed by Pooja S. on 13-AUG-18
retString = itemChanged(dom, domhr, domAll, objContext, currentColumn, editFlag, xtraParams, formName); retString = itemChanged(dom, domhr, domAll, objContext, currentColumn, editFlag, xtraParams, formName);
System.out.println("retString::::::::::" + retString); System.out.println("retString::::::::::" + retString);
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage()); System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
...@@ -883,7 +909,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -883,7 +909,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} }
// Changed by Pooja S. on 13-AUG-18 // Changed by Pooja S. on 13-AUG-18
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,String editFlag, String xtraParams, String formName) throws RemoteException, ITMException public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn,String editFlag, String xtraParams, String formName) throws RemoteException, ITMException
{ {
Connection conn = null; Connection conn = null;
// Added by sarita on 01/06/2017 // Added by sarita on 01/06/2017
...@@ -909,18 +935,18 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -909,18 +935,18 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
// Changed by Pooja S. on 13-AUG-18 // Changed by Pooja S. on 13-AUG-18
String sh_descr = "", descr = "", analysisdescr = "", descr4 = ""; String sh_descr = "", descr = "", analysisdescr = "", descr4 = "";
try try
{ {
// changes and commented by sarita for DBConnection on 01/06/2017 :START // changes and commented by sarita for DBConnection on 01/06/2017 :START
// changed by sarita on 09MARCH2018 // changed by sarita on 09MARCH2018
conn = getConnection(); conn = getConnection();
/* connDriver = new ConnDriver(); /* connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM"); conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver = null;*/ connDriver = null;*/
// changes and commented by sarita for DBConnection on 01/06/2017 :END // changes and commented by sarita for DBConnection on 01/06/2017 :END
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
...@@ -929,13 +955,13 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -929,13 +955,13 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append(editFlag).append("</editFlag></header>"); valueXmlString.append(editFlag).append("</editFlag></header>");
/* /*
* switch(currentFormNo) { case 1: * switch(currentFormNo) { case 1:
* { * {
*/ */
// Changed by Pooja S. on 13-AUG-18 // Changed by Pooja S. on 13-AUG-18
System.out.println("Currentform 0 " + formName + "" + currentFormNo); System.out.println("Currentform 0 " + formName + "" + currentFormNo);
// Changed by Pooja S. on 13-AUG-18 // Changed by Pooja S. on 13-AUG-18
if (currentFormNo == 1 || "accounts".equals(formName)) if (currentFormNo == 1 || "accounts".equals(formName))
{ {
parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
...@@ -949,48 +975,45 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -949,48 +975,45 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
ctr++; ctr++;
} while (ctr < childNodeListLength && !childNodeName.equals(currentColumn)); } while (ctr < childNodeListLength && !childNodeName.equals(currentColumn));
if ("itm_defaultedit".equalsIgnoreCase(currentColumn.trim())) if ("itm_defaultedit".equalsIgnoreCase(currentColumn.trim()))
{ {
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom)); acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom));
acct_code__par = checkNull(genericUtility.getColumnValue("acct_code__par", dom)); acct_code__par = checkNull(genericUtility.getColumnValue("acct_code__par", dom));
if (acct_code__par == null || acct_code__par.trim().length() == 0) if (acct_code__par == null || acct_code__par.trim().length() == 0)
{ {
valueXmlString.append("<acct_code__par>").append("<![CDATA[" + acct_code + "]]>").append("</acct_code__par>"); valueXmlString.append("<acct_code__par>").append("<![CDATA[" + acct_code + "]]>").append("</acct_code__par>");
} }
sgroup_code = checkNull(genericUtility.getColumnValue("sgroup_code", dom)); sgroup_code = checkNull(genericUtility.getColumnValue("sgroup_code", dom));
System.out.println("sgroup_code>>>>>>>>>>" + sgroup_code); System.out.println("sgroup_code>>>>>>>>>>" + sgroup_code);
sql = "select descr,group_code from acctsgrp where sgroup_code=?"; sql = "select descr,group_code from acctsgrp where sgroup_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sgroup_code); pstmt.setString(1, sgroup_code);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next())
while (rs.next())
{ {
ls_descr = rs.getString("descr"); ls_descr = rs.getString("descr");
ls_descr1 = rs.getString("group_code"); ls_descr1 = rs.getString("group_code");
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
valueXmlString.append("<acctsgrp_descr>").append("<![CDATA[" + ls_descr + "]]>").append("</acctsgrp_descr>"); valueXmlString.append("<acctsgrp_descr>").append("<![CDATA[" + ls_descr + "]]>").append("</acctsgrp_descr>");
valueXmlString.append("<group_code>").append("<![CDATA[" + ls_descr1 + "]]>").append("</group_code>"); valueXmlString.append("<group_code>").append("<![CDATA[" + ls_descr1 + "]]>").append("</group_code>");
sql = "select descr from acctgrp where group_code=?"; sql = "select descr from acctgrp where group_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, ls_descr1); pstmt.setString(1, ls_descr1);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
acctgrp_descr = rs.getString("descr"); acctgrp_descr = rs.getString("descr");
} }
...@@ -999,16 +1022,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -999,16 +1022,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
valueXmlString.append("<acctgrp_descr>").append("<![CDATA[" + acctgrp_descr + "]]>").append("</acctgrp_descr>"); valueXmlString.append("<acctgrp_descr>").append("<![CDATA[" + acctgrp_descr + "]]>").append("</acctgrp_descr>");
curr_code = checkNull(genericUtility.getColumnValue("curr_code", dom)); curr_code = checkNull(genericUtility.getColumnValue("curr_code", dom));
System.out.println("curr_code>>>>>>>>>>" + curr_code); System.out.println("curr_code>>>>>>>>>>" + curr_code);
sql = "Select descr from currency where curr_code =?"; sql = "Select descr from currency where curr_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, curr_code); pstmt.setString(1, curr_code);
...@@ -1018,76 +1039,72 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1018,76 +1039,72 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
currency_descr = rs.getString("descr"); currency_descr = rs.getString("descr");
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
valueXmlString.append("<currency_descr>").append("<![CDATA[" + currency_descr + "]]>").append("</currency_descr>"); valueXmlString.append("<currency_descr>").append("<![CDATA[" + currency_descr + "]]>").append("</currency_descr>");
acct_type = checkNull(genericUtility.getColumnValue("acct_type", dom)); acct_type = checkNull(genericUtility.getColumnValue("acct_type", dom));
System.out.println("acct_type>>>>>>>>>>" + acct_type); System.out.println("acct_type>>>>>>>>>>" + acct_type);
if (acct_type.equals("O"))
if (acct_type.equals("O"))
{ {
valueXmlString.append("<sundry_type protect='1'>").append("<![CDATA[" + "1" + "]]>").append("</sundry_type>"); valueXmlString.append("<sundry_type protect='1'>").append("<![CDATA[" + "1" + "]]>").append("</sundry_type>");
} }
else else
{ {
valueXmlString.append("<sundry_type protect='O'>").append("<![CDATA[" + "O" + "]]>").append("</sundry_type>"); valueXmlString.append("<sundry_type protect='O'>").append("<![CDATA[" + "O" + "]]>").append("</sundry_type>");
} }
} }
if ("acct_code".equalsIgnoreCase(currentColumn.trim())) if ("acct_code".equalsIgnoreCase(currentColumn.trim()))
{ {
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom)); acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom));
acct_code__par = checkNull(genericUtility.getColumnValue("acct_code__par", dom)); acct_code__par = checkNull(genericUtility.getColumnValue("acct_code__par", dom));
if (acct_code__par == null || acct_code__par.trim().length() == 0) if (acct_code__par == null || acct_code__par.trim().length() == 0)
{ {
valueXmlString.append("<acct_code__par>").append("<![CDATA[" + acct_code + "]]>").append("</acct_code__par>"); valueXmlString.append("<acct_code__par>").append("<![CDATA[" + acct_code + "]]>").append("</acct_code__par>");
} }
} // end of if block for acct_code } // end of if block for acct_code
else if ("sgroup_code".equalsIgnoreCase(currentColumn.trim())) else if ("sgroup_code".equalsIgnoreCase(currentColumn.trim()))
{ {
sgroup_code = checkNull(genericUtility.getColumnValue("sgroup_code", dom)); sgroup_code = checkNull(genericUtility.getColumnValue("sgroup_code", dom));
System.out.println("sgroup_code>>>>>>>>>>" + sgroup_code); System.out.println("sgroup_code>>>>>>>>>>" + sgroup_code);
sql = "select descr,group_code from acctsgrp where sgroup_code=?"; sql = "select descr,group_code from acctsgrp where sgroup_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sgroup_code); pstmt.setString(1, sgroup_code);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while (rs.next()) while (rs.next())
{ {
ls_descr = rs.getString("descr"); ls_descr = rs.getString("descr");
ls_descr1 = rs.getString("group_code"); ls_descr1 = rs.getString("group_code");
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
} }
valueXmlString.append("<acctsgrp_descr>").append("<![CDATA[" + ls_descr + "]]>").append("</acctsgrp_descr>"); valueXmlString.append("<acctsgrp_descr>").append("<![CDATA[" + ls_descr + "]]>").append("</acctsgrp_descr>");
valueXmlString.append("<group_code>").append("<![CDATA[" + ls_descr1 + "]]>").append("</group_code>"); valueXmlString.append("<group_code>").append("<![CDATA[" + ls_descr1 + "]]>").append("</group_code>");
sql = "select descr from acctgrp where group_code=?"; sql = "select descr from acctgrp where group_code=?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, ls_descr1); pstmt.setString(1, ls_descr1);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
acctgrp_descr = rs.getString("descr"); acctgrp_descr = rs.getString("descr");
} }
...@@ -1096,7 +1113,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1096,7 +1113,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
...@@ -1108,22 +1125,21 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1108,22 +1125,21 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
curr_code = checkNull(genericUtility.getColumnValue("curr_code", dom)); curr_code = checkNull(genericUtility.getColumnValue("curr_code", dom));
System.out.println("curr_code>>>>>>>>>>" + curr_code); System.out.println("curr_code>>>>>>>>>>" + curr_code);
sql = "Select descr from currency where curr_code =?"; sql = "Select descr from currency where curr_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, curr_code); pstmt.setString(1, curr_code);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
currency_descr = rs.getString("descr"); currency_descr = rs.getString("descr");
} }
if (pstmt != null) if (pstmt != null)
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if (rs != null) if (rs != null)
{ {
rs.close(); rs.close();
rs = null; rs = null;
...@@ -1131,16 +1147,16 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1131,16 +1147,16 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<currency_descr>").append("<![CDATA[" + currency_descr + "]]>").append("</currency_descr>"); valueXmlString.append("<currency_descr>").append("<![CDATA[" + currency_descr + "]]>").append("</currency_descr>");
} // end of if block for curr_code } // end of if block for curr_code
else if ("acct_type".equalsIgnoreCase(currentColumn.trim())) else if ("acct_type".equalsIgnoreCase(currentColumn.trim()))
{ {
acct_type = checkNull(genericUtility.getColumnValue("acct_type", dom)); acct_type = checkNull(genericUtility.getColumnValue("acct_type", dom));
System.out.println("acct_type>>>>>>>>>>" + acct_type); System.out.println("acct_type>>>>>>>>>>" + acct_type);
if (acct_type.equals("O")) if (acct_type.equals("O"))
{ {
valueXmlString.append("<sundry_type protect='1'>").append("<![CDATA[" + "1" + "]]>").append("</sundry_type>"); valueXmlString.append("<sundry_type protect='1'>").append("<![CDATA[" + "1" + "]]>").append("</sundry_type>");
} }
else else
{ {
valueXmlString.append("<sundry_type protect='O'>").append("<![CDATA[" + "O" + "]]>").append("</sundry_type>"); valueXmlString.append("<sundry_type protect='O'>").append("<![CDATA[" + "O" + "]]>").append("</sundry_type>");
} }
...@@ -1148,14 +1164,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1148,14 +1164,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} // end of if block for acct_type } // end of if block for acct_type
valueXmlString.append("</Detail" + currentFormNo + ">"); valueXmlString.append("</Detail" + currentFormNo + ">");
} // end of case1 } // end of case1
// Changed by Pooja S. on 13-AUG-18 START // Changed by Pooja S. on 13-AUG-18 START
else if (currentFormNo == 2 || "siteaccount".equals(formName)) else if (currentFormNo == 2 || "siteaccount".equals(formName))
{ {
valueXmlString.append("<Detail" + currentFormNo + ">"); valueXmlString.append("<Detail" + currentFormNo + ">");
if ("itm_default".equalsIgnoreCase(currentColumn.trim())) if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
{ {
String site_code = checkNull(genericUtility.getColumnValue("site_code", dom)); String site_code = checkNull(genericUtility.getColumnValue("site_code", dom));
if (site_code == null || site_code.trim().length() == 0) if (site_code == null || site_code.trim().length() == 0)
{ {
site_code = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode"); site_code = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append("<site_code protect = \"0\">").append("<![CDATA[" + site_code + "]]>").append("</site_code>"); valueXmlString.append("<site_code protect = \"0\">").append("<![CDATA[" + site_code + "]]>").append("</site_code>");
...@@ -1166,7 +1182,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1166,7 +1182,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} }
valueXmlString.append("</Detail" + currentFormNo + ">"); valueXmlString.append("</Detail" + currentFormNo + ">");
} }
else if (currentFormNo == 3 || "acctcostcntre".equals(formName)) else if (currentFormNo == 3 || "acctcostcntre".equals(formName))
{ {
valueXmlString.append("<Detail" + currentFormNo + ">"); valueXmlString.append("<Detail" + currentFormNo + ">");
if ("itm_default".equalsIgnoreCase(currentColumn.trim())) if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
...@@ -1175,11 +1191,11 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1175,11 +1191,11 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<acct_code protect = \"1\"><![CDATA[" + acct_code + "]]></acct_code>"); valueXmlString.append("<acct_code protect = \"1\"><![CDATA[" + acct_code + "]]></acct_code>");
valueXmlString.append("<cctr_code protect = \"0\"><![CDATA[]]></cctr_code>"); valueXmlString.append("<cctr_code protect = \"0\"><![CDATA[]]></cctr_code>");
} }
else if ("cctr_code".equalsIgnoreCase(currentColumn.trim())) else if ("cctr_code".equalsIgnoreCase(currentColumn.trim()))
{ {
String cctr_code = checkNull(genericUtility.getColumnValue("cctr_code", dom)); String cctr_code = checkNull(genericUtility.getColumnValue("cctr_code", dom));
System.out.print("Value valueXmlString cctr_code\n [" + cctr_code + "]"); System.out.print("Value valueXmlString cctr_code\n [" + cctr_code + "]");
if (cctr_code != null) if (cctr_code != null)
{ {
sql = "select descr,sh_descr from costctr where cctr_code=?"; sql = "select descr,sh_descr from costctr where cctr_code=?";
System.out.print("Value valueXmlString 100000000 \n [" + sql + "]"); System.out.print("Value valueXmlString 100000000 \n [" + sql + "]");
...@@ -1201,21 +1217,21 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1201,21 +1217,21 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} }
} }
valueXmlString.append("</Detail" + currentFormNo + ">"); valueXmlString.append("</Detail" + currentFormNo + ">");
} }
else if (currentFormNo == 4 || "acctanal".equals(formName)) else if (currentFormNo == 4 || "acctanal".equals(formName))
{ {
valueXmlString.append("<Detail" + currentFormNo + ">"); valueXmlString.append("<Detail" + currentFormNo + ">");
if ("itm_default".equalsIgnoreCase(currentColumn.trim())) if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
{ {
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom)); acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom));
valueXmlString.append("<acct_code protect = \"1\"><![CDATA[" + acct_code + "]]></acct_code>"); valueXmlString.append("<acct_code protect = \"1\"><![CDATA[" + acct_code + "]]></acct_code>");
valueXmlString.append("<anal_code protect = \"0\"><![CDATA[]]></anal_code>"); valueXmlString.append("<anal_code protect = \"0\"><![CDATA[]]></anal_code>");
} }
else if ("anal_code".equalsIgnoreCase(currentColumn.trim())) else if ("anal_code".equalsIgnoreCase(currentColumn.trim()))
{ {
String anal_code = checkNull(genericUtility.getColumnValue("anal_code", dom)); String anal_code = checkNull(genericUtility.getColumnValue("anal_code", dom));
System.out.print("Value valueXmlString cctr_code\n [" + anal_code + "]"); System.out.print("Value valueXmlString cctr_code\n [" + anal_code + "]");
if (anal_code != null) if (anal_code != null)
{ {
sql = "select descr from analysis where anal_code=?"; sql = "select descr from analysis where anal_code=?";
System.out.print("Value valueXmlString 100000000 \n [" + sql + "]"); System.out.print("Value valueXmlString 100000000 \n [" + sql + "]");
...@@ -1223,7 +1239,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1223,7 +1239,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
pstmt.setString(1, anal_code); pstmt.setString(1, anal_code);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
analysisdescr = checkNull(rs.getString("descr")); analysisdescr = checkNull(rs.getString("descr"));
} }
...@@ -1236,7 +1252,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1236,7 +1252,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} }
} }
valueXmlString.append("</Detail" + currentFormNo + ">"); valueXmlString.append("</Detail" + currentFormNo + ">");
} }
else if (currentFormNo == 5 || "acctdept".equals(formName)) else if (currentFormNo == 5 || "acctdept".equals(formName))
{ {
valueXmlString.append("<Detail" + currentFormNo + ">"); valueXmlString.append("<Detail" + currentFormNo + ">");
...@@ -1246,11 +1262,11 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1246,11 +1262,11 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<acct_code protect = \"1\"><![CDATA[" + acct_code + "]]></acct_code>"); valueXmlString.append("<acct_code protect = \"1\"><![CDATA[" + acct_code + "]]></acct_code>");
valueXmlString.append("<dept_code protect = \"0\"><![CDATA[]]></dept_code>"); valueXmlString.append("<dept_code protect = \"0\"><![CDATA[]]></dept_code>");
} }
if ("dept_code".equalsIgnoreCase(currentColumn.trim())) if ("dept_code".equalsIgnoreCase(currentColumn.trim()))
{ {
String dept_code = checkNull(genericUtility.getColumnValue("dept_code", dom)); String dept_code = checkNull(genericUtility.getColumnValue("dept_code", dom));
System.out.print("Value valueXmlString cctr_code\n [" + dept_code + "]"); System.out.print("Value valueXmlString cctr_code\n [" + dept_code + "]");
if (dept_code != null) if (dept_code != null)
{ {
sql = "select descr from department where dept_code=?"; sql = "select descr from department where dept_code=?";
...@@ -1259,7 +1275,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1259,7 +1275,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
pstmt.setString(1, dept_code); pstmt.setString(1, dept_code);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (rs.next()) if (rs.next())
{ {
descr4 = checkNull(rs.getString("descr")); descr4 = checkNull(rs.getString("descr"));
} }
...@@ -1276,22 +1292,22 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1276,22 +1292,22 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("</Root>"); valueXmlString.append("</Root>");
// end of switch statement // end of switch statement
} // end of try block } // end of try block
// Changed by Pooja S. on 13-AUG-18 END // Changed by Pooja S. on 13-AUG-18 END
catch (Exception e) catch (Exception e)
{ {
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage()); System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
throw new ITMException(e); throw new ITMException(e);
} }
finally finally
{ {
try try
{ {
if (conn != null) if (conn != null)
{ {
conn.close(); conn.close();
conn = null; conn = null;
} }
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::itemChanged::[" + e.getMessage() + "]"); System.out.println("Exception in EJB[" + getClass().getSimpleName() + "]::itemChanged::[" + e.getMessage() + "]");
...@@ -1300,18 +1316,18 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1300,18 +1316,18 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
return valueXmlString.toString(); return valueXmlString.toString();
} }
private String errorType(Connection conn, String errorCode) throws ITMException private String errorType(Connection conn, String errorCode) throws ITMException
{ {
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();
if (rs.next()) if (rs.next())
{ {
msgType = rs.getString("MSG_TYPE"); msgType = rs.getString("MSG_TYPE");
} }
...@@ -1319,15 +1335,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1319,15 +1335,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
rs = null; rs = null;
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
catch (Exception ex) catch (Exception ex)
{ {
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex); throw new ITMException(ex);
} }
finally finally
{ {
try try
{ {
if (rs != null) if (rs != 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