コード例 #1
0
ファイル: LogoutAction.java プロジェクト: karianna/ikasan
  /* (non-Javadoc)
   * @see com.mapping.configuration.ui.action.Action#exectuteAction()
   */
  @Override
  public void exectuteAction() {
    IkasanAuthentication ikasanAuthentication =
        (IkasanAuthentication)
            VaadinService.getCurrentRequest()
                .getWrappedSession()
                .getAttribute(DashboardSessionValueConstants.USER);

    VaadinService.getCurrentRequest()
        .getWrappedSession()
        .setAttribute(DashboardSessionValueConstants.USER, null);
    this.visibilityGroup.setVisible();
    this.editableGroup.setEditable(false);

    layout.removeComponent(this.logOutButton);
    layout.addComponent(this.loginButton, 2, 0);
    layout.addComponent(this.setupButton, 3, 0);
    layout.setComponentAlignment(this.setupButton, Alignment.MIDDLE_RIGHT);
    layout.setComponentAlignment(this.loginButton, Alignment.MIDDLE_RIGHT);
    this.layout.removeComponent(userLabel);

    VaadinSession vSession = VaadinSession.getCurrent();
    WrappedSession httpSession = vSession.getSession();

    this.navigationPanel.reset();

    // Invalidate HttpSession
    httpSession.invalidate();
    vSession.close();

    systemEventService.logSystemEvent(
        SystemEventConstants.DASHBOARD_LOGOUT_CONSTANTS,
        "User logging out: " + ikasanAuthentication.getName(),
        ikasanAuthentication.getName());

    // Redirect the user to the login/default Page
    Page.getCurrent().setLocation("/ikasan-dashboard");
  }
コード例 #2
0
  /**
   * search for system events
   *
   * @return - key to next view
   */
  @RequestMapping(value = "search.htm", method = RequestMethod.GET)
  public String search(
      HttpServletRequest request,
      @RequestParam(required = false) Boolean newSearch,
      @RequestParam(required = false) Integer page,
      @RequestParam(required = false) String orderBy,
      @RequestParam(required = false) Boolean orderAsc,
      @RequestParam(required = false) String subject,
      @RequestParam(required = false) String action,
      @RequestParam(required = false) String actor,
      @RequestParam(required = false) String timestampFromDate,
      @RequestParam(required = false) String timestampFromTime,
      @RequestParam(required = false) String timestampToDate,
      @RequestParam(required = false) String timestampToTime,
      ModelMap model) {
    Date timestampFrom = createDateTime(timestampFromDate, timestampFromTime);
    Date timestampTo = createDateTime(timestampToDate, timestampToTime);

    // Setup the generic search criteria
    int pageNo = page != null ? page : 0;
    int pageSize = 25;
    String orderByField = orderBy == null ? "timestamp" : orderBy;
    boolean orderAscending = orderAsc != null ? orderAsc : false;

    // Perform the paged search
    PagedSearchResult<SystemEvent> pagedResult = null;
    pagedResult =
        systemEventService.listSystemEvents(
            pageNo,
            pageSize,
            orderByField,
            orderAscending,
            subject,
            action,
            timestampFrom,
            timestampTo,
            actor);

    // Store the search parameters used
    Map<String, Object> searchParams = new HashMap<String, Object>();
    searchParams.put("subject", subject);
    searchParams.put("action", action);
    searchParams.put("actor", actor);
    searchParams.put("timestampFromDate", timestampFromDate);
    searchParams.put("timestampFromTime", timestampFromTime);
    searchParams.put("timestampToDate", timestampToDate);
    searchParams.put("timestampToTime", timestampToTime);

    model.addAttribute("searchParams", searchParams);
    model.addAttribute("orderBy", orderBy);
    model.addAttribute("orderAsc", orderAsc);
    model.addAttribute("page", pageNo);
    model.addAttribute("results", pagedResult);
    // pagedResult can be null if we're returning errors to the user
    if (pagedResult != null) {
      model.addAttribute("firstResultIndex", pagedResult.getFirstResultIndex());
      model.addAttribute("lastPage", pagedResult.isLastPage());
      model.addAttribute("resultSize", pagedResult.getResultSize());
      model.addAttribute("size", pagedResult.getPagedResults().size());
    }
    // Set a default value for the JSP to cleanly deal with errors coming back
    else {
      model.addAttribute("resultSize", 0);
    }

    model.addAttribute("searchResultsUrl", request.getRequestURL());

    return "admin/systemEventLog";
  }
コード例 #3
0
 /**
  * Invoke housekeeping on system event log
  *
  * @return - key to next view
  */
 @RequestMapping(value = "housekeeping.htm", method = RequestMethod.POST)
 public String housekeepnig(
     HttpServletRequest request, HttpServletResponse response, ModelMap model) {
   systemEventService.housekeep();
   return "redirect:search.htm";
 }