@Test(expected = ReadOnlyException.class) public void testResetReadOnly() throws ReadOnlyException, ValidatorException, IOException { addPref(basePrefs, "key", true, new String[] {"default"}); portletPreferences.reset("key"); }
@Override public final void reset(String key) throws ReadOnlyException { final Map<String, IPortletPreference> basePortletPreferences = this.getBasePortletPreferences(); final IPortletPreference basePreference = basePortletPreferences.get(key); if (this.isReadOnly(basePreference)) { throw new ReadOnlyException("Preference '" + key + "' is read only"); } final Map<String, IPortletPreference> targetPortletPreferences = this.getTargetPortletPreferences(); final IPortletPreference removed = targetPortletPreferences.remove(key); if (removed != null) { final Map<String, IPortletPreference> compositePortletPreferences = this.getCompositePortletPreferences(); if (basePreference != null) { compositePortletPreferences.put(key, basePreference); } else { compositePortletPreferences.remove(key); } this.modified = true; } }
AbstractPortletPreferencesImpl implements PortletPreferences { @Override public final void reset(String key) throws ReadOnlyException { final Map<String, IPortletPreference> basePortletPreferences = this.getBasePortletPreferences(); final IPortletPreference basePreference = basePortletPreferences.get(key); if (this.isReadOnly(basePreference)) { throw new ReadOnlyException("Preference '" + key + "' is read only"); } final Map<String, IPortletPreference> targetPortletPreferences = this.getTargetPortletPreferences(); final IPortletPreference removed = targetPortletPreferences.remove(key); if (removed != null) { final Map<String, IPortletPreference> compositePortletPreferences = this.getCompositePortletPreferences(); if (basePreference != null) { compositePortletPreferences.put(key, basePreference); } else { compositePortletPreferences.remove(key); } this.modified = true; } } }
AbstractPortletPreferencesImpl implements PortletPreferences { @Override public final void reset(String key) throws ReadOnlyException { final Map<String, IPortletPreference> basePortletPreferences = this.getBasePortletPreferences(); final IPortletPreference basePreference = basePortletPreferences.get(key); if (this.isReadOnly(basePreference)) { throw new ReadOnlyException("Preference '" + key + "' is read only"); } final Map<String, IPortletPreference> targetPortletPreferences = this.getTargetPortletPreferences(); final IPortletPreference removed = targetPortletPreferences.remove(key); if (removed != null) { final Map<String, IPortletPreference> compositePortletPreferences = this.getCompositePortletPreferences(); if (basePreference != null) { compositePortletPreferences.put(key, basePreference); } else { compositePortletPreferences.remove(key); } this.modified = true; } } AbstractPortletPreferencesImpl(boolean render); }
AbstractPortletPreferencesImpl implements PortletPreferences { @Override public final void reset(String key) throws ReadOnlyException { final Map<String, IPortletPreference> basePortletPreferences = this.getBasePortletPreferences(); final IPortletPreference basePreference = basePortletPreferences.get(key); if (this.isReadOnly(basePreference)) { throw new ReadOnlyException("Preference '" + key + "' is read only"); } final Map<String, IPortletPreference> targetPortletPreferences = this.getTargetPortletPreferences(); final IPortletPreference removed = targetPortletPreferences.remove(key); if (removed != null) { final Map<String, IPortletPreference> compositePortletPreferences = this.getCompositePortletPreferences(); if (basePreference != null) { compositePortletPreferences.put(key, basePreference); } else { compositePortletPreferences.remove(key); } this.modified = true; } } AbstractPortletPreferencesImpl(boolean render); @Override final boolean isReadOnly(String key); @Override final String getValue(String key, String def); @Override final String[] getValues(String key, String[] def); @Override final void setValue(String key, String value); @Override final void setValues(String key, String[] values); @Override final Enumeration<String> getNames(); @Override final Map<String, String[]> getMap(); @Override final void reset(String key); @Override final void store(); }
AbstractPortletPreferencesImpl implements PortletPreferences { @Override public final void reset(String key) throws ReadOnlyException { final Map<String, IPortletPreference> basePortletPreferences = this.getBasePortletPreferences(); final IPortletPreference basePreference = basePortletPreferences.get(key); if (this.isReadOnly(basePreference)) { throw new ReadOnlyException("Preference '" + key + "' is read only"); } final Map<String, IPortletPreference> targetPortletPreferences = this.getTargetPortletPreferences(); final IPortletPreference removed = targetPortletPreferences.remove(key); if (removed != null) { final Map<String, IPortletPreference> compositePortletPreferences = this.getCompositePortletPreferences(); if (basePreference != null) { compositePortletPreferences.put(key, basePreference); } else { compositePortletPreferences.remove(key); } this.modified = true; } } AbstractPortletPreferencesImpl(boolean render); @Override final boolean isReadOnly(String key); @Override final String getValue(String key, String def); @Override final String[] getValues(String key, String[] def); @Override final void setValue(String key, String value); @Override final void setValues(String key, String[] values); @Override final Enumeration<String> getNames(); @Override final Map<String, String[]> getMap(); @Override final void reset(String key); @Override final void store();  }