Class RestUtils
- java.lang.Object
-
- org.exoplatform.social.service.rest.RestUtils
-
public class RestUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringACTIVITIES_TYPEstatic StringADMIN_GROUPstatic intDEFAULT_LIMITstatic intDEFAULT_OFFSETstatic intHARD_LIMITstatic StringIDENTITIES_TYPEstatic StringKEYstatic StringLIKES_TYPEstatic StringSPACE_ACTIVITY_TYPEstatic StringSPACES_MEMBERSHIP_TYPEstatic StringSPACES_TYPEstatic StringSUPPORT_TYPEstatic StringUSER_ACTIVITY_TYPEstatic StringUSERS_RELATIONSHIP_TYPEstatic StringUSERS_TYPEstatic StringVALUE
-
Constructor Summary
Constructors Constructor Description RestUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Object>buildEntityFromActivity(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, String restPath, String expand)Get a hash map from an activity in order to build a json object for the rest servicestatic Map<String,Object>buildEntityFromIdentity(org.exoplatform.social.core.identity.model.Identity identity, String restPath, String expand)Get a hash map from an identity in order to build a json object for the rest servicestatic Map<String,Object>buildEntityFromRelationship(org.exoplatform.social.core.relationship.model.Relationship relationship, String restPath, String expand, boolean isSymetric)Get a hash map from a relationship in order to build a json object for the rest servicestatic Map<String,Object>buildEntityFromSpace(org.exoplatform.social.core.space.model.Space space, String userId, String restPath, String expand)Get a hash map from a space in order to build a json object for the rest servicestatic Map<String,Object>buildEntityFromSpaceMembership(org.exoplatform.social.core.space.model.Space space, String userId, String type, String restPath, String expand)Get a hash map from a space in order to build a json object for the rest servicestatic Map<String,String>getActivityStream(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, org.exoplatform.social.core.identity.model.Identity authentiatedUsed)Get the activityStream's information related to the activity.static org.exoplatform.social.core.identity.model.IdentitygetCurrentIdentity()Returns the social identity of the authenticated userstatic StringgetCurrentUsername()Returns the username of the authenticated userstatic javax.ws.rs.core.MediaTypegetJsonMediaType()Gets the json media typestatic booleanisMemberOfAdminGroup()Check if the authenticated user is a member of the admin group
-
-
-
Field Detail
-
DEFAULT_LIMIT
public static final int DEFAULT_LIMIT
- See Also:
- Constant Field Values
-
DEFAULT_OFFSET
public static final int DEFAULT_OFFSET
- See Also:
- Constant Field Values
-
HARD_LIMIT
public static final int HARD_LIMIT
- See Also:
- Constant Field Values
-
USERS_TYPE
public static final String USERS_TYPE
- See Also:
- Constant Field Values
-
USERS_RELATIONSHIP_TYPE
public static final String USERS_RELATIONSHIP_TYPE
- See Also:
- Constant Field Values
-
USER_ACTIVITY_TYPE
public static final String USER_ACTIVITY_TYPE
- See Also:
- Constant Field Values
-
IDENTITIES_TYPE
public static final String IDENTITIES_TYPE
- See Also:
- Constant Field Values
-
SPACES_TYPE
public static final String SPACES_TYPE
- See Also:
- Constant Field Values
-
SPACES_MEMBERSHIP_TYPE
public static final String SPACES_MEMBERSHIP_TYPE
- See Also:
- Constant Field Values
-
SPACE_ACTIVITY_TYPE
public static final String SPACE_ACTIVITY_TYPE
- See Also:
- Constant Field Values
-
ACTIVITIES_TYPE
public static final String ACTIVITIES_TYPE
- See Also:
- Constant Field Values
-
LIKES_TYPE
public static final String LIKES_TYPE
- See Also:
- Constant Field Values
-
KEY
public static final String KEY
- See Also:
- Constant Field Values
-
VALUE
public static final String VALUE
- See Also:
- Constant Field Values
-
SUPPORT_TYPE
public static final String SUPPORT_TYPE
- See Also:
- Constant Field Values
-
ADMIN_GROUP
public static final String ADMIN_GROUP
- See Also:
- Constant Field Values
-
-
Method Detail
-
buildEntityFromIdentity
public static Map<String,Object> buildEntityFromIdentity(org.exoplatform.social.core.identity.model.Identity identity, String restPath, String expand)
Get a hash map from an identity in order to build a json object for the rest service- Parameters:
identity- the provided identity- Returns:
- a hash map
-
buildEntityFromSpace
public static Map<String,Object> buildEntityFromSpace(org.exoplatform.social.core.space.model.Space space, String userId, String restPath, String expand)
Get a hash map from a space in order to build a json object for the rest service- Parameters:
space- the provided spaceuserId- the user's remote id- Returns:
- a hash map
-
buildEntityFromSpaceMembership
public static Map<String,Object> buildEntityFromSpaceMembership(org.exoplatform.social.core.space.model.Space space, String userId, String type, String restPath, String expand)
Get a hash map from a space in order to build a json object for the rest service- Parameters:
space- the provided spaceuserId- the user's remote idtype- membership type- Returns:
- a hash map
-
buildEntityFromActivity
public static Map<String,Object> buildEntityFromActivity(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, String restPath, String expand)
Get a hash map from an activity in order to build a json object for the rest service- Parameters:
activity- the provided activityexpand-- Returns:
- a hash map
-
buildEntityFromRelationship
public static Map<String,Object> buildEntityFromRelationship(org.exoplatform.social.core.relationship.model.Relationship relationship, String restPath, String expand, boolean isSymetric)
Get a hash map from a relationship in order to build a json object for the rest service- Parameters:
relationship- the provided relationship- Returns:
- a hash map
-
getActivityStream
public static Map<String,String> getActivityStream(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, org.exoplatform.social.core.identity.model.Identity authentiatedUsed)
Get the activityStream's information related to the activity.- Parameters:
authentiatedUsed- the vieweractivity-- Returns:
- activityStream object, null if the viewer has no permission to view activity
-
getJsonMediaType
public static javax.ws.rs.core.MediaType getJsonMediaType()
Gets the json media type- Returns:
- a media type
-
isMemberOfAdminGroup
public static boolean isMemberOfAdminGroup()
Check if the authenticated user is a member of the admin group- Returns:
-
getCurrentUsername
public static String getCurrentUsername()
Returns the username of the authenticated user- Returns:
- the username of the authenticated user
-
getCurrentIdentity
public static org.exoplatform.social.core.identity.model.Identity getCurrentIdentity()
Returns the social identity of the authenticated user- Returns:
- The social identity of the authenticated user
-
-