Search in sources :

Example 1 with CacheKeyBuilder

use of org.apereo.portal.utils.cache.CacheKey.CacheKeyBuilder in project uPortal by Jasig.

the class StylesheetDescriptorTransformerConfigurationSource method getCacheKey.

@Override
public final CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) {
    final CacheKeyBuilder cacheKeyBuilder = CacheKey.builder(this.getName());
    final PreferencesScope preferencesScope = this.getStylesheetPreferencesScope(request);
    final IStylesheetDescriptor stylesheetDescriptor = this.stylesheetUserPreferencesService.getStylesheetDescriptor(request, preferencesScope);
    // Build key from stylesheet descriptor parameters
    for (final IStylesheetParameterDescriptor stylesheetParameterDescriptor : stylesheetDescriptor.getStylesheetParameterDescriptors()) {
        final String defaultValue = stylesheetParameterDescriptor.getDefaultValue();
        if (defaultValue != null) {
            final String name = stylesheetParameterDescriptor.getName();
            cacheKeyBuilder.put(name, defaultValue);
        }
    }
    return cacheKeyBuilder.build();
}
Also used : IStylesheetParameterDescriptor(org.apereo.portal.layout.om.IStylesheetParameterDescriptor) CacheKeyBuilder(org.apereo.portal.utils.cache.CacheKey.CacheKeyBuilder) IStylesheetDescriptor(org.apereo.portal.layout.om.IStylesheetDescriptor) PreferencesScope(org.apereo.portal.layout.IStylesheetUserPreferencesService.PreferencesScope)

Example 2 with CacheKeyBuilder

use of org.apereo.portal.utils.cache.CacheKey.CacheKeyBuilder in project uPortal by Jasig.

the class PortletWindowAttributeSource method getCacheKey.

@Override
public final CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) {
    final Set<IPortletWindow> portletWindows = this.portletWindowRegistry.getAllLayoutPortletWindows(request);
    final CacheKeyBuilder cacheKeyBuilder = CacheKey.builder(this.name);
    for (final IPortletWindow portletWindow : portletWindows) {
        if (portletWindow != null) {
            final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
            final WindowState windowState = portletWindow.getWindowState();
            final PortletMode portletMode = portletWindow.getPortletMode();
            cacheKeyBuilder.addAll(portletWindowId, windowState.toString(), portletMode.toString());
        } else {
            this.logger.warn("portletWindowRegistry#getAllLayoutPortletWindows() returned a null portletWindow");
        }
    }
    return cacheKeyBuilder.build();
}
Also used : WindowState(javax.portlet.WindowState) CacheKeyBuilder(org.apereo.portal.utils.cache.CacheKey.CacheKeyBuilder) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) PortletMode(javax.portlet.PortletMode)

Example 3 with CacheKeyBuilder

use of org.apereo.portal.utils.cache.CacheKey.CacheKeyBuilder in project uPortal by Jasig.

the class PortletDefinitionAttributeSource method getCacheKey.

@Override
public final CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) {
    final CacheKeyBuilder cacheKeyBuilder = CacheKey.builder(this.name);
    // We need something that makes for a unique cache key.  For lack of anything else useful,
    // use the set of all layout portlet window ids in the user's layout.
    final Set<IPortletWindow> portletWindows = this.portletWindowRegistry.getAllLayoutPortletWindows(request);
    for (final IPortletWindow portletWindow : portletWindows) {
        if (portletWindow != null) {
            final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
            cacheKeyBuilder.add(portletWindowId);
        } else {
            this.logger.warn("portletWindowRegistry#getAllLayoutPortletWindows() returned a null portletWindow");
        }
    }
    return cacheKeyBuilder.build();
}
Also used : CacheKeyBuilder(org.apereo.portal.utils.cache.CacheKey.CacheKeyBuilder) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId)

Example 4 with CacheKeyBuilder

use of org.apereo.portal.utils.cache.CacheKey.CacheKeyBuilder in project uPortal by Jasig.

the class MergingTransformerConfigurationSource method getCacheKey.

/* (non-Javadoc)
     * @see org.apereo.portal.rendering.xslt.TransformerConfigurationSource#getTransformerConfigurationKey(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
@Override
public CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) {
    final CacheKeyBuilder cacheKeyBuilder = CacheKey.builder(this.getClass().getName());
    for (final TransformerConfigurationSource source : this.sources) {
        final CacheKey key = source.getCacheKey(request, response);
        cacheKeyBuilder.add(key);
    }
    return cacheKeyBuilder.build();
}
Also used : CacheKeyBuilder(org.apereo.portal.utils.cache.CacheKey.CacheKeyBuilder) CacheKey(org.apereo.portal.utils.cache.CacheKey)

Aggregations

CacheKeyBuilder (org.apereo.portal.utils.cache.CacheKey.CacheKeyBuilder)4 IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)2 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)2 PortletMode (javax.portlet.PortletMode)1 WindowState (javax.portlet.WindowState)1 PreferencesScope (org.apereo.portal.layout.IStylesheetUserPreferencesService.PreferencesScope)1 IStylesheetDescriptor (org.apereo.portal.layout.om.IStylesheetDescriptor)1 IStylesheetParameterDescriptor (org.apereo.portal.layout.om.IStylesheetParameterDescriptor)1 CacheKey (org.apereo.portal.utils.cache.CacheKey)1