Results 1 to 3 of 3

Thread: Field rank in Connection object

  1. #1
    Join Date
    Dec 2012
    Posts
    2

    Default Field rank in Connection object

    Hi,

    My application needs to manage several connection for the same provider for one user of my application.

    Among these Connection, I'd like to let my user which one is the "primary" connection (ie. the one returned by ConnectionRepository.getPrimaryConnection(apiType) , or the one with rank=1).

    But from what I read in the documentation and in the code, there is no such functionality (changing the rank of a Connection, the rank field does not seem to be accessible).

    Besides if the user remove the Connection with the rank 1, future calls to ConnectionRepository.getPrimaryConnection(apiType) will throw an exception, even if there is still a Connection of the type apiType.

    Am I correct?

    Thanks you very much
    Nicolas

  2. #2
    Join Date
    Aug 2004
    Posts
    1,072

    Default

    Re-ranking of connections is not support...you are correct. If this is something important to you, then I encourage you to open an improvement issue at (https://jira.springsource.org/browse/SOCIAL) and we'll try to work it into the mix.

    As for an exception thrown from getPrimaryConnection() if connection 1 is removed...that sounds like a bug. Can you confirm for me that it happens and, if so, open a bug issue for it?
    Craig Walls
    Spring Social Project Lead

  3. #3
    Join Date
    Dec 2012
    Posts
    2

    Default

    Here is the bug issue regarding the exception thrown from getPrimaryConnection(): https://jira.springsource.org/browse/SOCIAL-341

    Considering this bug and the fact that I need to choose the primary connection, here is what I do in my application
    • never use get/findPrimaryConnection. Instead call findConnections(ProviderId), and pick the first one (as connections are sorted by rank)
    • I added a method to change the connection with rank 1 :
      • first, update the primary connection with rank = max(rank) +1
      • then, update the connection with the right providerUserId with rank =1


    Nicolas

Posting Permissions

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