1 /* 2 * Copyright 2004 Blandware (http://www.blandware.com) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.blandware.atleap.service.core; 17 18 import com.blandware.atleap.common.util.PartialCollection; 19 import com.blandware.atleap.common.util.QueryInfo; 20 import com.blandware.atleap.model.core.User; 21 import com.blandware.atleap.model.core.UserCookie; 22 import com.blandware.atleap.service.exception.BeanAlreadyExistsException; 23 import com.blandware.atleap.service.exception.BeanNotFoundException; 24 import com.blandware.atleap.persistence.core.UserDAO; 25 26 27 /** 28 * <p>Business Delegate (Proxy) Interface to handle communication between web and 29 * persistence layer. 30 * </p> 31 * <p><a HREF="UserManager.java.htm"><i>View Source</i></a> 32 * </p> 33 * 34 * @author Matt Raible <a HREF="mailto:matt@raibledesigns.com"><matt@raibledesigns.com></a> 35 * @author Sergey Zubtcovskii <a HREF="mailto:sergey.zubtcovskii@blandware.com"><sergey.zubtcovskii@blandware.com></a> 36 * @version $Revision: 1.7 $ $Date: 2005/11/04 08:10:11 $ 37 */ 38 public interface UserManager extends BaseManager { 39 40 // U S E R 41 42 /** 43 * Sets DAO for operating with users 44 * 45 * @param userDAO the DAO to set 46 */ 47 public void setUserDAO(UserDAO userDAO); 48 49 /** 50 * Creates new user 51 * 52 * @param user Value object that represents what user must be created 53 * @throws BeanAlreadyExistsException if user with the same name already exists 54 */ 55 public void createUser(User user) throws BeanAlreadyExistsException; 56 57 /** 58 * Retrieves user with specified name 59 * 60 * @param userName Name to search by 61 * @return User or null if no user with specified ID exists in database 62 */ 63 public User retrieveUser(String userName); 64 65 /** 66 * Updates user 67 * 68 * @param user User to update 69 */ 70 public void updateUser(User user); 71 72 /** 73 * Deletes user with specified name 74 * 75 * @param userName Name of user to delete 76 */ 77 public void deleteUser(String userName) throws BeanNotFoundException; 78 79 // ~ Additional methods ================================================================ 80 81 /** 82 * Retrieves filtered/sorted collection of users. 83 * 84 * @param queryInfo Object that contains information about how to filter and sort data 85 * @return Collection of users 86 */ 87 public PartialCollection listUsers(QueryInfo queryInfo); 88 89 // U S E R C O O K I E 90 91 /** 92 * Validates a user based on a cookie value. If successful, it returns 93 * a new cookie String. If not, then it returns null. 94 * 95 * @param value (in format username|guid) 96 * @return indicator that this is a valid login (null == invalid) 97 * @throws BeanNotFoundException if user with specified name couldn't be found 98 */ 99 public String checkUserCookie(String value) throws BeanNotFoundException; 100 101 /** 102 * Creates a cookie string using a user cookie 103 * 104 * @param userCookie Cookie to be created 105 * @param userName Name of the user for whom the cookie is created 106 * @return String to put in a cookie for remembering user 107 * @throws BeanNotFoundException if user with specified name couldn't be found 108 */ 109 public String createUserCookie(UserCookie userCookie, String userName) throws BeanNotFoundException; 110 111 /** 112 * Deletes all cookies for user. 113 * 114 * @param userName Name of user to delete cookies for 115 */ 116 public void deleteUserCookies(String userName); 117 118 } 119