KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nemesis > forum > ProfileManager


1 /*
2  * NEMESIS-FORUM.
3  * Copyright (C) 2002 David Laurent(lithium2@free.fr). All rights reserved.
4  *
5  * Copyright (c) 2000 The Apache Software Foundation. All rights reserved.
6  *
7  * Copyright (C) 2001 Yasna.com. All rights reserved.
8  *
9  * Copyright (C) 2000 CoolServlets.com. All rights reserved.
10  *
11  * NEMESIS-FORUM. is free software; you can redistribute it and/or
12  * modify it under the terms of the Apache Software License, Version 1.1,
13  * or (at your option) any later version.
14  *
15  * NEMESIS-FORUM core framework, NEMESIS-FORUM backoffice, NEMESIS-FORUM frontoffice
16  * application are parts of NEMESIS-FORUM and are distributed under
17  * same terms of licence.
18  *
19  *
20  * NEMESIS-FORUM includes software developed by the Apache Software Foundation (http://www.apache.org/)
21  * and software developed by CoolServlets.com (http://www.coolservlets.com).
22  * and software developed by Yasna.com (http://www.yasna.com).
23  *
24  */

25
26 package org.nemesis.forum;
27
28 import java.util.Iterator JavaDoc;
29
30 import org.nemesis.forum.exception.GroupAlreadyExistsException;
31 import org.nemesis.forum.exception.GroupNotFoundException;
32 import org.nemesis.forum.exception.UnauthorizedException;
33 import org.nemesis.forum.exception.UserAlreadyExistsException;
34 import org.nemesis.forum.exception.UserNotFoundException;
35
36 /**
37  * Manages Users and Groups.
38  */

39 public interface ProfileManager {
40
41     /**
42      * Factory method for creating a new User. A password, email address, and
43      * unique username are all required fields to create a new User.
44      *
45      * @param username the new and unique username for the account.
46      * @param password the password for the account as plain text.
47      * @param email the email address for the account.
48      * @return a new User.
49      * @throws UserAlreadyExistsException if the username already exists in
50      * the system.
51      */

52     public User createUser(String JavaDoc username, String JavaDoc password, String JavaDoc email)
53             throws UserAlreadyExistsException;
54
55     /**
56      * Factory method for creating a new Group. A unique name is the only
57      * required field.
58      *
59      * @param name the new and unique name for the group.
60      * @return a new Group.
61      * @throws GroupAlreadyExistsException if the group name already exists in
62      * the system.
63      */

64     public Group createGroup(String JavaDoc name) throws UnauthorizedException,
65     GroupAlreadyExistsException;
66
67     /**
68      * Returns a User specified by their id.
69      *
70      * @param userid the id of the User to lookup.
71      * @return the User specified by the given id.
72      * @throws UserNotFoundException if the user does not exist.
73      */

74     public User getUser(int userID) throws UserNotFoundException;
75
76     /**
77      * Returns a User specified by username.
78      *
79      * throws UserNotFoundException if the user does not exist.
80      */

81     public User getUser(String JavaDoc username) throws UserNotFoundException;
82
83     /**
84      * Returns the special "anonymous user" object.
85      */

86     public User getAnonymousUser();
87
88     /**
89      * Returns the "special user" object. The special user represents any
90      * valid user in the system. Getting a handle on this object is only
91      * really useful for setting permissions on forums. For example, if you
92      * want to allow any registered user to post messgages in a forum, add
93      * a user permission for posting messages with the special user as the
94      * User parameter.
95      */

96     public User getSpecialUser();
97
98     /**
99      * Gets a Group by ID.
100      *
101      * throws GroupNotFoundException if the group does not exist.
102      */

103     public Group getGroup(int groupID) throws GroupNotFoundException;
104
105     /**
106      * Gets a Group by name.
107      *
108      * throws GroupNotFoundException if the group does not exist.
109      */

110     public Group getGroup(String JavaDoc name) throws GroupNotFoundException;
111
112     /**
113      * Deletes a User.
114      *
115      * @param user the user to delete.
116      * @throws UnauthorizedException
117      */

118     public void deleteUser(User user) throws UnauthorizedException;
119
120     /**
121      * Deletes a Group.
122      *
123      * @param group the group to delete.
124      * @throws UnauthorizedException
125      */

126     public void deleteGroup(Group group) throws UnauthorizedException;
127
128     /**
129      * Returns the numer of users in the system.
130      */

131     public int getUserCount();
132
133     /**
134      * Returns the number of groups in the system.
135      */

136     public int getGroupCount();
137
138     /**
139      * Retruns an iterator for all users.
140      */

141     public Iterator JavaDoc users();
142
143     /**
144      * Returns an iterator for all users starting at startIndex with the
145      * given number of results. This is useful to support pagination in a GUI
146      * where you may only want to display a certain number of results per page.
147      * It is possible that the number of results returned will be less than
148      * that specified by numResults if numResults is greater than the number
149      * of records left in the system to display.
150      *
151      * @param startIndex the beginning index to start the results at.
152      * @param numResults the total number of results to return.
153      * @return an Iterator for all users in the specified range.
154      */

155     public Iterator JavaDoc users(int startIndex, int numResults);
156
157     /**
158      * Returns an iterator for all groups in the system.
159      *
160      * @return an Iterator for all groups.
161      */

162     public Iterator JavaDoc groups();
163
164     /**
165      * Returns an iterator for all groups starting at startIndex with the
166      * given number of results. This is useful to support pagination in a GUI
167      * where you may only want to display a certain number of results per page.
168      * It is possible that the number of results returned will be less than
169      * that specified by numResults if numResults is greater than the number
170      * of records left in the system to display.
171      *
172      * @param startIndex the beginning index to start the results at.
173      * @param numResults the total number of results to return.
174      * @return an Iterator for all groups in the specified range.
175      */

176     public Iterator JavaDoc groups(int startIndex, int numResults);
177
178     /**
179      * Returns the number of messages a user has posted in a particular forum.
180      *
181      * @param user the user you want results for.
182      * @param forum the forum you want to check results in.
183      * @return the number of messages the user posted in the forum.
184      */

185     public int userMessageCount(User user, Forum forum);
186
187     /**
188      * Returns an iterator for all the messages that a user posted in a
189      * particular forum.
190      */

191     public Iterator JavaDoc userMessages(User user, Forum forum);
192 }
193
Popular Tags