/* (non-Javadoc)
   * @see org.jasig.portal.layout.om.IStylesheetUserPreferences#setOutputProperty(java.lang.String, java.lang.String)
   */
  @Override
  public String setOutputProperty(String name, String value) {
    final IOutputPropertyDescriptor outputPropertyDescriptor =
        this.stylesheetDescriptor.getOutputPropertyDescriptor(name);
    if (outputPropertyDescriptor == null) {
      logger.warn(
          "Attempted to set output property {}={} but no such output property is defined in stylesheet descriptor {}. It will be ignored",
          new Object[] {name, value, this.stylesheetDescriptor.getName()});
      return null;
    }

    final Scope scope = this.getWriteScope(outputPropertyDescriptor);
    final IStylesheetUserPreferences stylesheetUserPreferences =
        this.getStylesheetUserPreferences(scope, true);

    final String defaultValue = outputPropertyDescriptor.getDefaultValue();
    if (this.compareValues(value, defaultValue)) {
      return stylesheetUserPreferences.removeOutputProperty(name);
    }

    return stylesheetUserPreferences.setOutputProperty(name, value);
  }
  @Override
  public String getOutputProperty(String name) {
    final IOutputPropertyDescriptor outputPropertyDescriptor =
        this.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, this.stylesheetDescriptor.getName()});
      return null;
    }

    final Scope scope = outputPropertyDescriptor.getScope();
    final IStylesheetUserPreferences stylesheetUserPreferences =
        this.getStylesheetUserPreferences(scope, false);
    if (stylesheetUserPreferences != null) {
      final String outputProperty = stylesheetUserPreferences.getOutputProperty(name);
      if (outputProperty != null) {
        return outputProperty;
      }
    }

    return outputPropertyDescriptor.getDefaultValue();
  }