Interface ProfileConnectionsLogic


  • public interface ProfileConnectionsLogic
    An interface for dealing with connections in Profile2
    Author:
    Steve Swinsburg (steve.swinsburg@gmail.com)
    • Method Detail

      • getBasicConnectionsForUser

        List<BasicConnection> getBasicConnectionsForUser​(String userUuid)
        Gets a list of BasicOnlinePersons that are connected to this user
        Parameters:
        userUuid - uuid of the user to retrieve the list of connections for
        Returns:
      • getConnectionsForUser

        List<Person> getConnectionsForUser​(String userUuid)
        Gets a list of Persons that are connected to this user. incl prefs and privacy
        Parameters:
        userUuid - uuid of the user to retrieve the list of connections for
        Returns:
      • getConnectedUsersForUserInsecurely

        List<org.sakaiproject.user.api.User> getConnectedUsersForUserInsecurely​(String userUuid)
        Gets a list of Persons that are connected to this user. Current user, prefs and privacy are skipped.
        Parameters:
        userUuid - uuid of the user to retrieve the list of connections for
        Returns:
      • getConnectionsForUserCount

        int getConnectionsForUserCount​(String userId)
        Gets a count of the number of connections a user has.
        Parameters:
        userId - uuid of the user to retrieve the count for
        Returns:
      • getConnectionRequestsForUser

        List<Person> getConnectionRequestsForUser​(String userId)
        Gets a list of Persons's that have unconfirmed connection requests to this person
        Parameters:
        userId - uuid of the user to retrieve the list of connections for
        Returns:
      • getOutgoingConnectionRequestsForUser

        List<Person> getOutgoingConnectionRequestsForUser​(String userId)
        Gets a list of Persons's that have unconfirmed connection requests from this person
        Parameters:
        userId - the user whose outgoing outgoing connections will be retrieved
        Returns:
        A list of Persons who have had a request from the supplied user
      • getConnectionRequestsForUserCount

        int getConnectionRequestsForUserCount​(String userId)
        Gets a count of the number of unconfirmed incoming connection requests
        Parameters:
        userId - uuid of the user to retrieve the list of connections for
        Returns:
      • getConnectionsSubsetForSearch

        List<Person> getConnectionsSubsetForSearch​(List<Person> connections,
                                                   String search)
        Gets a subset of the connection list, based on the search string matching the beginning of the displayName
        Parameters:
        connections - list of connections
        search - search string to match on
        Returns:
      • getConnectionsSubsetForSearch

        List<Person> getConnectionsSubsetForSearch​(List<Person> connections,
                                                   String search,
                                                   boolean forMessaging)
        Gets a subset of the connection list, based on the search string matching the beginning of the displayName, and based on whether that user is allowed to be messaged.
        Parameters:
        connections - list of connections
        search - search string to match on
        forMessaging - if this request is for messaging, we also check if the user has indicated they can receive messages
        Returns:
      • getConnectionStatus

        int getConnectionStatus​(String userA,
                                String userB)
        Get the connection status between two users. The user making the query must be userA.
        Parameters:
        userA - user making the query
        userB - any other user
        Returns:
        int signaling the connection status. See ProfileConstants.
      • requestFriend

        boolean requestFriend​(String userId,
                              String friendId)
        Make a request for friendId to be a friend of userId
        Parameters:
        userId - uuid of the user making the request
        friendId - uuid of the user that userId wants to be a friend of
      • isFriendRequestPending

        boolean isFriendRequestPending​(String fromUser,
                                       String toUser)
        Check if there is a pending request from fromUser to toUser
        Parameters:
        fromUser - uuid of the user that made the friend request
        toUser - uuid of the user that userId made the request to
      • confirmFriendRequest

        boolean confirmFriendRequest​(String fromUser,
                                     String toUser)
        Confirm friend request from fromUser to toUser
        Parameters:
        fromUser - uuid of the user that made the original friend request
        toUser - uuid of the user that received the friend request Note that fromUser will ALWAYS be the one making the friend request, and toUser will ALWAYS be the one who receives the request.
      • ignoreFriendRequest

        boolean ignoreFriendRequest​(String fromUser,
                                    String toUser)
        Ignore a friend request from fromUser to toUser
        Parameters:
        fromUser - uuid of the user that made the original friend request
        toUser - uuid of the user that received the friend request and wants to ignore it Note that fromUser will ALWAYS be the one that made the friend request, and toUser will ALWAYS be the one who receives the request.
      • removeFriend

        boolean removeFriend​(String userId,
                             String friendId)
        Remove a friend connection
        Parameters:
        userId - uuid of one user
        userId - uuid of the other user Note that they could be in either column
      • isUserXFriendOfUserY

        boolean isUserXFriendOfUserY​(String userX,
                                     String userY)
        Is userY a friend of the userX?
        Parameters:
        userX - the uuid of the user we are querying
        userY - current user uuid
        Returns:
        boolean
      • getBasicConnection

        BasicConnection getBasicConnection​(String userUuid)
        Get a BasicConnection
        Parameters:
        userUuid -
        Returns:
      • getBasicConnection

        BasicConnection getBasicConnection​(org.sakaiproject.user.api.User user)
        Get a BasicConnection
        Parameters:
        user -
        Returns:
      • getBasicConnections

        List<BasicConnection> getBasicConnections​(List<org.sakaiproject.user.api.User> users)
        Get a List of BasicConnections for the given Users.
        Parameters:
        users -
        Returns:
      • getOnlineStatus

        int getOnlineStatus​(String userUuid)
        Get the online status for a user
        Parameters:
        userUuid - user to check
        Returns:
        int of status, according to ProfileConstants.ONLINE_STATUS_x
      • getOnlineStatus

        Map<String,​Integer> getOnlineStatus​(List<String> userUuids)
        Get the online status for a list of users
        Parameters:
        userUuid - List of users to check
        Returns:
        Map of userUuid to the status, according to ProfileConstants.ONLINE_STATUS_x