Commit c2b343bd authored by nsawalakhe's avatar nsawalakhe

Merge RSRSurveyServlet in SFA module


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102074 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a5bb46c1
package ibase.dashboard.sfa.servlet;
import ibase.dashboard.sfa.ejb.RSRSurveyRemote;
import ibase.system.config.AppConnectParm;
import ibase.webitm.utility.ITMException;
import java.io.IOException;
import java.io.OutputStream;
import javax.naming.InitialContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.json.simple.JSONObject;
public class RSRSurveyServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
JSONObject jsonObjMetaData =null;
JSONObject jsonMetaData = null;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
doPost(request, response);
}
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
RSRSurveyRemote rsrSurveyRemote = null;
InitialContext context = null;
AppConnectParm appConnectParm = new AppConnectParm();
String dataSourceName = "";
String salesPerson = "";
String month="";
String year="";
String loginId = "";
String reportName = "";
try
{
response.setContentType("application/xml");
HttpSession session = request.getSession(true);
ibase.utility.UserInfoBean userInfo = (ibase.utility.UserInfoBean) session.getAttribute("USER_INFO");
loginId = userInfo.getLoginCode();
dataSourceName = request.getParameter("dataSourceName");
salesPerson = (request.getParameter("salesperson"));
month = (request.getParameter("month"));
year = (request.getParameter("year"));
reportName =request.getParameter("reportName");
reportName =reportName +"-"+ month +"-"+ year ;
session.setAttribute("reportName", reportName);
/*Start before deploy on live remove this block*/
/*salesPerson = "01241";
month = "NOV";
year = "2013";
loginId ="01241";*/
/*End before deploy on live remove this block */
System.out.println("loginId--"+loginId);
System.out.println( "salesPerson is =" + salesPerson );
System.out.println( "month is =" + month );
System.out.println("year is =" + year );
System.out.println("reportName is =" + reportName );
context = new InitialContext(appConnectParm.getProperty());
rsrSurveyRemote = (RSRSurveyRemote) context.lookup("ibase/RSRSurveyEJB/remote");
JSONObject jsonObjData = (JSONObject)rsrSurveyRemote.getRSRSurveyDetails(loginId,salesPerson,month,year,dataSourceName);
OutputStream outputStream = response.getOutputStream();
outputStream.write(jsonObjData.toString().getBytes());
outputStream.flush();
outputStream.close();
System.out.println(" Final data set for RSRSurveyServlet build the Graph is===" + jsonObjData);
} catch (Exception e)
{
System.out.println("Exception : RSRSurveyServlet :doPost(HttpServletRequest request, HttpServletResponse response) :" + e);
try
{
throw new ITMException(e);
} catch (ITMException e1)
{
e1.printStackTrace();
}
}
}
}
\ 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