use of org.apereo.portal.layout.IStylesheetUserPreferencesService.PreferencesScope in project uPortal by Jasig.
the class StylesheetAttributeSource method getAdditionalAttributes.
@Override
public final Iterator<Attribute> getAdditionalAttributes(HttpServletRequest request, HttpServletResponse response, StartElement event) {
final IStylesheetDescriptor stylesheetDescriptor = this.getStylesheetDescriptor(request);
final PreferencesScope stylesheetPreferencesScope = this.getStylesheetPreferencesScope(request);
final Collection<Attribute> attributes = new LinkedList<Attribute>();
for (final ILayoutAttributeDescriptor layoutAttributeDescriptor : stylesheetDescriptor.getLayoutAttributeDescriptors()) {
final Set<String> targetElementNames = layoutAttributeDescriptor.getTargetElementNames();
final QName eventName = event.getName();
final String localEventName = eventName.getLocalPart();
if (targetElementNames.contains(localEventName)) {
final Attribute subscribeIdAttr = event.getAttributeByName(IUserLayoutManager.ID_ATTR_NAME);
final String subscribeId = subscribeIdAttr.getValue();
final String name = layoutAttributeDescriptor.getName();
String value = this.stylesheetUserPreferencesService.getLayoutAttribute(request, stylesheetPreferencesScope, subscribeId, name);
if (value == null) {
value = layoutAttributeDescriptor.getDefaultValue();
}
if (value != null) {
if (this.shouldDoSpelEvaluationForAttributeValue(value)) {
final ServletWebRequest webRequest = new ServletWebRequest(request, response);
value = this.doSpelEvaluationForAttributeValue(webRequest, value);
}
if (value != null) {
final Attribute attribute = xmlEventFactory.createAttribute(name, value);
attributes.add(attribute);
}
}
}
}
return attributes.iterator();
}
use of org.apereo.portal.layout.IStylesheetUserPreferencesService.PreferencesScope in project uPortal by Jasig.
the class StylesheetAttributeSource method getCacheKey.
@Override
public final CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) {
final PreferencesScope stylesheetPreferencesScope = this.getStylesheetPreferencesScope(request);
final CacheKeyBuilder<String, String> cacheKeyBuilder = CacheKey.builder(this.name);
final Iterable<String> layoutAttributeNodeIds = this.stylesheetUserPreferencesService.getAllLayoutAttributeNodeIds(request, stylesheetPreferencesScope);
for (final String nodeId : layoutAttributeNodeIds) {
cacheKeyBuilder.add(nodeId);
this.stylesheetUserPreferencesService.populateLayoutAttributes(request, stylesheetPreferencesScope, nodeId, cacheKeyBuilder);
}
return cacheKeyBuilder.build();
}
use of org.apereo.portal.layout.IStylesheetUserPreferencesService.PreferencesScope in project uPortal by Jasig.
the class StylesheetUserPreferencesTransformerConfigurationSource method getParameters.
/* (non-Javadoc)
* @see org.apereo.portal.rendering.xslt.TransformerConfigurationSource#getTransformerParameters(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public final Map<String, Object> getParameters(HttpServletRequest request, HttpServletResponse response) {
final PreferencesScope stylesheetPreferencesScope = this.getStylesheetPreferencesScope(request);
final LinkedHashMap<String, Object> stylesheetParameters = new LinkedHashMap<String, Object>();
this.stylesheetUserPreferencesService.populateStylesheetParameters(request, stylesheetPreferencesScope, new MapPopulator<String, String>(stylesheetParameters));
return stylesheetParameters;
}
use of org.apereo.portal.layout.IStylesheetUserPreferencesService.PreferencesScope in project uPortal by Jasig.
the class StylesheetUserPreferencesTransformerConfigurationSource method getOutputProperties.
@Override
public Properties getOutputProperties(HttpServletRequest request, HttpServletResponse response) {
final PreferencesScope stylesheetPreferencesScope = this.getStylesheetPreferencesScope(request);
final PropertiesPopulator outputProperties = this.stylesheetUserPreferencesService.populateOutputProperties(request, stylesheetPreferencesScope, new PropertiesPopulator());
return outputProperties.getProperties();
}
use of org.apereo.portal.layout.IStylesheetUserPreferencesService.PreferencesScope 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();
}
Aggregations