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;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
/**
* Session Bean implementation class AccountsIC
*/
......@@ -29,8 +30,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
E12GenericUtility genericUtility = new E12GenericUtility();
// GenericUtility genericUtility = GenericUtility.getInstance();
//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
// 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
{
Document dom = null;
Document dom1 = null;
......@@ -38,22 +39,26 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
String retString = "";
try
{
if (xmlString != null && xmlString.trim().length() > 0)
if (xmlString != null && xmlString.trim().length() > 0)
{
dom = genericUtility.parseString(xmlString);
}
if (xmlString1 != null && xmlString1.trim().length() > 0)
{
dom1 = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() > 0)
{
dom2 = genericUtility.parseString(xmlString2);
}
retString = wfValData(dom, dom1, dom2, objContext, editFlag, xtraParams, formName);
System.out.println("retString:::" + retString);
}
catch(Exception e)
catch (Exception e)
{
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
e.getMessage();
......@@ -66,8 +71,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
return input == null ? "" : input;
}
//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
// 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
{
// changes and commented by sarita on 01/06/2017
// changed by sarita on 09MAR2018
......@@ -87,7 +92,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
Node childNode = null;
String childNodeName = "";
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 sql = "";
String errCode = "";
......@@ -95,91 +100,59 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
ArrayList<String> errFields = new ArrayList<String>();
String errorType = "", errString = "";
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
// changed by sarita on 09MAR2018
conn = getConnection();
/*connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;*/
/* connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;*/
// changes and commented by sarita for DBConnection on 01/06/2017 :END
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if (objContext != null && objContext.trim().length() > 0)
{
currentFormNo = Integer.parseInt(objContext);
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);
// switch(currentFormName)
// {
if (currentFormNo == 1 || "accounts".equals(formName))
// switch(currentFormName)
// {
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++)
{
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);
childNodeName = childNode.getNodeName();
if ("acct_code__par".equalsIgnoreCase(childNodeName))
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
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;
}
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 (cnt == 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
} // end if block for acct_code__par
else if ("sgroup_code".equalsIgnoreCase(childNodeName))
if (!(acct_code__par.equalsIgnoreCase(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 =?";
sql = "select count(*) as cnt from accounts where acct_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sgroup_code);
pstmt.setString(1, acct_code__par);
rs = pstmt.executeQuery();
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
if (rs != null)
{
rs.close();
rs = null;
......@@ -187,19 +160,87 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
if (cnt == 0)
{
errCode = "VMACCTSGR1";
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} // end if block for sgroup_code
else if ("curr_code".equalsIgnoreCase(childNodeName))
}
} // end if block for acct_code__par
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)
{
curr_code = checkNull(genericUtility.getColumnValue("curr_code", dom)).trim();
System.out.println("curr_code>>>>>" + curr_code);
rs.close();
rs = null;
}
if (cnt == 0)
{
errCode = "VMCUR1";
errList.add(errCode);
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);
sql = "select count(*) as cnt from currency where curr_code =?";
if (acct_code__ntyp != null && acct_code__ntyp.trim().length() > 0)
{
sql = "select count(*) as cnt from accounts where acct_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, curr_code);
pstmt.setString(1, acct_code__ntyp);
rs = pstmt.executeQuery();
if (rs.next())
......@@ -219,130 +260,103 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
if (cnt == 0)
{
errCode = "VMCUR1";
errCode = "VMACCT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
} // end if block for curr_code
}
} // end if block for acct_code__ntyp
else if ("acct_code__ntyp".equalsIgnoreCase(childNodeName))
else if ("sundry_type".equalsIgnoreCase(childNodeName))
{
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom)).trim();
if ("E".equalsIgnoreCase(editFlag))
{
acct_code__ntyp = checkNull(genericUtility.getColumnValue("acct_code__ntyp", dom)).trim();
System.out.println("acct_code__ntyp>>>>>" + acct_code__ntyp);
sql = "select sundry_type from accounts where acct_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acct_code);
rs = pstmt.executeQuery();
if (acct_code__ntyp != null && acct_code__ntyp.trim().length() > 0)
if (rs.next())
{
sql = "select count(*) as cnt from accounts where acct_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, acct_code__ntyp);
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 = "VMACCT";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
sundtype = rs.getString("sundry_type");
}
} // end if block for acct_code__ntyp
else if ("sundry_type".equalsIgnoreCase(childNodeName))
{
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom)).trim();
if ("E".equalsIgnoreCase(editFlag))
if (pstmt != null)
{
sql = "select sundry_type from accounts where acct_code=?";
pstmt = conn.prepareStatement(sql);
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();
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (rs.next())
{
cnt = rs.getInt("cnt");
}
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 (cnt > 0)
{
errCode = "VMACCTSRS1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
if (rs.next())
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
} // end of if block for sundry_type
}
} // end case1
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);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("acct_code"))
{
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
if (acctcode == null || acctcode.length() <= 0)
if (cnt > 0)
{
errCode = "VMACCT1";
errCode = "VMACCTSRS1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("acctcode is not entered");
break;
}
}
} // end of if block for sundry_type
}
} // end case1
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);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("acct_code"))
{
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
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 ("site_code".equalsIgnoreCase(childNodeName))
}
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)
{
String site_code = checkNull(genericUtility.getColumnValue("site_code", dom));
sql = "select count(*) as cnt from site where site_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, site_code);
......@@ -352,12 +366,12 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{
cnt = rs.getInt("cnt");
}
if (pstmt != null)
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
if (rs != null)
{
rs.close();
rs = null;
......@@ -370,13 +384,15 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errFields.add(childNodeName.toLowerCase());
}
}
String updateFlag=null;
NodeList siteParentNode = null;
ArrayList<String> sitecodeall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
{
int ctr2 = 0;
int childNodeListLength2 = 0;
siteParentNode = dom2.getElementsByTagName("Detail"+currentFormNo);
siteParentNode = dom2.getElementsByTagName("Detail" + currentFormNo);
for (ctr2 = 0; ctr2 < siteParentNode.getLength(); ctr2++)
{
Node parentNode2 = siteParentNode.item(ctr2);
......@@ -386,359 +402,382 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{
Node childNode2 = childNodeList2.item(ctr3);
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"))
{
String siteCode = checkNull(genericUtility.getColumnValueFromNode("site_code", parentNode2)).trim();
System.out.println("Node value Site_code " + siteCode);
if (sitecodeall.contains(siteCode))
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
{
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);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for (ctr = 0; ctr < childNodeLength; ctr++)
{
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);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("acct_code"))
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("acct_code"))
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
if (acctcode == null || acctcode.length() == 0)
{
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("acctcode is not entered");
break;
}
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("cctr_code"))
{
String costcntrcode = checkNull(genericUtility.getColumnValue("cctr_code", dom));
}
else if (childNodeName.equalsIgnoreCase("cctr_code"))
if (costcntrcode == null || costcntrcode.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)
{
String costcntrcode = checkNull(genericUtility.getColumnValue("cctr_code", dom));
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();
rs = null;
}
if (costcntrcode == null || costcntrcode.length() <= 0)
if (cnt == 0)
{
errCode = "VMCCTR1";
errCode = "VMCCTR";
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();
rs = null;
}
if (cnt == 0)
{
errCode = "VMCCTR";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
NodeList costParentNode = null;
ArrayList<String> costcntrall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
}
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++)
{
int ctr3 = 0;
int childNodeListLength3 = 0;
costParentNode = dom2.getElementsByTagName("Detail"+currentFormNo);
for (ctr3 = 0; ctr3 < costParentNode.getLength(); ctr3++)
Node parentNode3 = costParentNode.item(ctr3);
NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
{
Node parentNode3 = costParentNode.item(ctr3);
NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("attribute"))
{
Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("cctr_code"))
updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue();
System.out.println("UpdateFlag"+updateFlag);
if ("D".equalsIgnoreCase(updateFlag))
{
String cctr_code = checkNull(genericUtility.getColumnValueFromNode("cctr_code", parentNode3)).trim();
if (costcntrall.contains(cctr_code))
{
System.out.println("0 cctr_code should not be duplicate dom");
errCode = "VMACCTSRS1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
costcntrall.add(cctr_code);
System.out.println("In Else add in array so now array " + costcntrall);
}
break;
}
}
if (childNodeName2.equalsIgnoreCase("cctr_code"))
{
String cctr_code = checkNull(genericUtility.getColumnValueFromNode("cctr_code", parentNode3)).trim();
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
{
costcntrall.add(cctr_code);
}
}
}
}
}
}
}
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++)
{
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);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("acct_code"))
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
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)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("acctcode is not entered");
break;
}
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("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;
}
if (childNodeName.equalsIgnoreCase("anal_code"))
else if (analcode != null && analcode.trim().length() > 0)
{
String analcode = checkNull(genericUtility.getColumnValue("anal_code", dom));
if (analcode == null || analcode.length() <= 0)
sql = "select count(*) as cnt from analysis where anal_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, analcode);
rs = pstmt.executeQuery();
cnt = 0;
if (rs.next())
{
errCode = "VMANAL1";
cnt = rs.getInt("cnt");
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
{
rs.close();
rs = null;
}
if (cnt == 0)
{
errCode = "VTACCANAL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("analcode is not entered");
break;
}
else if (analcode != null && analcode.trim().length() > 0)
{
sql = "select count(*) as cnt from analysis where anal_code =?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, analcode);
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)
{
errCode = "VTACCANAL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
NodeList analParentNode = null;
ArrayList<String> acctanalall = new ArrayList<String>();
if ("A".equalsIgnoreCase(editFlag))
}
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++)
{
int ctr3 = 0;
int childNodeListLength3 = 0;
analParentNode = dom2.getElementsByTagName("Detail"+currentFormNo);
for (ctr3 = 0; ctr3 < analParentNode.getLength(); ctr3++)
Node parentNode3 = analParentNode.item(ctr3);
NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
{
Node parentNode3 = analParentNode.item(ctr3);
NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("attribute"))
{
Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("anal_code"))
updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue();
System.out.println("UpdateFlag"+updateFlag);
if ("D".equalsIgnoreCase(updateFlag))
{
String anal_code = checkNull(genericUtility.getColumnValueFromNode("anal_code", parentNode3)).trim();
if (acctanalall.contains(anal_code))
{
System.out.println("0 anal_code should not be duplicate dom");
errCode = "VTSTKALS";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
acctanalall.add(anal_code);
System.out.println("In Else add in array so now array " + acctanalall);
}
break;
}
}
if (childNodeName2.equalsIgnoreCase("anal_code"))
{
String anal_code = checkNull(genericUtility.getColumnValueFromNode("anal_code", parentNode3)).trim();
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
{
acctanalall.add(anal_code);
}
}
}
}
}
}
}
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++)
{
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);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("acct_code"))
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("acct_code"))
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
if (acctcode == null || acctcode.length() == 0)
{
String acctcode = checkNull(genericUtility.getColumnValue("acct_code", dom));
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));
if (acctcode == null || acctcode.length() <= 0)
{
errCode = "VMACCT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("acctcode is not entered");
break;
}
if (deptcode == null || deptcode.length() <= 0)
{
errCode = "VMDEPT1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("deptcode is not entered");
break;
}
if (childNodeName.equalsIgnoreCase("dept_code"))
else if (deptcode != null && deptcode.trim().length() > 0)
{
String deptcode = checkNull(genericUtility.getColumnValue("dept_code", dom));
sql = "select count(*) as cnt from department where dept_code =?";
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;
}
if (deptcode == null || deptcode.length() <= 0)
if (cnt == 0)
{
errCode = "VMDEPT1";
errCode = "VTDEPTNL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
System.out.println("deptcode is not entered");
break;
}
else if (deptcode != null && deptcode.trim().length() > 0)
}
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++)
{
sql = "select count(*) as cnt from department where dept_code =?";
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;
}
Node parentNode3 = deptParentNode.item(ctr3);
NodeList childNodeList2 = parentNode3.getChildNodes();
if (cnt == 0)
{
errCode = "VTDEPTNL";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
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++)
childNodeListLength3 = childNodeList2.getLength();
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
{
Node parentNode3 = deptParentNode.item(ctr3);
NodeList childNodeList2 = parentNode3.getChildNodes();
childNodeListLength3 = childNodeList2.getLength();
for (int ctr4 = 0; ctr4 < childNodeListLength3; ctr4++)
Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("attribute"))
{
Node childNode2 = childNodeList2.item(ctr4);
String childNodeName2 = childNode2.getNodeName();
if (childNodeName2.equalsIgnoreCase("dept_code"))
updateFlag = ((childNode2.getAttributes()).getNamedItem("updateFlag")).getNodeValue();
System.out.println("UpdateFlag"+updateFlag);
if ("D".equalsIgnoreCase(updateFlag))
{
String dept_code = checkNull(genericUtility.getColumnValueFromNode("dept_code", parentNode3)).trim();
if (acctdeptall.contains(dept_code))
{
System.out.println("0 dept_code should not be duplicate dom");
errCode = "VMDEPTPD02";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
break;
}
else
{
acctdeptall.add(dept_code);
System.out.println("In Else add in array dept so now array " + acctdeptall);
}
break;
}
}
if (childNodeName2.equalsIgnoreCase("dept_code"))
{
String dept_code = checkNull(genericUtility.getColumnValueFromNode("dept_code", parentNode3)).trim();
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;
}
else
{
acctdeptall.add(dept_code);
}
}
}
}
}
}
}
} // end switch
//Changed by Pooja S. on 13-AUG-18 End
}
}// end switch
// Changed by Pooja S. on 13-AUG-18 End
int errListSize = errList.size();
System.out.println("errListSize::::::::::" + errListSize);
int count = 0;
String errFldName = null;
if (errList != null && errListSize > 0)
if (errList != null && errListSize > 0)
{
for (count = 0; count < errListSize; count++)
{
......@@ -750,12 +789,12 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errorType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8, errString.indexOf("</Errors>"));
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8,errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8,errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
errString = "";
}
if (errorType.equalsIgnoreCase("E"))
if (errorType.equalsIgnoreCase("E"))
{
break;
}
......@@ -771,17 +810,18 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
errStringXml = new StringBuffer("");
}
}
// end of try block
catch (Exception e)
{
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
throw new ITMException(e);
}
}
finally
{
try
try
{
if (conn != null)
if (conn != null)
{
if (rs != null)
{
......@@ -796,8 +836,8 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
conn.close();
}
conn = null;
}
catch (Exception d)
}
catch (Exception d)
{
d.printStackTrace();
throw new ITMException(d);
......@@ -807,8 +847,9 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
System.out.println("testing : final errString : " + 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 domhr = null;
......@@ -817,7 +858,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
try
{
System.out.println("************** Inside itemChanged method ****************");
if (xmlString != null && xmlString.trim().length() > 0)
if (xmlString != null && xmlString.trim().length() > 0)
{
dom = genericUtility.parseString(xmlString);
}
......@@ -825,23 +866,24 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{
domhr = genericUtility.parseString(xmlString1);
}
if (xmlString2 != null && xmlString2.trim().length() > 0)
if (xmlString2 != null && xmlString2.trim().length() > 0)
{
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);
System.out.println("retString::::::::::" + retString);
}
catch (Exception e)
catch (Exception e)
{
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
e.getMessage();
}
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;
// Added by sarita on 01/06/2017
......@@ -864,19 +906,18 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
String ls_descr = "";
String ls_descr1 = "", acctgrp_descr = "", curr_code = "";
String currency_descr = "", acct_type = "";
//Changed by Pooja S. on 13-AUG-18
String sh_descr = "", descr = "",
analysisdescr = "", descr4 = "";
// Changed by Pooja S. on 13-AUG-18
String sh_descr = "", descr = "", analysisdescr = "", descr4 = "";
try
{
// changes and commented by sarita for DBConnection on 01/06/2017 :START
// changed by sarita on 09MARCH2018
conn = getConnection();
/*connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;*/
/* connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
conn.setAutoCommit(false);
connDriver = null;*/
// changes and commented by sarita for DBConnection on 01/06/2017 :END
sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
if (objContext != null && objContext.trim().length() > 0)
......@@ -888,38 +929,38 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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);
//Changed by Pooja S. on 13-AUG-18
// Changed by Pooja S. on 13-AUG-18
if (currentFormNo == 1 || "accounts".equals(formName))
{
parentNodeList = dom.getElementsByTagName("Detail"+currentFormNo);
parentNodeList = dom.getElementsByTagName("Detail" + currentFormNo);
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
valueXmlString.append("<Detail"+currentFormNo+">");
valueXmlString.append("<Detail" + currentFormNo + ">");
childNodeListLength = childNodeList.getLength();
do
do
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
ctr++;
} 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__par = checkNull(genericUtility.getColumnValue("acct_code__par", dom));
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));
System.out.println("sgroup_code>>>>>>>>>>"+sgroup_code);
System.out.println("sgroup_code>>>>>>>>>>" + sgroup_code);
sql = "select descr,group_code from acctsgrp where sgroup_code=?";
pstmt = conn.prepareStatement(sql);
......@@ -973,32 +1014,32 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
pstmt.setString(1, curr_code);
rs = pstmt.executeQuery();
if (rs.next())
if (rs.next())
{
currency_descr = rs.getString("descr");
}
if (pstmt != null)
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
if (rs != null)
{
rs.close();
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));
System.out.println("acct_type>>>>>>>>>>" + acct_type);
if (acct_type.equals("O"))
{
valueXmlString.append("<sundry_type protect='1'>").append("<![CDATA["+"1"+"]]>").append("</sundry_type>");
}
else
valueXmlString.append("<sundry_type protect='1'>").append("<![CDATA[" + "1" + "]]>").append("</sundry_type>");
}
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,13 +1048,13 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
acct_code = checkNull(genericUtility.getColumnValue("acct_code", 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
else if ("sgroup_code".equalsIgnoreCase(currentColumn.trim()))
else if ("sgroup_code".equalsIgnoreCase(currentColumn.trim()))
{
sgroup_code = checkNull(genericUtility.getColumnValue("sgroup_code", dom));
System.out.println("sgroup_code>>>>>>>>>>" + sgroup_code);
......@@ -1038,32 +1079,32 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
rs.close();
rs = null;
}
valueXmlString.append("<acctsgrp_descr>").append("<![CDATA["+ls_descr+"]]>").append("</acctsgrp_descr>");
valueXmlString.append("<group_code>").append("<![CDATA["+ls_descr1+"]]>").append("</group_code>");
valueXmlString.append("<acctsgrp_descr>").append("<![CDATA[" + ls_descr + "]]>").append("</acctsgrp_descr>");
valueXmlString.append("<group_code>").append("<![CDATA[" + ls_descr1 + "]]>").append("</group_code>");
sql = "select descr from acctgrp where group_code=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, ls_descr1);
rs = pstmt.executeQuery();
if (rs.next())
if (rs.next())
{
acctgrp_descr = rs.getString("descr");
}
if (pstmt != null)
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
if (rs != null)
if (rs != null)
{
rs.close();
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()))
{
curr_code = checkNull(genericUtility.getColumnValue("curr_code", dom));
System.out.println("curr_code>>>>>>>>>>" + curr_code);
......@@ -1077,7 +1118,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
{
currency_descr = rs.getString("descr");
}
if (pstmt != null)
if (pstmt != null)
{
pstmt.close();
pstmt = null;
......@@ -1087,7 +1128,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
rs.close();
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
else if ("acct_type".equalsIgnoreCase(currentColumn.trim()))
......@@ -1097,20 +1138,20 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
if (acct_type.equals("O"))
{
valueXmlString.append("<sundry_type protect='1'>").append("<![CDATA["+"1"+"]]>").append("</sundry_type>");
}
else
valueXmlString.append("<sundry_type protect='1'>").append("<![CDATA[" + "1" + "]]>").append("</sundry_type>");
}
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
valueXmlString.append("</Detail"+currentFormNo+">");
valueXmlString.append("</Detail" + currentFormNo + ">");
} // end of case1
//Changed by Pooja S. on 13-AUG-18 START
else if (currentFormNo == 2 || "siteaccount".equals(formName))
// Changed by Pooja S. on 13-AUG-18 START
else if (currentFormNo == 2 || "siteaccount".equals(formName))
{
valueXmlString.append("<Detail"+currentFormNo+">");
valueXmlString.append("<Detail" + currentFormNo + ">");
if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
{
String site_code = checkNull(genericUtility.getColumnValue("site_code", dom));
......@@ -1119,26 +1160,26 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
site_code = getValueFromXTRA_PARAMS(xtraParams, "loginSiteCode");
valueXmlString.append("<site_code protect = \"0\">").append("<![CDATA[" + site_code + "]]>").append("</site_code>");
}
acct_code = checkNull(genericUtility.getColumnValue("acct_code", dom));
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))
{
valueXmlString.append("<Detail"+currentFormNo+">");
if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
valueXmlString.append("<Detail" + currentFormNo + ">");
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("<cctr_code protect = \"0\"><![CDATA[]]></cctr_code>");
}
}
else if ("cctr_code".equalsIgnoreCase(currentColumn.trim()))
{
String cctr_code = checkNull(genericUtility.getColumnValue("cctr_code", dom));
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=?";
System.out.print("Value valueXmlString 100000000 \n [" + sql + "]");
......@@ -1159,22 +1200,22 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<sh_descr ><![CDATA[" + sh_descr + "]]></sh_descr>");
}
}
valueXmlString.append("</Detail"+currentFormNo+">");
}
valueXmlString.append("</Detail" + currentFormNo + ">");
}
else if (currentFormNo == 4 || "acctanal".equals(formName))
{
valueXmlString.append("<Detail"+currentFormNo+">");
valueXmlString.append("<Detail" + currentFormNo + ">");
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("<anal_code protect = \"0\"><![CDATA[]]></anal_code>");
}
}
else if ("anal_code".equalsIgnoreCase(currentColumn.trim()))
{
String anal_code = checkNull(genericUtility.getColumnValue("anal_code", dom));
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=?";
System.out.print("Value valueXmlString 100000000 \n [" + sql + "]");
......@@ -1182,7 +1223,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
pstmt.setString(1, anal_code);
rs = pstmt.executeQuery();
if (rs.next())
if (rs.next())
{
analysisdescr = checkNull(rs.getString("descr"));
}
......@@ -1194,18 +1235,18 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<analysis_descr ><![CDATA[" + analysisdescr + "]]></analysis_descr>");
}
}
valueXmlString.append("</Detail"+currentFormNo+">");
}
valueXmlString.append("</Detail" + currentFormNo + ">");
}
else if (currentFormNo == 5 || "acctdept".equals(formName))
{
valueXmlString.append("<Detail"+currentFormNo+">");
if ("itm_default".equalsIgnoreCase(currentColumn.trim()))
valueXmlString.append("<Detail" + currentFormNo + ">");
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("<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));
System.out.print("Value valueXmlString cctr_code\n [" + dept_code + "]");
......@@ -1230,20 +1271,20 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
valueXmlString.append("<department_descr ><![CDATA[" + descr4 + "]]></department_descr>");
}
}
valueXmlString.append("</Detail"+currentFormNo+">");
valueXmlString.append("</Detail" + currentFormNo + ">");
}
valueXmlString.append("</Root>");
// end of switch statement
} // 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)
{
System.out.println(":::" + getClass().getSimpleName() + "::" + e.getMessage());
throw new ITMException(e);
}
finally
}
finally
{
try
try
{
if (conn != null)
{
......@@ -1251,9 +1292,9 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
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() + "]");
}
}
return valueXmlString.toString();
......@@ -1264,13 +1305,13 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
String msgType = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
try
{
String sql = "SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, errorCode);
rs = pstmt.executeQuery();
if (rs.next())
if (rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
......@@ -1279,16 +1320,16 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
pstmt.close();
pstmt = null;
}
catch (Exception ex)
catch (Exception ex)
{
ex.printStackTrace();
throw new ITMException(ex);
}
finally
{
try
try
{
if (rs != null)
if (rs != null)
{
rs.close();
rs = null;
......@@ -1298,7 +1339,7 @@ public class AccountsIC extends ValidatorEJB implements AccountsICRemote, Accoun
pstmt.close();
pstmt = null;
}
}
}
catch (Exception e)
{
e.printStackTrace();
......
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