001: /**
002: * Copyright (C) 2001 Yasna.com. All rights reserved.
003: *
004: * ===================================================================
005: * The Apache Software License, Version 1.1
006: *
007: * Redistribution and use in source and binary forms, with or without
008: * modification, are permitted provided that the following conditions
009: * are met:
010: *
011: * 1. Redistributions of source code must retain the above copyright
012: * notice, this list of conditions and the following disclaimer.
013: *
014: * 2. Redistributions in binary form must reproduce the above copyright
015: * notice, this list of conditions and the following disclaimer in
016: * the documentation and/or other materials provided with the
017: * distribution.
018: *
019: * 3. The end-user documentation included with the redistribution,
020: * if any, must include the following acknowledgment:
021: * "This product includes software developed by
022: * Yasna.com (http://www.yasna.com)."
023: * Alternately, this acknowledgment may appear in the software itself,
024: * if and wherever such third-party acknowledgments normally appear.
025: *
026: * 4. The names "Yazd" and "Yasna.com" must not be used to
027: * endorse or promote products derived from this software without
028: * prior written permission. For written permission, please
029: * contact yazd@yasna.com.
030: *
031: * 5. Products derived from this software may not be called "Yazd",
032: * nor may "Yazd" appear in their name, without prior written
033: * permission of Yasna.com.
034: *
035: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
036: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
037: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
038: * DISCLAIMED. IN NO EVENT SHALL YASNA.COM OR
039: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
040: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
041: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
042: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
043: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
044: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
045: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
046: * SUCH DAMAGE.
047: * ====================================================================
048: *
049: * This software consists of voluntary contributions made by many
050: * individuals on behalf of Yasna.com. For more information
051: * on Yasna.com, please see <http://www.yasna.com>.
052: */
053:
054: /**
055: * Copyright (C) 2000 CoolServlets.com. All rights reserved.
056: *
057: * ===================================================================
058: * The Apache Software License, Version 1.1
059: *
060: * Redistribution and use in source and binary forms, with or without
061: * modification, are permitted provided that the following conditions
062: * are met:
063: *
064: * 1. Redistributions of source code must retain the above copyright
065: * notice, this list of conditions and the following disclaimer.
066: *
067: * 2. Redistributions in binary form must reproduce the above copyright
068: * notice, this list of conditions and the following disclaimer in
069: * the documentation and/or other materials provided with the
070: * distribution.
071: *
072: * 3. The end-user documentation included with the redistribution,
073: * if any, must include the following acknowledgment:
074: * "This product includes software developed by
075: * CoolServlets.com (http://www.coolservlets.com)."
076: * Alternately, this acknowledgment may appear in the software itself,
077: * if and wherever such third-party acknowledgments normally appear.
078: *
079: * 4. The names "Jive" and "CoolServlets.com" must not be used to
080: * endorse or promote products derived from this software without
081: * prior written permission. For written permission, please
082: * contact webmaster@coolservlets.com.
083: *
084: * 5. Products derived from this software may not be called "Jive",
085: * nor may "Jive" appear in their name, without prior written
086: * permission of CoolServlets.com.
087: *
088: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
089: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
090: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
091: * DISCLAIMED. IN NO EVENT SHALL COOLSERVLETS.COM OR
092: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
093: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
094: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
095: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
096: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
097: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
098: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
099: * 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: */package com.Yasna.forum;
106:
107: import java.util.*;
108:
109: /**
110: * Manages Users and Groups.
111: */
112: public interface ProfileManager {
113:
114: /**
115: * Factory method for creating a new User. A password, email address, and
116: * unique username are all required fields to create a new User.
117: *
118: * @param username the new and unique username for the account.
119: * @param password the password for the account as plain text.
120: * @param email the email address for the account.
121: * @return a new User.
122: * @throws UserAlreadyExistsException if the username already exists in
123: * the system.
124: */
125: public User createUser(String username, String password,
126: String email) throws UserAlreadyExistsException;
127:
128: /**
129: * This method activates the user with a given userid and code which was sent to the user.
130: * @param UserID
131: * @param Code
132: * @return
133: */
134: public boolean activateUser(int UserID, String Code);
135:
136: /**
137: * Factory method for creating a new Group. A unique name is the only
138: * required field.
139: *
140: * @param name the new and unique name for the group.
141: * @return a new Group.
142: * @throws GroupAlreadyExistsException if the group name already exists in
143: * the system.
144: */
145: public Group createGroup(String name) throws UnauthorizedException,
146: GroupAlreadyExistsException;
147:
148: /**
149: * Returns a User specified by their id.
150: *
151: * @param userid the id of the User to lookup.
152: * @return the User specified by the given id.
153: * @throws UserNotFoundException if the user does not exist.
154: */
155: public User getUser(int userID) throws UserNotFoundException;
156:
157: /**
158: * Returns a User specified by username.
159: *
160: * throws UserNotFoundException if the user does not exist.
161: */
162: public User getUser(String username) throws UserNotFoundException;
163:
164: /**
165: * Returns the special "anonymous user" object.
166: */
167: public User getAnonymousUser();
168:
169: /**
170: * Returns the "special user" object. The special user represents any
171: * valid user in the system. Getting a handle on this object is only
172: * really useful for setting permissions on forums. For example, if you
173: * want to allow any registered user to post messgages in a forum, add
174: * a user permission for posting messages with the special user as the
175: * User parameter.
176: */
177: public User getSpecialUser();
178:
179: /**
180: * Gets a Group by ID.
181: *
182: * throws GroupNotFoundException if the group does not exist.
183: */
184: public Group getGroup(int groupID) throws GroupNotFoundException;
185:
186: /**
187: * Gets a Group by name.
188: *
189: * throws GroupNotFoundException if the group does not exist.
190: */
191: public Group getGroup(String name) throws GroupNotFoundException;
192:
193: /**
194: * Deletes a User.
195: *
196: * @param user the user to delete.
197: * @throws UnauthorizedException
198: */
199: public void deleteUser(User user) throws UnauthorizedException;
200:
201: /**
202: * Deletes a Group.
203: *
204: * @param group the group to delete.
205: * @throws UnauthorizedException
206: */
207: public void deleteGroup(Group group) throws UnauthorizedException;
208:
209: /**
210: * Returns the numer of users in the system.
211: */
212: public int getUserCount();
213:
214: /**
215: * Returns the number of groups in the system.
216: */
217: public int getGroupCount();
218:
219: /**
220: * Retruns an iterator for all users.
221: */
222: public Iterator users();
223:
224: /**
225: * Returns an iterator for all users starting at startIndex with the
226: * given number of results. This is useful to support pagination in a GUI
227: * where you may only want to display a certain number of results per page.
228: * It is possible that the number of results returned will be less than
229: * that specified by numResults if numResults is greater than the number
230: * of records left in the system to display.
231: *
232: * @param startIndex the beginning index to start the results at.
233: * @param numResults the total number of results to return.
234: * @return an Iterator for all users in the specified range.
235: */
236: public Iterator users(int startIndex, int numResults);
237:
238: /**
239: * Returns an iterator for all groups in the system.
240: *
241: * @return an Iterator for all groups.
242: */
243: public Iterator groups();
244:
245: /**
246: * Returns an iterator for all groups starting at startIndex with the
247: * given number of results. This is useful to support pagination in a GUI
248: * where you may only want to display a certain number of results per page.
249: * It is possible that the number of results returned will be less than
250: * that specified by numResults if numResults is greater than the number
251: * of records left in the system to display.
252: *
253: * @param startIndex the beginning index to start the results at.
254: * @param numResults the total number of results to return.
255: * @return an Iterator for all groups in the specified range.
256: */
257: public Iterator groups(int startIndex, int numResults);
258:
259: /**
260: * Returns the number of messages a user has posted in a particular forum.
261: *
262: * @param user the user you want results for.
263: * @param forum the forum you want to check results in.
264: * @return the number of messages the user posted in the forum.
265: */
266: public int userMessageCount(User user, Forum forum);
267:
268: /**
269: * Returns an iterator for all the messages that a user posted in a
270: * particular forum.
271: */
272: public Iterator userMessages(User user, Forum forum, int start,
273: int numResults);
274: }
|