use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class LiferayPortlet method translate.
protected String translate(PortletRequest portletRequest, String key, Object argument) {
PortletConfig portletConfig = (PortletConfig) portletRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
return LanguageUtil.format(portletConfig, themeDisplay.getLocale(), key, argument);
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class LiferayActivityService method doGetActivity.
public Activity doGetActivity(UserId userId, GroupId groupId, String appId, Set<String> fields, String activityId, SecurityToken securityToken) throws Exception {
ThemeDisplay themeDisplay = getThemeDisplay(securityToken);
long activityIdLong = GetterUtil.getLong(activityId);
SocialActivity socialActivity = SocialActivityLocalServiceUtil.getActivity(activityIdLong);
return getActivity(themeDisplay, socialActivity);
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class AdminPortlet method doAddGadget.
protected Gadget doAddGadget(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
String url = ParamUtil.getString(actionRequest, "url");
String portletCategoryNames = ParamUtil.getString(actionRequest, "portletCategoryNames");
ServiceContext serviceContext = ServiceContextFactory.getInstance(Gadget.class.getName(), actionRequest);
Gadget gadget = GadgetServiceUtil.addGadget(themeDisplay.getCompanyId(), url, portletCategoryNames, serviceContext);
return gadget;
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class AdminPortlet method updateOAuthConsumers.
public void updateOAuthConsumers(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
long gadgetId = ParamUtil.getLong(actionRequest, "gadgetId");
GadgetPermission.check(permissionChecker, themeDisplay.getScopeGroupId(), gadgetId, ActionKeys.UPDATE);
ShindigUtil.updateOAuthConsumers(actionRequest, actionResponse);
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class EditorPortlet method serveAddFileEntry.
protected void serveAddFileEntry(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
long folderId = ParamUtil.getLong(resourceRequest, "folderId");
Folder folder = DLAppServiceUtil.getFolder(folderId);
String fileEntryTitle = ParamUtil.getString(resourceRequest, "fileEntryTitle");
String content = ParamUtil.getString(resourceRequest, "content");
byte[] bytes = content.getBytes(StringPool.UTF8);
ServiceContext serviceContext = ServiceContextFactory.getInstance(resourceRequest);
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
serviceContext.setAttribute("sourceFileName", fileEntryTitle);
serviceContext.setScopeGroupId(folder.getGroupId());
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
FileEntry fileEntry = DLAppServiceUtil.addFileEntry(folder.getRepositoryId(), folderId, fileEntryTitle, resourceRequest.getContentType(), fileEntryTitle, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
jsonObject.put("fileEntryId", fileEntry.getFileEntryId());
String portalURL = PortalUtil.getPortalURL(themeDisplay);
String fileEntryURL = ShindigUtil.getFileEntryURL(portalURL, fileEntry.getFileEntryId());
jsonObject.put("fileEntryURL", fileEntryURL);
writeJSON(resourceRequest, resourceResponse, jsonObject);
}
Aggregations