Package com.defaultcompany.web.gantt.servlet

Source Code of com.defaultcompany.web.gantt.servlet.GanttChartService

package com.defaultcompany.web.gantt.servlet;

import java.io.IOException;
import java.io.PrintWriter;

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 javax.sql.DataSource;
import org.uengine.util.IntegrationDTO;
import org.uengine.util.dao.DefaultConnectionFactory;
import com.defaultcompany.web.gantt.dao.GanttChartWebDAO;
import com.defaultcompany.web.gantt.model.GanttChartModel;

public class GanttChartService extends HttpServlet {

  @Override
  protected void service(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
    IntegrationDTO paramDto= new IntegrationDTO();
    paramDto.parseRequest(arg0);
   
    String type= paramDto.getValue("type");
   
    String endpoint = paramDto.getValue("endpoint");
    int viewYear   = paramDto.getInt("viewYear");
    String pd       = paramDto.getValue("processDefinition");
   
    String orderby  = paramDto.getValue("orderby");
    String viewMode = paramDto.getValue("viewMode");
    int currentPage = paramDto.getInt("currentPage");
    int intPageCnt  = paramDto.getInt("intPageCnt");
   
    String strategyId = paramDto.getValue("strategyId");
   
   
   
   
    HttpSession session=arg0.getSession(true);
    String  loggedUserGlobalCom    = (String) session.getAttribute("loggedUserGlobalCom");
    String  loggedUserComName     = (String) session.getAttribute("loggedUserComName");
    boolean loggedUserIsAdmin      = "1".equals((String) session.getAttribute("loggedUserIsAdmin"));
    boolean loggedUserIsMaster     = loggedUserIsAdmin && !org.uengine.util.UEngineUtil.isNotEmpty(loggedUserGlobalCom);
    String globalCom =    (String) session.getAttribute("loggedUserGlobalCom");
   
   
    GanttChartWebDAO ganttChartWebDao=null;
    GanttChartModel ganttChartModel=null;
    try{
      ganttChartWebDao = new GanttChartWebDAO(DefaultConnectionFactory.create());
      ganttChartWebDao.init(viewYear, endpoint, pd, globalCom, orderby, loggedUserIsMaster,strategyId);
      ganttChartModel = ganttChartWebDao.makeGanttChart();
   
   
      arg1.setContentType("text/html; charset=UTF-8");
      arg1.setHeader("Cache-Control", "no-cache");
     
      PrintWriter out = arg1.getWriter();
      out.write(type.equals("title")?ganttChartModel.ganttChartTitleToHTML(currentPage, intPageCnt):ganttChartModel.ganttChartListToHTML(currentPage, intPageCnt,viewMode));
     
      out.flush();
      out.close();
    }catch(Exception e){
      e.printStackTrace();
     
    }
   
  }
 
}
TOP

Related Classes of com.defaultcompany.web.gantt.servlet.GanttChartService

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.