Announcement Announcement Module
Collapse
No announcement yet.
Get Connection Object Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get Connection Object

    Hi,

    How do I get a Connection of a specific user if I have userConnectionsRepository reference?

    Note: May be a dumb question but I am not able to figure it out using docs.

    Thanks,
    Abhijith

  • #2
    You first have to get the ConnectionRepository for the user, then use it to find the connection:

    Code:
    ConnectionRepository connRepo = userConnectionsRepository.createConnectionRepository(userId);
    Connection<Facebook> fbConn = connRepo.getPrimaryConnection(Facebook.class); // or whatever provider you're wanting a connection for
    Of course, that's the explicit coding if all you have is the UsersConnectionRepository. You'll may also have a request-scoped ConnectionRepository bean in your application context. If so, then from that you can call getPrimaryConnection(), findConnections(), or a number of other methods that will give you what you need.

    Comment


    • #3
      Thanks Craig, that worked.

      Comment

      Working...
      X