Package javax.servlet.http

Examples of javax.servlet.http.HttpSession


    long start = 0L;
    if (logger.isDebugEnabled()) {
      start = System.currentTimeMillis();
    }

    HttpSession session = request.getSession(true);

    // Check the session for an existing error message (possibly from the delete
    // handler)
    ActionErrors allErrors = (ActionErrors)session.getAttribute("listErrorMessage");
    if (allErrors != null) {
      saveErrors(request, allErrors);
      session.removeAttribute("listErrorMessage");
    }

    // Check wheather the actionType is it Lookup or not
    String actionType = (String)request.getParameter("actionType");

    String listScope = request.getParameter("listScope");
       
    if (listScope != null && listScope.equals("ALL")) {
      finalForward = ".view.support.tickets.all.list";
      listScope = "ALL";
    } else {
      finalForward = ".view.support.tickets.my.list";
      listScope = "MY";
    }

    if (actionType != null && actionType.equals("lookup")) {
        listScope = "ALL";
    }
   
    UserObject userObject = (UserObject)session.getAttribute("userobject");
    int individualId = userObject.getIndividualID();
    ListPreference listPreference = userObject.getListPreference("Ticket");
    ListView view = listPreference.getListView(String.valueOf(listPreference.getDefaultView()));
    ValueListParameters listParameters = null;
    ValueListParameters requestListParameters = (ValueListParameters)request.getAttribute("listParameters");
    if (requestListParameters == null) // build up new Parameters
    {
      listParameters = new ValueListParameters(ValueListConstants.TICKET_LIST_TYPE, listPreference.getRecordsPerPage(), 1);
    } else { // paging or sorting or something, use the parameters from the
             // request.
      listParameters = requestListParameters;
    }
    if (listParameters.getSortColumn() == 0) {
      FieldDescriptor sortField = (FieldDescriptor)ValueListConstants.ticketViewMap.get(listPreference.getSortElement());
      listParameters.setSortColumn(sortField.getQueryIndex());
      if (listPreference.getsortOrder()) {
        listParameters.setSortDirection("ASC");
      } else {
        listParameters.setSortDirection("DESC");
      }
    }

    String filter = null;
    String filterParameter = request.getParameter("filter");

    if (filterParameter != null) {
      filter = (String)session.getAttribute("listFilter");
      if (listScope != null && listScope.equalsIgnoreCase("MY")) {
        filter += " AND assignedto = " + individualId + " AND ocstatus = 'OPEN'";
      }
      request.setAttribute("appliedSearch", filterParameter);
    } else {
      if (listScope != null && listScope.equalsIgnoreCase("MY")) {
        filter = " SELECT ticketid FROM ticket WHERE assignedto = " + individualId + " AND ocstatus = 'OPEN'";
      }
      session.removeAttribute("listFilter");
    }
    listParameters.setFilter(filter);

    // TODO remove crappy map between old views and new views.
    Vector viewColumns = view.getColumns();
    ArrayList columns = new ArrayList();
    // We the Action Type is Ticket's Lookup then we must have
    // to set the columns which we are going to look
    if (actionType != null && actionType.equals("lookup")) {
      Vector lookupViewColumns = new Vector();
      lookupViewColumns.add("Number");
      lookupViewColumns.add("Subject");
      lookupViewColumns.add("Entity");
      ActionUtil.mapOldView(columns, lookupViewColumns, ValueListConstants.TICKET_LIST_TYPE);
      listParameters.setRecordsPerPage(100);
      finalForward = ".view.support.ticketslookup";
    } else {
      ActionUtil.mapOldView(columns, viewColumns, ValueListConstants.TICKET_LIST_TYPE);
    }
    listParameters.setColumns(columns);

    // Get the list!
    ValueListHome valueListHome = (ValueListHome)CVUtility.getHomeObject("com.centraview.valuelist.ValueListHome", "ValueList");
    ValueList valueList = null;
    try {
      valueList = valueListHome.create();
    } catch (CreateException e) {
      logger.error("[execute] Exception thrown.", e);
      throw new ServletException(e);
    }
    valueList.setDataSource(dataSource);
    ValueListVO listObject = valueList.getValueList(individualId, listParameters);

    session.setAttribute("ticketPieChartParams", listParameters);
    session.setAttribute("ticketBarChartParams", listParameters);
    ArrayList buttonList = new ArrayList();
    // For the searchBar
    String moduleID = (String)moduleList.get("Ticket");

    ValueListDisplay displayParameters = null;
View Full Code Here


  private static Logger logger = Logger.getLogger(PromotionValueListAction.class);
  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, CommunicationException, NamingException
  {
    String finalForward = ".view.marketing.promotions.list";
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    HttpSession session = request.getSession(true);
    UserObject userObject = (UserObject)session.getAttribute("userobject");
    int individualId = userObject.getIndividualID();
   
    //  Check the session for an existing error message (possibly from the delete handler)
    ActionErrors allErrors = (ActionErrors)session.getAttribute("listErrorMessage");
    if (allErrors != null) {
      saveErrors(request, allErrors);
      session.removeAttribute("listErrorMessage");
    }
   
    GlobalMasterLists globalMasterLists = GlobalMasterLists.getGlobalMasterLists(dataSource);
    HashMap moduleList = new HashMap();
    if (globalMasterLists.get("moduleList") != null)
      moduleList = (HashMap)globalMasterLists.get("moduleList");
   
    ListPreference listPreference = userObject.getListPreference("Promotion");
    ListView view = listPreference.getListView(String.valueOf(listPreference.getDefaultView()));
   
    ValueListParameters listParameters = null;
    ValueListParameters requestListParameters = (ValueListParameters)request.getAttribute("listParameters");
    if (requestListParameters == null) { // build up new Parameters
      listParameters = new ValueListParameters(ValueListConstants.PROMOTION_LIST_TYPE, listPreference.getRecordsPerPage(), 1);
    } else { // paging or sorting or something, use the parameters from the request.
      listParameters = requestListParameters;
    }
    if (listParameters.getSortColumn() == 0) {
      FieldDescriptor sortField = (FieldDescriptor)ValueListConstants.promotionViewMap.get(listPreference.getSortElement());
      listParameters.setSortColumn(sortField.getQueryIndex());
      if (listPreference.getsortOrder())
        listParameters.setSortDirection("ASC");
      else
        listParameters.setSortDirection("DESC");
    }
   
    //  Search handling
    String filter = null;
    String filterParameter = request.getParameter("filter");
    if (filterParameter != null) {
      filter = (String)session.getAttribute("listFilter");
      request.setAttribute("appliedSearch", filterParameter);
    } else {
      session.removeAttribute("listFilter");
    }
    listParameters.setFilter(filter);
   
    Vector viewColumns = view.getColumns();
    ArrayList columns = new ArrayList();   
View Full Code Here

  String blockForward = "displaylistruleemail";
    try
    {
        DynaActionForm dynaForm = (DynaActionForm)form;

    HttpSession session = request.getSession(true);
    UserObject userobjectd = (UserObject)session.getAttribute("userobject");
        int individualId = userobjectd.getIndividualID();

    EmailFacadeHome cfh = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
    EmailFacade remote = (EmailFacade)cfh.create();
    remote.setDataSource(dataSource);

    int accountid        = 0;
    String accountID           = (String) request.getParameter("accountid");

    if (accountID != null && !accountID.equals(""))
    {
      accountid = Integer.parseInt(accountID);
    } //end of if statement (aid != null && !aid.equals(""))

    //System.out.println("accountID"+accountID);




    //System.out.println("accountid"+accountid);

    FolderList fl        = (FolderList) session.getAttribute("folderlist");


    int folderid = fl.getDefaultFolder();

    if(request.getParameter("folderid")!= null)
      folderid =Integer.parseInt(request.getParameter("folderid"));

    //System.out.println("folderid"+folderid);


    Set listkey = fl.keySet();
    Iterator it = listkey.iterator();
    while(it.hasNext())
    {
      AccountDetail ad1 =(AccountDetail)fl.get(it.next());

      String accountAddress = ad1.getAccountaddress();
      ArrayList folderList = ad1.getFolderList() ;

      int parentID = 0;
      String path = "";
      Folder f = null;
      int id = 0;
      for( int i=0 ; i < folderList.size(); i++ )
      {
          f = (Folder)folderList.get( i );
          id = f.getFolderid();
          accountid = ad1.getAccountid();
          if(id==folderid)
          {
            break;
          }
      }
      if (accountid != 0){
        break;
      }
    }

      //System.out.println("accountid Before Accounting Detail"+accountid);
    AccountDetail ad     = (AccountDetail) fl.get(new Integer(accountid));
    ArrayList al         = ad.getFolderList();
    Folder f;

    boolean createJunkMailFolder = true;

    int parentId = 0;
    int junkMailId = 0;
    for (int i = 0; i < al.size(); i++)
    {
    f = (Folder) al.get(i);

      if (f.getFoldername().equalsIgnoreCase("trash")
         && f.getFtype().equalsIgnoreCase("system"))
      {
        parentId = f.getParentfolderid();
        //break;
      }
      if (f.getFoldername().equalsIgnoreCase("junk mail")
         && f.getFtype().equalsIgnoreCase("user"))
      {
         junkMailId = f.getFolderid();
         createJunkMailFolder = false;
        //break;
      }
      //end of if statement (f.getFoldername().equalsIgnoreCase("trash")
        // && f.getFtype().equalsIgnoreCase("user"))
    } //end of for loop (int i = 0; i < al.size(); i++)

    if (parentId != 0){
      createJunkMailFolder = true;
    }


//System.out.println("parentId"+parentId);
//System.out.println("createJunkMailFolder"+createJunkMailFolder);

    if(createJunkMailFolder){

      HashMap hmFolder = new HashMap();
      hmFolder.put("AccountID", new Integer(accountid));
      hmFolder.put("SubfolderID", new Integer(parentId));
      hmFolder.put("foldername", "Junk Mail");
      int i = remote.checkFoldersPresence(individualId, hmFolder);
      if (i != 0) // 0 means folder is present already
      {
        junkMailId = remote.addFolder(individualId, hmFolder);

          FolderList folderList = (FolderList)remote.getFolderList(individualId);
        session.setAttribute("folderlist", folderList);
      }
    }

//System.out.println("parentId After"+parentId);
View Full Code Here

  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();

    AuthorizationHome authHome = (AuthorizationHome)CVUtility.getHomeObject("com.centraview.administration.authorization.AuthorizationHome", "Authorization");
    try {
      HttpSession session = request.getSession(false);

      HashMap hm = new HashMap();

      RecordPermissionForm permissionForm = (RecordPermissionForm)form;
View Full Code Here

        {
          request.setAttribute("closeWindow", "true");
          request.setAttribute("refreshWindow", "false");
        }
      }
      HttpSession session = request.getSession(true);
      UserObject userobjectd = (UserObject)session.getAttribute("userobject");
      int individualId = userobjectd.getIndividualID();

      DynaActionForm dynaForm = (DynaActionForm)form;
      EmailFacadeHome cfh = (EmailFacadeHome)CVUtility.getHomeObject("com.centraview.email.emailfacade.EmailFacadeHome", "EmailFacade");
      EmailFacade remote = (EmailFacade)cfh.create();
View Full Code Here

  private static Logger logger = Logger.getLogger(ExpenseListHandler.class);

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)    throws IOException, ServletException, CommunicationException, NamingException
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    HttpSession session = request.getSession(true);
    session.setAttribute("highlightmodule", "account");

    request.setAttribute(AccountConstantKeys.TYPEOFSUBMODULE, AccountConstantKeys.EXPENSE);
    request.setAttribute("body", "list");

    UserObject  userobjectd = (UserObject)session.getAttribute( "userobject" );//get the user object
    int individualID = userobjectd.getIndividualID();
    ListPreference listpreference= userobjectd.getListPreference("Expense");

    ExpenseList displaylistSession = null;
    ExpenseList displaylist = null;

   
    // After performing the logic in the DeleteHanlder, we are generat a new request for the list
    // So we will not be carrying the old error. So that we will try to collect the error from the Session variable
    // Then destory it after getting the Session value
    if (session.getAttribute("listErrorMessage") != null)
    {
      ActionErrors allErrors = (ActionErrors) session.getAttribute("listErrorMessage");
      saveErrors(request, allErrors);
      session.removeAttribute("listErrorMessage");
    }//end of if (session.getAttribute("listErrorMessage") != null)
    try
    {
      displaylistSession = ( ExpenseList )session.getAttribute( "displaylist") ;//gets the list from session
    }
    catch( Exception e )
    {
      displaylistSession = null;
    }
    try
    {
      displaylist = ( ExpenseList )request.getAttribute( "displaylist") ;//gets the list from request
    }
    catch( Exception e )
    {
      displaylist = null;
    }

    ListGenerator lg = ListGenerator.getListGenerator(dataSource);//get the List Generator object for Listing
    ExpenseList DL = null ;

    if( displaylist == null  )
    {
      int records = listpreference.getRecordsPerPage();//gets the initial record per page to be displayed from listPreference
      String sortelement = listpreference.getSortElement();//gets the initial sort element from listPreference
      DL = (ExpenseList)lg.getExpenseList( individualID , 1, records , "" ,sortelement);//called when the request for the list is for first time
      DL = setLinksfunction( DL );
    }
    else
    {
      String searchSession = displaylistSession.getSearchString();
      String searchrequest = displaylist.getSearchString();
      if(searchSession == null)
        searchSession = "";
      if(searchrequest == null)
        searchrequest = "";

      if (((displaylistSession.getListID() == displaylist.getListID() )  &&
          ( displaylist.getDirtyFlag() == false ) &&
          ( displaylist.getStartAT() >= displaylistSession.getBeginIndex() ) &&
          ( displaylist.getEndAT()<=displaylistSession.getEndIndex() ) &&
          (displaylist.getSortMember().equals(displaylistSession.getSortMember() ) ) &&
          (displaylist.getSortType()==(displaylistSession.getSortType()) &&
          (searchSession.equals(searchrequest))  ) ) ||
          displaylist.getAdvanceSearchFlag() == true)
      {
        DL = (ExpenseList) displaylistSession;
      }
      else
      {
        DL = ( ExpenseList )lg.getExpenseList( individualID , displaylist );
      }// end of else
      DL = setLinksfunction( DL );
    }

    session.setAttribute( "displaylist" , DL );
    request.setAttribute("displaylist" , DL );

    // forward to jsp page
    FORWARD_final = FORWARD_showexpenselist;
    return (mapping.findForward(FORWARD_final));
View Full Code Here

   *  returns ActionForward
   */
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
  {
      String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    HttpSession session = request.getSession();
    int rowID=0;
      try
      {
      // call ejb to insert record
      // initialize file vo
      com.centraview.common.UserObject  userobjectd = (com.centraview.common.UserObject)session.getAttribute( "userobject" );
      String timeZone = userobjectd.getUserPref().getTimeZone();
      CvFileVO fileVO = new CvFileVO();

      if (((FileForm)form).getCompanynews().equals("YES"))
      {
        String startDay = ((FileForm)form).getStartday();
        String startMonth = ((FileForm)form).getStartmonth();
        String startYear = ((FileForm)form).getStartyear();
        String endMonth = ((FileForm)form).getEndmonth();
        String endDay = ((FileForm)form).getEndday();
        String endYear = ((FileForm)form).getEndyear();

        if (startDay != null && startMonth != null && startYear != null
            && startDay.length() != 0 && startMonth.length() != 0 && startYear.length() != 0 )
        {
             fileVO.setFrom(getTimestamp(startDay,startMonth,startYear,timeZone));
        }
        if (endDay != null && endMonth != null && endYear != null
            && endDay.length() != 0 && endMonth.length() != 0 && endYear.length() != 0 )
        {
           fileVO.setTo(getTimestamp(endDay,endMonth,endYear,timeZone));
        }
      }

      // get file
      FormFile fileUpload = ((FileForm)form).getFile();
      // set file vo
      fileVO.setName(fileUpload.getFileName());
      fileVO.setFileSize(fileUpload.getFileSize());
      fileVO.setPhysicalFolder(Integer.parseInt(((FileForm)form).getUploadfolderid()));
      fileVO.setTitle(((FileForm)form).getTitle());
      fileVO.setDescription(((FileForm)form).getDescription());

      if(((FileForm)form).getAuthorid() != null && ((FileForm)form).getAuthorid().length() > 0)
        fileVO.setAuthorId(Integer.parseInt(((FileForm)form).getAuthorid()));

      if(((FileForm)form).getEntityid() != null && ((FileForm)form).getEntityid().length() > 0)
        fileVO.setRelateEntity(Integer.parseInt(((FileForm)form).getEntityid()));

      if(((FileForm)form).getIndividualid() != null && ((FileForm)form).getIndividualid().length() > 0)
        fileVO.setRelateIndividual(Integer.parseInt(((FileForm)form).getIndividualid()));

      fileVO.setRelatedFieldID(((FileForm)form).getRelatedFieldID());
      fileVO.setRelatedFieldValue(((FileForm)form).getRelatedFieldValue());
      fileVO.setRelatedTypeID(((FileForm)form).getRelatedTypeID());
      fileVO.setRelatedTypeValue(((FileForm)form).getRelatedTypeValue());
      fileVO.setVisibility(((FileForm)form).getAccess());
      fileVO.setCustomerView(((FileForm)form).getCustomerview());
      fileVO.setCompanyNews(((FileForm)form).getCompanynews());

      int userId = ((UserObject)session.getAttribute("userobject")).getIndividualID();
      fileVO.setCreatedBy(userId);
      fileVO.setOwner(userId);
      // call to file facade
      CvFileFacade fileFacade = new CvFileFacade();

View Full Code Here

  private static String FORWARD_final = GLOBAL_FORWARD_failure;

  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
  {
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
    HttpSession session = request.getSession(true);
    session.removeAttribute("printtemplate");
    UserObject userObject = (UserObject) session.getAttribute("userobject");
    int individualID = userObject.getIndividualID();
    try {
      DynaActionForm dynaform = (DynaActionForm) form;
      dynaform.reset(mapping, request);
      dynaform.set("templateName", "");
View Full Code Here

  {
    String finalForward = ".view.email.lookup.list";
   
    String dataSource = Settings.getInstance().getSiteInfo(CVUtility.getHostName(super.getServlet().getServletContext())).getDataSource();
   
    HttpSession session = request.getSession(true);
    UserObject userObject = (UserObject)session.getAttribute("userobject");
    int individualId = userObject.getIndividualID();

    //  Check the session for an existing error message (possibly from the delete handler)
    ActionErrors allErrors = (ActionErrors)session.getAttribute("listErrorMessage");
    if (allErrors != null) {
      saveErrors(request, allErrors);
      session.removeAttribute("listErrorMessage");
    }
    ListPreference listPreference = userObject.getListPreference("EmailLookup");
    ListView view = listPreference.getListView(String.valueOf(listPreference.getDefaultView()));

    ValueListParameters listParameters = null;
View Full Code Here

    response.setContentType("text/plain");
    PrintWriter writer = response.getWriter();

    try
    {
      HttpSession session = request.getSession();
     
      if (session != null){
        session.invalidate();
      }
    }catch(java.lang.IllegalStateException e){
      // ok, if an exception occurs, there's nothing we can really do
      // so just print an error to the log and redirect to the login page
      System.out.println("[Exception][LogoutHandler] Exception thrown in execute(): " + e);
View Full Code Here

TOP

Related Classes of javax.servlet.http.HttpSession

Copyright © 2018 www.massapicom. 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.