Search in sources :

Example 1 with IPortletWindowId

use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.

the class LayoutRESTController method setAltMaxURL.

private void setAltMaxURL(HttpServletRequest request, NamedNodeMap attributes, IPortletDefinition def, LayoutPortlet portlet) {
    final String alternativeMaximizedLink = def.getAlternativeMaximizedLink();
    if (alternativeMaximizedLink != null) {
        portlet.setUrl(alternativeMaximizedLink);
        portlet.setAltMaxUrl(true);
    } else {
        // get the maximized URL for this portlet
        final IPortalUrlBuilder portalUrlBuilder = urlProvider.getPortalUrlBuilderByLayoutNode(request, attributes.getNamedItem("ID").getNodeValue(), UrlType.RENDER);
        final IPortletWindowId targetPortletWindowId = portalUrlBuilder.getTargetPortletWindowId();
        if (targetPortletWindowId != null) {
            final IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder.getPortletUrlBuilder(targetPortletWindowId);
            portletUrlBuilder.setWindowState(WindowState.MAXIMIZED);
        }
        portlet.setUrl(portalUrlBuilder.getUrlString());
        portlet.setAltMaxUrl(false);
    }
}
Also used : IPortletUrlBuilder(org.apereo.portal.url.IPortletUrlBuilder) IPortalUrlBuilder(org.apereo.portal.url.IPortalUrlBuilder) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 2 with IPortletWindowId

use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.

the class PortletWindowCache method storeIfAbsentWindow.

public T storeIfAbsentWindow(T window) {
    final IPortletWindowId portletWindowId = window.getPortletWindowId();
    // Check if the entity already exists (uses a read lock)
    T existingWindow = this.getWindow(portletWindowId);
    if (existingWindow != null) {
        return existingWindow;
    }
    writeLock.lock();
    try {
        // Check again inside the write lock
        existingWindow = this.windowsById.get(portletWindowId);
        if (existingWindow != null) {
            return existingWindow;
        }
        this.storeWindow(window);
    } finally {
        writeLock.unlock();
    }
    return window;
}
Also used : IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 3 with IPortletWindowId

use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.

the class PortletWindowCache method storeWindow.

public void storeWindow(T window) {
    writeLock.lock();
    try {
        final IPortletEntityId portletEntityId = window.getPortletEntityId();
        final Set<T> windowSet = this.getWindowSet(portletEntityId, true);
        windowSet.add(window);
        final IPortletWindowId portletWindowId = window.getPortletWindowId();
        this.windowsById.put(portletWindowId, window);
    } finally {
        writeLock.unlock();
    }
}
Also used : IPortletEntityId(org.apereo.portal.portlet.om.IPortletEntityId) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 4 with IPortletWindowId

use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.

the class PortletRequestParameterProcessor method processParameters.

/* (non-Javadoc)
     * @see org.apereo.portal.url.processing.IRequestParameterProcessor#processParameters(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
@Override
public boolean processParameters(HttpServletRequest request, HttpServletResponse response) {
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
    final IPortletWindowId targetedPortletWindowId = portalRequestInfo.getTargetedPortletWindowId();
    for (final IPortletRequestInfo portletRequestInfo : portalRequestInfo.getPortletRequestInfoMap().values()) {
        final IPortletWindowId portletWindowId = portletRequestInfo.getPortletWindowId();
        final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, targetedPortletWindowId);
        final UrlType urlType = portalRequestInfo.getUrlType();
        switch(urlType) {
            case RENDER:
                {
                    final Map<String, List<String>> portletParameters = portletRequestInfo.getPortletParameters();
                    portletWindow.setRenderParameters(ParameterMap.convertListMap(portletParameters));
                // fall through, render uses state/mode info
                }
            case ACTION:
                {
                    final WindowState windowState = portletRequestInfo.getWindowState();
                    if (windowState != null) {
                        portletWindow.setWindowState(windowState);
                    }
                    final PortletMode portletMode = portletRequestInfo.getPortletMode();
                    if (portletMode != null) {
                        portletWindow.setPortletMode(portletMode);
                    }
                    break;
                }
            default:
        }
        // Override the window state of the targeted portlet window based on the url state
        if (portletWindowId.equals(targetedPortletWindowId)) {
            final UrlState urlState = portalRequestInfo.getUrlState();
            switch(urlState) {
                case MAX:
                    {
                        portletWindow.setWindowState(WindowState.MAXIMIZED);
                        break;
                    }
                case DETACHED:
                    {
                        portletWindow.setWindowState(IPortletRenderer.DETACHED);
                        break;
                    }
                case EXCLUSIVE:
                    {
                        portletWindow.setWindowState(IPortletRenderer.EXCLUSIVE);
                        break;
                    }
                default:
            }
        }
        this.portletWindowRegistry.storePortletWindow(request, portletWindow);
    }
    return true;
}
Also used : WindowState(javax.portlet.WindowState) IPortalRequestInfo(org.apereo.portal.url.IPortalRequestInfo) IPortletRequestInfo(org.apereo.portal.url.IPortletRequestInfo) UrlType(org.apereo.portal.url.UrlType) ParameterMap(org.apereo.portal.url.ParameterMap) Map(java.util.Map) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) PortletMode(javax.portlet.PortletMode) UrlState(org.apereo.portal.url.UrlState)

Example 5 with IPortletWindowId

use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.

the class PortletAdministrationHelper method configModeAction.

public boolean configModeAction(ExternalContext externalContext, String fname) throws IOException {
    final ActionRequest actionRequest = (ActionRequest) externalContext.getNativeRequest();
    final ActionResponse actionResponse = (ActionResponse) externalContext.getNativeResponse();
    final IPortletWindowId portletWindowId = this.getDelegateWindowId(externalContext, fname);
    if (portletWindowId == null) {
        throw new IllegalStateException("Cannot execute configModeAciton without a delegate window ID in the session for key: " + RenderPortletTag.DEFAULT_SESSION_KEY_PREFIX + fname);
    }
    final PortletDelegationDispatcher requestDispatcher = this.portletDelegationLocator.getRequestDispatcher(actionRequest, portletWindowId);
    final DelegationActionResponse delegationResponse = requestDispatcher.doAction(actionRequest, actionResponse);
    final String redirectLocation = delegationResponse.getRedirectLocation();
    final DelegateState delegateState = delegationResponse.getDelegateState();
    if (redirectLocation != null || (delegationResponse.getPortletMode() != null && !IPortletRenderer.CONFIG.equals(delegationResponse.getPortletMode())) || !IPortletRenderer.CONFIG.equals(delegateState.getPortletMode())) {
        // The portlet sent a redirect OR changed it's mode away from CONFIG, assume it is done
        return true;
    }
    return false;
}
Also used : ActionRequest(javax.portlet.ActionRequest) PortletDelegationDispatcher(org.apereo.portal.api.portlet.PortletDelegationDispatcher) DelegateState(org.apereo.portal.api.portlet.DelegateState) ActionResponse(javax.portlet.ActionResponse) DelegationActionResponse(org.apereo.portal.api.portlet.DelegationActionResponse) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) DelegationActionResponse(org.apereo.portal.api.portlet.DelegationActionResponse)

Aggregations

IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)85 IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)31 Test (org.junit.Test)19 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)19 MockPortletWindowId (org.apereo.portal.mock.portlet.om.MockPortletWindowId)15 WindowState (javax.portlet.WindowState)10 HttpServletRequest (javax.servlet.http.HttpServletRequest)9 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)9 PortletMode (javax.portlet.PortletMode)8 IPortalRequestInfo (org.apereo.portal.url.IPortalRequestInfo)8 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)7 IPortletRenderExecutionWorker (org.apereo.portal.portlet.rendering.worker.IPortletRenderExecutionWorker)7 IPortletUrlBuilder (org.apereo.portal.url.IPortletUrlBuilder)7 LinkedHashMap (java.util.LinkedHashMap)6 IPerson (org.apereo.portal.security.IPerson)6 IPortalUrlBuilder (org.apereo.portal.url.IPortalUrlBuilder)6 IOException (java.io.IOException)5 List (java.util.List)5 IUserInstance (org.apereo.portal.user.IUserInstance)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5