Search in sources :

Example 31 with IPortletWindowId

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

the class UrlSyntaxProviderImplTest method testSingleFolderMultiplePortletFnameSubscribeIdMinimizedRenderUrlParsing.

@Test
public void testSingleFolderMultiplePortletFnameSubscribeIdMinimizedRenderUrlParsing() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    request.setContextPath("/uPortal");
    request.setRequestURI("/f/n2/normal/render.uP");
    request.setQueryString("?pCt=fname.s3&pCs=minimized&pP_action=dashboard&pCm_pw2=help&pP_pw2_a=b&pP_pw2_b=c&pCa=pw2");
    request.addParameter("pCt", "fname.s3");
    request.addParameter("pCs", "minimized");
    request.addParameter("pP_action", "dashboard");
    request.addParameter("pCa", "pw2");
    request.addParameter("pCm_pw2", "help");
    request.addParameter("pP_pw2_a", "b");
    request.addParameter("pP_pw2_b", "c");
    request.addParameter("postedParameter", "foobar");
    final MockPortletWindowId portletWindowId = new MockPortletWindowId("s3");
    final MockPortletWindowId portletWindowId2 = new MockPortletWindowId("pw2");
    when(this.portalRequestUtils.getOriginalPortalRequest(request)).thenReturn(request);
    when(urlNodeSyntaxHelperRegistry.getCurrentUrlNodeSyntaxHelper(request)).thenReturn(urlNodeSyntaxHelper);
    when(this.urlNodeSyntaxHelper.getLayoutNodeForFolderNames(request, Arrays.asList("n2"))).thenReturn("n2");
    when(this.urlNodeSyntaxHelper.getPortletForFolderName(request, "n2", "fname.s3")).thenReturn(portletWindowId);
    when(this.portletWindowRegistry.getPortletWindowId(request, "pw2")).thenReturn(portletWindowId2);
    final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);
    assertNotNull(portalRequestInfo);
    assertEquals("n2", portalRequestInfo.getTargetedLayoutNodeId());
    assertEquals(portletWindowId, portalRequestInfo.getTargetedPortletWindowId());
    assertEquals(UrlState.NORMAL, portalRequestInfo.getUrlState());
    assertEquals(UrlType.RENDER, portalRequestInfo.getUrlType());
    final Map<IPortletWindowId, ? extends IPortletRequestInfo> portletRequestInfoMap = portalRequestInfo.getPortletRequestInfoMap();
    assertNotNull(portletRequestInfoMap);
    assertEquals(2, portletRequestInfoMap.size());
    final IPortletRequestInfo portletRequestInfo = portletRequestInfoMap.get(portletWindowId);
    assertNotNull(portletRequestInfo);
    assertEquals(portletWindowId, portletRequestInfo.getPortletWindowId());
    assertEquals(ImmutableMap.of("action", Arrays.asList("dashboard"), "postedParameter", Arrays.asList("foobar")), portletRequestInfo.getPortletParameters());
    assertEquals(WindowState.MINIMIZED, portletRequestInfo.getWindowState());
    assertNull(portletRequestInfo.getPortletMode());
    final IPortletRequestInfo portletRequestInfo2 = portletRequestInfoMap.get(portletWindowId2);
    assertNotNull(portletRequestInfo2);
    assertEquals(portletWindowId2, portletRequestInfo2.getPortletWindowId());
    assertEquals(ImmutableMap.of("a", Arrays.asList("b"), "b", Arrays.asList("c")), portletRequestInfo2.getPortletParameters());
    assertNull(portletRequestInfo2.getWindowState());
    assertEquals(PortletMode.HELP, portletRequestInfo2.getPortletMode());
}
Also used : MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) MockPortletWindowId(org.apereo.portal.mock.portlet.om.MockPortletWindowId) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) Test(org.junit.Test)

Example 32 with IPortletWindowId

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

the class PortletResponseContextImpl method addProperty.

@Override
public void addProperty(Cookie cookie) {
    final IPortletWindowId portletWindowId = this.portletWindow.getPortletWindowId();
    this.portletCookieService.addCookie(this.servletRequest, portletWindowId, cookie);
}
Also used : IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 33 with IPortletWindowId

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

the class PortletPlaceholderEventSource method generateCharacterEvents.

@Override
public void generateCharacterEvents(HttpServletRequest servletRequest, MatchResult matchResult, Collection<CharacterEvent> eventBuffer) {
    final String subscribeId = matchResult.group(this.portletIdGroup);
    if (subscribeId == null) {
        this.logger.warn("MatchResult returned null for group " + this.portletIdGroup + ". No PortletPlaceholderEvent will be generated. " + matchResult);
        return;
    }
    final IPortletWindow portletWindow = this.portletWindowRegistry.getOrCreateDefaultPortletWindowByLayoutNodeId(servletRequest, subscribeId);
    final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
    this.generateCharacterEvents(portletWindowId, matchResult, eventBuffer);
}
Also used : IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 34 with IPortletWindowId

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

the class PortletWindowRegistryImpl method addPortletWindowData.

protected void addPortletWindowData(HttpServletRequest request, IPortletEntityId portletEntityId, final Set<IPortletWindow> portletWindows, final PortletWindowCache<IPortletWindow> portletWindowMap, final PortletWindowCache<PortletWindowData> portletWindowDataMap) {
    final Set<PortletWindowData> windows = portletWindowDataMap.getWindows(portletEntityId);
    if (windows == null) {
        return;
    }
    for (final PortletWindowData portletWindowData : windows) {
        final IPortletWindowId portletWindowId = portletWindowData.getPortletWindowId();
        // request cache
        if (!portletEntityId.equals(portletWindowData.getPortletEntityId()) || portletWindowMap.containsWindow(portletWindowId)) {
            continue;
        }
        // Wrap the data in a window and stick it in the request cache
        IPortletWindow portletWindow = this.wrapPortletWindowData(request, portletWindowData);
        portletWindow = portletWindowMap.storeIfAbsentWindow(portletWindow);
        portletWindows.add(portletWindow);
    }
}
Also used : IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow)

Example 35 with IPortletWindowId

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

the class PortletWindowRegistryImpl method getDefaultPortletWindowId.

/* (non-Javadoc)
     * @see org.apereo.portal.portlet.registry.IPortletWindowRegistry#getDefaultPortletWindowId(org.apereo.portal.portlet.om.IPortletEntityId)
     */
@Override
public IPortletWindowId getDefaultPortletWindowId(HttpServletRequest request, IPortletEntityId portletEntityId) {
    final IPortletWindowId portletWindowId = this.createPortletWindowId(null, portletEntityId);
    logger.trace("Determined default portlet window id {} for portlet entity {}", portletWindowId, portletEntityId);
    return portletWindowId;
}
Also used : IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

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