Clearspace API (2.5.29) Core Javadocs

com.jivesoftware.community.user.relationships
Interface UserRelationshipManager


public interface UserRelationshipManager


Method Summary
 void approveRelationship(com.jivesoftware.community.user.relationships.UserRelationship userRelationship, String responseMessage)
           
 boolean canViewRelationshipLists(User user)
           
 com.jivesoftware.community.user.relationships.UserRelationship createRelationship(long userID, long relatedUserID, int relationshipType, long relationshipGraphID, String requestMessage)
          Create a relationship between two users.
 com.jivesoftware.community.user.relationships.UserRelationship createRelationship(User user, User relatedUser, com.jivesoftware.community.user.relationships.UserRelationshipGraph relationshipGraph, String requestMessage)
          Create a relationship between two users.
 com.jivesoftware.community.user.relationships.UserRelationshipGraph createRelationshipGraph(String name, com.jivesoftware.community.user.relationships.UserRelationshipGraph.GraphType graphType)
          Create a new relationship graph with a given name and persist it.
 com.jivesoftware.community.user.relationships.UserRelationshipList createRelationshipList(String name, String label, User owner)
          Create a new UserRelationshipList.
 void deleteRelationshipGraph(long relationshipGraphID)
          Remove the graph from the peristence layer.
 void deleteRelationshipList(com.jivesoftware.community.user.relationships.UserRelationshipList list)
          Delete a list and all child relationships from the DB.
 void deleteUserRelationships(User user)
          Delete all relationships related to the given user, regardless of which end of the relationship the given user exists.
 Iterable<com.jivesoftware.community.user.relationships.UserRelationshipView> getAllActiveRelationships(com.jivesoftware.community.user.relationships.UserRelationshipManagerImpl.UserRelationshipResultFilter filter)
          Get a list of active user relationships for a given graph (for admin console purposes).
 com.jivesoftware.community.user.relationships.UserRelationshipView getApprovalViewForUserRelationship(com.jivesoftware.community.user.relationships.UserRelationship rel, long requestingUserID)
          Create a specific view for a relationship depending on who is requesting the view.
 Set<Long> getApproverUserIDs(User requester, com.jivesoftware.community.user.relationships.UserRelationship userRelationship)
           
 List<User> getColleagues(User user, com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph graph)
          Get a list of a user's colleagues (people who report to the same manager, minus the user) (may return empty list, but not null).
 Map<com.jivesoftware.community.user.relationships.UserRelationshipGraph,Collection<com.jivesoftware.community.user.relationships.UserRelationshipView>> getCurrentRelationshipMap(User user, boolean approvedOnly)
          Get a map of relationship views revolving around the user argument.
 Collection<com.jivesoftware.community.user.relationships.UserRelationshipView> getCurrentRelationships(User user, com.jivesoftware.community.user.relationships.UserRelationshipGraph graph, boolean approvedOnly)
          Get a collection of relationship views revolving around the user argument.
 com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph getDefaultHierarchicalRelationshipGraph()
          Find the default (primary) HierarchicalUserRelationshipGraph.
 com.jivesoftware.community.user.relationships.MeshUserRelationshipGraph getDefaultMeshRelationshipGraph()
          Find the default (primary) MeshUserRelationshipGraph.
 List<User> getDirectReports(User manager, com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph graph)
          Get a list of a user's direct reports (may return empty list, but not null).
 List<User> getEscalationChain(User user, com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph graph)
          Build a list of people upward in the hierarchical org from a given user.
 com.jivesoftware.community.user.relationships.UserRelationship getFriendRelationship(User user1, User user2, com.jivesoftware.community.user.relationships.MeshUserRelationshipGraph graph)
          If two users have a relationship in a given graph, return it, else return null.
 List<com.jivesoftware.community.user.relationships.UserRelationshipView> getFriends(User user)
          Get an list of a user's friends from the default mesh graph.
 List<com.jivesoftware.community.user.relationships.UserRelationshipView> getFriends(User user, com.jivesoftware.community.user.relationships.MeshUserRelationshipGraph graph)
          Get an list of a user's friends in a given mesh graph.
 List<com.jivesoftware.community.user.relationships.UserRelationshipView> getInverseFriends(User user, com.jivesoftware.community.user.relationships.MeshUserRelationshipGraph graph)
          Get a list of who has friended a user, for a non-reflexive graph.
 User getManager(User user, com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph graph)
          Get a user's current manager in a hierarchical graph, or null if no manager is found.
 com.jivesoftware.community.user.relationships.UserRelationship getManagerRelationship(User user, com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph graph)
          Get a user's current manager.
 Set<Long> getNotificationUserIDs(User requester, com.jivesoftware.community.user.relationships.UserRelationship userRelationship)
           
 Collection<com.jivesoftware.community.user.relationships.UserRelationshipView> getPendingRelationships(User user, com.jivesoftware.community.user.relationships.UserRelationshipGraph graph)
          Get a list of not-yet-approved relationships for a given graph.
 Map<com.jivesoftware.community.user.relationships.UserRelationshipGraph,Collection<com.jivesoftware.community.user.relationships.UserRelationshipView>> getPossibleRelationshipMap(User user, User relatedUser)
           
 Collection<com.jivesoftware.community.user.relationships.UserRelationshipView> getPossibleRelationships(User user, User relatedUser, com.jivesoftware.community.user.relationships.UserRelationshipGraph graph)
          Get a collection of relationship views (per graph) showing the possible relationships between two users.
 com.jivesoftware.community.user.relationships.UserRelationship getRelationship(long relationshipID)
          Get a given relationship for its ID.
 com.jivesoftware.community.user.relationships.UserRelationshipGraph getRelationshipGraph(long relationshipGraphID)
          Get a graph for a given graph ID.
 Collection<com.jivesoftware.community.user.relationships.UserRelationshipGraph> getRelationshipGraphs(boolean enabledOnly)
          Get a collection of all graphs in the system, regardless of state (enabled or disabled).
 com.jivesoftware.community.user.relationships.UserRelationshipList getRelationshipList(long listID)
          Retrive a relationship list by ID.
 Collection<com.jivesoftware.community.user.relationships.UserRelationshipList> getRelationshipListsByOwner(User owner)
          Retrieves a collection of lists based on an owner userID.
 Collection<com.jivesoftware.community.user.relationships.UserRelationshipList> getRelationshipListsByPerson(User person, User owner)
          Retrieves a collection of lists based on an owner userID and a person who is on the list.
 List<com.jivesoftware.community.user.relationships.UserRelationshipView> getRelationshipListUsers(com.jivesoftware.community.user.relationships.UserRelationshipList list)
          Get a list of users from a user relationship list.
 int getUserRelationshipCount()
          Get a count of all UserRelationships.
 int getUserRelationshipCount(com.jivesoftware.community.user.relationships.UserRelationshipManagerImpl.UserRelationshipResultFilter filter)
          Get a filtered count of all UserRelationships.
 boolean isFriend(User user1, User user2, com.jivesoftware.community.user.relationships.MeshUserRelationshipGraph graph)
          In a reflexive mesh graph, are user1 and user2 friends?
 boolean isFriendingEnabled()
          Is the friending feature enabled?
 boolean isOrgChartingEnabled()
          Is the organizational relationship feature enabled?
 void notifyUsers(String key, User requester, com.jivesoftware.community.user.relationships.UserRelationship relationship, Map<String,Object> additonalContext)
          Send a notification corresponding to an event (creation, approval, rejection, retirement) of a UserRelationship.
 void rejectRelationship(com.jivesoftware.community.user.relationships.UserRelationship userRelationship, String responseMessage)
           
 void retireRelationship(User retirer, com.jivesoftware.community.user.relationships.UserRelationship userRelationship)
          Set relationship to be retired and persist the change in the DB.
 void retireRelationships(User user)
          Retire all current relationships for a given user (for example, on disabling an account).
 void updateRelationship(com.jivesoftware.community.user.relationships.UserRelationship userRelationship)
           
 void updateRelationshipGraph(com.jivesoftware.community.user.relationships.UserRelationshipGraph relationshipGraph)
          Persist any changes to the graph.
 void updateRelationshipList(com.jivesoftware.community.user.relationships.UserRelationshipList list)
          Update the name or labelStyle of a list.
 

Method Detail

isOrgChartingEnabled

boolean isOrgChartingEnabled()
Is the organizational relationship feature enabled?

Returns:
the enabled state of the feature.

isFriendingEnabled

boolean isFriendingEnabled()
Is the friending feature enabled?

Returns:
the enabled state of the feature.

createRelationshipGraph

com.jivesoftware.community.user.relationships.UserRelationshipGraph createRelationshipGraph(String name,
                                                                                            com.jivesoftware.community.user.relationships.UserRelationshipGraph.GraphType graphType)
Create a new relationship graph with a given name and persist it.

Parameters:
name - The name (title) of this graph.
graphType - The GraphType (Hierarchical or Mesh) of the graph that is being created.
Returns:
a newly created and persisted object that implements UserRelationshipGraph.

getRelationshipGraph

com.jivesoftware.community.user.relationships.UserRelationshipGraph getRelationshipGraph(long relationshipGraphID)
Get a graph for a given graph ID.

Parameters:
relationshipGraphID - The ID of the graph to return.
Returns:
an object that implements UserRelationshipGraph.

updateRelationshipGraph

void updateRelationshipGraph(com.jivesoftware.community.user.relationships.UserRelationshipGraph relationshipGraph)
Persist any changes to the graph. Note that graph type cannot be updated once created.

Parameters:
relationshipGraph - an object that implements UserRelationshipGraph.

deleteRelationshipGraph

void deleteRelationshipGraph(long relationshipGraphID)
Remove the graph from the peristence layer.

WARNING: this will remove all relationships associated with this graph as well.

Parameters:
relationshipGraphID - The ID of the graph to delete.

getDefaultHierarchicalRelationshipGraph

com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph getDefaultHierarchicalRelationshipGraph()
Find the default (primary) HierarchicalUserRelationshipGraph. If no default graph is found, null is returned.

Returns:

getDefaultMeshRelationshipGraph

com.jivesoftware.community.user.relationships.MeshUserRelationshipGraph getDefaultMeshRelationshipGraph()
Find the default (primary) MeshUserRelationshipGraph. If no default graph is found, null is returned.

Returns:

getRelationshipGraphs

Collection<com.jivesoftware.community.user.relationships.UserRelationshipGraph> getRelationshipGraphs(boolean enabledOnly)
Get a collection of all graphs in the system, regardless of state (enabled or disabled).

Parameters:
enabledOnly -
Returns:
a Collection of UserRelationshipGraphs.

createRelationship

com.jivesoftware.community.user.relationships.UserRelationship createRelationship(long userID,
                                                                                  long relatedUserID,
                                                                                  int relationshipType,
                                                                                  long relationshipGraphID,
                                                                                  String requestMessage)
                                                                                  throws com.jivesoftware.community.user.relationships.UserRelationshipException
Create a relationship between two users. If the graph is hierarchical, user will be relatedUser's manager. Otherwise, user will be relatedUser's peer.

Parameters:
userID -
relatedUserID -
relationshipType -
relationshipGraphID -
requestMessage -
Returns:
Throws:
UserRelationshipAlreadyExistsException
com.jivesoftware.community.user.relationships.UserRelationshipException

createRelationship

com.jivesoftware.community.user.relationships.UserRelationship createRelationship(User user,
                                                                                  User relatedUser,
                                                                                  com.jivesoftware.community.user.relationships.UserRelationshipGraph relationshipGraph,
                                                                                  String requestMessage)
                                                                                  throws com.jivesoftware.community.user.relationships.UserRelationshipException
Create a relationship between two users. If the graph is hierarchical, user will be relatedUser's manager. Otherwise, user will be relatedUser's peer.

Parameters:
user -
relatedUser -
relationshipGraph -
Returns:
Throws:
UserRelationshipAlreadyExistsException - If this relationship already exists (in either direction for peer relationships, or if relatedUser already has a manager for hierarchical relationships).
com.jivesoftware.community.user.relationships.UserRelationshipException

deleteUserRelationships

void deleteUserRelationships(User user)
                             throws UnauthorizedException
Delete all relationships related to the given user, regardless of which end of the relationship the given user exists.

Parameters:
user - The user or relatedUser within the relationships being deleted.
Throws:
UnauthorizedException - If the currently authenticated user is not a sys-admin or user-admin.

getCurrentRelationshipMap

Map<com.jivesoftware.community.user.relationships.UserRelationshipGraph,Collection<com.jivesoftware.community.user.relationships.UserRelationshipView>> getCurrentRelationshipMap(User user,
                                                                                                                                                                                  boolean approvedOnly)
Get a map of relationship views revolving around the user argument. The map is keyed by the graphs of the relationships and shows one level of removal from the user for any graph.

Parameters:
user -
approvedOnly -
Returns:

getCurrentRelationships

Collection<com.jivesoftware.community.user.relationships.UserRelationshipView> getCurrentRelationships(User user,
                                                                                                       com.jivesoftware.community.user.relationships.UserRelationshipGraph graph,
                                                                                                       boolean approvedOnly)
Get a collection of relationship views revolving around the user argument.

Parameters:
user -
graph -
approvedOnly -
Returns:

getPossibleRelationshipMap

Map<com.jivesoftware.community.user.relationships.UserRelationshipGraph,Collection<com.jivesoftware.community.user.relationships.UserRelationshipView>> getPossibleRelationshipMap(User user,
                                                                                                                                                                                   User relatedUser)

getPossibleRelationships

Collection<com.jivesoftware.community.user.relationships.UserRelationshipView> getPossibleRelationships(User user,
                                                                                                        User relatedUser,
                                                                                                        com.jivesoftware.community.user.relationships.UserRelationshipGraph graph)
Get a collection of relationship views (per graph) showing the possible relationships between two users. Possible relationships are relationships that don't exist yet or aren't pending approval.

Parameters:
user -
graph -
Returns:

getPendingRelationships

Collection<com.jivesoftware.community.user.relationships.UserRelationshipView> getPendingRelationships(User user,
                                                                                                       com.jivesoftware.community.user.relationships.UserRelationshipGraph graph)
Get a list of not-yet-approved relationships for a given graph.

Parameters:
user -
graph -
Returns:

getRelationship

com.jivesoftware.community.user.relationships.UserRelationship getRelationship(long relationshipID)
Get a given relationship for its ID.

Parameters:
relationshipID -
Returns:

getManagerRelationship

com.jivesoftware.community.user.relationships.UserRelationship getManagerRelationship(User user,
                                                                                      com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph graph)
Get a user's current manager. NOTE: the relationship may or may not be approved.

Returns:

retireRelationships

void retireRelationships(User user)
Retire all current relationships for a given user (for example, on disabling an account).

Parameters:
the - user to disable all relationships for.

retireRelationship

void retireRelationship(User retirer,
                        com.jivesoftware.community.user.relationships.UserRelationship userRelationship)
Set relationship to be retired and persist the change in the DB.

Parameters:
userRelationship -

updateRelationship

void updateRelationship(com.jivesoftware.community.user.relationships.UserRelationship userRelationship)

approveRelationship

void approveRelationship(com.jivesoftware.community.user.relationships.UserRelationship userRelationship,
                         String responseMessage)

rejectRelationship

void rejectRelationship(com.jivesoftware.community.user.relationships.UserRelationship userRelationship,
                        String responseMessage)

getApproverUserIDs

Set<Long> getApproverUserIDs(User requester,
                             com.jivesoftware.community.user.relationships.UserRelationship userRelationship)

getNotificationUserIDs

Set<Long> getNotificationUserIDs(User requester,
                                 com.jivesoftware.community.user.relationships.UserRelationship userRelationship)

getApprovalViewForUserRelationship

com.jivesoftware.community.user.relationships.UserRelationshipView getApprovalViewForUserRelationship(com.jivesoftware.community.user.relationships.UserRelationship rel,
                                                                                                      long requestingUserID)
Create a specific view for a relationship depending on who is requesting the view.

Parameters:
rel -
requestingUserID -
Returns:

notifyUsers

void notifyUsers(String key,
                 User requester,
                 com.jivesoftware.community.user.relationships.UserRelationship relationship,
                 Map<String,Object> additonalContext)
Send a notification corresponding to an event (creation, approval, rejection, retirement) of a UserRelationship.

Parameters:
key -
requester -
relationship -
additonalContext -

getEscalationChain

List<User> getEscalationChain(User user,
                              com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph graph)
Build a list of people upward in the hierarchical org from a given user.

Parameters:
user -
Returns:
An upwards chain of managers of the user. May return profile data.

getManager

User getManager(User user,
                com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph graph)
Get a user's current manager in a hierarchical graph, or null if no manager is found.

Parameters:
user -
Returns:
The user's manager. May return profile data.

getColleagues

List<User> getColleagues(User user,
                         com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph graph)
Get a list of a user's colleagues (people who report to the same manager, minus the user) (may return empty list, but not null).

Parameters:
user -
graph -
Returns:
A list of colleagues, sorted by name. May return profile data.

getDirectReports

List<User> getDirectReports(User manager,
                            com.jivesoftware.community.user.relationships.HierarchicalUserRelationshipGraph graph)
Get a list of a user's direct reports (may return empty list, but not null).

Parameters:
manager -
graph -
Returns:
A list of direct reports, sorted by name. May return profile data.

getFriends

List<com.jivesoftware.community.user.relationships.UserRelationshipView> getFriends(User user)
Get an list of a user's friends from the default mesh graph.

Parameters:
user -
Returns:
A list of friends, sorted by name. May return profile data.

getFriends

List<com.jivesoftware.community.user.relationships.UserRelationshipView> getFriends(User user,
                                                                                    com.jivesoftware.community.user.relationships.MeshUserRelationshipGraph graph)
Get an list of a user's friends in a given mesh graph.

Parameters:
user -
graph -
Returns:
A list of friends, sorted by name. May return profile data.

getInverseFriends

List<com.jivesoftware.community.user.relationships.UserRelationshipView> getInverseFriends(User user,
                                                                                           com.jivesoftware.community.user.relationships.MeshUserRelationshipGraph graph)
Get a list of who has friended a user, for a non-reflexive graph.

Parameters:
user -
graph -
Returns:
A list of friends, sorted by name. May return profile data.

isFriend

boolean isFriend(User user1,
                 User user2,
                 com.jivesoftware.community.user.relationships.MeshUserRelationshipGraph graph)
In a reflexive mesh graph, are user1 and user2 friends? In a non-reflexive graph, is user1 following user2?

Parameters:
user1 -
user2 -
Returns:

getFriendRelationship

com.jivesoftware.community.user.relationships.UserRelationship getFriendRelationship(User user1,
                                                                                     User user2,
                                                                                     com.jivesoftware.community.user.relationships.MeshUserRelationshipGraph graph)
If two users have a relationship in a given graph, return it, else return null.

Parameters:
user1 -
user2 -
graph -
Returns:

getRelationshipListUsers

List<com.jivesoftware.community.user.relationships.UserRelationshipView> getRelationshipListUsers(com.jivesoftware.community.user.relationships.UserRelationshipList list)
Get a list of users from a user relationship list.

Parameters:
list -
Returns:

getAllActiveRelationships

Iterable<com.jivesoftware.community.user.relationships.UserRelationshipView> getAllActiveRelationships(com.jivesoftware.community.user.relationships.UserRelationshipManagerImpl.UserRelationshipResultFilter filter)
Get a list of active user relationships for a given graph (for admin console purposes).

Parameters:
filter - A filter for the results (by graph, username, etc).

getUserRelationshipCount

int getUserRelationshipCount()
Get a count of all UserRelationships.

Returns:

getUserRelationshipCount

int getUserRelationshipCount(com.jivesoftware.community.user.relationships.UserRelationshipManagerImpl.UserRelationshipResultFilter filter)
Get a filtered count of all UserRelationships.

Parameters:
filter -
Returns:

createRelationshipList

com.jivesoftware.community.user.relationships.UserRelationshipList createRelationshipList(String name,
                                                                                          String label,
                                                                                          User owner)
Create a new UserRelationshipList.

Parameters:
name - The name of the list.
owner - The list owner.
Returns:
A newly created list.

updateRelationshipList

void updateRelationshipList(com.jivesoftware.community.user.relationships.UserRelationshipList list)
Update the name or labelStyle of a list. All child relationship changes will be persisted as well.

Parameters:
list - The list to update.

deleteRelationshipList

void deleteRelationshipList(com.jivesoftware.community.user.relationships.UserRelationshipList list)
Delete a list and all child relationships from the DB.

Parameters:
list - The list to delete.

getRelationshipList

com.jivesoftware.community.user.relationships.UserRelationshipList getRelationshipList(long listID)
Retrive a relationship list by ID.

Parameters:
listID - The ID of the list.
Returns:
the list, or null if none is found.

getRelationshipListsByOwner

Collection<com.jivesoftware.community.user.relationships.UserRelationshipList> getRelationshipListsByOwner(User owner)
Retrieves a collection of lists based on an owner userID.

Parameters:
owner - The lists' owner.
Returns:
a Collection of lists, or an empty collection if none found.

getRelationshipListsByPerson

Collection<com.jivesoftware.community.user.relationships.UserRelationshipList> getRelationshipListsByPerson(User person,
                                                                                                            User owner)
Retrieves a collection of lists based on an owner userID and a person who is on the list.

Parameters:
owner - The lists' owner.
Returns:
a Collection of lists, or an empty collection if none found.

canViewRelationshipLists

boolean canViewRelationshipLists(User user)

Clearspace Project Page

Copyright © 1999-2007 Jive Software.