KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > Yasna > forum > ProfileManager


1 /**
2  * Copyright (C) 2001 Yasna.com. All rights reserved.
3  *
4  * ===================================================================
5  * The Apache Software License, Version 1.1
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in
16  * the documentation and/or other materials provided with the
17  * distribution.
18  *
19  * 3. The end-user documentation included with the redistribution,
20  * if any, must include the following acknowledgment:
21  * "This product includes software developed by
22  * Yasna.com (http://www.yasna.com)."
23  * Alternately, this acknowledgment may appear in the software itself,
24  * if and wherever such third-party acknowledgments normally appear.
25  *
26  * 4. The names "Yazd" and "Yasna.com" must not be used to
27  * endorse or promote products derived from this software without
28  * prior written permission. For written permission, please
29  * contact yazd@yasna.com.
30  *
31  * 5. Products derived from this software may not be called "Yazd",
32  * nor may "Yazd" appear in their name, without prior written
33  * permission of Yasna.com.
34  *
35  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38  * DISCLAIMED. IN NO EVENT SHALL YASNA.COM OR
39  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46  * SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of Yasna.com. For more information
51  * on Yasna.com, please see <http://www.yasna.com>.
52  */

53
54 /**
55  * Copyright (C) 2000 CoolServlets.com. All rights reserved.
56  *
57  * ===================================================================
58  * The Apache Software License, Version 1.1
59  *
60  * Redistribution and use in source and binary forms, with or without
61  * modification, are permitted provided that the following conditions
62  * are met:
63  *
64  * 1. Redistributions of source code must retain the above copyright
65  * notice, this list of conditions and the following disclaimer.
66  *
67  * 2. Redistributions in binary form must reproduce the above copyright
68  * notice, this list of conditions and the following disclaimer in
69  * the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3. The end-user documentation included with the redistribution,
73  * if any, must include the following acknowledgment:
74  * "This product includes software developed by
75  * CoolServlets.com (http://www.coolservlets.com)."
76  * Alternately, this acknowledgment may appear in the software itself,
77  * if and wherever such third-party acknowledgments normally appear.
78  *
79  * 4. The names "Jive" and "CoolServlets.com" must not be used to
80  * endorse or promote products derived from this software without
81  * prior written permission. For written permission, please
82  * contact webmaster@coolservlets.com.
83  *
84  * 5. Products derived from this software may not be called "Jive",
85  * nor may "Jive" appear in their name, without prior written
86  * permission of CoolServlets.com.
87  *
88  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
89  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
90  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
91  * DISCLAIMED. IN NO EVENT SHALL COOLSERVLETS.COM OR
92  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
93  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
94  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
95  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
96  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
97  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
98  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
99  * SUCH DAMAGE.
100  * ====================================================================
101  *
102  * This software consists of voluntary contributions made by many
103  * individuals on behalf of CoolServlets.com. For more information
104  * on CoolServlets.com, please see <http://www.coolservlets.com>.
105  */

106
107 package com.Yasna.forum;
108
109 import java.util.*;
110
111 /**
112  * Manages Users and Groups.
113  */

114 public interface ProfileManager {
115
116     /**
117      * Factory method for creating a new User. A password, email address, and
118      * unique username are all required fields to create a new User.
119      *
120      * @param username the new and unique username for the account.
121      * @param password the password for the account as plain text.
122      * @param email the email address for the account.
123      * @return a new User.
124      * @throws UserAlreadyExistsException if the username already exists in
125      * the system.
126      */

127     public User createUser(String JavaDoc username, String JavaDoc password, String JavaDoc email)
128             throws UserAlreadyExistsException;
129
130     /**
131      * This method activates the user with a given userid and code which was sent to the user.
132      * @param UserID
133      * @param Code
134      * @return
135      */

136     public boolean activateUser(int UserID, String JavaDoc Code);
137
138     /**
139      * Factory method for creating a new Group. A unique name is the only
140      * required field.
141      *
142      * @param name the new and unique name for the group.
143      * @return a new Group.
144      * @throws GroupAlreadyExistsException if the group name already exists in
145      * the system.
146      */

147     public Group createGroup(String JavaDoc name) throws UnauthorizedException,
148             GroupAlreadyExistsException;
149
150     /**
151      * Returns a User specified by their id.
152      *
153      * @param userid the id of the User to lookup.
154      * @return the User specified by the given id.
155      * @throws UserNotFoundException if the user does not exist.
156      */

157     public User getUser(int userID) throws UserNotFoundException;
158
159     /**
160      * Returns a User specified by username.
161      *
162      * throws UserNotFoundException if the user does not exist.
163      */

164     public User getUser(String JavaDoc username) throws UserNotFoundException;
165
166     /**
167      * Returns the special "anonymous user" object.
168      */

169     public User getAnonymousUser();
170
171     /**
172      * Returns the "special user" object. The special user represents any
173      * valid user in the system. Getting a handle on this object is only
174      * really useful for setting permissions on forums. For example, if you
175      * want to allow any registered user to post messgages in a forum, add
176      * a user permission for posting messages with the special user as the
177      * User parameter.
178      */

179     public User getSpecialUser();
180
181     /**
182      * Gets a Group by ID.
183      *
184      * throws GroupNotFoundException if the group does not exist.
185      */

186     public Group getGroup(int groupID) throws GroupNotFoundException;
187
188     /**
189      * Gets a Group by name.
190      *
191      * throws GroupNotFoundException if the group does not exist.
192      */

193     public Group getGroup(String JavaDoc name) throws GroupNotFoundException;
194
195     /**
196      * Deletes a User.
197      *
198      * @param user the user to delete.
199      * @throws UnauthorizedException
200      */

201     public void deleteUser(User user) throws UnauthorizedException;
202
203     /**
204      * Deletes a Group.
205      *
206      * @param group the group to delete.
207      * @throws UnauthorizedException
208      */

209     public void deleteGroup(Group group) throws UnauthorizedException;
210
211     /**
212      * Returns the numer of users in the system.
213      */

214     public int getUserCount();
215
216     /**
217      * Returns the number of groups in the system.
218      */

219     public int getGroupCount();
220
221     /**
222      * Retruns an iterator for all users.
223      */

224     public Iterator users();
225
226     /**
227      * Returns an iterator for all users starting at startIndex with the
228      * given number of results. This is useful to support pagination in a GUI
229      * where you may only want to display a certain number of results per page.
230      * It is possible that the number of results returned will be less than
231      * that specified by numResults if numResults is greater than the number
232      * of records left in the system to display.
233      *
234      * @param startIndex the beginning index to start the results at.
235      * @param numResults the total number of results to return.
236      * @return an Iterator for all users in the specified range.
237      */

238     public Iterator users(int startIndex, int numResults);
239
240     /**
241      * Returns an iterator for all groups in the system.
242      *
243      * @return an Iterator for all groups.
244      */

245     public Iterator groups();
246
247     /**
248      * Returns an iterator for all groups starting at startIndex with the
249      * given number of results. This is useful to support pagination in a GUI
250      * where you may only want to display a certain number of results per page.
251      * It is possible that the number of results returned will be less than
252      * that specified by numResults if numResults is greater than the number
253      * of records left in the system to display.
254      *
255      * @param startIndex the beginning index to start the results at.
256      * @param numResults the total number of results to return.
257      * @return an Iterator for all groups in the specified range.
258      */

259     public Iterator groups(int startIndex, int numResults);
260
261     /**
262      * Returns the number of messages a user has posted in a particular forum.
263      *
264      * @param user the user you want results for.
265      * @param forum the forum you want to check results in.
266      * @return the number of messages the user posted in the forum.
267      */

268     public int userMessageCount(User user, Forum forum);
269
270     /**
271      * Returns an iterator for all the messages that a user posted in a
272      * particular forum.
273      */

274     public Iterator userMessages(User user, Forum forum,int start,int numResults);
275 }
276
Popular Tags