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 StylesheetUserPreferencesTransformerConfigurationSource method getCacheKey.
/* (non-Javadoc)
* @see org.apereo.portal.rendering.xslt.TransformerConfigurationSource#getTransformerConfigurationKey(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@Override
public final CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) {
final CacheKeyBuilder<String, String> cacheKeyBuilder = CacheKey.builder(getName());
final PreferencesScope stylesheetPreferencesScope = this.getStylesheetPreferencesScope(request);
this.stylesheetUserPreferencesService.populateStylesheetParameters(request, stylesheetPreferencesScope, cacheKeyBuilder);
this.stylesheetUserPreferencesService.populateOutputProperties(request, stylesheetPreferencesScope, cacheKeyBuilder);
return cacheKeyBuilder.build();
}
Aggregations