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());
}
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);
}
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);
}
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);
}
}
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;
}
Aggregations