@Override
public String getOutputProperty(HttpServletRequest request, PreferencesScope prefScope, String name) {
final StylesheetPreferencesKey stylesheetPreferencesKey = this.getStylesheetPreferencesKey(request, prefScope);
final IStylesheetDescriptor stylesheetDescriptor = stylesheetPreferencesKey.stylesheetDescriptor;
final IOutputPropertyDescriptor outputPropertyDescriptor = stylesheetDescriptor.getOutputPropertyDescriptor(name);
if (outputPropertyDescriptor == null) {
logger.warn("Attempted to get output property {} but no such output property is defined in stylesheet descriptor {}. null will be returned", new Object[] {name, stylesheetDescriptor.getName()});
return null;
}
final String value;
final Scope scope = outputPropertyDescriptor.getScope();
switch (scope) {
case PERSISTENT: {
final IStylesheetUserPreferences stylesheetUserPreferences = this.getStylesheetUserPreferences(request, stylesheetPreferencesKey);
if (stylesheetUserPreferences == null) {
return null;
}
value = stylesheetUserPreferences.getOutputProperty(name);
break;
}
default: {
value = this.getDataValue(request, stylesheetPreferencesKey, scope, OUTPUT_PROPERTIES_KEY, name);
break;
}
}
if (value == null) {
return null;
}
//If the value is equal to the default value remove the property and return null
if (this.compareValues(value, outputPropertyDescriptor.getDefaultValue())) {
this.removeOutputProperty(request, prefScope, name);
return null;
}
return value;