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 Details

    • 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
    • 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.
      Returns:
      Relationship if exists else null
      Since:
      1.2.0-GA
      eXo level API
      Platform
    • confirm

      Relationship 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.
      Returns:
      Relationship after confirming
      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

      Relationship 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.
      Returns:
      Relationship after ignoring
      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
    • 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
    • invite

      Deprecated, for removal: This API element is subject to removal in a future version.
      Use inviteToConnect(Identity, Identity) instead. Will be removed by 4.0.x.
      Creates a connection invitation between 2 identities.
      Parameters:
      sender - The inviter.
      receiver - The invitee.
      Returns:
      The PENDING relation.
      Throws:
      RelationshipStorageException
      eXo level API
      Provisional
    • getRelationshipById

      Relationship getRelationshipById(String id) throws RelationshipStorageException
      Gets a relationship by a given Id.
      Parameters:
      id - The given Id.
      Returns:
      The relationship.
      Throws:
      RelationshipStorageException - the exception
      eXo level API
      Provisional
    • confirm

      @Deprecated(forRemoval=true) void confirm(Relationship relationship) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use confirm(Identity, Identity) instead. Will be removed by 4.0.x.
      Marks a relationship as "confirmed".
      Parameters:
      relationship - The relationship to be marked as "confirmed".
      Throws:
      RelationshipStorageException - the exception
      eXo level API
      Provisional
    • deny

      @Deprecated(forRemoval=true) void deny(Relationship relationship) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use deny(Identity, Identity) instead. Will be removed by 4.0.x.
      Denies a relationship.
      Parameters:
      relationship - The relationship to be denied.
      Throws:
      RelationshipStorageException
      eXo level API
      Provisional
    • remove

      @Deprecated(forRemoval=true) void remove(Relationship relationship) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use deny(Identity, Identity) or ignore(Identity, Identity) instead. Will be removed by 4.0.x.
      Removes a relationship.
      Parameters:
      relationship - The relationship to be removed.
      Throws:
      RelationshipStorageException - the exception
      eXo level API
      Provisional
    • ignore

      @Deprecated(forRemoval=true) void ignore(Relationship relationship) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use ignore(Identity, Identity) instead. Will be removed by 4.0.x.
      Marks a relationship as "ignored".
      Parameters:
      relationship - The relationship to be marked as "ignored".
      Throws:
      RelationshipStorageException - the exception
      eXo level API
      Provisional
    • getPendingRelationships

      @Deprecated(forRemoval=true) List<Relationship> getPendingRelationships(Identity identity) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getIncoming(Identity) instead. Will be removed by 4.0.x.
      Returns all pending relationships: sent.
      Parameters:
      identity - The identity.
      Returns:
      The pending relationships.
      Throws:
      RelationshipStorageException - the exception
      eXo level API
      Provisional
    • getPendingRelationships

      @Deprecated(forRemoval=true) List<Relationship> getPendingRelationships(Identity identity, boolean toConfirm) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      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(forRemoval=true) List<Relationship> getPendingRelationships(Identity currIdentity, List<Identity> identities, boolean toConfirm) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
    • getContacts

      @Deprecated(forRemoval=true) List<Relationship> getContacts(Identity currIdentity, List<Identity> identities) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getConnections(Identity) instead. Will be removed by 4.0.x.
      Gets contacts matching with the current identity.
      Parameters:
      currIdentity - The current identity.
      identities - The identities.
      Returns:
      The contacts.
      Throws:
      RelationshipStorageException - the exception
      eXo level API
      Provisional
    • getContacts

      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getConnections(Identity) instead. Will be removed by 4.0.x.
      Gets contacts of an identity.
      Parameters:
      identity - The identity.
      Returns:
      The contacts.
      Throws:
      RelationshipStorageException - the exception
      eXo level API
      Provisional
    • getAllRelationships

      @Deprecated(forRemoval=true) List<Relationship> getAllRelationships(Identity identity) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getAllWithListAccess(Identity) instead. Will be removed by 4.0.x.
      Returns all relationships associated with a given identity.
      Parameters:
      identity - The identity.
      Returns:
      The relationships.
      Throws:
      RelationshipStorageException - the exception
      eXo level API
      Provisional
    • getRelationshipsByIdentityId

      @Deprecated(forRemoval=true) List<Relationship> getRelationshipsByIdentityId(String id) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getAllWithListAccess(Identity) with identity instead. Will be removed by 4.0.x.
      Returns all relationships associated with a given identityId.
      Parameters:
      id - Id of the identity.
      Returns:
      The relationships.
      Throws:
      RelationshipStorageException - the exception
      eXo level API
      Provisional
    • getIdentities

      @Deprecated(forRemoval=true) List<Identity> getIdentities(Identity id) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getAllWithListAccess(Identity) instead. Will be removed by 4.0.x.
      Returns all identities associated with a given identity.
      Parameters:
      id - The given identity.
      Returns:
      The identities.
      Throws:
      Exception - the exception
      eXo level API
      Provisional
    • getRelationship

      @Deprecated(forRemoval=true) Relationship getRelationship(Identity sender, Identity receiver) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use get(Identity, Identity) instead. Will be removed by 4.0.x.
      Gets a relationship between 2 identities.
      Parameters:
      sender - The identity 1.
      receiver - The identity 2.
      Returns:
      The relationship.
      Throws:
      RelationshipStorageException - the exception
      eXo level API
      Provisional
    • findRelationships

      @Deprecated(forRemoval=true) List<Identity> findRelationships(Identity ownerIdentity, Relationship.Type relationshipType) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getIncoming(Identity) or getOutgoing(Identity) instead. Will be removed by 4.0.x.
      Finds all identities having relationshipType with the ownerIdentity.
      Parameters:
      ownerIdentity - The owner identity.
      relationshipType - The relationship type.
      Returns:
      The identities.
      Throws:
      RelationshipStorageException
      Since:
      1.2.0-Beta1
      eXo level API
      Provisional
    • getRelationshipStatus

      @Deprecated(forRemoval=true) Relationship.Type getRelationshipStatus(Relationship rel, Identity id)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
    • getConnectionStatus

      @Deprecated(forRemoval=true) Relationship.Type getConnectionStatus(Identity fromIdentity, Identity toIdentity) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getStatus(Identity, Identity) instead. Will be removed by 4.0.x.
      Gets the connection status between 2 identities.
      Parameters:
      fromIdentity - The identity 1.
      toIdentity - The identity 2.
      Returns:
      The connection status.
      Throws:
      Exception
      Since:
      1.1.1
      eXo level API
      Provisional
    • getPending

      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getIncoming(Identity) instead. Will be removed by 4.0.x.
      Gets all pending relationships of a sender.
      Parameters:
      sender - The sender.
      Returns:
      The pending relationships.
      Throws:
      RelationshipStorageException - the exception
      Since:
      1.2.0-Beta1
      eXo level API
      Provisional
    • getPending

      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getIncomingWithListAccess(Identity) instead. Will be removed by 4.0.x.
      Gets pending relationships of a sender that match with identities.
      Parameters:
      sender - The sender.
      identities - The identities.
      Returns:
      The pending relationships.
      Throws:
      RelationshipStorageException - the exception
      Since:
      1.2.0-Beta1
      eXo level API
      Provisional
    • getIncoming

      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getIncomingWithListAccess(Identity) instead. Will be removed by 4.0.x.
      Gets relationships of a receiver that are waiting for validation.
      Parameters:
      receiver - Identity of the receiver.
      Returns:
      The relationships.
      Throws:
      RelationshipStorageException
      Since:
      1.2.0-Beta1
      eXo level API
      Provisional
    • getIncoming

      @Deprecated(forRemoval=true) List<Relationship> getIncoming(Identity receiver, List<Identity> identities) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getIncomingWithListAccess(Identity) instead. Will be removed by 4.0.x.
      Gets relationships of a receiver that are waiting for validation and match with identities.
      Parameters:
      receiver - Identity of the receiver.
      identities - The identities.
      Returns:
      The list of relationships.
      Throws:
      RelationshipStorageException - the exception
      Since:
      1.2.0-Beta1
      eXo level API
      Provisional
    • getConfirmed

      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getConnections(Identity) instead. Will be removed by 4.0.x.
      Gets relationships confirmed by an identity.
      Parameters:
      identity - The identity.
      Returns:
      The confirmed relationships.
      Throws:
      RelationshipStorageException - the exception
      Since:
      1.2.0-Beta1
      eXo level API
      Provisional
    • getConfirmed

      @Deprecated(forRemoval=true) List<Relationship> getConfirmed(Identity identity, List<Identity> identities) throws RelationshipStorageException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getConnections(Identity) instead. Will be removed by 4.0.x.
      Gets relationships confirmed by an identity that match with identities.
      Parameters:
      identity - The identity.
      identities - The identities.
      Returns:
      The confirmed relationships.
      Throws:
      RelationshipStorageException - the exception
      Since:
      1.2.0-Beta1
      eXo level API
      Provisional
    • getAll

      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getAllWithListAccess(Identity) instead. Will be removed by 4.0.x.
      Gets all relationships of a given identity with other identity.
      Parameters:
      identity - The identity.
      Returns:
      The relationships.
      Throws:
      RelationshipStorageException - the exception
      Since:
      1.2.0-Beta1
      eXo level API
      Provisional
    • getAll

      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getAllWithListAccess(Identity) instead. Will be removed by 4.0.x.
      Gets all relationships of a given identity.
      Parameters:
      identity - The identity.
      identities - The identities.
      Returns:
      The relationships.
      Throws:
      RelationshipStorageException - the exception
      Since:
      1.2.0-Beta1
      eXo level API
      Provisional
    • getAll

      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getAllWithListAccess(Identity) instead. Will be removed by 4.0.x.
      Gets all relationships of a given identity.
      Parameters:
      identity - The identity.
      type - The status.
      identities - The identities.
      Returns:
      The relationships.
      Throws:
      RelationshipStorageException - the exception
      Since:
      1.2.0-Beta1
      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(forRemoval=true) org.exoplatform.commons.utils.ListAccess<Identity> getIncomingByFilter(Identity existingIdentity, ProfileFilter profileFilter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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(forRemoval=true) org.exoplatform.commons.utils.ListAccess<Identity> getOutgoingByFilter(Identity existingIdentity, ProfileFilter profileFilter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      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
    • getSuggestions

      @Deprecated(forRemoval=true) Map<Identity,Integer> getSuggestions(Identity identity, int offset, int limit)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets suggestions having common users with the provided identity.
      Parameters:
      identity - The provided identity.
      offset - The starting point from which suggestions are got.
      limit - The limitation of suggestions.
      Returns:
      The suggestions.
      Since:
      4.0.2
      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