本文整理匯總了Java中javax.portlet.PortletPreferences.setValue方法的典型用法代碼示例。如果您正苦於以下問題:Java PortletPreferences.setValue方法的具體用法?Java PortletPreferences.setValue怎麽用?Java PortletPreferences.setValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.portlet.PortletPreferences
的用法示例。
在下文中一共展示了PortletPreferences.setValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processAction
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse arg2) throws Exception {
if (!Constants.UPDATE.equals(actionRequest.getParameter(Constants.CMD)))
return;
PortletPreferences prefs;
String portletResource = ParamUtil.getString(actionRequest, "portletResource");
if (Validator.isNotNull(portletResource)){
prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);
} else {
prefs = actionRequest.getPreferences();
}
prefs.setValue("numerateModules", actionRequest.getParameter("numerateModules"));
prefs.store();
SessionMessages.add(actionRequest,portletConfig.getPortletName() + ".doConfigure");
}
示例2: _noRetry
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
private void _noRetry() {
try {
PortletPreferences portletPreferences =
PrefsPropsUtil.getPreferences();
portletPreferences.setValue(
PortletPropsKeys.MQTT_ERRORS_RETRY_CONNECT,
String.valueOf(false));
portletPreferences.store();
}
catch (Exception e1) {
_log.error(e1);
}
}
示例3: _setupRetry
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
private void _setupRetry(Throwable e) {
try {
PortletPreferences portletPreferences =
PrefsPropsUtil.getPreferences();
portletPreferences.setValue(
PortletPropsKeys.MQTT_ERRORS_RETRY_CONNECT,
String.valueOf(true));
portletPreferences.store();
}
catch (Exception e1) {
_log.error(e);
}
}
示例4: store
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
@Override
public void store(final PortletPreferences preferences, final String key, final JournalArticle article)
throws ReadOnlyException {
String articleResourceUuid = null;
String articleId = null;
if (article != null) {
try {
articleResourceUuid = article.getArticleResourceUuid();
articleId = article.getArticleId();
} catch (final PortalException | SystemException e) {
log.error("Could not load article resource id for article {}", article.getArticleId(), e);
}
}
preferences.setValue(key + RESOURCE_UUID_SUFFIX, articleResourceUuid);
preferences.setValue(key + ARTICLE_ID_SUFFIX, articleId);
}
示例5: processAction
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse arg2) throws Exception {
if (!Constants.UPDATE.equals(actionRequest.getParameter(Constants.CMD)))
return;
PortletPreferences prefs;
String portletResource = ParamUtil.getString(actionRequest, "portletResource");
if (Validator.isNotNull(portletResource)){
prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);
} else {
prefs = actionRequest.getPreferences();
}
prefs.setValue("viewMode", actionRequest.getParameter("viewMode"));
prefs.setValue("numerateModules", actionRequest.getParameter("numerateModules"));
prefs.store();
SessionMessages.add(actionRequest,portletConfig.getPortletName() + ".doConfigure");
}
示例6: processAction
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
public void processAction(
PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse actionResponse)
throws Exception {
PortletPreferences portletPreferences =
PortletPreferencesFactoryUtil.getPortletSetup(
actionRequest, ParamUtil.getString(actionRequest, "portletResource"));
/**
* boolean showAllways = preferences.getValue("showAllways", "false").equals("true");
boolean showOnlyWhenFinishDate = preferences.getValue("showOnlyWhenFinishDate", "true").equals("true");
*/
portletPreferences.setValue("showCalificationMode",ParamUtil.getString(actionRequest, "showCalificationMode"));
portletPreferences.store();
SessionMessages.add(
actionRequest, portletConfig.getPortletName() + ".doConfigure");
//SessionMessages.add(actionRequest,"success");
}
示例7: setmodulePref
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
@ProcessAction(name = "setmodulePref")
public void setmodulePref(ActionRequest request, ActionResponse response) throws Exception {
String rowsPerPage = ParamUtil.getString(request, "module-rows-per-page");
String dateFormat = ParamUtil.getString(request, "module-date-format");
String datetimeFormat = ParamUtil.getString(request, "module-datetime-format");
ArrayList<String> errors = new ArrayList<String>();
if (moduleValidator.validateEditmodule(rowsPerPage, dateFormat, datetimeFormat, errors)) {
response.setRenderParameter("module-rows-per-page", "");
response.setRenderParameter("module-date-format", "");
response.setRenderParameter("module-datetime-format", "");
PortletPreferences prefs = request.getPreferences();
prefs.setValue("module-rows-per-page", rowsPerPage);
prefs.setValue("module-date-format", dateFormat);
prefs.setValue("module-datetime-format", datetimeFormat);
prefs.store();
SessionMessages.add(request, "module-prefs-success");
}
}
示例8: processAction
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
@Override
public void processAction(ActionRequest request, ActionResponse response)
throws IOException, PortletException {
String action = request.getParameter("action");
if ("editPrefs".equals(action)) {
PortletPreferences prefs = request.getPreferences();
for (String key : prefs.getMap().keySet()) {
String value = request.getParameter(key);
prefs.setValue(key, value);
}
prefs.store();
} else {
String url = request.getParameter("URL");
if (!StringUtils.isBlank(url)) {
PortletMessaging.publish(request, IFrameGenericPortlet.IFRAME_SRC_URL, url.trim());
}
}
response.setPortletMode(PortletMode.VIEW);
}
示例9: checkSetPreferenceSingleValue
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
protected TestResult checkSetPreferenceSingleValue(PortletRequest request) {
TestResult result = new TestResult();
result.setDescription("Ensure a single preference value can be set.");
result.setSpecPLT("14.1");
PortletPreferences preferences = request.getPreferences();
try {
preferences.setValue("TEST", "TEST_VALUE");
} catch (ReadOnlyException ex) {
TestUtils.failOnException("Unable to set preference value.", ex, result);
return result;
}
String value = preferences.getValue("TEST", DEF_VALUE);
if (value != null && value.equals("TEST_VALUE")) {
result.setReturnCode(TestResult.PASSED);
} else {
TestUtils.failOnAssertion("preference value", value, "TEST_VALUE", result);
}
return result;
}
示例10: checkSetPreferenceNull
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
protected TestResult checkSetPreferenceNull(PortletRequest request) {
TestResult result = new TestResult();
result.setDescription("Ensure a preference value can be set to null.");
result.setSpecPLT("14.1");
PortletPreferences preferences = request.getPreferences();
try {
preferences.setValue("TEST", null);
} catch (ReadOnlyException ex) {
TestUtils.failOnException("Unable to set preference value.", ex, result);
return result;
}
String value = preferences.getValue("TEST", DEF_VALUE);
// see PLUTO-609: behavioral change!
if (null == value) {
result.setReturnCode(TestResult.PASSED);
} else {
TestUtils.failOnAssertion("preference value", value, null, result);
}
return result;
}
示例11: deleteVoiceCommand
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
public static PortletPreferences deleteVoiceCommand(ActionRequest request, String voiceCommand)
throws PortalException, SystemException, ReadOnlyException, ValidatorException, IOException {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
long plid = themeDisplay.getLayout().getPlid();
long ownerId = PortletKeys.PREFS_OWNER_ID_DEFAULT;
int ownerType = PortletKeys.PREFS_OWNER_TYPE_LAYOUT;
long companyId = themeDisplay.getCompanyId();
PortletPreferences preference = request.getPreferences();
Map<String, String[]> preferencesMap = new HashMap<String, String[]>(preference.getMap());
preferencesMap.remove(voiceCommand);
PortletPreferencesLocalServiceUtil.deletePortletPreferences(ownerId, ownerType, plid, SpeechConstants.PORTLET_NAMESPACE);
preference = PortletPreferencesLocalServiceUtil.getPreferences(companyId, ownerId, ownerType, plid,
SpeechConstants.PORTLET_NAMESPACE);
for (Map.Entry<String, String[]> entry : preferencesMap.entrySet()) {
preference.setValue(entry.getKey(), entry.getValue()[0]);
}
preference.store();
return preference;
}
示例12: updateBuddyListStrategy
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
/**
* Updates buddy list strategy preferences
*
* @param preferences PortletPreferences
* @param properties Properties
* @throws Exception
*/
private void updateBuddyListStrategy(PortletPreferences preferences, Properties properties) throws Exception {
// Reset previous preferences
preferences.reset(PortletPropertiesKeys.BUDDY_LIST_STRATEGY);
// Set the value in portlet preferences
preferences.setValue(
PortletPropertiesKeys.BUDDY_LIST_STRATEGY,
properties.getBuddyListStrategy().getDescription()
);
// Persist
preferences.store();
// Save in environment
setupBuddyListStrategy(preferences);
}
示例13: saveGlobalSettings
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
@Override
public void saveGlobalSettings(String adtUuid, boolean doSearchOnStartup, String doSearchOnStartupKeywords, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException {
if(Validator.isNull(doSearchOnStartupKeywords)) {
doSearchOnStartupKeywords = FlashlightSearchService.CONFIGURATION_DEFAULT_SEARCH_KEYWORDS;
}
preferences.setValue(CONF_KEY_ADT_UUID, adtUuid);
preferences.setValue(CONF_KEY_DO_SEARCH_ON_STARTUP, Boolean.toString(doSearchOnStartup));
preferences.setValue(CONF_KEY_DO_SEARCH_ON_STARTUP_KEYWORDS, doSearchOnStartupKeywords);
preferences.store();
}
示例14: saveSearchFacetConfig
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
@Override
public void saveSearchFacetConfig(FlashlightSearchConfigurationTab configurationTab, SearchFacet searchFacet, PortletPreferences preferences) throws ReadOnlyException, ValidatorException, IOException {
String tabId = configurationTab.getId();
String facetConfigKey = format(CONF_KEY_FORMAT_SEARCH_FACET, tabId, searchFacet.getClass().getName());
preferences.setValue(facetConfigKey, searchFacet.getData().toJSONString());
preferences.store();
}
示例15: changePreference
import javax.portlet.PortletPreferences; //導入方法依賴的package包/類
/**
* In the action phase, the dateFormat preference is modified. To persist any
* modifications, the PortletPreferences must be stored.
*/
@RequestMapping
public void changePreference(PortletPreferences preferences, @RequestParam("dateFormat") String dateFormat)
throws Exception {
preferences.setValue("dateFormat", dateFormat);
preferences.store();
}