Results 1 to 3 of 3

Thread: Get Connection Object

  1. #1

    Default 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. #2
    Join Date
    Aug 2004
    Posts
    1,070

    Default

    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.
    Craig Walls
    Spring Social Project Lead

  3. #3

    Default

    Thanks Craig, that worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •