A ForumFactory provides access to and management of Forums. It is the point
of entry for the entire Yazd 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 Yazd 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 Yazd content.
It is also possible to access Yazd 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 Yazd 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, Yazd will
look for the Yazd property "ForumFactory.className". If it fails to find
that property, it will use the default class.
See Also:AuthorizationFactory
Method Summary
abstractpublic void
BlackListIP(ClientIP cip, boolean add) This method adds the IP address to the black list.
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.
forumsWithArticlesForums() This method returns the iterator with all the forums including the forums that
are used for discussions around an article or a webpage.
getPermissions(Authorization authorization) Returns the permissions for the factory that correspond to the
passed-in Authorization.
Parameters: authorization - the auth token for the user.
getSearchIndexer() Returns the search indexer which can be used to manage the index used
by Yazd to perform searches.
throws: UnauthorizedException - if not a system administator.
groupsWithPermission(int permissionType) Returns all the groupID's of groups with a particular system permission.
abstractpublic 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.
abstractpublic boolean
isBlackListed(ClientIP cip) This method checks to see if this ip address has been black listed.
abstractpublic int[]
usersWithPermission(int permissionType) Returns all the userID's of users with a particular system permission.
Creates a new Category.
Parameters: name - the name of the category. Parameters: description - the description of the category. throws: UnauthorizedException - if not allowed to create a Category. throws: CategoryAlreadExistsException - if the category name already exists.
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. Parameters: moderated - when true - posted messages and threads must first be approved Parameters: forumGroupID - every forum belongs to a Category and ForumGroup throws: UnauthorizedException - if not allowed to create a Forum. throws: ForumAlreadExistsException - if the forum name already exists.
Deletes a category and all of its content. This method is not always
guaranteed to be safe to call.
Parameters: category - the category to delete. throws: UnauthorizedException - if not allowed to delete a category.
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.
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.
This method returns the iterator with all the forums including the forums that
are used for discussions around an article or a webpage.
an iterator with the forum objects
Returns the category with the specified categoryID.
Parameters: categoryID - the id of the category to return. the Category specified by categoryID. throws: UnauthorizedException - if not allowed to read the category. throws: CategoryNotFoundException - if the requested category does not exist.
Returns the Category with the specified name.
Parameters: name - the name of the category to return. the category with the specified name. throws: CategoryNotFoundException - if the requested category does not exist. throws: UnauthorizedException - if not allowed to read the forum.
Returns the forum with the specified forumID.
Parameters: forumID - the id of the forum to return. the Forum specified by forumID. throws: UnauthorizedException - if not allowed to read the forum. throws: ForumNotFoundException - if the requested forum does not exist.
Returns the Forum with the specified name.
Parameters: name - the name of the forum to return. the forum with the specified name. throws: ForumNotFoundException - if the requested forum does not exist. throws: UnauthorizedException - if not allowed to read the forum.
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.
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.
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.
Returns the search indexer which can be used to manage the index used
by Yazd to perform searches.
throws: UnauthorizedException - if not a system administator. a search indexer.
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.
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
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.