Search in sources :

Example 1 with PortletHeaderPlaceholderEvent

use of org.apereo.portal.character.stream.events.PortletHeaderPlaceholderEvent in project uPortal by Jasig.

the class PortletRenderingInitiationCharacterComponent method getEventReader.

/* (non-Javadoc)
     * @see org.apereo.portal.rendering.PipelineComponent#getEventReader(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
@Override
public PipelineEventReader<CharacterEventReader, CharacterEvent> getEventReader(HttpServletRequest request, HttpServletResponse response) {
    final PipelineEventReader<CharacterEventReader, CharacterEvent> pipelineEventReader = this.wrappedComponent.getEventReader(request, response);
    final CharacterEventReader eventReader = pipelineEventReader.getEventReader();
    final List<CharacterEvent> eventBuffer = new LinkedList<CharacterEvent>();
    while (eventReader.hasNext()) {
        final CharacterEvent event = eventReader.next();
        switch(event.getEventType()) {
            case PORTLET_HEADER:
                {
                    final PortletHeaderPlaceholderEvent headerEvent = (PortletHeaderPlaceholderEvent) event;
                    final IPortletWindowId portletWindowId = headerEvent.getPortletWindowId();
                    if (!this.portletExecutionManager.isPortletRenderHeaderRequested(portletWindowId, request, response)) {
                        this.portletExecutionManager.startPortletHeaderRender(portletWindowId, request, response);
                    }
                    break;
                }
            case PORTLET_CONTENT:
                {
                    final PortletContentPlaceholderEvent headerEvent = (PortletContentPlaceholderEvent) event;
                    final IPortletWindowId portletWindowId = headerEvent.getPortletWindowId();
                    if (!this.portletExecutionManager.isPortletRenderRequested(portletWindowId, request, response)) {
                        this.portletExecutionManager.startPortletRender(portletWindowId, request, response);
                    }
                    break;
                }
        }
        eventBuffer.add(event);
    }
    final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
    final CharacterEventBufferReader bufferEventReader = new CharacterEventBufferReader(eventBuffer.listIterator());
    return new PipelineEventReaderImpl<CharacterEventReader, CharacterEvent>(bufferEventReader, outputProperties);
}
Also used : CharacterEventReader(org.apereo.portal.character.stream.CharacterEventReader) CharacterEvent(org.apereo.portal.character.stream.events.CharacterEvent) CharacterEventBufferReader(org.apereo.portal.character.stream.CharacterEventBufferReader) PortletHeaderPlaceholderEvent(org.apereo.portal.character.stream.events.PortletHeaderPlaceholderEvent) PortletContentPlaceholderEvent(org.apereo.portal.character.stream.events.PortletContentPlaceholderEvent) LinkedList(java.util.LinkedList) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Aggregations

LinkedList (java.util.LinkedList)1 CharacterEventBufferReader (org.apereo.portal.character.stream.CharacterEventBufferReader)1 CharacterEventReader (org.apereo.portal.character.stream.CharacterEventReader)1 CharacterEvent (org.apereo.portal.character.stream.events.CharacterEvent)1 PortletContentPlaceholderEvent (org.apereo.portal.character.stream.events.PortletContentPlaceholderEvent)1 PortletHeaderPlaceholderEvent (org.apereo.portal.character.stream.events.PortletHeaderPlaceholderEvent)1 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)1