@Override public String getLayoutAttribute(String nodeId, String name) { final ILayoutAttributeDescriptor layoutAttributeDescriptor = this.stylesheetDescriptor.getLayoutAttributeDescriptor(name); if (layoutAttributeDescriptor == null) { logger.warn( "Attempted to get layout attribute {} for ID=\"{}\" but no such stylesheet parameter is defined in stylesheet descriptor {}. Null will be returned", new Object[] {name, nodeId, this.stylesheetDescriptor.getName()}); return null; } final Scope scope = layoutAttributeDescriptor.getScope(); final IStylesheetUserPreferences stylesheetUserPreferences = this.getStylesheetUserPreferences(scope, false); if (stylesheetUserPreferences != null) { final String layoutAttribute = stylesheetUserPreferences.getLayoutAttribute(nodeId, name); if (layoutAttribute != null) { return layoutAttribute; } } if (this.distributedStylesheetUserPreferences != null) { final String layoutAttribute = this.distributedStylesheetUserPreferences.getLayoutAttribute(nodeId, name); if (layoutAttribute != null) { return layoutAttribute; } } return layoutAttributeDescriptor.getDefaultValue(); }
/* (non-Javadoc) * @see org.jasig.portal.layout.om.IStylesheetUserPreferences#setLayoutAttribute(java.lang.String, java.lang.String, java.lang.String) */ @Override public String setLayoutAttribute(String nodeId, String name, String value) { final ILayoutAttributeDescriptor layoutAttributeDescriptor = this.stylesheetDescriptor.getLayoutAttributeDescriptor(name); if (layoutAttributeDescriptor == null) { logger.warn( "Attempted to set layout attribute {}={} on node with ID=\"{}\" but no such stylesheet parameter is defined in stylesheet descriptor {}. It will be ignored.", new Object[] {name, value, nodeId, this.stylesheetDescriptor.getName()}); return null; } final Scope scope = this.getWriteScope(layoutAttributeDescriptor); final IStylesheetUserPreferences stylesheetUserPreferences = this.getStylesheetUserPreferences(scope, true); final String defaultValue = layoutAttributeDescriptor.getDefaultValue(); if (this.compareValues(value, defaultValue)) { return stylesheetUserPreferences.removeLayoutAttribute(nodeId, name); } return stylesheetUserPreferences.setLayoutAttribute(nodeId, name, value); }