existingPreference.setReadOnly(preference.isReadOnly()); this.portletPreferences.add(existingPreference);
@Override public IPortletPreference apply(IPortletPreference newPreference) { if (newPreference == null) { return null; } final String name = newPreference.getName(); for (final IPortletPreference oldPreference : portletPreferences) { if (name.equals(oldPreference.getName())) { // Don't add the new preference, just replace the existing one when a match is // found oldPreference.setValues(newPreference.getValues()); oldPreference.setReadOnly(newPreference.isReadOnly()); return null; } } return newPreference; } }