Class RestUtils


  • public class RestUtils
    extends Object
    • Constructor Detail

      • RestUtils

        public RestUtils()
    • 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 space
        userId - 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 space
        userId - the user's remote id
        type - 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 activity
        expand -
        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 viewer
        activity -
        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