| |
|
| java.lang.Object org.nemesis.forum.ForumFactory
All known Subclasses: org.nemesis.forum.impl.DbForumFactory, org.nemesis.forum.proxy.ForumFactoryProxy,
ForumFactory | abstract public class ForumFactory (Code) | | A ForumFactory provides access to and management of Forums. It is the point
of entry for the entire system.
A concrete instance of ForumFactory can be obtained by calling the getInstance()
method with an Authorization token. The Authorization token determines with
what permissions the rest of the objects in the system will be accessed with.
Usually the first steps of any program interacting with the system are:
- Obtain an authorization token by calling
AuthorizationFactory.getInstance().getAuthorization(username, password);
- Use that authorization to get a ForumFactory instance.
- Use the forum factory to access forums and other content.
It is also possible to access content with anonymous permissions. See
the AuthorizationFactory class for more information.
ForumFactory is an abstract class so that the actual implementation is
pluggable. For example, the default implementation uses a database
backend. You can optionally plug in your own backend that might use the
filesystem, for example. When first creating the forum factory, will
look for the property "ForumFactory.className". If it fails to find
that property, it will use the default class.
See Also: AuthorizationFactory |
Field Summary | |
protected static Log | log |
Method Summary | |
abstract public Forum | createForum(String name, String description) Creates a new forum. | abstract public void | deleteForum(Forum forum) Deletes a forum and all of its content. | abstract public Iterator | forums() Returns an Iterator of Forum objects for all the forums in the system
that the user has READ access for. | abstract public Iterator | forumsModeration() Returns an Iterator of Forum objects for all the forums in the system
that the user has Moderation, Forum Admin or System Admin access to. | abstract public Forum | getForum(int forumID) Returns the forum with the specified forumID.
Parameters: forumID - the id of the forum to return. | abstract public Forum | getForum(String name) Returns the Forum with the specified name.
Parameters: name - the name of the forum to return. | abstract public int | getForumCount() Returns the total number of forums. | public static ForumFactory | getInstance(Authorization authorization) Returns a concrete ForumFactory instance. | abstract public ForumPermissions | getPermissions(Authorization authorization) Returns the permissions for the factory that correspond to the
passed-in Authorization.
Parameters: authorization - the auth token for the user. | abstract public ProfileManager | getProfileManager() Returns a ProfileManager that can be used to manage Users and Groups. | abstract public int[] | groupsWithPermission(int permissionType) Returns all the groupID's of groups with a particular system permission. | abstract public boolean | hasPermission(int type) Returns true if the handle on the object has the permission specified.
A list of possible permissions can be found in the ForumPermissions
class. | abstract public int[] | usersWithPermission(int permissionType) Returns all the userID's of users with a particular system permission. |
log | protected static Log log(Code) | | |
createForum | abstract public Forum createForum(String name, String description) throws UnauthorizedException, ForumAlreadyExistsException(Code) | | Creates a new forum. This method should always be used instead of
trying to instantiate a forum directly.
Parameters: name - the name of the forum. Parameters: description - the description of the forum. throws: UnauthorizedException - if not allowed to create a Forum. throws: ForumAlreadExistsException - if the forum name already exists. |
deleteForum | abstract public void deleteForum(Forum forum) throws UnauthorizedException(Code) | | Deletes a forum and all of its content. This method is not always
guaranteed to be safe to call. For example, if multiple clients have
handles on a forum, and that forum is subsequently deleted, the behavior
of the forum objects that the clients have handles on is unspecified and
may result in errors.
Parameters: forum - the forum to delete. throws: UnauthorizedException - if not allowed to delete a forum. |
forums | abstract public Iterator forums()(Code) | | Returns an Iterator of Forum objects for all the forums in the system
that the user has READ access for. Read access can be granted in the
following ways:
- Anonymous read permission is enabled for the forum; anyone can
read it.
- The "all users" read permission is set so that any registered
user can read the forum.
- The user belongs to a group that has been granted read permission.
- The user has been specifically granted read permission.
- The current user is a system admin or admin of this forum. This
allows automatic read permission.
an Iterator of Forum objects for all forums in the system thatthe user has read permission for. |
forumsModeration | abstract public Iterator forumsModeration()(Code) | | Returns an Iterator of Forum objects for all the forums in the system
that the user has Moderation, Forum Admin or System Admin access to.
|
getForumCount | abstract public int getForumCount()(Code) | | Returns the total number of forums. This number might not agree
with the number of forums returned by ForumFactory.forums() since that
method return an Iterator of forums that a user has READ access for.
the total number of forums. |
getInstance | public static ForumFactory getInstance(Authorization authorization)(Code) | | Returns a concrete ForumFactory instance. Permissions corresponding
to the Authorization will be used. If getting the factory fails, null
will be returned.
Parameters: authorization - the auth token for the user. a concrete ForumFactory instance. |
getPermissions | abstract public ForumPermissions getPermissions(Authorization authorization)(Code) | | Returns the permissions for the factory that correspond to the
passed-in Authorization.
Parameters: authorization - the auth token for the user. the permissions for this object. |
getProfileManager | abstract public ProfileManager getProfileManager()(Code) | | Returns a ProfileManager that can be used to manage Users and Groups.
|
groupsWithPermission | abstract public int[] groupsWithPermission(int permissionType) throws UnauthorizedException(Code) | | Returns all the groupID's of groups with a particular system permission.
System permissions apply to all forums.
throws: UnauthorizedException - if does not have ADMIN permissions. |
hasPermission | abstract public boolean hasPermission(int type)(Code) | | Returns true if the handle on the object has the permission specified.
A list of possible permissions can be found in the ForumPermissions
class. Certain methods of this class are restricted to certain
permissions as specified in the method comments.
Parameters: type - the type of permission to check for. See Also: ForumPermissions |
usersWithPermission | abstract public int[] usersWithPermission(int permissionType) throws UnauthorizedException(Code) | | Returns all the userID's of users with a particular system permission.
System permissions apply to all forums.
throws: UnauthorizedException - if does not have ADMIN permissions. |
|
|
|