예제 #1
0
  /** Contains Display Logic */
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    HttpSession session = request.getSession(true);
    UserModel sessionModel = (UserModel) session.getAttribute("user");

    Long id = sessionModel.getCollegeId();
    Long roleId = sessionModel.getRoleId();

    if (id == 0) {
      id = DataUtility.getLong(request.getParameter("id"));
    }

    CollegeModel model = new CollegeModel();
    System.out.println("org12" + UserFilterManager.getOrganizationId(request));
    model.setOrganizationId(UserFilterManager.getOrganizationId(request));

    if (id > 0) {
      try {
        model = model.findByPK(id);
        ServletUtility.setModel(model, request);
      } catch (ApplicationException e) {
        ServletUtility.handleException(e, request, response);
        return;
      }
    }
    ServletUtility.setModel(model, request);
    ServletUtility.forwardView(ORSView.COLLEGE_VIEW, request, response);
  }
예제 #2
0
 /**
  * Returns logged in user role
  *
  * @param request
  * @return
  */
 public static long getRole(HttpServletRequest request) {
   UserModel model = (UserModel) request.getSession().getAttribute("user");
   if (model != null) {
     return model.getRoleId();
   } else {
     return AppRole.GUEST;
   }
 }