001
014
015 package com.liferay.portlet.social.util;
016
017 import com.liferay.portal.kernel.util.StringPool;
018 import com.liferay.social.kernel.model.SocialRelationConstants;
019 import com.liferay.social.kernel.util.SocialRelationTypes;
020
021 import java.util.Arrays;
022 import java.util.List;
023
024
027 public class SocialRelationTypesImpl implements SocialRelationTypes {
028
029 @Override
030 public List<Integer> getAllSocialRelationTypes() {
031 return _allSocialRelationTypes;
032 }
033
034 @Override
035 public String getTypeLabel(int type) {
036 if (type == SocialRelationConstants.TYPE_BI_CONNECTION) {
037 return "connection";
038 }
039 else if (type == SocialRelationConstants.TYPE_BI_COWORKER) {
040 return "coworker";
041 }
042 else if (type == SocialRelationConstants.TYPE_BI_FRIEND) {
043 return "friend";
044 }
045 else if (type == SocialRelationConstants.TYPE_BI_ROMANTIC_PARTNER) {
046 return "romantic-partner";
047 }
048 else if (type == SocialRelationConstants.TYPE_BI_SIBLING) {
049 return "sibling";
050 }
051 else if (type == SocialRelationConstants.TYPE_BI_SPOUSE) {
052 return "spouse";
053 }
054 else if (type == SocialRelationConstants.TYPE_UNI_CHILD) {
055 return "child";
056 }
057 else if (type == SocialRelationConstants.TYPE_UNI_ENEMY) {
058 return "enemy";
059 }
060 else if (type == SocialRelationConstants.TYPE_UNI_FOLLOWER) {
061 return "follower";
062 }
063 else if (type == SocialRelationConstants.TYPE_UNI_PARENT) {
064 return "parent";
065 }
066 else if (type == SocialRelationConstants.TYPE_UNI_SUBORDINATE) {
067 return "subordinate";
068 }
069 else if (type == SocialRelationConstants.TYPE_UNI_SUPERVISOR) {
070 return "supervisor";
071 }
072
073 return StringPool.BLANK;
074 }
075
076 @Override
077 public boolean isTypeBi(int type) {
078 return !isTypeUni(type);
079 }
080
081 @Override
082 public boolean isTypeUni(int type) {
083 if ((type == SocialRelationConstants.TYPE_UNI_CHILD) ||
084 (type == SocialRelationConstants.TYPE_UNI_ENEMY) ||
085 (type == SocialRelationConstants.TYPE_UNI_FOLLOWER) ||
086 (type == SocialRelationConstants.TYPE_UNI_PARENT) ||
087 (type == SocialRelationConstants.TYPE_UNI_SUBORDINATE) ||
088 (type == SocialRelationConstants.TYPE_UNI_SUPERVISOR)) {
089
090 return true;
091 }
092 else {
093 return false;
094 }
095 }
096
097 private static final List<Integer> _allSocialRelationTypes = Arrays.asList(
098 SocialRelationConstants.TYPE_BI_CONNECTION,
099 SocialRelationConstants.TYPE_BI_COWORKER,
100 SocialRelationConstants.TYPE_BI_FRIEND,
101 SocialRelationConstants.TYPE_BI_ROMANTIC_PARTNER,
102 SocialRelationConstants.TYPE_BI_SIBLING,
103 SocialRelationConstants.TYPE_BI_SPOUSE,
104 SocialRelationConstants.TYPE_UNI_CHILD,
105 SocialRelationConstants.TYPE_UNI_ENEMY,
106 SocialRelationConstants.TYPE_UNI_FOLLOWER,
107 SocialRelationConstants.TYPE_UNI_PARENT,
108 SocialRelationConstants.TYPE_UNI_SUBORDINATE,
109 SocialRelationConstants.TYPE_UNI_SUPERVISOR);
110
111 }