001
014
015 package com.liferay.portlet.social.util;
016
017
021 public class SocialInteractionsConfiguration {
022
023 public SocialInteractionsConfiguration(
024 boolean socialInteractionsFriendsEnabled,
025 boolean socialInteractionsSitesEnabled,
026 SocialInteractionsType socialInteractionsType) {
027
028 _socialInteractionsFriendsEnabled = socialInteractionsFriendsEnabled;
029 _socialInteractionsSitesEnabled = socialInteractionsSitesEnabled;
030 _socialInteractionsType = socialInteractionsType;
031 }
032
033 public boolean isSocialInteractionsAnyUserEnabled() {
034 if (_socialInteractionsType.equals(SocialInteractionsType.ALL_USERS)) {
035 return true;
036 }
037 else {
038 return false;
039 }
040 }
041
042 public boolean isSocialInteractionsFriendsEnabled() {
043 return _socialInteractionsFriendsEnabled;
044 }
045
046 public boolean isSocialInteractionsSelectUsersEnabled() {
047 if (_socialInteractionsType.equals(
048 SocialInteractionsType.SELECT_USERS)) {
049
050 return true;
051 }
052 else {
053 return false;
054 }
055 }
056
057 public boolean isSocialInteractionsSitesEnabled() {
058 return _socialInteractionsSitesEnabled;
059 }
060
061 public enum SocialInteractionsType {
062
063 ALL_USERS("all_users"), SELECT_USERS("select_users");
064
065 public static SocialInteractionsType parse(String value) {
066 if (ALL_USERS.getValue().equals(value)) {
067 return ALL_USERS;
068 }
069 else if (SELECT_USERS.getValue().equals(value)) {
070 return SELECT_USERS;
071 }
072
073 throw new IllegalArgumentException("Invalid value " + value);
074 }
075
076 public String getValue() {
077 return _value;
078 }
079
080 @Override
081 public String toString() {
082 return _value;
083 }
084
085 private SocialInteractionsType(String value) {
086 _value = value;
087 }
088
089 private final String _value;
090
091 }
092
093 private final boolean _socialInteractionsFriendsEnabled;
094 private final boolean _socialInteractionsSitesEnabled;
095 private final SocialInteractionsType _socialInteractionsType;
096
097 }