Package evolaris.platform.smssvc.web.form

Examples of evolaris.platform.smssvc.web.form.SendTaskListForm


   */
  public ActionForward list(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {

    UserManagerBase userManager = new UserManager(locale,session);
    User user = userManager.getUserDetails(req.getUserPrincipal().getName().toLowerCase());
    SendTaskListForm sendTaskListForm = (SendTaskListForm) form;

    SendTaskManager sendTaskMgr = new SendTaskManager(locale, session);

    Group groupToDisplay = getCurrentGroup(req);
    if (Boolean.TRUE.equals(sendTaskListForm.getAllGroups()) && UserManager.isUserInRole(webUser, UserManagerBase.ADMINISTRATOR)) {
      groupToDisplay = null;
    }   
    User userToDisplay = null;

    if (!UserManager.isUserInRole(user, UserManagerBase.GROUP_ADMINISTRATOR) && (!UserManager.isUserInRole(user, UserManagerBase.ADMINISTRATOR))) {
      userToDisplay = user;
      Hibernate.initialize(userToDisplay); // used to fetch
    }
   
    int pageNumber = 1; // default page size
    if(req.getParameter("page") != null){
      pageNumber = Integer.parseInt(req.getParameter("page"));
    }
   
    String sortCriterion = "createdAt"; // default sort criterion
    if(req.getParameter("sort") != null){
      sortCriterion = req.getParameter("sort");
    }
   
    SortOrderEnum sortOrderDisplayTag = SortOrderEnum.DESCENDING; // default
    evolaris.framework.database.util.SortOrderEnum sortOrderDb = evolaris.framework.database.util.SortOrderEnum.desc;
    if(req.getParameter("dir") != null) {
      String order = req.getParameter("dir");
      if("asc".equals(order)) {
        sortOrderDisplayTag = SortOrderEnum.ASCENDING;
        sortOrderDb = evolaris.framework.database.util.SortOrderEnum.asc;
      } else {
        sortOrderDisplayTag = SortOrderEnum.DESCENDING;
        sortOrderDb = evolaris.framework.database.util.SortOrderEnum.desc;
      }
    }   
    List tasks = sendTaskMgr.getSendTasks(groupToDisplay, userToDisplay, pageNumber, PAGE_SIZE, sortCriterion, sortOrderDb, sendTaskListForm.getShowErroneousOnly(),sendTaskListForm.getFilterString());
    int fullListCount = sendTaskMgr.getSendTaskCount(groupToDisplay, userToDisplay, sendTaskListForm.getShowErroneousOnly(),sendTaskListForm.getFilterString());
    PaginatedSendTaskList paginatedList = new PaginatedSendTaskList(tasks,fullListCount, PAGE_SIZE, pageNumber, sortCriterion, sortOrderDisplayTag);
    req.setAttribute("tasks", paginatedList);   

    return mapping.findForward("list");
  }
View Full Code Here

TOP

Related Classes of evolaris.platform.smssvc.web.form.SendTaskListForm

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.