code: @SuppressWarnings("unchecked")
    public String saveProfile() {
      List<SessionProfileBean> profiles = (List<SessionProfileBean>) categoryProfileService.getProfiles();
      for (final SessionProfileBean profile : profiles) {
        Integer roleId = profile.getRole().getId();
        Integer max = getInt("max_" + roleId);
        Short maxSessions = getShort("maxSessions_" + roleId);
        Short inactiveInterval = getShort("inactiveInterval_" + roleId);
        if (null != max && null != maxSessions && null != inactiveInterval) {
          profile.setCapacity(max);
          profile.setUserMaxSessions(maxSessions);
          profile.setInactiveInterval(inactiveInterval);
        }
      }
      Integer roleId = getInt("roleId_new");
      Integer max = getInt("max_new");
      Short maxSessions = getShort("maxSessions_new");
      Short inactiveInterval = getShort("inactiveInterval_new");
      if (null != max && null != maxSessions && null != inactiveInterval) {
        SessionProfileBean newProfile = new SessionProfileBean();
        newProfile.setRole(roleService.get(roleId));
        newProfile.setCapacity(max);
        newProfile.setUserMaxSessions(maxSessions);
        newProfile.setInactiveInterval(inactiveInterval);
        profiles.add(newProfile);
      }
      categoryProfileService.saveOrUpdate(profiles);
      return redirect("profiles", "info.save.success");
    }
docs: 保存设置