@Override public void reset(String key) { try { _portletPreferences.reset(key); } catch (ReadOnlyException roe) { _log.error( "Portlet preferences used to persist settings should never " + "be read only", roe); } }
protected void removeDefaultValue( PortletRequest portletRequest, PortletPreferences portletPreferences, String key, String defaultValue) { String value = getParameter(portletRequest, key); if (defaultValue.equals(value) || StringUtil.equalsIgnoreBreakLine(defaultValue, value)) { try { portletPreferences.reset(key); } catch (ReadOnlyException roe) { throw new SystemException(roe); } } }
@Override protected String upgradePreferences( long companyId, long ownerId, int ownerType, long plid, String portletId, String xml) throws Exception { PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.fromXML( companyId, ownerId, ownerType, plid, portletId, xml); Map<String, String[]> preferencesMap = portletPreferences.getMap(); for (Map.Entry<String, String[]> entry : preferencesMap.entrySet()) { String oldName = entry.getKey(); String newName = TextFormatter.format(oldName, TextFormatter.M); portletPreferences.reset(oldName); portletPreferences.setValues(newName, entry.getValue()); } return PortletPreferencesFactoryUtil.toXML(portletPreferences); }
@Override protected String upgradePreferences( long companyId, long ownerId, int ownerType, long plid, String portletId, String xml) throws Exception { PortletPreferences preferences = PortletPreferencesFactoryUtil.fromXML( companyId, ownerId, ownerType, plid, portletId, xml); Map<String, String[]> preferencesMap = preferences.getMap(); Map<String, String> preferenceNamesMap = getPreferenceNamesMap(); for (Map.Entry<String, String> entry : preferenceNamesMap.entrySet()) { String name = entry.getKey(); String[] values = preferencesMap.get(name); if (values == null) { continue; } preferences.reset(name); String newName = entry.getValue(); String[] newValues = preferencesMap.get(newName); if (newValues == null) { preferences.setValues(newName, values); } } return PortletPreferencesFactoryUtil.toXML(preferences); }
public void reset() throws ReadOnlyException { mPreferences.reset(mPreferenceKey); }
public void reset() throws ReadOnlyException { portletPreferences.reset(name); }
public void reset() throws ReadOnlyException { portletPreferences.reset(name); }
protected void setSelectionStyle( ActionRequest actionRequest, PortletPreferences preferences) throws Exception { String selectionStyle = getParameter(actionRequest, "selectionStyle"); String displayStyle = getParameter(actionRequest, "displayStyle"); preferences.setValue("selectionStyle", selectionStyle); if (selectionStyle.equals("manual") || selectionStyle.equals("view-count")) { preferences.setValue("enableRss", Boolean.FALSE.toString()); preferences.setValue("showQueryLogic", Boolean.FALSE.toString()); preferences.reset("rssDelta"); preferences.reset("rssDisplayStyle"); preferences.reset("rssFormat"); preferences.reset("rssName"); } if (!selectionStyle.equals("view-count") && displayStyle.equals("view-count-details")) { preferences.setValue("displayStyle", "full-content"); } }
/** * Resets or removes the value associated with the specified key. * <p> * If this implementation supports stored defaults, and there is such a * default for the specified preference, the given key will be reset to the * stored default. * <p> * If there is no default available the key will be removed. * * @param key * to reset * * @exception java.lang.IllegalArgumentException * if key is <code>null</code>. * @exception IOException * if this preference cannot be modified for this request */ public static void reset(String key) throws IOException { PortletPreferences prefs = getPortletPreferences(); if (prefs == null) { throw new IllegalStateException( "Cannot retrieve PortletPreferences."); } try { prefs.reset(key); } catch (ReadOnlyException e) { throw new IOException(e.toString()); } }
@Override protected String upgradePreferences( long companyId, long ownerId, int ownerType, long plid, String portletId, String xml) throws Exception { PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.fromXML( companyId, ownerId, ownerType, plid, portletId, xml); String enableSocialBookmarks = portletPreferences.getValue( "enableSocialBookmarks", Boolean.TRUE.toString()); if (!enableSocialBookmarks.equals(Boolean.TRUE.toString())) { portletPreferences.setValue( "socialBookmarksTypes", StringPool.BLANK); } portletPreferences.reset("enableSocialBookmarks"); portletPreferences.reset("socialBookmarksDisplayPosition"); return PortletPreferencesFactoryUtil.toXML(portletPreferences); }
prefs.reset(names.getSelectedBackgroundImagePreferenceName()); prefs.store(); } catch (Exception e) {
selectionStyle.equals("manual")) { portletPreferences.reset("anyAssetType"); "anyAssetType", null); portletPreferences.reset("classNameIds"); !anyAssetTypeString.equals("false")) { portletPreferences.reset(name); classTypeIdsDLFileEntryAssetRendererFactory[0]); portletPreferences.reset( "classTypeIdsDLFileEntryAssetRendererFactory"); "false"))) { portletPreferences.reset(name); classTypeIdsJournalArticleAssetRendererFactory[0]); portletPreferences.reset( "classTypeIdsJournalArticleAssetRendererFactory"); portletPreferences.reset(name);
jxPortletPreferences.reset("last-publish-date");