Package org.jamwiki.model

Examples of org.jamwiki.model.WikiGroup


    ofy.put(page);
    return page;
  }

  public static WikiGroup update(WikiGroup role) {
    WikiGroup existingEntity = null;
    try {
      Objectify ofy = OS.begin();
      existingEntity = ofy.get(WikiGroup.class, role.getGroupId());
      existingEntity.setName(role.getName());
      existingEntity.setDescription(role.getDescription());
      ofy.put(existingEntity);
      cache.put(existingEntity.getName(), existingEntity);
    } catch (EntityNotFoundException enf) {
    }
    return existingEntity;
  }
View Full Code Here


    Objectify ofy = OS.begin();
    ofy.delete(role);
  }

  public static WikiGroup findByName(String name) {
    WikiGroup role = (WikiGroup) cache.get(name);
    if (role != null) {
      return role;
    }
    try {
      Objectify ofy = OS.begin();
      // OQuery<WikiGroup> q = OS.createQuery(WikiGroup.class);
      Query<WikiGroup> q = ofy.query(WikiGroup.class);
      q.filter("name", name);
      // role = ofy.prepare(q).asSingle();
      role = q.get();
      cache.put(role.getName(), role);
      return role;
    } catch (NullPointerException npe) {
    }
    return null;
  }
View Full Code Here

  /**
   *
   */
  protected static void setupGroups() throws DataAccessException, WikiException {
    WikiGroup group = new WikiGroup();
    group.setName(WikiGroup.GROUP_ANONYMOUS);
    // FIXME - use message key
    group
        .setDescription("All non-logged in users are automatically assigned to the anonymous group.");
    WikiBase.getDataHandler().writeWikiGroup(group);
    List<String> anonymousRoles = new ArrayList<String>();
    anonymousRoles.add(RoleImpl.ROLE_EDIT_EXISTING.getAuthority());
    anonymousRoles.add(RoleImpl.ROLE_EDIT_NEW.getAuthority());
    anonymousRoles.add(RoleImpl.ROLE_UPLOAD.getAuthority());
    anonymousRoles.add(RoleImpl.ROLE_VIEW.getAuthority());
    WikiBase.getDataHandler().writeRoleMapGroup(group.getGroupId(),
        group.getName(), anonymousRoles);
    group = new WikiGroup();
    group.setName(WikiGroup.GROUP_REGISTERED_USER);
    // FIXME - use message key
    group
        .setDescription("All logged in users are automatically assigned to the registered user group.");
    WikiBase.getDataHandler().writeWikiGroup(group);
    List<String> userRoles = new ArrayList<String>();
    userRoles.add(RoleImpl.ROLE_EDIT_EXISTING.getAuthority());
    userRoles.add(RoleImpl.ROLE_EDIT_NEW.getAuthority());
    userRoles.add(RoleImpl.ROLE_MOVE.getAuthority());
    userRoles.add(RoleImpl.ROLE_UPLOAD.getAuthority());
    userRoles.add(RoleImpl.ROLE_VIEW.getAuthority());
    WikiBase.getDataHandler().writeRoleMapGroup(group.getGroupId(),
        group.getName(), userRoles);
  }
View Full Code Here

TOP

Related Classes of org.jamwiki.model.WikiGroup

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.