1 /*
2 * Copyright 2005 Arnaud Prost
3 *
4 * Arnaud.prost@gmail.com
5 *
6 * This software is a computer program whose purpose is to ease the
7 * management of software project.
8 *
9 * This software is governed by the CeCILL license under French law and
10 * abiding by the rules of distribution of free software. You can use,
11 * modify and/ or redistribute the software under the terms of the CeCILL
12 * license as circulated by CEA, CNRS and INRIA at the following URL
13 * "http://www.cecill.info".
14 *
15 * As a counterpart to the access to the source code and rights to copy,
16 * modify and redistribute granted by the license, users are provided only
17 * with a limited warranty and the software's author, the holder of the
18 * economic rights, and the successive licensors have only limited
19 * liability.
20 *
21 * In this respect, the user's attention is drawn to the risks associated
22 * with loading, using, modifying and/or developing or reproducing the
23 * software by the user in light of its specific status of free software,
24 * that may mean that it is complicated to manipulate, and that also
25 * therefore means that it is reserved for developers and experienced
26 * professionals having in-depth computer knowledge. Users are therefore
27 * encouraged to load and test the software's suitability as regards their
28 * requirements in conditions enabling the security of their systems and/or
29 * data to be ensured and, more generally, to use and operate it in the
30 * same conditions as regards security.
31 *
32 * The fact that you are presently reading this means that you have had
33 * knowledge of the CeCILL license and that you accept its terms.
34 */
35
36 package net.sf.pmr.core.service;
37
38 import java.util.List;
39
40 import net.sf.pmr.core.domain.user.User;
41 import net.sf.pmr.keopsframework.domain.validation.Errors;
42
43 /***
44 * @author Arnaud Prost (arnaud.prost@gmail.com)
45 */
46 public interface UserService {
47
48 /***
49 * add or update a user
50 * @param id (0 is user is new)
51 * @param firstName firstName
52 * @param lastName lastName
53 * @param login login
54 * @param password password
55 * @param email email
56 * @param persistanceVersion persistanceVersion (0 is user is new)
57 * @return Errors
58 */
59 Errors addOrUpdate(final int id, final String firstName, final String lastName, final String login, final String password, final String email, long persistanceVersion);
60
61 /***
62 * delete a user
63 * @param id
64 * @return Errors
65 */
66 Errors delete(final Integer id);
67
68
69 /***
70 * Find a User by his id
71 * @param id
72 * @return User
73 */
74 User findById(final int id);
75
76 /***
77 * Find a User by his login
78 * @param login
79 * @return
80 */
81 User findByLogin(final String login);
82
83 /***
84 * find all users
85 * @return list of users
86 */
87 List findAll();
88
89 /***
90 * count all users
91 * @return number of users
92 */
93 Integer countAll();
94
95
96 }