Package org.nemesis.forum

Examples of org.nemesis.forum.Forum


    //Dummy call to super-class. This specialized iterator proxy doesn't
    //use the superclass like the other iterators do.
    super(iterator, authorization, permissions);

    while (iterator.hasNext()) {
      Forum forum = (Forum) iterator.next();
      ForumPermissions forumPermissions =
        forum.getPermissions(authorization);
      //Create a new permissions object with the combination of the
      //permissions of this object and tempPermissions.
      //Check and see if the user has READ permissions. If not, throw an
      //an UnauthorizedException.
     
View Full Code Here


  public static void reindex(Authorization auth) throws UnauthorizedException{
    ForumFactory forumFactory = ForumFactory.getInstance(auth);
    if(! forumFactory.getPermissions(auth).get(Constants.SYSTEM_ADMIN)) throw new UnauthorizedException();
    //ok system admin
    flush(auth);
    Forum f=null;
    ForumThread ft=null;
    for(Iterator it=forumFactory.forums();it.hasNext();){
      f=(Forum)it.next();
      for(Iterator it2=f.threads();it2.hasNext();){
        ft=(ForumThread)it2.next();
        index(ft.getRootMessage());
      }
    }
   
View Full Code Here

  }

  //FROM THE FORUMFACTORY INTERFACE//

  public Forum createForum(String name, String description) throws UnauthorizedException, ForumAlreadyExistsException {
    Forum newForum = null;
    try {
      Forum existingForum = getForum(name);

      //The forum already exists since now exception, so:
      throw new ForumAlreadyExistsException();
    } catch (ForumNotFoundException fnfe) {
      //The forum doesn't already exist so we can create a new one
View Full Code Here

  }

  public Forum getForum(String name) throws ForumNotFoundException, UnauthorizedException {
    //If cache is not enabled, do a new lookup of object
    if (!cacheManager.isCacheEnabled()) {
      Forum forum = new DbForum(name, this);
      return forum;
    }
    //Cache is enabled.
    CacheableInteger forumIDInteger = (CacheableInteger) cacheManager.get(DbCacheManager.FORUM_ID_CACHE, name);
    //if id wan't found in cache, load it up and put it there.
    if (forumIDInteger == null) {
      Forum forum = new DbForum(name, this);
      forumIDInteger = new CacheableInteger(new Integer(forum.getID()));
      cacheManager.add(DbCacheManager.FORUM_ID_CACHE, name, forumIDInteger);
    }
    return getForum(forumIDInteger.getInteger().intValue());
  }
View Full Code Here

    boolean isUser = !isAnonymous;

    ForumPermissions finalPermissions = ForumPermissions.none();
    // check each forum for a specific permission
    Iterator allForums = this.forums();
    Forum forum;
    ForumPermissions forumUserPermissions;
    while (allForums.hasNext()) {
      forum = (Forum) allForums.next();
      forumUserPermissions = getUserPermissions(userID, forum.getID());
      finalPermissions = new ForumPermissions(finalPermissions, forumUserPermissions);
    }

    //Step 1 - Get permissions for the User. This includes anonymous
    //perms, "special user" perms, and the specific perms for the user.
View Full Code Here

   */
  public void cleanDatabase() {
    //Iterate through all forums, threads to delete unwanted messages.
    Iterator forums = forums();
    while (forums.hasNext()) {
      Forum forum = (Forum) forums.next();
      Iterator threads = forum.threads();
      while (threads.hasNext()) {
        try {
          ForumThread thread = (ForumThread) threads.next();
          Iterator messages = thread.messages();
          while (messages.hasNext()) {
View Full Code Here

  /**
   * Returns the next Forum the user has READ access for.
   */
  public Object next() throws NoSuchElementException {
    Forum forum = null;
    currentIndex++;
    if (currentIndex >= forums.length) {
      throw new java.util.NoSuchElementException();
    }
    try {
View Full Code Here

  public int nextIndex() {
    return currentIndex + 1;
  }

  public Object previous() throws NoSuchElementException {
    Forum forum = null;
    currentIndex--;
    if (currentIndex < 0) {
      currentIndex++;
      throw new NoSuchElementException();
    }
View Full Code Here

    try {
        try {
         
          ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request));
          ProfileManager manager = forumFactory.getProfileManager();
          Forum f = forumFactory.getForum(Integer.parseInt(request.getParameter("id")));
          forumFactory.deleteForum(f);
         
          errors.add("general"new ActionError("delForum.confirm"));
         
        }
View Full Code Here

   
    ActionErrors errors = new ActionErrors();
   
    try {
        ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request));
        Forum forum = forumFactory.getForum(Integer.parseInt(request.getParameter("id")));
        //check permission
        checkPermission(request,OperationConstants.LIST_FORUM_CONTENT,forum);
       
        ForumThread t=forum.getThread(Integer.parseInt(request.getParameter("threadID")));
        t.setApproved(!t.isApproved());
        t.getRootMessage().setApproved(t.isApproved());
       
       
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.nemesis.forum.Forum

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.