本文整理匯總了Java中javax.portlet.PortletPreferences類的典型用法代碼示例。如果您正苦於以下問題:Java PortletPreferences類的具體用法?Java PortletPreferences怎麽用?Java PortletPreferences使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PortletPreferences類屬於javax.portlet包,在下文中一共展示了PortletPreferences類的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: doImportData
import javax.portlet.PortletPreferences; //導入依賴的package包/類
@Override
protected PortletPreferences doImportData(PortletDataContext portletDataContext, String portletId,
PortletPreferences portletPreferences, String data) throws Exception {
if (!portletDataContext.getBooleanParameter(NAMESPACE, "task-records")) {
return null;
}
portletDataContext.importPortletPermissions(TimetrackerPortletPermission.RESOURCE_NAME);
Element entriesElement = portletDataContext.getImportDataGroupElement(TaskRecord.class);
List<Element> entryElements = entriesElement.elements();
for (Element entryElement : entryElements) {
StagedModelDataHandlerUtil.importStagedModel(portletDataContext, entryElement);
}
return null;
}
示例3: readConfiguration
import javax.portlet.PortletPreferences; //導入依賴的package包/類
@Override
public FlashlightSearchConfiguration readConfiguration(PortletPreferences preferences) {
// Get the ADT UUID
String adtUUID = preferences.getValue(CONF_KEY_ADT_UUID, StringPool.BLANK);
// Perform a search on startup?
boolean doSearchOnStartup = preferences.getValue(CONF_KEY_DO_SEARCH_ON_STARTUP, StringPool.FALSE).equals(StringPool.TRUE);
String doSearchOnStartupKeywords = preferences.getValue(CONF_KEY_DO_SEARCH_ON_STARTUP_KEYWORDS, FlashlightSearchService.CONFIGURATION_DEFAULT_SEARCH_KEYWORDS);
// Get the tabs
String[] tabIds = preferences.getValues(CONF_KEY_TABS, EMPTY_ARRAY);
int tabIdsLength = tabIds.length;
ArrayList<FlashlightSearchConfigurationTab> tabs = new ArrayList<>(tabIdsLength);
// For each tabs, get its configuration
for(int i = 0; i < tabIdsLength; i++) {
tabs.add(this.readTabConfiguration(preferences, tabIds[i]));
}
return new FlashlightSearchConfiguration(adtUUID, doSearchOnStartup, doSearchOnStartupKeywords, tabs);
}
示例4: actionSaveFacetConfig
import javax.portlet.PortletPreferences; //導入依賴的package包/類
/**
* This action saves the Liferay facet configuration for a given tab
*
* @param request The request
* @param response The response
* @throws PortletException If something goes wrong
* @throws IOException If something goes wrong
*/
@ProcessAction(name = ACTION_NAME_SAVE_FACET_CONFIG)
public void actionSaveFacetConfig(ActionRequest request, ActionResponse response) throws PortletException, IOException {
String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK);
String facetClassName = ParamUtil.get(request, FORM_FIELD_FACET_CLASS_NAME, StringPool.BLANK);
String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK);
PortletPreferences preferences = request.getPreferences();
FlashlightSearchConfiguration configuration = this.searchService.readConfiguration(preferences);
SearchFacet targetFacet = this.getSearchFacetFromRequest(tabId, facetClassName, configuration);
if(targetFacet != null) {
JSONObject facetConfiguration = targetFacet.getJSONData(request);
targetFacet.getFacetConfiguration().setDataJSONObject(facetConfiguration);
this.searchService.saveSearchFacetConfig(configuration.getTabs().get(tabId), targetFacet, preferences);
SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED);
response.sendRedirect(redirectUrl);
}
}
示例5: actionDeleteTab
import javax.portlet.PortletPreferences; //導入依賴的package包/類
/**
* Deletes a tab from the configuration
*
* @param request The request
* @param response The response
* @throws PortletException If something goes wrong
* @throws IOException If something goes wrong
*/
@ProcessAction(name = ACTION_NAME_DELETE_TAB)
public void actionDeleteTab(ActionRequest request, ActionResponse response) throws PortletException, IOException {
String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK);
String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK);
if (tabId != null && PATTERN_UUID.matcher(tabId).matches()) {
PortletPreferences preferences = request.getPreferences();
Map<String, FlashlightSearchConfigurationTab> tabs = this.searchService.readConfiguration(preferences).getTabs();
if (tabs.containsKey(tabId)) {
this.searchService.deleteConfigurationTab(tabId, preferences);
}
}
SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED);
if (!redirectUrl.isEmpty()) {
response.sendRedirect(redirectUrl);
}
}
示例6: doImportData
import javax.portlet.PortletPreferences; //導入依賴的package包/類
@Override
protected PortletPreferences doImportData(PortletDataContext portletDataContext, String portletId,
PortletPreferences portletPreferences, String data) throws Exception {
if (!portletDataContext.getBooleanParameter(NAMESPACE, "contacts")) {
return null;
}
portletDataContext.importPortletPermissions(ContactManagerPortletPermission.RESOURCE_NAME);
Element entriesElement = portletDataContext.getImportDataGroupElement(Contact.class);
List<Element> entryElements = entriesElement.elements();
for (Element entryElement : entryElements) {
StagedModelDataHandlerUtil.importStagedModel(portletDataContext, entryElement);
}
return null;
}
示例7: getPortletPreferences
import javax.portlet.PortletPreferences; //導入依賴的package包/類
protected PortletPreferences getPortletPreferences(long groupId)
throws PortalException {
long ownerId = groupId;
int ownerType = PortletKeys.PREFS_OWNER_TYPE_GROUP;
long plid = 0;
PortletPreferences preferences = null;
try {
com.liferay.portal.kernel.model.PortletPreferences portletPreferences = _portletPreferencesLocalService
.getPortletPreferences(ownerId, ownerType, plid,
ch.inofix.data.constants.PortletKeys.DATA_MANAGER);
preferences = PortletPreferencesFactoryUtil
.fromDefaultXML(portletPreferences.getPreferences());
} catch (NoSuchPortletPreferencesException e) {
_log.warn(e.getMessage());
}
return preferences;
}
示例8: getPreferences
import javax.portlet.PortletPreferences; //導入依賴的package包/類
protected PortletPreferences getPreferences(long groupId)
throws PortalException {
long ownerId = groupId;
int ownerType = PortletKeys.PREFS_OWNER_TYPE_GROUP;
long plid = 0;
com.liferay.portal.kernel.model.PortletPreferences portletPreferences = _portletPreferencesLocalService
.getPortletPreferences(ownerId, ownerType, plid,
ch.inofix.data.constants.PortletKeys.DATA_MANAGER);
PortletPreferences preferences = PortletPreferencesFactoryUtil
.fromDefaultXML(portletPreferences.getPreferences());
return preferences;
}
示例9: _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);
}
}
示例10: _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);
}
}
示例11: processAction
import javax.portlet.PortletPreferences; //導入依賴的package包/類
public void processAction(
PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse actionResponse)
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("showActionSocial", actionRequest.getParameter("showActionSocial"));
prefs.setValue("showActionAudit", actionRequest.getParameter("showActionAudit"));
prefs.store();
SessionMessages.add(
actionRequest, portletConfig.getPortletName() + ".doConfigure");
//SessionMessages.add(actionRequest,"success");
}
示例12: 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("viewAlways", actionRequest.getParameter("viewAlways"));
prefs.store();
SessionMessages.add(actionRequest,portletConfig.getPortletName() + ".doConfigure");
}
示例13: 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");
}
示例14: 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("showPreviousModuleButton", actionRequest.getParameter("showPreviousModuleButton"));
prefs.store();
SessionMessages.add(actionRequest,portletConfig.getPortletName() + ".doConfigure");
}
示例15: 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");
}