1 package org.musicontroller.service; 2 3 import java.util.List; 4 5 import org.musicontroller.security.IUser; 6 import org.musicontroller.security.Role; 7 8 /** 9 * Defines operations on Users. 10 * @author Varienaja 11 * 12 */ 13 public interface UserService { 14 15 /** 16 * Returns the User that was persisted under the ID given. 17 * @param id The Id 18 * @return The User with that id, or null if there was no such user. 19 */ 20 public IUser getUserById(long id); 21 22 /** 23 * Persists a new User-object in the database. 24 * @param user The new User 25 * @throws Exception when the User's loginname is not unique. 26 */ 27 public void addUser(IUser user) throws Exception; 28 29 /** 30 * Saves changs to an existing user. 31 * @param user The changed user. 32 */ 33 public void saveUser(IUser user); 34 35 /** 36 * Queries the database for a list of all users. The list returned is sorted 37 * by loginname. 38 * @return A list of users, sorted on loginname. 39 */ 40 public List<IUser> listUsers(); 41 42 /** 43 * Queries the database for a list of all Roles. 44 * @return A list or roles. 45 */ 46 public List<Role> listRoles(); 47 48 49 }