001
014
015 package com.liferay.portlet.social.util;
016
017 import com.liferay.portal.kernel.util.PrefsParamUtil;
018 import com.liferay.portal.kernel.util.PrefsPropsUtil;
019 import com.liferay.portlet.social.util.SocialInteractionsConfiguration.SocialInteractionsType;
020
021 import javax.portlet.PortletPreferences;
022
023 import javax.servlet.http.HttpServletRequest;
024
025
029 public class SocialInteractionsConfigurationUtil {
030
031 public static SocialInteractionsConfiguration
032 getSocialInteractionsConfiguration(
033 long companyId, HttpServletRequest request, String serviceName) {
034
035 PortletPreferences portletPreferences = PrefsPropsUtil.getPreferences(
036 companyId, true);
037
038 boolean socialInteractionsFriendsEnabled = PrefsParamUtil.getBoolean(
039 portletPreferences, request,
040 "socialInteractionsFriendsEnabled" + serviceName, true);
041 boolean socialInteractionsSitesEnabled = PrefsParamUtil.getBoolean(
042 portletPreferences, request,
043 "socialInteractionsSitesEnabled" + serviceName, true);
044 SocialInteractionsType socialInteractionsType =
045 SocialInteractionsType.parse(
046 PrefsParamUtil.getString(
047 portletPreferences, request,
048 "socialInteractionsType" + serviceName,
049 SocialInteractionsType.ALL_USERS.toString()));
050
051 return new SocialInteractionsConfiguration(
052 socialInteractionsFriendsEnabled, socialInteractionsSitesEnabled,
053 socialInteractionsType);
054 }
055
056 public static SocialInteractionsConfiguration
057 getSocialInteractionsConfiguration(long companyId, String serviceName) {
058
059 boolean socialInteractionsFriendsEnabled = PrefsPropsUtil.getBoolean(
060 companyId, "socialInteractionsFriendsEnabled" + serviceName, true);
061 boolean socialInteractionsSitesEnabled = PrefsPropsUtil.getBoolean(
062 companyId, "socialInteractionsSitesEnabled" + serviceName, true);
063 SocialInteractionsType socialInteractionsType =
064 SocialInteractionsType.parse(
065 PrefsPropsUtil.getString(
066 companyId, "socialInteractionsType" + serviceName,
067 SocialInteractionsType.ALL_USERS.toString()));
068
069 return new SocialInteractionsConfiguration(
070 socialInteractionsFriendsEnabled, socialInteractionsSitesEnabled,
071 socialInteractionsType);
072 }
073
074 }