use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class PortletRendererImpl method publishRenderEvent.
/**
* Publish the portlet render event
*/
protected void publishRenderEvent(IPortletWindow portletWindow, HttpServletRequest httpServletRequest, RenderPart renderPart, long executionTime, boolean cached) {
final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
// Determine if the portlet was targeted
final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(httpServletRequest);
final boolean targeted = portletWindowId.equals(portalRequestInfo.getTargetedPortletWindowId());
renderPart.publishRenderExecutionEvent(this.portalEventFactory, this, httpServletRequest, portletWindowId, executionTime, targeted, cached);
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class PortletCookieServiceImplTest method testAddCookieControl.
/**
* Control test for adding a portlet cookie: no existing portalCookie, portlet cookie requires
* persistence.
*/
@Test
public void testAddCookieControl() {
Cookie portletCookie = new Cookie("somePortletCookieName", "somePortletCookieValue");
// max age will trigger persistence
portletCookie.setMaxAge(360);
IPortletCookieDao portletCookieDao = EasyMock.createMock(IPortletCookieDao.class);
MockPortalCookie portalCookie = new MockPortalCookie();
portalCookie.setValue("ABCDEF");
EasyMock.expect(portletCookieDao.createPortalCookie(PortletCookieServiceImpl.DEFAULT_MAX_AGE)).andReturn(portalCookie);
EasyMock.expect(portletCookieDao.addOrUpdatePortletCookie(portalCookie, portletCookie)).andReturn(portalCookie);
PortletCookieServiceImpl cookieService = new PortletCookieServiceImpl();
cookieService.setPortletCookieDao(portletCookieDao);
IPortletWindowId mockWindowId = EasyMock.createMock(IPortletWindowId.class);
EasyMock.replay(portletCookieDao, mockWindowId);
MockHttpServletRequest request = new MockHttpServletRequest();
cookieService.addCookie(request, mockWindowId, portletCookie);
EasyMock.verify(portletCookieDao, mockWindowId);
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class PortletDelegationLocatorImpl method createRequestDispatcher.
/* (non-Javadoc)
* @see org.apereo.portal.api.portlet.PortletDelegationLocator#createRequestDispatcher(org.apereo.portal.portlet.om.IPortletDefinitionId)
*/
@Override
public PortletDelegationDispatcher createRequestDispatcher(PortletRequest portletRequest, IPortletDefinitionId delegatePortletDefinitionId) {
final HttpServletRequest request = this.portalRequestUtils.getPortletHttpRequest(portletRequest);
final String windowID = portletRequest.getWindowID();
final IPortletWindowId parentPortletWindowId = this.portletWindowRegistry.getPortletWindowId(request, windowID);
final IPortletEntity delegatePortletEntity = this.portletEntityRegistry.getOrCreateDelegatePortletEntity(request, parentPortletWindowId, delegatePortletDefinitionId);
final IPortletEntityId delegatePortletEntityId = delegatePortletEntity.getPortletEntityId();
final IPortletWindow delegatePortletWindow = this.portletWindowRegistry.createDelegatePortletWindow(request, delegatePortletEntityId, parentPortletWindowId);
final IPerson person = this.personManager.getPerson(request);
final int userId = person.getID();
return new PortletDelegationDispatcherImpl(delegatePortletWindow, userId, portalRequestUtils, personManager, portletRenderer, portalUrlProvider, portletDelegationManager);
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class AnalyticsIncorporationComponent method serializePortletRenderExecutionEvents.
protected String serializePortletRenderExecutionEvents(final Set<PortalEvent> portalEvents) {
// Filter to include just portlet render events
final Map<String, PortletRenderExecutionEvent> renderEvents = new HashMap<>();
for (final PortalEvent portalEvent : portalEvents) {
if (portalEvent instanceof PortletRenderExecutionEvent) {
final PortletRenderExecutionEvent portletRenderEvent = (PortletRenderExecutionEvent) portalEvent;
// Don't write out info for minimized portlets
if (!WindowState.MINIMIZED.equals(portletRenderEvent.getWindowState())) {
final IPortletWindowId portletWindowId = portletRenderEvent.getPortletWindowId();
final String eventKey = portletWindowId != null ? portletWindowId.getStringId() : portletRenderEvent.getFname();
renderEvents.put(eventKey, portletRenderEvent);
}
}
}
try {
return portletEventWriter.writeValueAsString(renderEvents);
} catch (JsonParseException e) {
logger.warn("Failed to convert this request's render events to JSON, no portlet level analytics will be included", e);
} catch (JsonMappingException e) {
logger.warn("Failed to convert this request's render events to JSON, no portlet level analytics will be included", e);
} catch (IOException e) {
logger.warn("Failed to convert this request's render events to JSON, no portlet level analytics will be included", e);
}
return "{}";
}
use of org.apereo.portal.portlet.om.IPortletWindowId in project uPortal by Jasig.
the class PortalUrlProviderImpl method verifyPortletWindowId.
/**
* Verify the requested portlet window corresponds to a node in the user's layout and return the
* corresponding layout node id
*/
protected String verifyPortletWindowId(HttpServletRequest request, IPortletWindowId portletWindowId) {
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
final IPortletWindowId delegationParentWindowId = portletWindow.getDelegationParentId();
if (delegationParentWindowId != null) {
return verifyPortletWindowId(request, delegationParentWindowId);
}
final IPortletEntity portletEntity = portletWindow.getPortletEntity();
final String channelSubscribeId = portletEntity.getLayoutNodeId();
final IUserLayoutNodeDescription node = userLayoutManager.getNode(channelSubscribeId);
if (node == null) {
throw new IllegalArgumentException("No layout node exists for id " + channelSubscribeId + " of window " + portletWindowId);
}
return node.getId();
}
Aggregations