本文整理汇总了Java中com.liferay.portal.kernel.servlet.SessionMessages.add方法的典型用法代码示例。如果您正苦于以下问题:Java SessionMessages.add方法的具体用法?Java SessionMessages.add怎么用?Java SessionMessages.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.servlet.SessionMessages
的用法示例。
在下文中一共展示了SessionMessages.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionSaveGlobal
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
/**
* Saves the global aspect of the configuration
*
* @param request The request
* @param response The response
* @throws IOException If something goes wrong
* @throws PortletException If something goes wrong
*/
@ProcessAction(name = ACTION_NAME_SAVE_GLOBAL)
public void actionSaveGlobal(ActionRequest request, ActionResponse response) throws IOException, PortletException {
String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK);
String adtUuid = ParamUtil.get(request, FORM_FIELD_ADT_UUID, StringPool.BLANK);
boolean doSearchOnStartup = ParamUtil.getBoolean(request, FORM_FIELD_DO_SEARCH_ON_STARTUP, false);
if (!PATTERN_UUID.matcher(adtUuid).matches()) {
adtUuid = StringPool.BLANK;
}
String doSearchOnStartupKeywords = ParamUtil.getString(request, FORM_FIELD_DO_SEARCH_ON_STARTUP_KEYWORDS, FlashlightSearchService.CONFIGURATION_DEFAULT_SEARCH_KEYWORDS);
this.searchService.saveGlobalSettings(adtUuid, doSearchOnStartup, doSearchOnStartupKeywords, request.getPreferences());
SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED);
if (!redirectUrl.isEmpty()) {
response.sendRedirect(redirectUrl);
}
}
示例2: actionSaveFacetConfig
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的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);
}
}
示例3: actionDeleteTab
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的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);
}
}
示例4: doProcessAction
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) {
try {
DummyGenerator<OrgContext> dummyGenerator = _orgDummyFactory.create(request);
dummyGenerator.create(request);
} catch (Exception e) {
hideDefaultSuccessMessage(request);
_log.error(e, e);
}
response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);
SessionMessages.add(request, "success");
}
示例5: doProcessAction
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) {
try {
DummyGenerator<CategoryContext> dummyGenerator = _categoryDummyFactory.create(request);
dummyGenerator.create(request);
} catch (Exception e) {
hideDefaultSuccessMessage(request);
_log.error(e, e);
return;
}
response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);
SessionMessages.add(request, "success");
}
示例6: doProcessAction
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) {
try {
DummyGenerator<DLContext> dummyGenerator = _dlDummyFactory.create(request);
dummyGenerator.create(request);
} catch (Exception e) {
hideDefaultSuccessMessage(request);
_log.error(e, e);
}
response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);
SessionMessages.add(request, "success");
}
示例7: processAction
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
String linkList = ParamUtil.getString(actionRequest, DummyFactoryConfiguration.CONF_LINKLIST);
String urlList = ParamUtil.getString(actionRequest, DummyFactoryConfiguration.CONF_URLLIST);
if (_log.isDebugEnabled()) {
_log.debug("Link List :" + linkList);
_log.debug("URL List :" + urlList);
}
List<String> errors = Lists.newArrayList();
if (validate(linkList, errors)) {
setPreference(actionRequest, DummyFactoryConfiguration.CONF_LINKLIST, linkList);
setPreference(actionRequest, DummyFactoryConfiguration.CONF_URLLIST, urlList);
SessionMessages.add(actionRequest, "prefs-success");
}
super.processAction(portletConfig, actionRequest, actionResponse);
}
示例8: doProcessAction
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) {
try {
DummyGenerator<JournalContext> dummyGenerator = _journalDummyFactory.create(request);
dummyGenerator.create(request);
} catch (Exception e) {
hideDefaultSuccessMessage(request);
_log.error(e, e);
}
response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);
SessionMessages.add(request, "success");
}
示例9: doProcessAction
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
@Override
protected void doProcessAction(ActionRequest request, ActionResponse response) {
try {
DummyGenerator<PageContext> dummyGenerator = _pageDummyFactory.create(request);
dummyGenerator.create(request);
} catch (Exception e) {
hideDefaultSuccessMessage(request);
_log.error(e, e);
}
response.setRenderParameter("mvcRenderCommandName", LDFPortletKeys.COMMON);
SessionMessages.add(request, "success");
}
示例10: addDocTemplate
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
public void addDocTemplate(ActionRequest actionRequest,
ActionResponse actionResponse) throws PortletException {
ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
try {
String templateNo = ParamUtil.getString(actionRequest, "templateNo");
String title = ParamUtil.getString(actionRequest, "title");
String enTitle = ParamUtil.getString(actionRequest, "enTitle");
String _uuid = ParamUtil.getString(actionRequest, "fileEntryUuid");
DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.getFileEntryByUuidAndGroupId(_uuid, serviceContext.getScopeGroupId());
DocTemplate docTemplate = DocTemplateLocalServiceUtil.addDocTemplate(templateNo, title, enTitle, fileEntry.getFileEntryId(), serviceContext);
if (docTemplate != null) {
SessionMessages.add(actionRequest.getPortletSession(), DocTemplateKeys.SuccessMessageKeys.ORG_OEP_CORE_UTILITIES_DOSSIERMGT_PORTLET_DOCTEMPLATE_SUCCESS_ADDNEW);
_log.info("doc template have been added successfylly");
} else {
_log.error("There is an Erron in adding doc template");
}
actionResponse.setRenderParameter("mvcPath",
"/html/dossiermgt/portlet/doctemplate/edit_doctemplate.jsp");
} catch (Exception e) {
e.printStackTrace();
}
}
示例11: processAction
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
public void processAction(
PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse actionResponse)
throws Exception {
PortletPreferences portletPreferences =
PortletPreferencesFactoryUtil.getPortletSetup(
actionRequest, ParamUtil.getString(actionRequest, "portletResource"));
portletPreferences.setValue("myCoursesOrder",Integer.toString(ParamUtil.getInteger(actionRequest, "myCoursesOrder",0)));
portletPreferences.store();
SessionMessages.add(
actionRequest, portletConfig.getPortletName() + ".doConfigure");
//SessionMessages.add(actionRequest,"success");
}
示例12: addEditAppRole
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
public void addEditAppRole(ActionRequest request, ActionResponse response) throws SystemException, PortalException, IOException {
validateParamsIntoSessionError(request);
if (SessionErrors.isEmpty(request)) {
ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
long applicationId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.APPLICATION_ID, PortletKeys.LONG_DEFAULT);
String roleCode = ParamUtil.getString(request, AppRoleKeys.AddEditAttributes.ROLE_CODE, PortletKeys.TEXT_BOX);
String roleName = ParamUtil.getString(request, AppRoleKeys.AddEditAttributes.ROLE_NAME, PortletKeys.TEXT_BOX);
Long editId = ParamUtil.getLong(request, AppRoleKeys.AddEditAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
if (editId == PortletKeys.LONG_DEFAULT) {
AppRoleLocalServiceUtil.addAppRole(applicationId, roleCode, roleName, serviceContext);
SessionMessages.add(request, AppRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_SUCCESS_ADDNEW);
} else {
AppRoleLocalServiceUtil.updateAppRole(editId, applicationId, roleCode, roleName, serviceContext);
SessionMessages.add(request, AppRoleKeys.SuccessMessageKeys.ORG_OEP_SSOMGT_PORTLET_APPROLE_SUCCESS_UPDATE);
}
}
SessionMessages.add(request, PortalUtil.getPortletId(request) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
if (!SessionErrors.isEmpty(request)) {
PortalUtil.copyRequestParameters(request, response);
} else {
response.sendRedirect(ParamUtil.getString(request, PortletKeys.REDIRECT_PAGE));
}
}
示例13: viewactivity
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
public void viewactivity(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortalException, SystemException, Exception {
long actId = ParamUtil.getInteger(actionRequest, "actId");
AssetRendererFactory laf = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(LearningActivity.class.getName());
//auditing
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
AuditingLogFactory.audit(themeDisplay.getCompanyId(), themeDisplay.getScopeGroupId(), LearningActivity.class.getName(),
actId, themeDisplay.getUserId(), AuditConstants.GET, null);
if (laf != null) {
AssetRenderer assetRenderer = laf.getAssetRenderer(actId, 0);
String urlEdit = assetRenderer.getURLViewInContext((LiferayPortletRequest) actionRequest, (LiferayPortletResponse) actionResponse, "").toString();
actionResponse.sendRedirect(urlEdit);
}
SessionMessages.add(actionRequest, "asset-renderer-not-defined");
}
示例14: applicationActionDeveloperDelete
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的package包/类
@ProcessAction(name = "applicationActionDeveloperDelete")
public void applicationActionDeveloperDelete(ActionRequest request, ActionResponse response) {
String errorForward = "/devel/error.jsp";
try {
Application application = ApplicationLocalServiceUtil.fetchApplication(ParamUtil.getLong(request, "applicationId"));
if (application != null) {
ApplicationLocalServiceUtil.developerDeleteApplication(application);
SessionMessages.add(request, "application-deleted-successfully");
} else {
SessionErrors.add(request, "error-deleting-application");
// request.setAttribute("applicationId", ParamUtil.getLong(request, "applicationId"));
}
} catch (SystemException e) {
_log.debug(e.getMessage());
request.setAttribute("errorMsg", e.getMessage());
response.setRenderParameter("jspPage", errorForward);
}
}
示例15: processAction
import com.liferay.portal.kernel.servlet.SessionMessages; //导入方法依赖的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");
}