|
Spring Social | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ConnectionRepository
Data access interface for saving and restoring Connection objects from a persistent store.
The view is relative to a specific local user--it's not possible using this interface to access or update connections for multiple local users.
If you need that capability, see UsersConnectionRepository
.
UsersConnectionRepository
Method Summary | ||
---|---|---|
void |
addConnection(Connection<?> connection)
Add a new connection to this repository for the current user. |
|
org.springframework.util.MultiValueMap<java.lang.String,Connection<?>> |
findAllConnections()
Find all connections the current user has across all providers. |
|
|
findConnections(java.lang.Class<A> apiType)
Find the connections the current user has to the provider of the given API e.g. |
|
java.util.List<Connection<?>> |
findConnections(java.lang.String providerId)
Find the connections the current user has to the provider registered by the given id e.g. |
|
org.springframework.util.MultiValueMap<java.lang.String,Connection<?>> |
findConnectionsToUsers(org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> providerUserIds)
Find the connections the current user has to the given provider users. |
|
|
findPrimaryConnection(java.lang.Class<A> apiType)
Find the "primary" connection the current user has to the provider of the given API e.g. |
|
|
getConnection(java.lang.Class<A> apiType,
java.lang.String providerUserId)
Get a connection between the current user and the given provider user. |
|
Connection<?> |
getConnection(ConnectionKey connectionKey)
Get a connection for the current user by its key, which consists of the providerId + providerUserId. |
|
|
getPrimaryConnection(java.lang.Class<A> apiType)
Get the "primary" connection the current user has to the provider of the given API e.g. |
|
void |
removeConnection(ConnectionKey connectionKey)
Remove a single Connection for the current user from this repository. |
|
void |
removeConnections(java.lang.String providerId)
Remove all Connections between the current user and the provider from this repository. |
|
void |
updateConnection(Connection<?> connection)
Update a Connection already added to this repository. |
Method Detail |
---|
org.springframework.util.MultiValueMap<java.lang.String,Connection<?>> findAllConnections()
Connection
s that exist between the user and that provider.
For example, if the user is connected once to Facebook and twice to Twitter, the returned map would contain two entries with the following structure:
{ "facebook" -> Connection("Keith Donald") , "twitter" -> Connection("kdonald"), Connection("springsource") }The returned map is sorted by providerId and entry values are ordered by rank. Returns an empty map if the user has no connections.
java.util.List<Connection<?>> findConnections(java.lang.String providerId)
providerId
- the provider id e.g. "facebook"
<A> java.util.List<Connection<A>> findConnections(java.lang.Class<A> apiType)
findConnections(String)
, but uses the apiType as the provider key instead of the providerId.
Useful for direct use by application code to obtain parameterized Connection instances e.g. List<Connection<Facebook>>
.
A
- the API parameterized typeapiType
- the API type e.g. Facebook.class or Twitter.class
org.springframework.util.MultiValueMap<java.lang.String,Connection<?>> findConnectionsToUsers(org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> providerUserIds)
providerUserIds
- the provider users map
Connection<?> getConnection(ConnectionKey connectionKey)
connectionKey
- the service provider connection key
NoSuchConnectionException
- if no such connection exists for the current user<A> Connection<A> getConnection(java.lang.Class<A> apiType, java.lang.String providerUserId)
getConnection(ConnectionKey)
, but uses the apiType as the provider key instead of the providerId.
Useful for direct use by application code to obtain a parameterized Connection instance.
A
- the API parameterized typeapiType
- the API type e.g. Facebook.class or Twitter.classproviderUserId
- the provider user e.g. "126500".
NoSuchConnectionException
- if no such connection exists for the current user<A> Connection<A> getPrimaryConnection(java.lang.Class<A> apiType)
A
- the API parameterized typeapiType
- the API type e.g. Facebook.class or Twitter.class
NotConnectedException
- if the user is not connected to the provider of the API<A> Connection<A> findPrimaryConnection(java.lang.Class<A> apiType)
getPrimaryConnection(Class)
but returns null if no connection is found instead of throwing an exception.
A
- the API parameterized typeapiType
- the API type e.g. Facebook.class or Twitter.class
null
if not foundvoid addConnection(Connection<?> connection)
connection
- the new connection to add to this repository
DuplicateConnectionException
- if the user already has this connectionvoid updateConnection(Connection<?> connection)
connection
- the existing connection to update in this repositoryvoid removeConnections(java.lang.String providerId)
providerId
- the provider id e.g. 'facebook'void removeConnection(ConnectionKey connectionKey)
connectionKey
- the connection key
|
Spring Social | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |