/** * @param request the request being processed * @param response the response to return * @param preferences the portlet preferences */ @ActionMapping(params = Consts.ACTION_ENDDELEGATEMODE) public void doActionEndDelegationMode( ActionRequest request, ActionResponse response, PortletPreferences preferences, Model model) throws Exception { LogHelper log = new LogHelper(request); RequestMessages rqm = RequestMessages.getRequestMessages(request); PortletSession session = request.getPortletSession(); try { log.startTimer("doActionEndDelegationMode"); BannerPortletData data = (BannerPortletData) session.getAttribute("BannerPortletData", PortletSession.APPLICATION_SCOPE); if (data == null) { data = new BannerPortletData(); data.loadFromRequest(request); data.loadFromPreferences(request, rqm); } // ProtectBlock actionEndDelegationModeBody logger.debug("In the doActionEndDelegationMode of ServiceCreditsDeleationView Controller "); log.startTimer("doActionEndDelegationMode"); // logger.info("In the doActionEndDelegationMode,Sessin clean up triggred. " // +session.getAttributeMap(PortletSession.APPLICATION_SCOPE).keySet()); logger.info( "Clearing all session attribute set by the ServiceCreditsDelegationView Controller : " + Consts.SESSION_SUBJECT_USER_MAP + " " + Consts.TEMP_SUBJECT_USER_MAP_KEY_IN_SESSION); session.removeAttribute(Consts.SESSION_SUBJECT_USER_MAP, PortletSession.APPLICATION_SCOPE); session.removeAttribute( Consts.TEMP_SUBJECT_USER_MAP_KEY_IN_SESSION, PortletSession.APPLICATION_SCOPE); // logger.info("In the doActionEndDelegationMode,Sessin clean up triggred. " // +session.getAttributeMap(PortletSession.APPLICATION_SCOPE).keySet()); logger.debug("Setting the Session Cleanup flag to true"); // request.setAttribute("spf.cleanupSession", true); logger.debug("Ending the Delegation session"); logger.info("Sending redirect to ServiceCredits home page"); PortalURL url = Utility.getServiceCreditsHomeUrl(request); url.setParameter("spf.cleanupSession", "true"); response.sendRedirect(url.toString()); logger.debug("End of doActionEndDelegationMode of ServiceCreditsDeleationView Controller "); // TODO Fill In Action Body // ProtectBlock End session.setAttribute("BannerPortletData", data, PortletSession.APPLICATION_SCOPE); } catch (Exception ex) { log.endTimer("doActionEndDelegationMode"); throw ex; } finally { rqm.saveToRequest(); session.setAttribute("ActionMode", "action", PortletSession.PORTLET_SCOPE); log.endTimer("doActionEndDelegationMode"); } }
/** * @param request the request being processed * @param response the response to return * @param preferences the portlet preferences */ @ActionMapping(params = Consts.ACTION_BEGINDELEGATIONMODE) public void doActionBeginDelegationMode( ActionRequest request, ActionResponse response, PortletPreferences preferences, Model model) throws Exception { LogHelper log = new LogHelper(request); RequestMessages rqm = RequestMessages.getRequestMessages(request); PortletSession session = request.getPortletSession(); try { log.startTimer("doActionBeginDelegationMode"); BannerPortletData data = (BannerPortletData) session.getAttribute("BannerPortletData", PortletSession.APPLICATION_SCOPE); if (data == null) { data = new BannerPortletData(); data.loadFromRequest(request); data.loadFromPreferences(request, rqm); } // ProtectBlock actionBeginDelegationModeBody logger.debug("In the doActionBeginDelegationMode of ServiceCreditsDelegationView Controller"); logger.info("Constructing the Subject user map from the ExternalUserProfile"); Map<String, Object> subjectUserProfile = Utility.constructSubjectUserMap( (ExternalUserProfile) session.getAttribute( Consts.TEMP_SUBJECT_USER_MAP_KEY_IN_SESSION, PortletSession.APPLICATION_SCOPE), request); logger.info( "Setting the constructed Subject user in to session under the name SPF_RETAIN_SESSION_SUBJECT_USER_MAP"); session.setAttribute( Consts.SESSION_SUBJECT_USER_MAP, subjectUserProfile, PortletSession.APPLICATION_SCOPE); session.removeAttribute( Consts.TEMP_SUBJECT_USER_MAP_KEY_IN_SESSION, PortletSession.APPLICATION_SCOPE); logger.info( "The constructed Subject user " + session.getAttribute( Consts.SESSION_SUBJECT_USER_MAP, PortletSession.APPLICATION_SCOPE)); logger.info("Setting the Session cleanup attribute to true in the request"); // request.setAttribute("spf.cleanupSession", true); // logger.info("In the doActionBeginDelegationMode,Sessin clean up triggred. " // +session.getAttributeMap(PortletSession.APPLICATION_SCOPE).keySet()); PortalURL url = Utility.getServiceCreditsHomeUrl(request); if (session.getAttribute(Consts.SESSION_SUBJECT_USER_MAP, PortletSession.APPLICATION_SCOPE) != null) { url.setParameter("delegateuseraccesstoservicecredits1", "action", "delegationView"); url.setParameter("spf.cleanupSession", "true"); } logger.info("Redirecting to Service Credirs Home page"); logger.debug("The deleagtion session has now begun"); response.sendRedirect(url.toString()); logger.debug("End of doActionBeginDelegationMode of ServiceCreditsDelegationView Controller"); // TODO Fill In Action Body // ProtectBlock End session.setAttribute("BannerPortletData", data, PortletSession.APPLICATION_SCOPE); } catch (Exception ex) { log.endTimer("doActionBeginDelegationMode"); throw ex; } finally { rqm.saveToRequest(); session.setAttribute("ActionMode", "action", PortletSession.PORTLET_SCOPE); log.endTimer("doActionBeginDelegationMode"); } }