View Javadoc
1   /*******************************************************************************
2    *   Gisgraphy Project 
3    * 
4    *   This library is free software; you can redistribute it and/or
5    *   modify it under the terms of the GNU Lesser General Public
6    *   License as published by the Free Software Foundation; either
7    *   version 2.1 of the License, or (at your option) any later version.
8    * 
9    *   This library is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   *   Lesser General Public License for more details.
13   * 
14   *   You should have received a copy of the GNU Lesser General Public
15   *   License along with this library; if not, write to the Free Software
16   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
17   * 
18   *  Copyright 2008  Gisgraphy project 
19   *  David Masclet <davidmasclet@gisgraphy.com>
20   *  
21   *  
22   *******************************************************************************/
23  package com.gisgraphy.service;
24  
25  import java.util.List;
26  
27  import javax.jws.WebService;
28  
29  import org.springframework.security.userdetails.UsernameNotFoundException;
30  
31  import com.gisgraphy.model.User;
32  
33  /**
34   * Web Service interface so hierarchy of Universal and Generic Managers isn't
35   * carried through.
36   */
37  @WebService
38  public interface UserService {
39      /**
40       * Retrieves a user by userId. An exception is thrown if user not found
41       * 
42       * @param userId
43       *                the identifier for the user
44       * @return User
45       */
46      User getUser(String userId);
47  
48      /**
49       * Finds a user by their username.
50       * 
51       * @param username
52       *                the user's username used to login
53       * @return User a populated user object
54       * @throws org.acegisecurity.userdetails.UsernameNotFoundException
55       *                 exception thrown when user not found
56       */
57      User getUserByUsername(String username) throws UsernameNotFoundException;
58  
59      /**
60       * Retrieves a list of users, filtering with parameters on a user object
61       * 
62       * @param user
63       *                parameters to filter on
64       * @return List
65       */
66      List<User> getUsers(User user);
67  
68      /**
69       * Saves a user's information
70       * 
71       * @param user
72       *                the user's information
73       * @throws UserExistsException
74       *                 thrown when user already exists
75       * @return updated user
76       */
77      User saveUser(User user) throws UserExistsException;
78  
79      /**
80       * Removes a user from the database by their userId
81       * 
82       * @param userId
83       *                the user's id
84       */
85      void removeUser(String userId);
86  }