ccc.api.jaxrs
Class UsersImpl

java.lang.Object
  extended by ccc.api.jaxrs.JaxrsCollection
      extended by ccc.api.jaxrs.UsersImpl
All Implemented Interfaces:
Users

public class UsersImpl
extends JaxrsCollection
implements Users

Implementation of the Users interface.

Author:
Civic Computing Ltd.

Field Summary
 
Fields inherited from interface ccc.api.core.Users
NAME
 
Constructor Summary
UsersImpl(Users users)
          Constructor.
 
Method Summary
 User create(User user)
          Create a new user in the system.
 java.util.Collection<java.lang.String> listUserMetadataValuesWithKey(java.lang.String key)
          Query metadata values with given key.
 PagedCollection<User> query(java.lang.String username, java.lang.String email, java.lang.String groups, java.lang.String metadataKey, java.lang.String metadataValue, java.lang.String sort, SortOrder order, int pageNo, int pageSize)
          Query users.
 User retrieve(java.util.UUID userId)
          Retrieve a user.
 User retrieveCurrent()
          Returns currently logged in user.
 void update(java.util.UUID userId, User delta)
          Updates the user in the system.
 void updateCurrent(User user)
          Update the email and/or password for the current user.
 void updateUserPassword(java.util.UUID userId, User pu)
          Update the password for the specified user.
 User userByLegacyId(java.lang.String legacyId)
          Look up the user for a specified legacy id.
 java.lang.Boolean usernameExists(Username username)
          Query whether the specified username is in use.
 
Methods inherited from class ccc.api.jaxrs.JaxrsCollection
convertException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsersImpl

public UsersImpl(Users users)
Constructor.

Parameters:
users -
Method Detail

retrieveCurrent

public User retrieveCurrent()
Returns currently logged in user.

Specified by:
retrieveCurrent in interface Users
Returns:
UserDTO

retrieve

public User retrieve(java.util.UUID userId)
Retrieve a user.

Specified by:
retrieve in interface Users
Parameters:
userId - The user's id.
Returns:
The corresponding delta.

usernameExists

public java.lang.Boolean usernameExists(Username username)
Query whether the specified username is in use.

Specified by:
usernameExists in interface Users
Parameters:
username - The username to check
Returns:
True if the username is in use, false otherwise.

create

public User create(User user)
Create a new user in the system.

Specified by:
create in interface Users
Parameters:
user - The new user details.
Returns:
A user summary describing the new user.

updateUserPassword

public void updateUserPassword(java.util.UUID userId,
                               User pu)
Update the password for the specified user.

Specified by:
updateUserPassword in interface Users
Parameters:
userId - The user's id.
pu - New details for the user.

updateCurrent

public void updateCurrent(User user)
Update the email and/or password for the current user.

Specified by:
updateCurrent in interface Users
Parameters:
user - New details for the user.

update

public void update(java.util.UUID userId,
                   User delta)
Updates the user in the system.

Specified by:
update in interface Users
Parameters:
userId - The id of the user to update.
delta - The changes to apply.

userByLegacyId

public User userByLegacyId(java.lang.String legacyId)
Look up the user for a specified legacy id.

Specified by:
userByLegacyId in interface Users
Parameters:
legacyId - The legacy id of the user.
Returns:
A summary of the corresponding user.

listUserMetadataValuesWithKey

public java.util.Collection<java.lang.String> listUserMetadataValuesWithKey(java.lang.String key)
Query metadata values with given key.

Specified by:
listUserMetadataValuesWithKey in interface Users
Parameters:
key - The key as a string.
Returns:
Returns list of users.

query

public PagedCollection<User> query(java.lang.String username,
                                   java.lang.String email,
                                   java.lang.String groups,
                                   java.lang.String metadataKey,
                                   java.lang.String metadataValue,
                                   java.lang.String sort,
                                   SortOrder order,
                                   int pageNo,
                                   int pageSize)
Query users.

Specified by:
query in interface Users
Parameters:
username - The username criteria.
email - The email criteria.
groups - The groups criteria.
metadataKey - The metadata key criteria.
metadataValue - The metadata value criteria.
sort - The column to sort.
order - The sort order (ASC/DESC).
pageNo - The page to display.
pageSize - The number of results per page.
Returns:
Returns list of users.


Copyright © 2010. All Rights Reserved.