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 @@
********************************************************/
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.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 java.rmi.RemoteException;
......@@ -20,32 +25,33 @@ import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.ejb.Stateless;
//modified by Shital on 24/07/2019 [Start]
//import javax.ejb.Stateless;
//modified by Shital on 24/07/2019 [End]
import org.w3c.dom.Document;
import org.w3c.dom.Node;
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 {
GenericUtility genericUtility = GenericUtility.getInstance();
public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,RepSpecificAdRemote
{
//modified by Shital on 24/07/2019 [Start]
//GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
//modified by Shital on 24/07/2019 [End]
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
public String wfValData(String xmlString, String xmlString1, String xmlString2, String objContext, String editFlag, String xtraParams) throws RemoteException,ITMException
{
System.out.println("In ReportSpecificationMaster[wfValData]");
String errString = "";
Document dom = null;
Document dom1 = null;
Document dom2 = null;
try
{
if (xmlString != null && xmlString.trim().length() > 0 )
{
dom = parseString(xmlString);
......@@ -65,6 +71,9 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
}
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);
}
return(errString);
......@@ -98,15 +107,20 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
Connection conn = null;
PreparedStatement pstmt = 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>");
try
{
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");
if(objContext != null && objContext.trim().length() > 0)
......@@ -151,7 +165,10 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
}
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.setString(1,adCode.trim());
rs = pstmt.executeQuery();
......@@ -172,9 +189,9 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
pstmt.close();
pstmt = null;
}
}
}else if(childNodeName.equalsIgnoreCase("rep_section"))
}
else if(childNodeName.equalsIgnoreCase("rep_section"))
{
repSection = checkNull(genericUtility.getColumnValue("rep_section", curDom));
......@@ -199,14 +216,14 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
errCode = errList.get(count);
errFldName = errFields.get(count);
System.out.println("errCode .........." + errCode);
//modified by Shital on 24/07/2019 [Start]
// 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,"",conn);
errString = itmDBAccessEJB.getErrorString(errFldName, errCode, userId, "", conn);
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,"",conn);
//errString = itmDBAccessEJB.getErrorString("", errCode, userId);
errString = itmDBAccessEJB.getErrorString("", errCode, userId, "", conn);
//modified by Shital on 24/07/2019 [End]
System.out.println("errString........"+errString);
errorType = errorType(conn,errCode);
......@@ -249,7 +266,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
conn.close();
conn = null;
}
}
catch(Exception d)
{
......@@ -267,7 +283,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
Document dom1 = null;
Document dom2 = null;
Document dom3=null;
String valueXmlString = "";
try
......@@ -296,7 +311,13 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
}
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());
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(e);
//modified by Shital on 24/07/2019 [End]
}
return valueXmlString;
}
......@@ -325,22 +346,30 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
Connection conn = null;
PreparedStatement pstmt = 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
{
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");
termId = getValueFromXTRA_PARAMS(xtraParams,"termId");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
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);
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)
{
currentFormNo = Integer.parseInt(objContext);
}
valueXmlString = new StringBuffer("<?xml version = \"1.0\"?> <Root> <header> <editFlag>");
valueXmlString.append(editFlag).append("</editFlag> </header>");
......@@ -357,12 +386,12 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
childNode = childNodeList.item(ctr);
childNodeName = childNode.getNodeName();
ctr ++;
}while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn));
}
while(ctr < childNodeListLength && ! childNodeName.equals(currentColumn));
System.out.println("currentColumn = "+currentColumn);
if(currentColumn.trim().equalsIgnoreCase("itm_default") )
{
tranDate = simpleDateFormat.format(timestamp).toString();
System.out.println("Tran Date 111: "+tranDate.toString());
valueXmlString.append("<chg_user>").append("<![CDATA["+userId+"]]>").append("</chg_user>");
......@@ -382,7 +411,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
{
lineNo = rs.getInt(1) ;
}
lineNo = lineNo+ 1 ;
if(rs != null)
......@@ -395,9 +423,7 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
pstmt.close();
pstmt = null;
}
valueXmlString.append("<line_no>").append("<![CDATA[" + lineNo +"]]>").append("</line_no>\r\n");
}
else if(currentColumn.trim().equalsIgnoreCase("ad_code")) //Item change for ad_code
{
......@@ -422,19 +448,13 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
pstmt.close();
pstmt = null;
}
//valueXmlString.append("<ad_code>").append("<![CDATA[" + adCode +"]]>").append("</ad_code>\r\n");
valueXmlString.append("<descr>").append("<![CDATA[" + adCodeDescr +"]]>").append("</descr>\r\n");
}
valueXmlString.append("</Detail1>");
break;
}
valueXmlString.append("</Root>");
}
catch(Exception e)
{
......@@ -444,7 +464,6 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
}
finally
{
try
{
if(rs != null)
......@@ -456,18 +475,19 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
{
pstmt.close();
pstmt = null;
}
if(conn != null)
{
conn.close();
conn = null;
}
}
catch(Exception d)
{
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();
......@@ -481,14 +501,14 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
return input;
}
private String errorType(Connection conn , String errorCode)
private String errorType(Connection conn , String errorCode) throws ITMException
{
String msgType = "";
PreparedStatement pstmt = null ;
ResultSet rs = null;
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.setString(1,errorCode);
rs = pstmt.executeQuery();
......@@ -500,6 +520,9 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
catch(Exception ex)
{
ex.printStackTrace();
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(ex);
//modified by Shital on 24/07/2019 [End]
}
finally
{
......@@ -519,10 +542,11 @@ public class RepSpecificAd extends ValidatorEJB implements RepSpecificAdLocal,R
catch(Exception e)
{
e.printStackTrace();
//modified by Shital on 24/07/2019 [Start]
throw new ITMException(e);
//modified by Shital on 24/07/2019 [End]
}
}
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