Commit eb962545 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@190493 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 541789d6
...@@ -18,6 +18,7 @@ import ibase.system.config.ConnDriver; ...@@ -18,6 +18,7 @@ import ibase.system.config.ConnDriver;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
/** /**
* Session Bean implementation class AccountsIC * Session Bean implementation class AccountsIC
*/ */
...@@ -29,8 +30,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -29,8 +30,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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;
...@@ -41,19 +42,23 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -41,19 +42,23 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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());
e.getMessage(); e.getMessage();
...@@ -66,8 +71,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -66,8 +71,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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
...@@ -87,7 +92,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -87,7 +92,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
Node childNode = null; Node childNode = null;
String childNodeName = ""; String childNodeName = "";
String userId = ""; String userId = "";
String acct_code__par="",sgroup_code="",curr_code="",acct_code__ntyp="",ls_acc="",acct_code="",sundry_type=""; String acct_code__par = "", sgroup_code = "", curr_code = "", acct_code__ntyp = "", ls_acc = "", acct_code = "",sundry_type = "";
String sundtype = ""; String sundtype = "";
String sql = ""; String sql = "";
String errCode = ""; String errCode = "";
...@@ -100,7 +105,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -100,7 +105,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
// 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;*/
...@@ -110,13 +115,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -110,13 +115,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
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); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
...@@ -252,7 +258,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -252,7 +258,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
rs = null; rs = null;
} }
if(cnt == 0) if (cnt == 0)
{ {
errCode = "VMACCT"; errCode = "VMACCT";
errList.add(errCode); errList.add(errCode);
...@@ -318,7 +324,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -318,7 +324,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} // end case1 } // end case1
else if (currentFormNo == 2 || "siteaccount".equals(formName)) else if (currentFormNo == 2 || "siteaccount".equals(formName))
{ {
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
...@@ -329,8 +335,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -329,8 +335,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
if (childNodeName.equalsIgnoreCase("acct_code")) if (childNodeName.equalsIgnoreCase("acct_code"))
{ {
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom)); String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
if (acctcode == null || acctcode.length() == 0)
if (acctcode == null || acctcode.length() <= 0)
{ {
errCode = "VMACCT1"; errCode = "VMACCT1";
errList.add(errCode); errList.add(errCode);
...@@ -343,6 +348,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -343,6 +348,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
else if ("site_code".equalsIgnoreCase(childNodeName)) else if ("site_code".equalsIgnoreCase(childNodeName))
{ {
String site_code = checkNull(genericUtility.getColumnValue("site_code", dom)); 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)
{
sql = "select count(*) as cnt from site where site_code =?"; sql = "select count(*) as cnt from site where site_code =?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, site_code); pstmt.setString(1, site_code);
...@@ -370,13 +384,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -370,13 +384,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
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 ctr2 = 0;
int childNodeListLength2 = 0; int childNodeListLength2 = 0;
siteParentNode = dom2.getElementsByTagName("Detail"+currentFormNo); siteParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr2 = 0; ctr2 < siteParentNode.getLength(); ctr2++) for (ctr2 = 0; ctr2 < siteParentNode.getLength(); ctr2++)
{ {
Node parentNode2 = siteParentNode.item(ctr2); Node parentNode2 = siteParentNode.item(ctr2);
...@@ -386,12 +402,19 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -386,12 +402,19 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
Node childNode2 = childNodeList2.item(ctr3); Node childNode2 = childNodeList2.item(ctr3);
String childNodeName2 = childNode2.getNodeName(); 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")) if (childNodeName2.equalsIgnoreCase("site_code"))
{ {
String siteCode = checkNull(genericUtility.getColumnValueFromNode("site_code", parentNode2)).trim(); String siteCode = checkNull(genericUtility.getColumnValueFromNode("site_code", parentNode2)).trim();
System.out.println("Node value Site_code " + siteCode); if (sitecodeall.contains(site_code))
if (sitecodeall.contains(siteCode))
{ {
System.out.println("0 site_code should not be duplicate dom"); System.out.println("0 site_code should not be duplicate dom");
errCode = "VTDUPSITCD"; errCode = "VTDUPSITCD";
...@@ -402,20 +425,17 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -402,20 +425,17 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
else else
{ {
sitecodeall.add(siteCode); sitecodeall.add(siteCode);
System.out.println("In Else add in array so now array " + sitecodeall);
} }
} }
} }
} }
}
} }
} }
} }
else if (currentFormNo == 3 || "acctcostcntre".equals(formName)) else if (currentFormNo == 3 || "acctcostcntre".equals(formName))
{ {
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
...@@ -427,7 +447,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -427,7 +447,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom)); String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
if (acctcode == null || acctcode.length() <= 0) if (acctcode == null || acctcode.length() == 0)
{ {
errCode = "VMACCT1"; errCode = "VMACCT1";
errList.add(errCode); errList.add(errCode);
...@@ -478,13 +498,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -478,13 +498,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
String updateFlag=null;
NodeList costParentNode = null; NodeList costParentNode = null;
ArrayList<String> costcntrall = new ArrayList<String>(); ArrayList<String> costcntrall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag)) if ("A".equalsIgnoreCase(editFlag))
{ {
int ctr3 = 0; int ctr3 = 0;
int childNodeListLength3 = 0; int childNodeListLength3 = 0;
costParentNode = dom2.getElementsByTagName("Detail"+currentFormNo); costParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr3 = 0; ctr3 < costParentNode.getLength(); ctr3++) for (ctr3 = 0; ctr3 < costParentNode.getLength(); ctr3++)
{ {
Node parentNode3 = costParentNode.item(ctr3); Node parentNode3 = costParentNode.item(ctr3);
...@@ -494,10 +515,20 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -494,10 +515,20 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
Node childNode2 = childNodeList2.item(ctr4); Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName(); 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("cctr_code")) if (childNodeName2.equalsIgnoreCase("cctr_code"))
{ {
String cctr_code = checkNull(genericUtility.getColumnValueFromNode("cctr_code", parentNode3)).trim(); String cctr_code = checkNull(genericUtility.getColumnValueFromNode("cctr_code", parentNode3)).trim();
if (costcntrall.contains(cctr_code)) if (costcntrall.contains(costcntrcode))
{ {
System.out.println("0 cctr_code should not be duplicate dom"); System.out.println("0 cctr_code should not be duplicate dom");
errCode = "VMACCTSRS1"; errCode = "VMACCTSRS1";
...@@ -508,20 +539,17 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -508,20 +539,17 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
else else
{ {
costcntrall.add(cctr_code); costcntrall.add(cctr_code);
System.out.println("In Else add in array so now array " + costcntrall);
} }
} }
} }
} }
} }
} }
} }
} }
else if (currentFormNo == 4 || "acctanal".equals(formName)) else if (currentFormNo == 4 || "acctanal".equals(formName))
{ {
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
...@@ -543,10 +571,10 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -543,10 +571,10 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} }
} }
if (childNodeName.equalsIgnoreCase("anal_code")) else if (childNodeName.equalsIgnoreCase("anal_code"))
{ {
String analcode = checkNull(genericUtility.getColumnValue("anal_code", dom)); String analcode = checkNull(genericUtility.getColumnValue("anal_code", dom));
if (analcode == null || analcode.length() <= 0) if (analcode == null || analcode.length() == 0)
{ {
errCode = "VMANAL1"; errCode = "VMANAL1";
errList.add(errCode); errList.add(errCode);
...@@ -582,13 +610,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -582,13 +610,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
String updateFlag=null;
NodeList analParentNode = null; NodeList analParentNode = null;
ArrayList<String> acctanalall = new ArrayList<String>(); ArrayList<String> acctanalall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag)) if ("A".equalsIgnoreCase(editFlag))
{ {
int ctr3 = 0; int ctr3 = 0;
int childNodeListLength3 = 0; int childNodeListLength3 = 0;
analParentNode = dom2.getElementsByTagName("Detail"+currentFormNo); analParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr3 = 0; ctr3 < analParentNode.getLength(); ctr3++) for (ctr3 = 0; ctr3 < analParentNode.getLength(); ctr3++)
{ {
Node parentNode3 = analParentNode.item(ctr3); Node parentNode3 = analParentNode.item(ctr3);
...@@ -598,10 +627,19 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -598,10 +627,19 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
Node childNode2 = childNodeList2.item(ctr4); Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName(); 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("anal_code")) if (childNodeName2.equalsIgnoreCase("anal_code"))
{ {
String anal_code = checkNull(genericUtility.getColumnValueFromNode("anal_code", parentNode3)).trim(); String anal_code = checkNull(genericUtility.getColumnValueFromNode("anal_code", parentNode3)).trim();
if (acctanalall.contains(anal_code)) if (acctanalall.contains(analcode))
{ {
System.out.println("0 anal_code should not be duplicate dom"); System.out.println("0 anal_code should not be duplicate dom");
errCode = "VTSTKALS"; errCode = "VTSTKALS";
...@@ -612,21 +650,17 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -612,21 +650,17 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
else else
{ {
acctanalall.add(anal_code); acctanalall.add(anal_code);
System.out.println("In Else add in array so now array " + acctanalall);
} }
} }
} }
} }
} }
} }
} }
} }
else if (currentFormNo == 5 || "acctdept".equals(formName)) else if (currentFormNo == 5 || "acctdept".equals(formName))
{ {
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo); parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0); parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength(); childNodeLength = childNodeList.getLength();
...@@ -638,7 +672,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -638,7 +672,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom)); String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
if (acctcode == null || acctcode.length() <= 0) if (acctcode == null || acctcode.length() == 0)
{ {
errCode = "VMACCT1"; errCode = "VMACCT1";
errList.add(errCode); errList.add(errCode);
...@@ -647,7 +681,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -647,7 +681,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
break; break;
} }
} }
if (childNodeName.equalsIgnoreCase("dept_code")) else if (childNodeName.equalsIgnoreCase("dept_code"))
{ {
String deptcode = checkNull(genericUtility.getColumnValue("dept_code", dom)); String deptcode = checkNull(genericUtility.getColumnValue("dept_code", dom));
...@@ -688,13 +722,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -688,13 +722,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errFields.add(childNodeName.toLowerCase()); errFields.add(childNodeName.toLowerCase());
} }
} }
String updateFlag=null;
NodeList deptParentNode = null; NodeList deptParentNode = null;
ArrayList<String> acctdeptall = new ArrayList<String>(); ArrayList<String> acctdeptall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag)) if ("A".equalsIgnoreCase(editFlag))
{ {
int ctr3 = 0; int ctr3 = 0;
int childNodeListLength3 = 0; int childNodeListLength3 = 0;
deptParentNode = dom2.getElementsByTagName("Detail"+currentFormNo); deptParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr3 = 0; ctr3 < deptParentNode.getLength(); ctr3++) for (ctr3 = 0; ctr3 < deptParentNode.getLength(); ctr3++)
{ {
Node parentNode3 = deptParentNode.item(ctr3); Node parentNode3 = deptParentNode.item(ctr3);
...@@ -705,10 +740,19 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -705,10 +740,19 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
Node childNode2 = childNodeList2.item(ctr4); Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName(); 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("dept_code")) if (childNodeName2.equalsIgnoreCase("dept_code"))
{ {
String dept_code = checkNull(genericUtility.getColumnValueFromNode("dept_code", parentNode3)).trim(); String dept_code = checkNull(genericUtility.getColumnValueFromNode("dept_code", parentNode3)).trim();
if (acctdeptall.contains(dept_code)) if (acctdeptall.contains(deptcode))
{ {
System.out.println("0 dept_code should not be duplicate dom"); System.out.println("0 dept_code should not be duplicate dom");
errCode = "VMDEPTPD02"; errCode = "VMDEPTPD02";
...@@ -719,21 +763,16 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -719,21 +763,16 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
else else
{ {
acctdeptall.add(dept_code); acctdeptall.add(dept_code);
System.out.println("In Else add in array dept so now array " + acctdeptall);
} }
} }
} }
} }
} }
} }
} }
} }
} // 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;
...@@ -750,8 +789,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -750,8 +789,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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>"));
errStringXml.append(bifurErrString); errStringXml.append(bifurErrString);
errString = ""; errString = "";
} }
...@@ -771,6 +810,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -771,6 +810,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errStringXml = new StringBuffer(""); errStringXml = new StringBuffer("");
} }
} }
// end of try block // end of try block
catch (Exception e) catch (Exception e)
{ {
...@@ -807,8 +847,9 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -807,8 +847,9 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
System.out.println("testing : final errString : " + errString); System.out.println("testing : final errString : " + errString);
return errString; return errString;
} }
//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 // 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
{ {
Document dom = null; Document dom = null;
Document domhr = null; Document domhr = null;
...@@ -829,7 +870,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -829,7 +870,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{ {
domAll = genericUtility.parseString(xmlString2); domAll = genericUtility.parseString(xmlString2);
} }
//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);
} }
...@@ -840,8 +881,9 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -840,8 +881,9 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} }
return retString; return retString;
} }
//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 // 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
{ {
Connection conn = null; Connection conn = null;
// Added by sarita on 01/06/2017 // Added by sarita on 01/06/2017
...@@ -864,16 +906,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -864,16 +906,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
String ls_descr = ""; String ls_descr = "";
String ls_descr1 = "", acctgrp_descr = "", curr_code = ""; String ls_descr1 = "", acctgrp_descr = "", curr_code = "";
String currency_descr = "", acct_type = ""; String currency_descr = "", acct_type = "";
//Changed by Pooja S. on 13-AUG-18 // Changed by Pooja S. on 13-AUG-18
String sh_descr = "", descr = "", String sh_descr = "", descr = "", analysisdescr = "", descr4 = "";
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;*/
...@@ -891,15 +932,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -891,15 +932,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
* 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);
childNodeList = parentNode.getChildNodes(); childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail"+currentFormNo+">"); valueXmlString.append("<Detail" + currentFormNo + ">");
childNodeListLength = childNodeList.getLength(); childNodeListLength = childNodeList.getLength();
do do
{ {
...@@ -915,11 +956,11 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -915,11 +956,11 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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);
...@@ -987,18 +1028,18 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -987,18 +1028,18 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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>");
} }
} }
...@@ -1007,9 +1048,9 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1007,9 +1048,9 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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
...@@ -1038,8 +1079,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1038,8 +1079,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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);
...@@ -1060,7 +1101,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1060,7 +1101,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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>");
} }
else if ("curr_code".equalsIgnoreCase(currentColumn.trim())) else if ("curr_code".equalsIgnoreCase(currentColumn.trim()))
...@@ -1087,7 +1128,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1087,7 +1128,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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>");
} // 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()))
...@@ -1097,20 +1138,20 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1097,20 +1138,20 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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>");
} }
} // 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));
...@@ -1123,14 +1164,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1123,14 +1164,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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("</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()))
{ {
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("<cctr_code protect = \"0\"><![CDATA[]]></cctr_code>"); valueXmlString.append("<cctr_code protect = \"0\"><![CDATA[]]></cctr_code>");
} }
...@@ -1159,14 +1200,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1159,14 +1200,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<sh_descr ><![CDATA[" + sh_descr + "]]></sh_descr>"); valueXmlString.append("<sh_descr ><![CDATA[" + sh_descr + "]]></sh_descr>");
} }
} }
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>");
} }
...@@ -1194,14 +1235,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1194,14 +1235,14 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<analysis_descr ><![CDATA[" + analysisdescr + "]]></analysis_descr>"); valueXmlString.append("<analysis_descr ><![CDATA[" + analysisdescr + "]]></analysis_descr>");
} }
} }
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 + ">");
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("<dept_code protect = \"0\"><![CDATA[]]></dept_code>"); valueXmlString.append("<dept_code protect = \"0\"><![CDATA[]]></dept_code>");
} }
...@@ -1230,12 +1271,12 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1230,12 +1271,12 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<department_descr ><![CDATA[" + descr4 + "]]></department_descr>"); valueXmlString.append("<department_descr ><![CDATA[" + descr4 + "]]></department_descr>");
} }
} }
valueXmlString.append("</Detail"+currentFormNo+">"); valueXmlString.append("</Detail" + currentFormNo + ">");
} }
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());
...@@ -1253,7 +1294,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun ...@@ -1253,7 +1294,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
} }
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() + "]");
} }
} }
return valueXmlString.toString(); return valueXmlString.toString();
......
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