Skip to content

Instantly share code, notes, and snippets.

@bmvakili
Created August 15, 2015 21:41
Show Gist options
  • Save bmvakili/251413f0ae3fb8f66314 to your computer and use it in GitHub Desktop.
Save bmvakili/251413f0ae3fb8f66314 to your computer and use it in GitHub Desktop.
Liferay Portlet Configuration Edit Scope Action Update Scope Method
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
WebKeys.THEME_DISPLAY);
String oldScopeName = getOldScopeName(actionRequest, portlet);
PortletPreferences portletPreferences = actionRequest.getPreferences();
String scopeType = ParamUtil.getString(actionRequest, "scopeType");
portletPreferences.setValue("lfrScopeType", scopeType);
String scopeLayoutUuid = ParamUtil.getString(
actionRequest, "scopeLayoutUuid");
if (!scopeType.equals("layout")) {
scopeLayoutUuid = StringPool.BLANK;
}
portletPreferences.setValue("lfrScopeLayoutUuid", scopeLayoutUuid);
String portletTitle = getPortletTitle(
actionRequest, portlet, portletPreferences);
Tuple newScopeTuple = getNewScope(actionRequest);
String newScopeName = (String)newScopeTuple.getObject(1);
String newPortletTitle = PortalUtil.getNewPortletTitle(
portletTitle, oldScopeName, newScopeName);
if (!newPortletTitle.equals(portletTitle)) {
portletPreferences.setValue(
"portletSetupTitle_" + themeDisplay.getLanguageId(),
newPortletTitle);
portletPreferences.setValue(
"portletSetupUseCustomTitle", Boolean.TRUE.toString());
}
portletPreferences.store();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment