Пример #1
0
 @SkipValidation
 public String reset() throws Exception {
   pForm.reset();
   clearErrorsAndMessages();
   clearCustomErrorMessages();
   return "reset";
 }
Пример #2
0
  public String update() throws Exception {

    HttpSession session = request.getSession();
    WebUser user = SessionUtils.getWebUser(session);

    String forwardStr = SUCCESS;

    String token = (String) session.getAttribute("currentPortletToken");

    // For multi-portlet configurations
    String resKey = JsonLoadCriticalAlertsNG.RESOURCES_KEY;
    String countKey = PropertiesFormNG.ALERT_NUMBER;
    String priorityKey = PropertiesFormNG.PRIORITY;
    String timeKey = PropertiesFormNG.PAST;
    String selOrAllKey = PropertiesFormNG.SELECTED_OR_ALL;
    String titleKey = PropertiesFormNG.TITLE;

    if (token != null) {
      resKey += token;
      countKey += token;
      priorityKey += token;
      timeKey += token;
      selOrAllKey += token;
      titleKey += token;
    }
    DashboardConfig dashConfig =
        dashboardManager.findDashboard(
            (Integer) session.getAttribute(Constants.SELECTED_DASHBOARD_ID), user, authzBoss);
    ConfigResponse dashPrefs = dashConfig.getConfig();

    if (pForm.isRemoveClicked()) {
      DashboardUtils.removeResources(pForm.getIds(), resKey, dashPrefs);
      configurationProxy.setDashboardPreferences(session, user, dashPrefs);
      forwardStr = "review";
    }

    String forward = checkSubmit(pForm);

    if (forward != null) {
      return forward;
    }

    Integer numberOfAlerts = pForm.getNumberOfAlerts();
    String past = String.valueOf(pForm.getPast());
    String prioritity = pForm.getPriority();
    String selectedOrAll = pForm.getSelectedOrAll();

    dashPrefs.setValue(countKey, numberOfAlerts.toString());
    dashPrefs.setValue(timeKey, past);
    dashPrefs.setValue(priorityKey, prioritity);
    dashPrefs.setValue(selOrAllKey, selectedOrAll);
    dashPrefs.setValue(titleKey, pForm.getTitle());

    configurationProxy.setDashboardPreferences(session, user, dashPrefs);

    session.removeAttribute(Constants.USERS_SES_PORTAL);

    removeValueInSession("currentPortletKey");
    removeValueInSession("currentPortletToken");

    return forwardStr;
  }