public String execute() throws Exception { HttpSession session = request.getSession(false); WebUser user = RequestUtils.getWebUser(session); if (!isPropertyEmpty(dForm.getSelectedDashboardId())) { // assign a selected dashboard session.setAttribute( Constants.SELECTED_DASHBOARD_ID, new Integer(dForm.getSelectedDashboardId())); } if (!isPropertyEmpty(dForm.getDefaultDashboard())) { String currentDefaultDashboardId = user.getPreference(Constants.DEFAULT_DASHBOARD_ID, null); String submittedDefaultDashboardId = dForm.getDefaultDashboard(); // Compare the incoming default dashboard id with the one we had in // our user preferences // If they aren't equal it means the user is changing it, so update if (!submittedDefaultDashboardId.equals(currentDefaultDashboardId)) { user.setPreference(Constants.DEFAULT_DASHBOARD_ID, dForm.getDefaultDashboard()); session.setAttribute( Constants.SELECTED_DASHBOARD_ID, new Integer(dForm.getDefaultDashboard())); authzBoss.setUserPrefs( user.getSessionId(), user.getSubject().getId(), user.getPreferences()); } } return SUCCESS; }
@Override public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); WebUser user = SessionUtils.getWebUser(session); AuthzSubject guestUser = authzBoss.findSubjectByName(user.getSessionId(), "guest"); DashboardConfig dashboardConfig = dashboardManager.getUserDashboard(guestUser, guestUser); String portletId = request.getParameter("pid"); Portlet portlet = new Portlet(portletId); session.setAttribute("portlet", portlet); session.setAttribute(Constants.SELECTED_DASHBOARD_ID, dashboardConfig.getId()); return super.execute(mapping, form, request, response); }