Commit 488c41de authored by sghate's avatar sghate

*Done changes on RepSpecificAd Master Component.

RepSpecificAd.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@204859 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1f8227e1
...@@ -7,10 +7,15 @@ ...@@ -7,10 +7,15 @@
********************************************************/ ********************************************************/
package ibase.webitm.ejb.adm; package ibase.webitm.ejb.adm;
import ibase.system.config.ConnDriver; //modified by Shital on 24/07/2019 [Start]
//import ibase.system.config.ConnDriver;
//modified by Shital on 24/07/2019 [End]
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB; import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.GenericUtility; //modified by Shital on 24/07/2019 [Start]
//import ibase.webitm.utility.GenericUtility;
//modified by Shital on 24/07/2019 [End]
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -20,32 +25,33 @@ import java.sql.ResultSet; ...@@ -20,32 +25,33 @@ import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
//modified by Shital on 24/07/2019 [Start]
import javax.ejb.Stateless; //import javax.ejb.Stateless;
//modified by Shital on 24/07/2019 [End]
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;
@Stateless //modified by Shital on 24/07/2019 [Start]
//@Stateless
//modified by Shital on 24/07/2019 [End]
public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,RepSpecificAdRemote { public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,RepSpecificAdRemote
{
//modified by Shital on 24/07/2019 [Start]
GenericUtility genericUtility = GenericUtility.getInstance(); //GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//modified by Shital on 24/07/2019 [End]
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{ {
System.out.println("In ReportSpecificationMaster[wfValData]"); System.out.println("In ReportSpecificationMaster[wfValData]");
String errString = ""; String errString = "";
Document dom = null; Document dom = null;
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
try try
{ {
if (xmlString != null && xmlString.trim().length() > 0 ) if (xmlString != null && xmlString.trim().length() > 0 )
{ {
dom = parseString(xmlString); dom = parseString(xmlString);
...@@ -65,6 +71,9 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -65,6 +71,9 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
} }
catch(Exception e) catch(Exception e)
{ {
//modified by Shital on 24/07/2019 [Start]
e.printStackTrace();
//modified by Shital on 24/07/2019 [End]
throw new ITMException(e); throw new ITMException(e);
} }
return(errString); return(errString);
...@@ -98,15 +107,20 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -98,15 +107,20 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null ; PreparedStatement pstmt = null ;
ResultSet rs = null; ResultSet rs = null;
ConnDriver connDriver = new ConnDriver(); String sql = "";
//modified by Shital on 24/07/2019 [Start]
//ConnDriver connDriver = new ConnDriver();
//modified by Shital on 24/07/2019 [End]
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>"); StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try try
{ {
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
conn = connDriver.getConnectDB("DriverITM"); //modified by Shital on 24/07/2019 [Start]
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//modified by Shital on 24/07/2019 [End]
userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode"); userId = getValueFromXTRA_PARAMS(xtraParams, "loginCode");
if(objContext != null && objContext.trim().length() > 0) if(objContext != null && objContext.trim().length() > 0)
...@@ -151,7 +165,10 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -151,7 +165,10 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
} }
else else
{ {
String sql = "SELECT AD_CODE FROM ALLWDEDN WHERE AD_CODE = ?"; //modified by Shital on 24/07/2019 [Start]
//String sql = "SELECT AD_CODE FROM ALLWDEDN WHERE AD_CODE = ?";
sql = "SELECT AD_CODE FROM ALLWDEDN WHERE AD_CODE = ?";
//modified by Shital on 24/07/2019 [End]
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,adCode.trim()); pstmt.setString(1,adCode.trim());
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -172,9 +189,9 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -172,9 +189,9 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
} }
}else if(childNodeName.equalsIgnoreCase("rep_section")) }
else if(childNodeName.equalsIgnoreCase("rep_section"))
{ {
repSection = checkNull(genericUtility.getColumnValue("rep_section", curDom)); repSection = checkNull(genericUtility.getColumnValue("rep_section", curDom));
...@@ -199,14 +216,14 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -199,14 +216,14 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
errCode = errList.get(count); errCode = errList.get(count);
errFldName = errFields.get(count); errFldName = errFields.get(count);
System.out.println("errCode .........." + errCode); System.out.println("errCode .........." + errCode);
//modified by Shital on 24/07/2019 [Start]
// errString = getErrorString(errFldName, errCode, userId); // errString = getErrorString(errFldName, errCode, userId);
//Commented and added by Varsha V on 20-Jul-18 for calling connection method
//errString = itmDBAccessEJB.getErrorString(errFldName, errCode, userId); //errString = itmDBAccessEJB.getErrorString(errFldName, errCode, userId);
errString = itmDBAccessEJB.getErrorString(errFldName,errCode,userId,"",conn); errString = itmDBAccessEJB.getErrorString(errFldName, errCode, userId, "", conn);
System.out.println("errString........"+errString); System.out.println("errString........"+errString);
//Commented and added by Varsha V on 20-Jul-18 for calling connection method //errString = itmDBAccessEJB.getErrorString("", errCode, userId);
//errString = itmDBAccessEJB.getErrorString("", errCode, userId); errString = itmDBAccessEJB.getErrorString("", errCode, userId, "", conn);
errString = itmDBAccessEJB.getErrorString("",errCode,userId,"",conn); //modified by Shital on 24/07/2019 [End]
System.out.println("errString........"+errString); System.out.println("errString........"+errString);
errorType = errorType(conn,errCode); errorType = errorType(conn,errCode);
...@@ -249,7 +266,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -249,7 +266,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
conn.close(); conn.close();
conn = null; conn = null;
} }
} }
catch(Exception d) catch(Exception d)
{ {
...@@ -267,7 +283,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -267,7 +283,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
Document dom1 = null; Document dom1 = null;
Document dom2 = null; Document dom2 = null;
Document dom3=null; Document dom3=null;
String valueXmlString = ""; String valueXmlString = "";
try try
...@@ -296,7 +311,13 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -296,7 +311,13 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
} }
catch(Exception e) catch(Exception e)
{ {
//modified by Shital on 24/07/2019 [Start]
e.printStackTrace();
//modified by Shital on 24/07/2019 [End]
System.out.println("Exception : [ReportSpecificationMaster][itemChanged( String, String )] :==>\n" + e.getMessage()); System.out.println("Exception : [ReportSpecificationMaster][itemChanged( String, String )] :==>\n" + e.getMessage());
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(e);
//modified by Shital on 24/07/2019 [End]
} }
return valueXmlString; return valueXmlString;
} }
...@@ -325,22 +346,30 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -325,22 +346,30 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet rs = null ; ResultSet rs = null ;
ConnDriver connDriver = new ConnDriver(); //modified by Shital on 24/07/2019 [Start]
//ConnDriver connDriver = new ConnDriver();
//modified by Shital on 24/07/2019 [End]
try try
{ {
GenericUtility genericUtility = GenericUtility.getInstance(); //modified by Shital on 24/07/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
//modified by Shital on 24/07/2019 [End]
userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode"); userId = getValueFromXTRA_PARAMS(xtraParams,"loginCode");
termId = getValueFromXTRA_PARAMS(xtraParams,"termId"); termId = getValueFromXTRA_PARAMS(xtraParams,"termId");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
conn = connDriver.getConnectDB("DriverITM"); //modified by Shital on 24/07/2019 [Start]
//conn = connDriver.getConnectDB("DriverITM");
conn = getConnection();
//modified by Shital on 24/07/2019 [End]
conn.setAutoCommit(false); conn.setAutoCommit(false);
connDriver=null; //modified by Shital on 24/07/2019 [Start]
//connDriver=null;
//modified by Shital on 24/07/2019 [End]
if(objContext != null && objContext.trim().length()>0) if(objContext != null && objContext.trim().length()>0)
{ {
currentFormNo = Integer.parseInt(objContext); currentFormNo = Integer.parseInt(objContext);
} }
valueXmlString = new StringBuffer("<?xml version = \"1.0\"?> <Root> <header> <editFlag>"); valueXmlString = new StringBuffer("<?xml version = \"1.0\"?> <Root> <header> <editFlag>");
valueXmlString.append(editFlag).append("</editFlag> </header>"); valueXmlString.append(editFlag).append("</editFlag> </header>");
...@@ -357,12 +386,12 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -357,12 +386,12 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
childNode = childNodeList.item(ctr); childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
ctr ++; ctr ++;
}while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn)); }
while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn));
System.out.println("currentColumn = "+currentColumn); System.out.println("currentColumn = "+currentColumn);
if(currentColumn.trim().equalsIgnoreCase("itm_default") ) if(currentColumn.trim().equalsIgnoreCase("itm_default") )
{ {
tranDate = simpleDateFormat.format(timestamp).toString(); tranDate = simpleDateFormat.format(timestamp).toString();
System.out.println("Tran Date 111: "+tranDate.toString()); System.out.println("Tran Date 111: "+tranDate.toString());
valueXmlString.append("<chg_user>").append("<![CDATA["+userId+"]]>").append("</chg_user>"); valueXmlString.append("<chg_user>").append("<![CDATA["+userId+"]]>").append("</chg_user>");
...@@ -382,7 +411,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -382,7 +411,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
{ {
lineNo = rs.getInt(1) ; lineNo = rs.getInt(1) ;
} }
lineNo = lineNo+ 1 ; lineNo = lineNo+ 1 ;
if(rs != null) if(rs != null)
...@@ -395,9 +423,7 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -395,9 +423,7 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
valueXmlString.append("<line_no>").append("<![CDATA[" + lineNo +"]]>").append("</line_no>\r\n"); valueXmlString.append("<line_no>").append("<![CDATA[" + lineNo +"]]>").append("</line_no>\r\n");
} }
else if(currentColumn.trim().equalsIgnoreCase("ad_code")) //Item change for ad_code else if(currentColumn.trim().equalsIgnoreCase("ad_code")) //Item change for ad_code
{ {
...@@ -422,19 +448,13 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -422,19 +448,13 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
//valueXmlString.append("<ad_code>").append("<![CDATA[" + adCode +"]]>").append("</ad_code>\r\n"); //valueXmlString.append("<ad_code>").append("<![CDATA[" + adCode +"]]>").append("</ad_code>\r\n");
valueXmlString.append("<descr>").append("<![CDATA[" + adCodeDescr +"]]>").append("</descr>\r\n"); valueXmlString.append("<descr>").append("<![CDATA[" + adCodeDescr +"]]>").append("</descr>\r\n");
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
break; break;
} }
valueXmlString.append("</Root>"); valueXmlString.append("</Root>");
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -444,7 +464,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -444,7 +464,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
} }
finally finally
{ {
try try
{ {
if(rs != null) if(rs != null)
...@@ -456,18 +475,19 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -456,18 +475,19 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
{ {
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
} }
if(conn != null) if(conn != null)
{ {
conn.close(); conn.close();
conn = null; conn = null;
} }
} }
catch(Exception d) catch(Exception d)
{ {
d.printStackTrace(); d.printStackTrace();
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(d);
//modified by Shital on 24/07/2019 [End]
} }
} }
return valueXmlString.toString(); return valueXmlString.toString();
...@@ -481,14 +501,14 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -481,14 +501,14 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
return input; return input;
} }
private String errorType(Connection conn , String errorCode) private String errorType(Connection conn , String errorCode) throws ITMException
{ {
String msgType = ""; String msgType = "";
PreparedStatement pstmt = null ; PreparedStatement pstmt = null ;
ResultSet rs = null; ResultSet rs = null;
try try
{ {
String sql = "SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?"; String sql = "SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1,errorCode); pstmt.setString(1,errorCode);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
...@@ -500,6 +520,9 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -500,6 +520,9 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
catch(Exception ex) catch(Exception ex)
{ {
ex.printStackTrace(); ex.printStackTrace();
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(ex);
//modified by Shital on 24/07/2019 [End]
} }
finally finally
{ {
...@@ -519,10 +542,11 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R ...@@ -519,10 +542,11 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
catch(Exception e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(e);
//modified by Shital on 24/07/2019 [End]
} }
} }
return msgType; return msgType;
} }
} }
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