List of usage examples for com.liferay.portal.kernel.util WebKeys THEME_DISPLAY
String THEME_DISPLAY
To view the source code for com.liferay.portal.kernel.util WebKeys THEME_DISPLAY.
Click Source Link
From source file:com.liferay.configuration.admin.web.internal.portlet.action.ViewMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); Map<String, ConfigurationModel> configurationModels = _configurationModelRetriever .getConfigurationModels(themeDisplay.getLanguageId()); Map<String, Set<ConfigurationModel>> categorizedConfigurationModels = _configurationModelRetriever .categorizeConfigurationModels(configurationModels); List<String> configurationCategories = _configurationModelRetriever .getConfigurationCategories(categorizedConfigurationModels); renderRequest.setAttribute(ConfigurationAdminWebKeys.CONFIGURATION_CATEGORIES, configurationCategories); String configurationCategory = ParamUtil.getString(renderRequest, "configurationCategory"); if (Validator.isNull(configurationCategory)) { configurationCategory = configurationCategories.get(0); }/*from ww w . j a v a 2s. co m*/ renderRequest.setAttribute(ConfigurationAdminWebKeys.CONFIGURATION_CATEGORY, configurationCategory); Set<ConfigurationModel> categoryConfigurationModels = categorizedConfigurationModels .get(configurationCategory); renderRequest.setAttribute(ConfigurationAdminWebKeys.CONFIGURATION_MODEL_ITERATOR, new ConfigurationModelIterator(categoryConfigurationModels)); renderRequest.setAttribute(ConfigurationAdminWebKeys.RESOURCE_BUNDLE_LOADER_PROVIDER, _resourceBundleLoaderProvider); return "/view.jsp"; }
From source file:com.liferay.configuration.admin.web.internal.portlet.configuration.icon.ExportAllConfigurationIcon.java
License:Open Source License
@Override public String getMessage(PortletRequest portletRequest) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); ResourceBundle resourceBundle = _resourceBundleLoader.loadResourceBundle(themeDisplay.getLocale()); return LanguageUtil.get(resourceBundle, "export-all-settings"); }
From source file:com.liferay.configuration.admin.web.internal.portlet.configuration.icon.ExportFactoryInstancesIcon.java
License:Open Source License
@Override public String getMessage(PortletRequest portletRequest) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); ResourceBundle resourceBundle = _resourceBundleLoader.loadResourceBundle(themeDisplay.getLocale()); return LanguageUtil.get(resourceBundle, "export-entries"); }
From source file:com.liferay.configuration.admin.web.internal.util.DDMFormRendererHelper.java
License:Open Source License
protected Locale getLocale() { ThemeDisplay themeDisplay = (ThemeDisplay) _portletRequest.getAttribute(WebKeys.THEME_DISPLAY); return themeDisplay.getLocale(); }
From source file:com.liferay.contacts.contactscenter.portlet.ContactsCenterPortlet.java
License:Open Source License
public void addSocialRelation(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long[] userIds = getUserIds(actionRequest); int type = ParamUtil.getInteger(actionRequest, "type"); if (type == SocialRelationConstants.TYPE_BI_CONNECTION) { return;/*w w w . j av a2s .c o m*/ } for (long userId : userIds) { if (userId == themeDisplay.getUserId()) { continue; } boolean blocked = SocialRelationLocalServiceUtil.hasRelation(userId, themeDisplay.getUserId(), SocialRelationConstants.TYPE_UNI_ENEMY); if (type == SocialRelationConstants.TYPE_UNI_ENEMY) { SocialRelationLocalServiceUtil.deleteRelations(themeDisplay.getUserId(), userId); SocialRelationLocalServiceUtil.deleteRelations(userId, themeDisplay.getUserId()); } else if (blocked) { continue; } SocialRelationLocalServiceUtil.addRelation(themeDisplay.getUserId(), userId, type); if (blocked) { SocialRelationLocalServiceUtil.addRelation(userId, themeDisplay.getUserId(), type); } } }
From source file:com.liferay.contacts.contactscenter.portlet.ContactsCenterPortlet.java
License:Open Source License
public void deleteSocialRelation(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long[] userIds = getUserIds(actionRequest); int type = ParamUtil.getInteger(actionRequest, "type"); for (long userId : userIds) { if (userId == themeDisplay.getUserId()) { continue; }/* w w w . ja va2 s . co m*/ try { SocialRelationLocalServiceUtil.deleteRelation(themeDisplay.getUserId(), userId, type); } catch (NoSuchRelationException nsre) { } } }
From source file:com.liferay.contacts.contactscenter.portlet.ContactsCenterPortlet.java
License:Open Source License
public void getContact(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); long userId = ParamUtil.getLong(resourceRequest, "userId"); JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); jsonObject.put("success", Boolean.TRUE); JSONObject userJSONObject = getUserJSONObject(resourceResponse, themeDisplay, userId); jsonObject.put("user", userJSONObject); writeJSON(resourceRequest, resourceResponse, jsonObject); }
From source file:com.liferay.contacts.contactscenter.portlet.ContactsCenterPortlet.java
License:Open Source License
public void getSelectedContacts(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); long[] userIds = StringUtil.split(ParamUtil.getString(resourceRequest, "userIds"), 0L); JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); for (long userId : userIds) { try {//from w ww.j a va 2s . c o m JSONObject userJSONObject = JSONFactoryUtil.createJSONObject(); userJSONObject.put("success", Boolean.TRUE); userJSONObject.put("user", getUserJSONObject(resourceResponse, themeDisplay, userId)); jsonArray.put(userJSONObject); } catch (NoSuchUserException nsue) { } } jsonObject.put("contacts", jsonArray); writeJSON(resourceRequest, resourceResponse, jsonObject); }
From source file:com.liferay.contacts.contactscenter.portlet.ContactsCenterPortlet.java
License:Open Source License
@Override public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); if (!themeDisplay.isSignedIn()) { return;/*from w w w. j a v a 2s .co m*/ } try { String actionName = ParamUtil.getString(actionRequest, ActionRequest.ACTION_NAME); boolean jsonFormat = ParamUtil.getBoolean(actionRequest, "jsonFormat"); if (jsonFormat) { if (actionName.equals("addSocialRelation")) { addSocialRelation(actionRequest, actionResponse); } else if (actionName.equals("deleteSocialRelation")) { deleteSocialRelation(actionRequest, actionResponse); } else if (actionName.equals("requestSocialRelation")) { requestSocialRelation(actionRequest, actionResponse); } JSONObject jsonObject = getContactsDisplayJSONObject(actionRequest, actionResponse); writeJSON(actionRequest, actionResponse, jsonObject); } else if (actionName.equals("deleteEntry")) { deleteEntry(actionRequest, actionResponse); } else if (actionName.equals("updateEntry")) { updateEntry(actionRequest, actionResponse); } else if (actionName.equals("updateFieldGroup")) { updateFieldGroup(actionRequest, actionResponse); } else if (actionName.equals("updateSocialRequest")) { updateSocialRequest(actionRequest, actionResponse); } else { super.processAction(actionRequest, actionResponse); } } catch (Exception e) { throw new PortletException(e); } }
From source file:com.liferay.contacts.contactscenter.portlet.ContactsCenterPortlet.java
License:Open Source License
public void requestSocialRelation(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long[] userIds = getUserIds(actionRequest); int type = ParamUtil.getInteger(actionRequest, "type"); for (long userId : userIds) { if (userId == themeDisplay.getUserId()) { continue; }//from w w w . j a v a2 s .co m if (SocialRelationLocalServiceUtil.hasRelation(userId, themeDisplay.getUserId(), SocialRelationConstants.TYPE_UNI_ENEMY) || SocialRequestLocalServiceUtil.hasRequest(themeDisplay.getUserId(), User.class.getName(), themeDisplay.getUserId(), type, userId, SocialRequestConstants.STATUS_PENDING)) { continue; } JSONObject extraDataJSONObject = JSONFactoryUtil.createJSONObject(); String portletId = PortalUtil.getPortletId(actionRequest); extraDataJSONObject.put("portletId", PortletConstants.getRootPortletId(portletId)); SocialRequest socialRequest = SocialRequestLocalServiceUtil.addRequest(themeDisplay.getUserId(), 0, User.class.getName(), themeDisplay.getUserId(), type, extraDataJSONObject.toString(), userId); sendNotificationEvent(socialRequest); } }