Commit b42c9304 authored by ssalve's avatar ssalve

Sarita : Committed on 08MARCH2019

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@198175 ce508802-f39f-4f6c-b175-0d175dae99d5
parent f0fd0972
...@@ -4,14 +4,21 @@ import java.rmi.RemoteException; ...@@ -4,14 +4,21 @@ import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.HashMap;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ProcessEJB; import ibase.webitm.ejb.ProcessEJB;
import ibase.webitm.ejb.sys.UtilMethods;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
@Stateless @Stateless
...@@ -20,7 +27,6 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -20,7 +27,6 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
ibase.utility.E12GenericUtility genericUtility= new ibase.utility.E12GenericUtility(); ibase.utility.E12GenericUtility genericUtility= new ibase.utility.E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String getData(String xmlString, String xmlString2, String xtraParams) throws RemoteException,ITMException public String getData(String xmlString, String xmlString2, String xtraParams) throws RemoteException,ITMException
{ {
String rtrStr = ""; String rtrStr = "";
...@@ -37,7 +43,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -37,7 +43,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
detailDom = genericUtility.parseString(xmlString2); detailDom = genericUtility.parseString(xmlString2);
} }
rtrStr = getData(headerDom, detailDom, xtraParams); rtrStr = getData(headerDom, detailDom, xtraParams);
System.out.println("Inside getDate returnString is :::"+rtrStr); System.out.println("Inside getDate returnString is 8888:::"+rtrStr);
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -47,12 +53,12 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -47,12 +53,12 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
} }
return rtrStr; return rtrStr;
}//END OF GETDATA(1) }//END OF GETDATA(1)
public String getData(Document headerDom, Document detailDom, String xtraParams) throws RemoteException,ITMException public String getData(Document headerDom, Document detailDom, String xtraParams) throws RemoteException,ITMException
{ {
String resultString = "", errString= ""; String resultString = "", errString= "";
String lsFrEmp = "",lsToEmp = "",lsFrSite = "",lsToSite = "",lsProcfr = "",lsProcto = "", String lsFrEmp = "",lsToEmp = "",lsFrSite = "",lsToSite = "",lsProcfr = "",lsProcto = "",
lsAdTtax = "",lsAdTpaid = "",lsPrd = "",userId = ""; lsAdTtax = "",lsAdTpaid = "",lsPrd = "",userId = "";
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
boolean isError = false; boolean isError = false;
...@@ -63,7 +69,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -63,7 +69,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
{ {
System.out.println("Inside getData method "); System.out.println("Inside getData method ");
conn = getConnection(); conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
lsPrd = checkNullAndTrim(genericUtility.getColumnValue("acct_prd",headerDom)); lsPrd = checkNullAndTrim(genericUtility.getColumnValue("acct_prd",headerDom));
lsFrEmp = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr",headerDom)); lsFrEmp = checkNullAndTrim(genericUtility.getColumnValue("emp_code__fr",headerDom));
...@@ -72,7 +78,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -72,7 +78,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
lsToSite = checkNullAndTrim(genericUtility.getColumnValue("site_code__to",headerDom)); lsToSite = checkNullAndTrim(genericUtility.getColumnValue("site_code__to",headerDom));
lsProcfr = checkNullAndTrim(genericUtility.getColumnValue("proc_group__from",headerDom)); lsProcfr = checkNullAndTrim(genericUtility.getColumnValue("proc_group__from",headerDom));
lsProcto = checkNullAndTrim(genericUtility.getColumnValue("proc_group__to",headerDom)); lsProcto = checkNullAndTrim(genericUtility.getColumnValue("proc_group__to",headerDom));
if(lsFrEmp == null || lsFrEmp.trim().length() == 0) if(lsFrEmp == null || lsFrEmp.trim().length() == 0)
{ {
lsFrEmp = "0"; lsFrEmp = "0";
...@@ -100,54 +106,53 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -100,54 +106,53 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
{ {
lsProcto = "ZZZZZ"; lsProcto = "ZZZZZ";
} }
lsAdTtax = objAdmCommon.getEnv("999999","IYEAR",conn); lsAdTtax = objAdmCommon.getEnv("999999","IYEAR",conn);
lsAdTpaid = objAdmCommon.getEnv("999999","IPAYABLE",conn); lsAdTpaid = objAdmCommon.getEnv("999999","IPAYABLE",conn);
System.out.println("Value of lsAdTtax ["+lsAdTtax+"] \t Value of lsAdTpaid ["+lsAdTpaid+"]"); System.out.println("Value of lsAdTtax ["+lsAdTtax+"] \t Value of lsAdTpaid ["+lsAdTpaid+"]");
if((lsAdTtax != null && lsAdTtax.trim().length() > 0) && (lsAdTtax.equalsIgnoreCase("NULLFOUND"))) if((lsAdTtax != null && lsAdTtax.trim().length() > 0) && (lsAdTtax.equalsIgnoreCase("NULLFOUND")))
{ {
errString = itmDBAccessEJB.getErrorString("","VSENVAR1","",userId,conn); errString = itmDBAccessEJB.getErrorString("","VSENVAR1","",userId,conn);
isError = true; isError = true;
return errString; return errString;
} }
if(lsAdTpaid != null && lsAdTpaid.trim().length() > 0 && (lsAdTpaid.equalsIgnoreCase("NULLFOUND"))) if(lsAdTpaid != null && lsAdTpaid.trim().length() > 0 && (lsAdTpaid.equalsIgnoreCase("NULLFOUND")))
{ {
errString = itmDBAccessEJB.getErrorString("","VSENVAR1","",userId,conn); errString = itmDBAccessEJB.getErrorString("","VSENVAR1","",userId,conn);
isError = true; isError = true;
return errString; return errString;
} }
StringBuffer retTabSepStrBuff = new StringBuffer("<?xml version = \"1.0\"?>"); StringBuffer retTabSepStrBuff = new StringBuffer("<?xml version = \"1.0\"?>");
retTabSepStrBuff.append("<DocumentRoot>"); retTabSepStrBuff.append("<DocumentRoot>");
retTabSepStrBuff.append("<description>").append("Datawindow Root").append("</description>"); retTabSepStrBuff.append("<description>").append("Datawindow Root").append("</description>");
retTabSepStrBuff.append("<group0>"); retTabSepStrBuff.append("<group0>");
retTabSepStrBuff.append("<description>").append("Group0 description").append("</description>"); retTabSepStrBuff.append("<description>").append("Group0 description").append("</description>");
retTabSepStrBuff.append("<Header0>"); retTabSepStrBuff.append("<Header0>");
sql = "select itcalhdr.acct_prd , " + sql = "select itcalhdr.acct_prd , " +
"employee.emp_code , " + "employee.emp_code , " +
"employee.emp_fname || ' ' || employee.emp_mname || ' ' || employee.emp_lname as emp_name, " + "employee.emp_fname || ' ' || employee.emp_mname || ' ' || employee.emp_lname as emp_name, " +
"employee.pay_site as site_code, " + "employee.pay_site as site_code, " +
"employee.proc_group as proc_group, " + "employee.proc_group as proc_group, " +
"case when itcaldet1.amount is null then 0 else itcaldet1.amount end as itax, " + "case when itcaldet1.amount is null then 0 else itcaldet1.amount end as itax, " +
"case when itcaldet2.amount is null then 0 else itcaldet2.amount end as taxpaid, " + "case when itcaldet2.amount is null then 0 else itcaldet2.amount end as taxpaid, " +
"(case when itcaldet1.amount is null then 0 else itcaldet1.amount end - case when itcaldet2.amount is null then 0 else itcaldet2.amount end) as itpayable " + "(case when itcaldet1.amount is null then 0 else itcaldet1.amount end - case when itcaldet2.amount is null then 0 else itcaldet2.amount end) as itpayable " +
"from IT_CALCHDR itcalhdr, EMPLOYEE employee , IT_CALCDET itcaldet1 , IT_CALCDET itcaldet2 " + "from IT_CALCHDR itcalhdr, EMPLOYEE employee , IT_CALCDET itcaldet1 , IT_CALCDET itcaldet2 " +
"where (itcalhdr.emp_code = employee.emp_code) " + "where (itcalhdr.emp_code = employee.emp_code) " +
"and itcalhdr.acct_prd = ? " + "and itcalhdr.acct_prd = ? " +
"and case when itcalhdr.confirmed is null then 'N' else itcalhdr.confirmed end <> 'Y' " + "and case when itcalhdr.confirmed is null then 'N' else itcalhdr.confirmed end <> 'Y' " +
"and employee.emp_code between ? and ? " + "and employee.emp_code between ? and ? " +
"and employee.pay_site between ? and ? " + "and employee.pay_site between ? and ? " +
"and employee.proc_group between ? and ? " + "and employee.proc_group between ? and ? " +
"and itcaldet1.emp_code = employee.emp_code " + "and itcaldet1.emp_code = employee.emp_code " +
"and itcaldet1.acct_prd = ? " + "and itcaldet1.acct_prd = ? " +
"and itcaldet1.ad_code = ? " + "and itcaldet1.ad_code = ? " +
"and itcaldet2.emp_code = employee.emp_code " + "and itcaldet2.emp_code = employee.emp_code " +
"and itcaldet2.acct_prd = ? " + "and itcaldet2.acct_prd = ? " +
"and itcaldet2.ad_code = ?"; "and itcaldet2.ad_code = ?";
System.out.println("sql..."+ sql); System.out.println("sql..."+ sql);
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,lsPrd ); pstmt.setString(1,lsPrd );
...@@ -175,7 +180,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -175,7 +180,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
retTabSepStrBuff.append("<itpayable>").append("<![CDATA[" + rs.getString("itpayable") + "]]>").append("</itpayable>\r\n"); retTabSepStrBuff.append("<itpayable>").append("<![CDATA[" + rs.getString("itpayable") + "]]>").append("</itpayable>\r\n");
retTabSepStrBuff.append("</Detail2>"); retTabSepStrBuff.append("</Detail2>");
} }
retTabSepStrBuff.append("</Header0>\r\n"); retTabSepStrBuff.append("</Header0>\r\n");
retTabSepStrBuff.append("</group0>\r\n"); retTabSepStrBuff.append("</group0>\r\n");
retTabSepStrBuff.append("</DocumentRoot>\r\n"); retTabSepStrBuff.append("</DocumentRoot>\r\n");
if(rs != null) if(rs != null)
...@@ -188,8 +193,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -188,8 +193,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
} }
resultString = retTabSepStrBuff.toString(); resultString = retTabSepStrBuff.toString(); System.out.println("ResultString....." + resultString);
System.out.println("ResultString....." + resultString);
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -200,6 +204,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -200,6 +204,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
conn.rollback(); conn.rollback();
} }
catch(Exception d) {throw new ITMException(d);} catch(Exception d) {throw new ITMException(d);}
throw new ITMException(e);
} }
finally finally
{ {
...@@ -235,14 +240,16 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -235,14 +240,16 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
} }
return resultString; return resultString;
}//END OF GETDATA(2) }//END OF GETDATA(2)
public String process(String xmlString, String xmlString2, String xtraParams) throws RemoteException,ITMException public String process(String xmlString, String xmlString2, String xtraParams) throws RemoteException,ITMException
{ {
Document detailDom = null; Document detailDom = null;
Document headerDom = null; Document headerDom = null;
String retStr = ""; String retStr = "";
try try
{ {
System.out.println("xmlString ::: ["+xmlString+"] \t xmlString2 ["+xmlString2+"]");
if(xmlString != null && xmlString.trim().length() > 0) if(xmlString != null && xmlString.trim().length() > 0)
{ {
headerDom = genericUtility.parseString(xmlString); headerDom = genericUtility.parseString(xmlString);
...@@ -252,6 +259,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -252,6 +259,7 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
detailDom = genericUtility.parseString(xmlString2); detailDom = genericUtility.parseString(xmlString2);
} }
retStr = process(headerDom, detailDom, xtraParams); retStr = process(headerDom, detailDom, xtraParams);
System.out.println("Process forEmpITConfPrc ::"+retStr); System.out.println("Process forEmpITConfPrc ::"+retStr);
} }
catch (Exception e) catch (Exception e)
...@@ -260,12 +268,14 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -260,12 +268,14 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e); throw new ITMException(e);
} }
return retStr; return retStr;
}//END OF PROCESS (1) }//END OF PROCESS (1)
public String process(Document headerDom, Document detailDom, String xtraParams) throws RemoteException,ITMException public String process(Document headerDom, Document detailDom, String xtraParams) throws Exception
{ {
String errString="",childNodeName="",employeeCode = "",accountPrd = ""; String errString="",childNodeName="",employeeCode = "",accountPrd = "";
String errorCode = "";
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
Node parentNode = null; Node parentNode = null;
...@@ -273,13 +283,23 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -273,13 +283,23 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
int parentNodeListLength = 0 , childNodeListLength = 0,cnt1 = 0; int parentNodeListLength = 0 , childNodeListLength = 0,cnt1 = 0;
Connection conn = null; Connection conn = null;
boolean isError = false; boolean isError = false;
String succstring = ""; String succstring = "";
String succLine = "Successfully processed IT confirmation for below employee's :"; String succLine = "Successfully processed IT confirmation for below employee's :";
int totConfRec = 0 , totRejRec = 0 , totFinRec = 0;
int hdrNoEmp = 0;
String retStr = "",errMsg = "";
try try
{ {
System.out.println("Inside process method [DETAIL DOM]"+genericUtility.serializeDom(detailDom)+"]"); setNodeValue(headerDom, "noof_confirmed", "0");
conn = getConnection(); setNodeValue(headerDom, "noof_rejected", "0");
System.out.println("Inside process method [HEADER DOM]"+genericUtility.serializeDom(headerDom)+"\n Inside process method [DETAIL DOM]"+genericUtility.serializeDom(detailDom));
conn = getConnection();
hdrNoEmp = Integer.valueOf(genericUtility.getColumnValue("no_employee",headerDom));
System.out.println("hdrNoEmp is === ["+hdrNoEmp+"]" );
parentNodeList = detailDom.getElementsByTagName("Detail2"); parentNodeList = detailDom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength(); parentNodeListLength = parentNodeList.getLength();
cnt1 = getNumOfNonDelDetail(detailDom,2); cnt1 = getNumOfNonDelDetail(detailDom,2);
...@@ -289,7 +309,8 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -289,7 +309,8 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
errString = itmDBAccessEJB.getErrorString("","VTBLNKDTL","","",conn); errString = itmDBAccessEJB.getErrorString("","VTBLNKDTL","","",conn);
return errString; return errString;
} }
System.out.println("9999["+genericUtility.serializeDom(headerDom)+"]");
for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++) for (int selectedRow = 0; selectedRow < parentNodeListLength; selectedRow++)
{ {
parentNode = parentNodeList.item(selectedRow); parentNode = parentNodeList.item(selectedRow);
...@@ -309,23 +330,24 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -309,23 +330,24 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
accountPrd = childNode.getFirstChild().getNodeValue(); accountPrd = childNode.getFirstChild().getNodeValue();
} }
System.out.println("employeeCode is ["+employeeCode+"] \t accountPrd is ["+accountPrd+"]"); System.out.println("employeeCode is ["+employeeCode+"] \t accountPrd is ["+accountPrd+"]");
} }
errString = gbfConfIt(accountPrd,employeeCode,xtraParams,conn); errorCode = gbfConfIt(accountPrd,employeeCode,xtraParams,conn);
System.out.println("errString is "+errString); System.out.println("Value returned from gbfConfIt Method ["+errorCode+"]");
if((errString !=null && errString.trim().length() > 0 ) && (!(errString.contains("VTSUCC1")))) if((errorCode !=null && errorCode.trim().length() > 0 ) && (!(errorCode.contains("VTSUCC1"))))
{ {
totConfRec = totConfRec + 1;
isError = false; isError = false;
succstring = succstring + employeeCode + "</br>"; }
}//end of if
else else
{ {
totRejRec = totRejRec + 1;
isError = true; isError = true;
return errString;
} }
setNodeValue(headerDom, "noof_confirmed", String.valueOf(totConfRec));
setNodeValue(headerDom, "noof_rejected", String.valueOf(totConfRec));
} }
succLine = succLine + succstring; System.out.println("Total Confirmed Count Values ["+totConfRec+"] \t Total Rejected Count Values ["+totRejRec+"] \t Total Selected Records ["+totFinRec+"] \n Final Return String ["+errString+"]");
errString = getErrorXml(succLine); totFinRec = totConfRec + totRejRec; System.out.println("totFinRec is ["+totFinRec+"]");
System.out.println("errString--["+errString+"]");
}//try end }//try end
catch(Exception e) catch(Exception e)
{ {
...@@ -339,9 +361,11 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -339,9 +361,11 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
{ {
throw new ITMException(d); throw new ITMException(d);
} }
throw new ITMException(e);
} }
finally finally
{ {
System.out.println("Closing Connection....");
try try
{ {
if(isError) if(isError)
...@@ -351,22 +375,27 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -351,22 +375,27 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
else else
{ {
conn.commit(); conn.commit();
}
if(conn != null)
{
conn.close(); conn.close();
conn = null; conn = null;
} }
} }
catch(Exception e) catch(Exception e)
{ {
errString = e.getMessage(); errString = e.getMessage();
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);
} }
} }
System.out.println("Error Message=>"+errString.toString()); System.out.println("FINAL ["+(errorCode)+"]");
return errString; errMsg = "\n noof_confirmed are ["+totConfRec+"] \n noof_rejected are ["+totRejRec+"]";
retStr = getError(errMsg,errorCode,conn);
return retStr;
}//END OF PROCESS(2) }//END OF PROCESS(2)
public String checkNullAndTrim( String inputVal ) private String checkNullAndTrim( String inputVal )
{ {
if ( inputVal == null ) if ( inputVal == null )
{ {
...@@ -378,24 +407,36 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -378,24 +407,36 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
} }
return inputVal; return inputVal;
} }
private java.sql.Time now()
{
return new java.sql.Time(System.currentTimeMillis());
}
public String gbfConfIt(String acctPrd , String empCode,String xtraParams,Connection conn) throws ITMException private String gbfConfIt(String acctPrd , String empCode,String xtraParams,Connection conn) throws ITMException
{ {
String retString = ""; String retString = "";
String sql = "",loginEmpCode=""; String sql = "",loginEmpCode="";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
SimpleDateFormat sdf1 = null; SimpleDateFormat sdf1 = null;
java.sql.Timestamp currentDate = null,today = null; java.sql.Timestamp currentDate = null,today = null;
UtilMethods utilMethod = new UtilMethods();
try try
{ {
java.sql.Date todayDt = new java.sql.Date(System.currentTimeMillis());
System.out.println("13["+todayDt+"]");
/*currentDate = utilMethod.dateTime(utilMethod.todaySqlDate(),utilMethod.now());
System.out.println("Current Date is ==== ["+currentDate+"]");*/
today = new java.sql.Timestamp(System.currentTimeMillis()) ; today = new java.sql.Timestamp(System.currentTimeMillis()) ;
sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat()); sdf1 = new SimpleDateFormat(genericUtility.getDBDateFormat());
currentDate = java.sql.Timestamp.valueOf(sdf1.format(today) + " 00:00:00.000"); currentDate = java.sql.Timestamp.valueOf(sdf1.format(today) + " 00:00:00.000");
loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); loginEmpCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
System.out.println("loginEmpCode is ==="+loginEmpCode); System.out.println("loginEmpCode is ==="+loginEmpCode + "currentDate is ===" +currentDate);
sql = "update it_calchdr set confirmed = ? , emp_code__aprv = ?, conf_date = ? " sql = "update it_calchdr set confirmed = ? , emp_code__aprv = ?, conf_date = ? "
+ "where acct_prd = ? and emp_code = ?"; + "where acct_prd = ? and emp_code = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,"Y"); pstmt.setString(1,"Y");
pstmt.setString(2,loginEmpCode); pstmt.setString(2,loginEmpCode);
...@@ -410,13 +451,38 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -410,13 +451,38 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
} }
System.out.println("["+updateCnt+"] data updated in it_calchdr table"); System.out.println("["+updateCnt+"] data updated in it_calchdr table");
if(updateCnt > 0) if(updateCnt > 0)
{ {
retString = itmDBAccessEJB.getErrorString("","VPSUCC1","","",conn); //Added by sarita on 24 OCT 2018 to set Confirmed and rejected Records [START]
/* if (detlList != null)
{
for (int cntr = 0; cntr < detlList.getLength(); cntr++)
{
Element tblQty = detailDom.createElement("noof_confirmed");
tblQty.appendChild(detailDom.createTextNode(String.valueOf(updateCnt)));
detlList.item(cntr).appendChild(tblQty);
}
}
//Added by sarita on 24 OCT 2018 to set Confirmed and rejected Records [END]*/
//retString = itmDBAccessEJB.getErrorString("","VPSUCC1","","",conn);
retString = "VPSUCC1";
} }
else else
{ {
retString = itmDBAccessEJB.getErrorString("","DS000","","",conn); //retString = itmDBAccessEJB.getErrorString("","DS000","","",conn);
retString = "DS000";
} }
/*else
{
//Added by sarita on 24 OCT 2018 to set Confirmed and rejected Records [START]
for (int cntr = 0; cntr < detlList.getLength(); cntr++)
{
Element tblQty = detailDom.createElement("noof_rejected");
tblQty.appendChild(detailDom.createTextNode(String.valueOf(updateCnt)));
detlList.item(cntr).appendChild(tblQty);
}
//Added by sarita on 24 OCT 2018 to set Confirmed and rejected Records [END]
retString = itmDBAccessEJB.getErrorString("","DS000","","",conn);
}*/
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -427,8 +493,9 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -427,8 +493,9 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
conn.rollback(); conn.rollback();
} }
catch(Exception d) { catch(Exception d) {
throw new ITMException(e); throw new ITMException(e);
} }
throw new ITMException(e);
} }
finally finally
{ {
...@@ -446,10 +513,10 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -446,10 +513,10 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
throw new ITMException(e); throw new ITMException(e);
} }
} }
return retString.toString(); return retString;
} }//end of Method gbfConfIt
public int getNumOfNonDelDetail(Document dom2,int detailNo) private int getNumOfNonDelDetail(Document dom2,int detailNo) throws ITMException
{ {
Node childNode = null; Node childNode = null;
NodeList updateList; NodeList updateList;
...@@ -463,11 +530,8 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -463,11 +530,8 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
NodeList detailNoteList = dom2.getElementsByTagName("Detail"+detailNo); NodeList detailNoteList = dom2.getElementsByTagName("Detail"+detailNo);
for(int cnt = 0;cnt<detailNoteList.getLength();cnt++) for(int cnt = 0;cnt<detailNoteList.getLength();cnt++)
{ {
Node pNode=detailNoteList.item(cnt); Node pNode=detailNoteList.item(cnt);
/*NodeList cNodeList=pNode.getChildNodes();
childNodeListLength = cNodeList.getLength();*/
childNodeName = pNode.getNodeName(); childNodeName = pNode.getNodeName();
//System.out.println("pNode::["+pNode+"]"+"cNodeList::["+cNodeList+"]");
updateFlag = getAttributeVal(pNode,"updateFlag"); updateFlag = getAttributeVal(pNode,"updateFlag");
System.out.println("updateFlag [" + updateFlag + "]"); System.out.println("updateFlag [" + updateFlag + "]");
if(!updateFlag.equalsIgnoreCase("D")) if(!updateFlag.equalsIgnoreCase("D"))
...@@ -481,11 +545,12 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -481,11 +545,12 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
{ {
System.out.println("Exception : : getNumOfNonDelDetail :"+e); System.out.println("Exception : : getNumOfNonDelDetail :"+e);
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);
} }
return cntr; return cntr;
} }//End of Method getNumOfNonDelDetail
public String getAttributeVal(Node dom, String attribName )throws ITMException private String getAttributeVal(Node dom, String attribName )throws ITMException
{ {
String AttribValue = null; String AttribValue = null;
try try
...@@ -512,108 +577,51 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI ...@@ -512,108 +577,51 @@ public class EmpITConfPrc extends ProcessEJB implements EmpITConfPrcLocal,EmpI
throw new ITMException(e); throw new ITMException(e);
} }
return AttribValue; return AttribValue;
} }//End of Method getAttributeVal
public String getErrorXML(String message,String messageValue,String errorId, String traceInfo ,String type) throws RemoteException,ITMException
{
System.out.println("getErrorXML..........");
String errString = "";
try
{
errString = "";
StringBuffer valueXmlErrorString = new StringBuffer( "<?xml version=\"1.0\"?>\r\n<Root>\r\n<Header>\r\n<Errors>\r\n" );
valueXmlErrorString.append("<error id=\"").append(errorId).append("\" type=\""+type+"\"").append(" column_name=\"description\"").append(">");
//valueXmlErrorString.append("<message><![CDATA[").append(message).append("]]></message>\r\n");
valueXmlErrorString.append("<message><![CDATA[").append(message).append("]]></message>\r\n");
valueXmlErrorString.append("<description><![CDATA[").append(messageValue).append("]]></description>\r\n");
valueXmlErrorString.append("<type>"+type+"</type>\r\n");
valueXmlErrorString.append("<option></option>\r\n");
valueXmlErrorString.append("<time></time>\r\n");
valueXmlErrorString.append("<alarm></alarm>\r\n");
valueXmlErrorString.append("<source></source>\r\n");
valueXmlErrorString.append("<trace>Error : "+traceInfo+" </trace>\r\n");
valueXmlErrorString.append("<redirect>1</redirect>\r\n");
valueXmlErrorString.append("</error>\r\n");
valueXmlErrorString.append("</Errors>\r\n");
valueXmlErrorString.append("</Header>\r\n");
valueXmlErrorString.append( "</Root>\r\n" );
System.out.println( "\n****valueXmlErrorString :" + valueXmlErrorString.toString() + ":********" );
errString =valueXmlErrorString.toString();
System.out.println("Modified error string"+errString); private static void setNodeValue( Document dom, String nodeName, String nodeVal ) throws Exception
}
catch (Exception ex)
{
ex.printStackTrace();
}
return errString;
}
private String getErrorXml(String retXml)
{ {
System.out.println("retXml------["+ retXml + "]"); Node tempNode = dom.getElementsByTagName( nodeName ).item(0);
E12GenericUtility genericUtility = null; System.out.println("tempNode is ["+tempNode+"]");
NodeList parentNodeList = null; if( tempNode != null )
Node parentNode = null;
NodeList childNodeList = null;
Node childNode = null;
String childNodeName = "";
String message = "";
String description = "";
String errId = "";
String msgType = "";
int childNodeLength = 0;
int ctr=0;
try
{ {
if(retXml.indexOf("<root>") != -1 || retXml.indexOf("<Root>") != -1 ) if( tempNode.getFirstChild() == null )
{ {
System.out.println("Inside root condition......"); CDATASection cDataSection = dom.createCDATASection( nodeVal );
genericUtility = new E12GenericUtility(); tempNode.appendChild( cDataSection );
Document errDom = genericUtility.parseString(retXml); System.out.println("tempNode is 1["+tempNode+"]");
parentNodeList = errDom.getElementsByTagName("root");
parentNode = parentNodeList.item(0);
childNodeList = parentNode.getChildNodes();
childNodeLength = childNodeList.getLength();
for(ctr = 0; ctr < childNodeLength; ctr++)
{
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
if("error".equalsIgnoreCase(childNodeName))
{
errId = childNode.getAttributes().getNamedItem("id").getNodeValue();
System.out.println("Error code -----["+ errId +"]");
msgType = childNode.getAttributes().getNamedItem("type").getNodeValue();
System.out.println("msgType--["+msgType+"]");
}
else if("message".equalsIgnoreCase(childNodeName))
{
message = genericUtility.getColumnValue("message", errDom);
System.out.println("message--["+message+"]");
}
else if("description".equalsIgnoreCase(childNodeName))
{
description = genericUtility.getColumnValue("description", errDom);
System.out.println("description--["+description+"]");
}
}
retXml = getErrorXML(message, description, errId, "",msgType);
System.out.println("retXml----[" + retXml + "]");
} }
else else
{ {
retXml = getErrorXML("Message", retXml, "VTCONFTRAN", "","P"); tempNode.getFirstChild().setNodeValue(nodeVal);
} System.out.println("tempNode is 2["+tempNode+"]");
}
}
tempNode = null;
}//End of Method setNodeValue
private String getError(String errMsg, String Code, Connection conn) throws ITMException, Exception
{
String mainStr ="";
try
{
String errString = "";
errString = new ITMDBAccessEJB().getErrorString("",Code,"","",conn);
System.out.println("Origional ErrorString is =====> <"+errString+">");
String begPart = errString.substring(0,errString.indexOf("</description>"));
String endDesc = errString.substring(errString.indexOf("</description>"),errString.length());
System.out.println("begPart ["+begPart+"] \t endDesc ["+endDesc+"]");
mainStr = checkNullAndTrim(begPart) + errMsg + checkNullAndTrim(endDesc);
System.out.println("mainStr:::::::::::::::::: "+mainStr);
//begPart = null;
//mainStr = errString;
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception from getErrorXml---["+ e.getMessage() +"]");
e.printStackTrace(); e.printStackTrace();
return retXml; throw new ITMException(e);
} }
return retXml; return mainStr;
} }
} //Added by sarita on 24 OCT 2018 to set Confirmed and rejected Records [END]
}
\ No newline at end of file
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