Commit dbd72cfb authored by sghate's avatar sghate

*Done Changes On PayarrToProc Master Component.

PayarrToProc.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@204788 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c29a24f4
...@@ -9,19 +9,23 @@ import java.sql.SQLException; ...@@ -9,19 +9,23 @@ import java.sql.SQLException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import javax.ejb.Stateless;
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.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
@Stateless
public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,PayarrToProcRemote public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,PayarrToProcRemote
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 12/07/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = null;
//modified by Shital on 12/07/2019[End]
ITMDBAccessEJB itmDbAccess = new ITMDBAccessEJB();
AdmCommon admCommon = new AdmCommon(); AdmCommon admCommon = new AdmCommon();
public String wfValData() throws RemoteException, ITMException public String wfValData() throws RemoteException, ITMException
{ {
...@@ -36,6 +40,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -36,6 +40,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
String retString = ""; String retString = "";
try try
{ {
genericUtility = new E12GenericUtility();
if(xmlString != null && xmlString.trim().length() > 0) if(xmlString != null && xmlString.trim().length() > 0)
{ {
dom = genericUtility.parseString(xmlString); dom = genericUtility.parseString(xmlString);
...@@ -55,6 +60,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -55,6 +60,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
{ {
System.out.println("::: PayarrToProc ::"+ e.getMessage()); System.out.println("::: PayarrToProc ::"+ e.getMessage());
e.getMessage(); e.getMessage();
throw new ITMException(e);
} }
return retString; return retString;
} }
...@@ -74,20 +80,32 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -74,20 +80,32 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
Node childNode = null; Node childNode = null;
String childNodeName = ""; String childNodeName = "";
String errString=""; String errString="";
String userId = "", errCode = "", errorType = "", loginCode = ""; String userId = "";
String errCode = "";
String errorType = "";
String loginCode = "";
String msgType = "";//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails] String msgType = "";//Modified by Ahmed on 31-AUG-2018[To break and return error message when validation fails]
ArrayList<String> errList = new ArrayList<String>(); ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>(); ArrayList<String> errFields = new ArrayList<String>();
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = null;
String sql = ""; String sql = "";
String empCode = "", status = "", prdCode = "", procType = "", paySite = "", tranId = ""; String empCode = "";
String status = "";
String prdCode = "";
String procType = "";
String paySite = "";
String tranId = "";
int userLevel = 0; int userLevel = 0;
Date fromDate = null, relieveDate = null, toDate = null, joinDate = null; Date fromDate = null;
Date relieveDate = null;
Date toDate = null;
Date joinDate = null;
try try
{ {
conn = getConnection(); conn = getConnection();
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode"); userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginEmpCode");
loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
if(objContext != null && objContext.trim().length() > 0) if(objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
...@@ -436,6 +454,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -436,6 +454,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
//Added by Jaffar S. for validation while editing same record on 19-11-18 [End] //Added by Jaffar S. for validation while editing same record on 19-11-18 [End]
} }
} }
} }
} }
int errListSize = errList.size(); int errListSize = errList.size();
...@@ -449,7 +468,10 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -449,7 +468,10 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
errCode = errList.get(count); errCode = errList.get(count);
errFldName = errFields.get(count); errFldName = errFields.get(count);
System.out.println(" testing :errCode .:" + errCode); System.out.println(" testing :errCode .:" + errCode);
errString = getErrorString(errFldName, errCode, userId); //modified by Shital on 12/07/2019[Start]
//errString = getErrorString(errFldName, errCode, userId);
errString = itmDbAccess.getErrorString(errFldName, errCode, userId, "", conn);
//modified by Shital on 12/07/2019[End]
System.out.println("errString>>>>>>>>>"+errString); System.out.println("errString>>>>>>>>>"+errString);
errorType = errorType(conn, errCode); errorType = errorType(conn, errCode);
if (errString.length() > 0) if (errString.length() > 0)
...@@ -468,13 +490,15 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -468,13 +490,15 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
errList = null; errList = null;
errFields.clear(); errFields.clear();
errFields = null; errFields = null;
errStringXml.append("</Errors> </Root> \r\n");
} }
else else
{ {
errStringXml = new StringBuffer(""); errStringXml = new StringBuffer("");
} }
} }
errStringXml.append("</Errors> </Root> \r\n");
} }
catch(SQLException se) catch(SQLException se)
{ {
...@@ -495,8 +519,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -495,8 +519,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
finally finally
{ {
try { try {
if ( conn != null )
{
if ( rs != null ) if ( rs != null )
{ {
rs.close(); rs.close();
...@@ -507,9 +530,14 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -507,9 +530,14 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if ( conn != null )
{
//modified by Shital on 12/07/2019[Start]
conn.close(); conn.close();
conn = null; conn = null;
//modified by Shital on 12/07/2019[End]
} }
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -533,9 +561,13 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -533,9 +561,13 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
String errFields = null; String errFields = null;
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital Start Date 12/07/2019
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = null;
//modified by Shital End Date 12/07/2019
try try
{ {
genericUtility = new E12GenericUtility();
System.out.println("xmlString [" + xmlString + "]"); System.out.println("xmlString [" + xmlString + "]");
System.out.println("xmlString1 [" + xmlString1 + "]"); System.out.println("xmlString1 [" + xmlString1 + "]");
System.out.println("xmlString2 [" + xmlString2 + "]"); System.out.println("xmlString2 [" + xmlString2 + "]");
...@@ -558,6 +590,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -558,6 +590,7 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
{ {
System.out.println("Exception :PayarrToProc :" + e.getMessage()+ ":"); System.out.println("Exception :PayarrToProc :" + e.getMessage()+ ":");
errFields = genericUtility.createErrorString(e); errFields = genericUtility.createErrorString(e);
throw new ITMException(e);
} }
return errFields; return errFields;
} }
...@@ -576,23 +609,29 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -576,23 +609,29 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
String descr=""; String descr="";
String procType=""; String procType="";
String tranId=""; String tranId="";
String empName = "", paySite = "", loginCode = ""; String empName = "";
String paySite = "";
String loginCode = "";
int userLevel = 0, cnt = 0; int userLevel = 0, cnt = 0;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null; ResultSet rs = null;
String sql = ""; String sql = "";
StringBuffer xmlString = new StringBuffer(); StringBuffer xmlString = null;
Connection conn = null; Connection conn = null;
int currentFormNo = 0;
try try
{ {
conn = getConnection(); conn= getConnection();
chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "userId")); xmlString = new StringBuffer();
genericUtility = new E12GenericUtility();
//chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "userId"));
chgUser = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = getValueFromXTRA_PARAMS(xtraParams, "termId"); chgTerm = getValueFromXTRA_PARAMS(xtraParams, "termId");
java.util.Date currDate = new java.util.Date(); java.util.Date currDate = new java.util.Date();
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
chgDate = sdf.format(currDate); chgDate = sdf.format(currDate);
int currentFormNo = 0;
if (objContext != null && objContext.trim().length() > 0) if (objContext != null && objContext.trim().length() > 0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
...@@ -623,23 +662,34 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -623,23 +662,34 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
}//Ended itm_default itemchange by Varsha V on 24-08-18 [END] }//Ended itm_default itemchange by Varsha V on 24-08-18 [END]
else if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit")) else if (currentColumn.trim().equalsIgnoreCase("itm_defaultedit"))
{ {
empCode=checkNull(genericUtility.getColumnValue("emp_code", dom1)); //modified by Shital on 12/07/2019[Start]
//empCode=checkNull(genericUtility.getColumnValue("emp_code", dom1));
empCode=checkNull(genericUtility.getColumnValue("emp_code", dom));
System.out.println("Emp_Code: ["+empCode+"]"); System.out.println("Emp_Code: ["+empCode+"]");
site=checkNull(genericUtility.getColumnValue("site", dom1)); //site=checkNull(genericUtility.getColumnValue("site", dom1));
site=checkNull(genericUtility.getColumnValue("site", dom));
System.out.println("Site_Code: ["+site+"]"); System.out.println("Site_Code: ["+site+"]");
descr=checkNull(genericUtility.getColumnValue("descr", dom1)); //descr=checkNull(genericUtility.getColumnValue("descr", dom1));
descr=checkNull(genericUtility.getColumnValue("descr", dom));
System.out.println("Description: ["+descr+"]"); System.out.println("Description: ["+descr+"]");
prdCode=checkNull(genericUtility.getColumnValue("prd_code", dom1)); //prdCode=checkNull(genericUtility.getColumnValue("prd_code", dom1));
prdCode=checkNull(genericUtility.getColumnValue("prd_code", dom));
System.out.println("Prd_Code: ["+prdCode+"]"); System.out.println("Prd_Code: ["+prdCode+"]");
status=checkNull(genericUtility.getColumnValue("status", dom1)); //status=checkNull(genericUtility.getColumnValue("status", dom1));
status=checkNull(genericUtility.getColumnValue("status", dom));
System.out.println("Status: ["+status+"]"); System.out.println("Status: ["+status+"]");
prdCodeAcc=checkNull(genericUtility.getColumnValue("prd_code__acc", dom1)); //prdCodeAcc=checkNull(genericUtility.getColumnValue("prd_code__acc", dom1));
prdCodeAcc=checkNull(genericUtility.getColumnValue("prd_code__acc", dom));
System.out.println("prd_code__acc: ["+prdCodeAcc+"]"); System.out.println("prd_code__acc: ["+prdCodeAcc+"]");
procDate=checkNull(genericUtility.getColumnValue("proc_date", dom1)); //procDate=checkNull(genericUtility.getColumnValue("proc_date", dom1));
procDate=checkNull(genericUtility.getColumnValue("proc_date", dom));
System.out.println("proc_Date: ["+procDate+"]"); System.out.println("proc_Date: ["+procDate+"]");
procType=checkNull(genericUtility.getColumnValue("proc_type", dom1)); //procType=checkNull(genericUtility.getColumnValue("proc_type", dom1));
procType=checkNull(genericUtility.getColumnValue("proc_type", dom));
System.out.println("proc_type: ["+procType+"]"); System.out.println("proc_type: ["+procType+"]");
tranId=checkNull(genericUtility.getColumnValue("tran_id", dom1)); //tranId=checkNull(genericUtility.getColumnValue("tran_id", dom1));
tranId=checkNull(genericUtility.getColumnValue("tran_id", dom));
//modified by Shital on 12/07/2019[End]
System.out.println("tran_id: ["+tranId+"]"); System.out.println("tran_id: ["+tranId+"]");
System.out.println("Current column is[" + currentColumn + "]"); System.out.println("Current column is[" + currentColumn + "]");
...@@ -658,12 +708,12 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -658,12 +708,12 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
xmlString.append("<chg_date><![CDATA[").append(checkNull(chgDate)).append("]]></chg_date>\r\n"); xmlString.append("<chg_date><![CDATA[").append(checkNull(chgDate)).append("]]></chg_date>\r\n");
xmlString.append("<chg_user><![CDATA[").append(checkNull(chgUser)).append("]]></chg_user>\r\n"); xmlString.append("<chg_user><![CDATA[").append(checkNull(chgUser)).append("]]></chg_user>\r\n");
xmlString.append("<chg_term><![CDATA[").append(checkNull(chgTerm)).append("]]></chg_term>\r\n"); xmlString.append("<chg_term><![CDATA[").append(checkNull(chgTerm)).append("]]></chg_term>\r\n");
// if((prdCodeAcc != null && prdCodeAcc.trim().length()>0 ) && status.trim().equalsIgnoreCase("P") ) // if((prdCodeAcc != null && prdCodeAcc.trim().length()>0 ) && status.trim().equalsIgnoreCase("P") )
// { // {
// //
// System.out.println("IN IF CONDITION::::::::::"); // System.out.println("IN IF CONDITION::::::::::");
// xmlString.append("<status protect=\"1\"><![CDATA[").append(checkNull(status)).append("]]></status>\r\n"); // xmlString.append("<status protect=\"1\"><![CDATA[").append(checkNull(status)).append("]]></status>\r\n");
// } // }
if((status.trim().equalsIgnoreCase("P") )) if((status.trim().equalsIgnoreCase("P") ))
{ {
System.out.println("IN IF CONDITION::::::::::"); System.out.println("IN IF CONDITION::::::::::");
...@@ -795,19 +845,22 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -795,19 +845,22 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
} }
//Ended emp_code itemchange by Varsha V on 24-08-18 [End] //Ended emp_code itemchange by Varsha V on 24-08-18 [End]
xmlString.append("</Detail1>\r\n"); xmlString.append("</Detail1>\r\n");
} }
} }
xmlString.append("</Root>\r\n");
} }
catch (Exception ex) catch (Exception ex)
{ {
System.out.println("1st catch Exception::" + ex.getMessage()); System.out.println("1st catch Exception::" + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex);
} }
finally finally
{ {
try { try {
if ( conn != null )
{
if ( rs != null ) if ( rs != null )
{ {
rs.close(); rs.close();
...@@ -818,18 +871,24 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -818,18 +871,24 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if ( conn != null )
{
//modified by Shital on 12/07/2019[start]
conn.close(); conn.close();
conn = null; conn = null;
//modified by Shital on 12/07/2019[End]
} }
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("[PayarrToProc][itemChanged]Exception ::"+e); System.out.println("[PayarrToProc][itemChanged]Exception ::"+e);
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);
} }
} }
System.out.println("value of xmlString::::" + xmlString); System.out.println("value of xmlString::::" + xmlString);
xmlString.append("</Root>\r\n");
System.out.println("xmlString....[" + xmlString.toString()); System.out.println("xmlString....[" + xmlString.toString());
return xmlString.toString(); return xmlString.toString();
} }
...@@ -838,7 +897,8 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -838,7 +897,8 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
if (input == null) if (input == null)
{ {
input = ""; input = "";
} else }
else
{ {
input = input.trim(); input = input.trim();
} }
...@@ -859,11 +919,23 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya ...@@ -859,11 +919,23 @@ public class PayarrToProc extends ValidatorEJB implements PayarrToProcLocal,Paya
{ {
msgType = rs.getString("MSG_TYPE"); msgType = rs.getString("MSG_TYPE");
} }
//modified by Shital on 12/07/2019[start]
//rs.close();
//rs = null;
//pstmt.close();
//pstmt = null;
if(rs != null)
{
rs.close(); rs.close();
rs = null; rs = null;
}
//modified by Shital on 12/07/2019[End]
if(pstmt != null)
{
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
}
catch (Exception ex) catch (Exception ex)
{ {
ex.printStackTrace(); ex.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