|
|||||||||
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 for the current user to this repository. |
|
Connection<?> |
findConnection(ConnectionKey connectionKey)
Find a single Connection for the current user by its key, which consists of the providerId + providerUserId. |
|
MultiValueMap<java.lang.String,Connection<?>> |
findConnections()
Find a map of all Connections for the current user. |
|
MultiValueMap<java.lang.String,Connection<?>> |
findConnectionsForUsers(MultiValueMap<java.lang.String,java.lang.String> providerUserIds)
Find the Connections the current user has to the given provider users. |
|
|
findConnectionsToApi(java.lang.Class<A> apiType)
Find the Connections for the current user by the given apiType e.g. |
|
java.util.List<Connection<?>> |
findConnectionsToProvider(java.lang.String providerId)
Find the Connections the current user has to the provider registered by the given id. |
|
|
findConnectionToApiForUser(java.lang.Class<A> apiType,
java.lang.String providerUserId)
Find the Connection between the current user and the given provider user. |
|
|
findPrimaryConnectionToApi(java.lang.Class<A> apiType)
Find a single Connection for the current user by its apiType e.g. |
|
void |
removeConnection(ConnectionKey connectionKey)
Remove a single Connection for the current user from this repository. |
|
void |
removeConnectionsToProvider(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 |
---|
MultiValueMap<java.lang.String,Connection<?>> findConnections()
{ "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<?>> findConnectionsToProvider(java.lang.String providerId)
providerId
- the provider id e.g. "facebook"MultiValueMap<java.lang.String,Connection<?>> findConnectionsForUsers(MultiValueMap<java.lang.String,java.lang.String> providerUserIds)
providerUserIds
- the provider users map
Connection<?> findConnection(ConnectionKey connectionKey)
connectionKey
- the service provider connection key
NoSuchConnectionException
- if no such connection exists for the current user<A> Connection<A> findPrimaryConnectionToApi(java.lang.Class<A> apiType)
A
- the service api parameterized typeapiType
- the service api type e.g. FacebookApi.class or TwitterApi.class
<A> Connection<A> findConnectionToApiForUser(java.lang.Class<A> apiType, java.lang.String providerUserId)
findConnection(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 service api type e.g. FacebookApi.class or TwitterApi.classproviderUserId
- the provider user e.g. "126500".
<A> java.util.List<Connection<A>> findConnectionsToApi(java.lang.Class<A> apiType)
findConnectionsToProvider(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<FacebookApi>>
.
A
- the api parameterized typeapiType
- the service api type e.g. FacebookApi.class or TwitterApi.class
void addConnection(Connection<?> connection)
connection
- connection
DuplicateConnectionException
- if the user already has this connectionvoid updateConnection(Connection<?> connection)
connection
- the connectionvoid removeConnectionsToProvider(java.lang.String providerId)
providerId
- the provider id e.g. "facebook"void removeConnection(ConnectionKey connectionKey)
connectionKey
- the connection key
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |