Package org.nemesis.forum

Examples of org.nemesis.forum.Group


    cacheManager.remove(DbCacheManager.USER_ID_CACHE, user.getUsername());
    cacheManager.remove(DbCacheManager.USER_CACHE, new Integer(userID));
  }

  public Group createGroup(String name) throws UnauthorizedException, GroupAlreadyExistsException {
    Group newGroup = null;
    try {
      Group existingGroup = getGroup(name);

      //The group already exists since now exception, so:
      throw new GroupAlreadyExistsException();
    } catch (GroupNotFoundException unfe) {
      //The group doesn't already exist so we can create a new group
View Full Code Here


  public Group getGroup(String name) throws GroupNotFoundException {
    DbCacheManager cacheManager = factory.getCacheManager();
    //If cache is not enabled, do a new lookup of object
    if (!cacheManager.isCacheEnabled()) {
      Group group = new DbGroup(name, null, factory);
      return getGroup(group.getID());
    }
    //Cache is enabled.
    CacheableInteger groupIDInteger = (CacheableInteger) cacheManager.get(DbCacheManager.GROUP_ID_CACHE, name);
    //if id wan't found in cache, load it up and put it there.
    if (groupIDInteger == null) {
      Group group = new DbGroup(name, null, factory);
      groupIDInteger = new CacheableInteger(new Integer(group.getID()));
      cacheManager.add(DbCacheManager.GROUP_ID_CACHE, name, groupIDInteger);
    }
    return getGroup(groupIDInteger.getInteger().intValue());
  }
View Full Code Here

  public GroupIteratorProxy(Iterator iterator, Authorization authorization, ForumPermissions permissions) {
    super(iterator, authorization, permissions);
  }

  public Object next() throws NoSuchElementException {
    Group group = (Group) iterator.next();
    ForumPermissions groupPermissions = group.getPermissions(authorization);
    ForumPermissions newPermissions = new ForumPermissions(permissions, groupPermissions);
    return new GroupProxy(group, authorization, newPermissions);
  }
View Full Code Here

  /**
   * Returns the next Group.
   */
  public Object next() throws NoSuchElementException {
    Group group = null;
    currentIndex++;
    if (currentIndex >= groups.length) {
      throw new java.util.NoSuchElementException();
    }
    try {
View Full Code Here

  /**
   * Returns the previous group.
   */
  public Object previous() throws java.util.NoSuchElementException {
    Group group = null;
    currentIndex--;
    if (currentIndex < 0) {
      currentIndex++;
      throw new java.util.NoSuchElementException();
    }
View Full Code Here

  }

  public Group createGroup(String name)
    throws UnauthorizedException, GroupAlreadyExistsException {
    if (permissions.get(Constants.SYSTEM_ADMIN)) {
      Group group = profileManager.createGroup(name);
      return new GroupProxy(group, authorization, permissions);
    } else {
      throw new UnauthorizedException();
    }
  }
View Full Code Here

  public User getSpecialUser() {
    return profileManager.getSpecialUser();
  }

  public Group getGroup(int groupID) throws GroupNotFoundException {
    Group group = profileManager.getGroup(groupID);
    ForumPermissions groupPermissions = group.getPermissions(authorization);
    ForumPermissions newPermissions =
      new ForumPermissions(permissions, groupPermissions);
    return new GroupProxy(group, authorization, newPermissions);
  }
View Full Code Here

      new ForumPermissions(permissions, groupPermissions);
    return new GroupProxy(group, authorization, newPermissions);
  }

  public Group getGroup(String name) throws GroupNotFoundException {
    Group group = profileManager.getGroup(name);
    ForumPermissions groupPermissions = group.getPermissions(authorization);
    ForumPermissions newPermissions =
      new ForumPermissions(permissions, groupPermissions);
    return new GroupProxy(group, authorization, newPermissions);
  }
View Full Code Here

       
        ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request));
        ProfileManager manager = forumFactory.getProfileManager();
        User user = manager.getUser(getAuthToken(request).getUserID());
         
        Group group = manager.getGroup(request.getParameter("group"));
        request.setAttribute("id",group.getID()+"";
        User  u = manager.getUser(request.getParameter("username"));
        // add user as an administrator of the group
        group.removeAdministrator(u);
         
       
    } catch (NotFoundException e) {
      errors.add("general"new ActionError("groupUser.error.notFound"));           
       
View Full Code Here

       
        ForumFactory forumFactory = ForumFactory.getInstance(getAuthToken(request));
        ProfileManager manager = forumFactory.getProfileManager();
        User user = manager.getUser(getAuthToken(request).getUserID());
         
        Group group = manager.getGroup((String)PropertyUtils.getSimpleProperty(form, "group"));
        request.setAttribute("id",group.getID()+"";
        User  u = manager.getUser((String)PropertyUtils.getSimpleProperty(form, "username"));
        //check permission
        checkPermission(request,OperationConstants.ADD_GROUP_MEMBER,group);
        // add user as an administrator of the group
        group.addMember(u);
       
       
    } catch (NotFoundException e) {
      errors.add("general"new ActionError("groupUser.error.notFound"));           
       
View Full Code Here

TOP

Related Classes of org.nemesis.forum.Group

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.