Interface RelationshipManager


  • public interface RelationshipManager
    Controls connections between identities. This includes:
    • Getting relationship between 2 identities.
    • Interacting between identities: inviting, confirming, denying and ignoring.
    • Getting a list access which contains connections, incoming and outgoing.
    • Method Detail

      • get

        Relationship get​(String relationshipId)
        Gets a relationship by its Id.
        Parameters:
        relationshipId - Id of the relationship.
        Returns:
        The existing relationship or null.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • get

        Relationship get​(Identity identity1,
                         Identity identity2)
        Gets a relationship between 2 identities.
        Parameters:
        identity1 - The identity 1.
        identity2 - The identity 2.
        Returns:
        The relationship between 2 identities.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • update

        void update​(Relationship existingRelationship)
        Updates an existing relationship.
        Parameters:
        existingRelationship - The existing relationship to be updated.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • delete

        void delete​(Relationship existingRelationship)
        Deletes an existing relationship.
        Parameters:
        existingRelationship - The existing relationship to be deleted.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • inviteToConnect

        Relationship inviteToConnect​(Identity invitingIdentity,
                                     Identity invitedIdentity)
        Invites one identity to connect to the other. The first argument must be the sender identity. The second argument must be the identity who is invited to connect.
        One identity is not allowed to invite himself to connect.
        Parameters:
        invitingIdentity - The sender identity.
        invitedIdentity - The identity who is invited.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • confirm

        void confirm​(Identity invitedIdentity,
                     Identity invitingIdentity)
        Confirms to connect to an identity who sent invitation.
        Parameters:
        invitedIdentity - The identity who gets invitation.
        invitingIdentity - The identity who invites another.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • deny

        void deny​(Identity invitedIdentity,
                  Identity invitingIdentity)
        Denies to connect to an identity who sent invitation.
        Parameters:
        invitedIdentity - The identity who gets invitation.
        invitingIdentity - The identity who invites another.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • ignore

        void ignore​(Identity invitedIdentity,
                    Identity invitingIdentity)
        Ignores to connect to an identity who sent invitation. Once being ignored, the inviting identity cannot invite any more.
        Parameters:
        invitedIdentity - The identity who gets invitation.
        invitingIdentity - The identity who invites another.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • getConnections

        org.exoplatform.commons.utils.ListAccess<Identity> getConnections​(Identity existingIdentity)
        Gets a list access which contains all identities who are connected to a provided identity.
        Parameters:
        existingIdentity - The existing provided identity.
        Returns:
        The list access.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • getIncomingWithListAccess

        org.exoplatform.commons.utils.ListAccess<Identity> getIncomingWithListAccess​(Identity existingIdentity)
        Gets a list access which contains all identities who invited to connect to a provided identity.
        Parameters:
        existingIdentity - The existing provided identity.
        Returns:
        The list access.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • getOutgoing

        org.exoplatform.commons.utils.ListAccess<Identity> getOutgoing​(Identity existingIdentity)
        Gets a list access which contains all identities who were invited to connect by a provided identity.
        Parameters:
        existingIdentity - The existing provided identity.
        Returns:
        The list access.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • getAllWithListAccess

        org.exoplatform.commons.utils.ListAccess<Identity> getAllWithListAccess​(Identity existingIdentity)
        Gets a list access which contains all identities who were connected, were invited or invited a provided identity.
        Parameters:
        existingIdentity - The existing provided identity.
        Returns:
        The list access.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • getStatus

        Relationship.Type getStatus​(Identity identity1,
                                    Identity identity2)
        Gets the relationship status between 2 identities.
        Parameters:
        identity1 - The identity 1.
        identity2 - The identity 2.
        Returns:
        The relationship type.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • getPendingRelationships

        @Deprecated
        List<Relationship> getPendingRelationships​(Identity identity,
                                                   boolean toConfirm)
                                            throws RelationshipStorageException
        Deprecated.
        When toConfirm=true, use getIncoming(Identity) instead. When toConfirm=false, use getOutgoing(Identity) instead. Will be removed by 4.0.x.
        Gets a list of pending relationships that were received but not confirmed or were sent but not confirmed.
        Parameters:
        identity - The identity.
        toConfirm - If "true", it returns a list of pending relationships received but not confirmed. If "false", it returns a list of pending relationships sent but not confirmed.
        Returns:
        The list of pending relationships.
        Throws:
        RelationshipStorageException - the exception
        eXo level API
        Provisional
      • getPendingRelationships

        @Deprecated
        List<Relationship> getPendingRelationships​(Identity currIdentity,
                                                   List<Identity> identities,
                                                   boolean toConfirm)
                                            throws RelationshipStorageException
        Deprecated.
        When toConfirm=true, use getIncoming(Identity) instead. When toConfirm=false use getOutgoing(Identity) instead. Will be removed by 4.0.x.
        Gets a list of pending relationships that were received but not confirmed or were sent but not confirmed.
        Parameters:
        currIdentity - The current identity.
        identities - The identities.
        toConfirm - If "true", it returns a list of pending relationships received but not confirmed. If "false", it returns a list of pending relationships sent but not confirmed.
        Returns:
        The list of pending relationships.
        Throws:
        RelationshipStorageException - the exception
        eXo level API
        Provisional
      • getRelationshipStatus

        @Deprecated
        Relationship.Type getRelationshipStatus​(Relationship rel,
                                                Identity id)
        Deprecated.
        Now we don't use this method to get relationship we get status of relationship object and depend on sender and receiver, we can define pending relationship or incoming relationship. But we still keep this method for build, call getStatus(Identity, Identity). This method will be removed by 4.0.x.
        Gets the relationship status.
        Parameters:
        rel - The relationship.
        id - The identity.
        Returns:
        The relationship status.
        eXo level API
        Provisional
      • getConnectionsByFilter

        org.exoplatform.commons.utils.ListAccess<Identity> getConnectionsByFilter​(Identity existingIdentity,
                                                                                  ProfileFilter profileFilter)
        Gets a list access which contains all identities who are connected to a provided identity and filtered by a profile filter.
        Parameters:
        existingIdentity - The provided identity.
        profileFilter - The provided profile filter.
        Returns:
        The list access.
        Since:
        1.2.3
        eXo level API
        Platform
      • getIncomingByFilter

        @Deprecated
        org.exoplatform.commons.utils.ListAccess<Identity> getIncomingByFilter​(Identity existingIdentity,
                                                                               ProfileFilter profileFilter)
        Deprecated.
        Gets a list access which contains all identities who invited to connect to a provided identity and filtered by a profile filter.
        Parameters:
        existingIdentity - The provided identity.
        profileFilter - The provided profile filter.
        Returns:
        The list access.
        Since:
        1.2.3
        eXo level API
        Platform
      • getOutgoingByFilter

        @Deprecated
        org.exoplatform.commons.utils.ListAccess<Identity> getOutgoingByFilter​(Identity existingIdentity,
                                                                               ProfileFilter profileFilter)
        Deprecated.
        Gets a list access which contains all identities who were invited by a provided identity to connect and filtered by a profile filter.
        Parameters:
        existingIdentity - The provided identity.
        profileFilter - The provided profile filter.
        Returns:
        The list access.
        Since:
        1.2.3
        eXo level API
        Platform
      • getSuggestions

        Map<Identity,​Integer> getSuggestions​(Identity identity,
                                                   int maxConnections,
                                                   int maxConnectionsToLoad,
                                                   int maxSuggestions)
        Gets suggestions having common users with the provided identity.
        Parameters:
        identity - The provided identity.
        maxConnections - Maximum of connections that we can treat per identity. If set to a value <= 0, the limit will be disabled
        maxConnectionsToLoad - In case, the maxConnections are not enough to find enough suggestion, we load more connections at the first level. If maxConnectionsToLoad or maxConnections has been set to a value <= 0, the limit will be disabled
        maxSuggestions - The total amount of expected suggestions. If set to a value <= 0, the limit will be disabled
        Returns:
        The suggestions.
        Since:
        4.0.6
        eXo level API
        Experimental
      • getLastConnections

        List<Identity> getLastConnections​(Identity identity,
                                          int limit)
        Get the list of identities who are most recently connected with given user the limit number of results must be greater than 0 or an empty list will be returned
        Parameters:
        identity -
        limit -
        Returns:
      • getRelationshipsByStatus

        List<Relationship> getRelationshipsByStatus​(Identity identity,
                                                    Relationship.Type type,
                                                    int offset,
                                                    int limit)
        Gets a list which contains all relationships by status.
        Parameters:
        identity - The provided identity.
        type - type of the relationship : ALL, PENDING or CONFIRMED.
        offset - The starting point.
        limit - The limitation.
        Returns:
        The list of relationships.
      • getRelationshipsCountByStatus

        int getRelationshipsCountByStatus​(Identity identity,
                                          Relationship.Type type)
        Gets number of relationships by status.
        Parameters:
        identity - The provided identity.
        type - type of the relationship : ALL, PENDING or CONFIRMED.
        Returns:
        The number of relationships.
      • getConnectionsInCommonCount

        default int getConnectionsInCommonCount​(Identity identity1,
                                                Identity identity2)
        Parameters:
        identity1 - user identity of Type Identity
        identity2 - user identity of Type Identity
        Returns:
        connections in common count between two users