Search in sources :

Example 1 with PortletRenderExecutionEvent

use of org.apereo.portal.events.PortletRenderExecutionEvent 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<String, PortletRenderExecutionEvent>();
    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 "{}";
}
Also used : PortalEvent(org.apereo.portal.events.PortalEvent) HashMap(java.util.HashMap) PortletRenderExecutionEvent(org.apereo.portal.events.PortletRenderExecutionEvent) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) IOException(java.io.IOException) JsonParseException(com.fasterxml.jackson.core.JsonParseException) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Aggregations

JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 PortalEvent (org.apereo.portal.events.PortalEvent)1 PortletRenderExecutionEvent (org.apereo.portal.events.PortletRenderExecutionEvent)1 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)1