Package org.jasig.portal.portlets.groupselector

Examples of org.jasig.portal.portlets.groupselector.EntityEnum


   
    // create the group array from the form's group list
    IGroupMember[] groupMembers = new IGroupMember[form.getGroups().size()];
    for (int i = 0; i < groupMembers.length; i++) {
      JsonEntityBean bean = form.getGroups().get(i);
      EntityEnum entityEnum = EntityEnum.getEntityEnum(bean.getEntityType());
      if (entityEnum.isGroup()) {
        groupMembers[i] = GroupService.findGroup(bean.getId());
      } else {
              groupMembers[i] = GroupService.getGroupMember(bean.getId(), entityEnum.getClazz());
       
      }
    }
   
        // create the category array from the form's category list
View Full Code Here


  @SuppressWarnings("unchecked")
  public Set<JsonEntityBean> search(String entityType, String searchTerm) {
   
    Set<JsonEntityBean> results = new HashSet<JsonEntityBean>();

    EntityEnum entityEnum = EntityEnum.getEntityEnum(entityType);

    EntityIdentifier[] identifiers;
   
    Class identifierType;
   
    // if the entity type is a group, use the group service's findGroup method
    // to locate it
    if (entityEnum.isGroup()) {
      identifiers = GroupService.searchForGroups(searchTerm, GroupService.CONTAINS,
          entityEnum.getClazz());
      identifierType = IEntityGroup.class;
    }
   
    // otherwise use the getGroupMember method
    else {
      identifiers = GroupService.searchForEntities(searchTerm, GroupService.CONTAINS,
          entityEnum.getClazz());
      identifierType = entityEnum.getClazz();
    }
   
    for(int i=0;i<identifiers.length;i++) {
      if(identifiers[i].getType().equals(identifierType)) {
        IGroupMember entity = GroupService.getGroupMember(identifiers[i]);
View Full Code Here

   * @see org.jasig.portal.layout.dlm.remoting.IGroupListHelper#getEntity(java.lang.String, java.lang.String, boolean)
   */
  public JsonEntityBean getEntity(String entityType, String entityId, boolean populateChildren) {

    // get the EntityEnum for the specified entity type
    EntityEnum entityEnum = EntityEnum.getEntityEnum(entityType);
   
    // if the entity type is a group, use the group service's findGroup method
    // to locate it
    if(entityEnum.isGroup()) {
      // attempt to find the entity
      IEntityGroup entity = GroupService.findGroup(entityId);
      if(entity == null) {
        return null;
      } else {
        JsonEntityBean jsonBean = new JsonEntityBean(entity, entityEnum.toString());
        if (populateChildren) {
          @SuppressWarnings("unchecked")
          Iterator<IGroupMember> members = (Iterator<IGroupMember>) entity.getMembers();
          jsonBean = populateChildren(jsonBean, members);
        }
        return jsonBean;
      }
    }
   
    // otherwise use the getGroupMember method
    else {
      IGroupMember entity = GroupService.getGroupMember(entityId, entityEnum.getClazz());
      if(entity == null || entity instanceof IEntityGroup) {
        return null;
      }
      JsonEntityBean jsonBean = new JsonEntityBean(entity, entityEnum.toString());
     
      // the group member interface doesn't include the entity name, so
      // we'll need to look that up manually
      jsonBean.setName(lookupEntityName(jsonBean));
      return jsonBean;
View Full Code Here

     
      IGroupMember member = children.next();
     
      // get the type of this member entity
      String entityType = getEntityType(member);
      EntityEnum entityEnum = EntityEnum.getEntityEnum(entityType);
     
      // construct a new entity bean for this entity
      JsonEntityBean jsonChild;
      if (entityEnum.isGroup()) {
        jsonChild = new JsonEntityBean((IEntityGroup) member, entityEnum.toString());
      } else {
        jsonChild = new JsonEntityBean(member, entityEnum.toString());
      }
     
     
      // if the name hasn't been set yet, look up the entity name
      if (jsonChild.getName() == null) {
View Full Code Here

   * @param groupMember Entity to look up
   * @return groupMember's name or null if there's an error
   */
  public String lookupEntityName(JsonEntityBean entity) {
   
    EntityEnum entityEnum = EntityEnum.getEntityEnum(entity.getEntityType());
    IEntityNameFinder finder;
    if (entityEnum.isGroup()) {
      finder = EntityNameFinderService.instance()
        .getNameFinder(IEntityGroup.class);
    } else {
      finder = EntityNameFinderService.instance()
        .getNameFinder(entityEnum.getClazz());
    }
   
    try {
      return finder.getName(entity.getId());
    } catch (Exception e) {
View Full Code Here

        }
       
        // To proceed, we need to know about the containing
        // groups (if any) for this principal...
        IGroupMember member = null;
        EntityEnum entityEnum = a.getPrincipal().getEntityType();
        if (entityEnum.isGroup()) {
            member = GroupService.findGroup(a.getPrincipal().getId());
        } else {
            member = GroupService.getGroupMember(a.getPrincipal().getId(), entityEnum.getClazz());
        }

        AuthorizationService authService = AuthorizationService.instance();
        Iterator<?> it = GroupService.getCompositeGroupService().findContainingGroups(member);
        if (it.hasNext()) {
            // This member must be nested within its parent(s)...
            while (it.hasNext()) {
                IEntityGroup group = (IEntityGroup) it.next();

                EntityEnum beanType = EntityEnum.getEntityEnum(group.getEntityType(), true);

                JsonEntityBean bean = new JsonEntityBean(group, beanType);
                Assignment parent = null;
                for (Assignment root : hierarchy) {
                    parent = root.findDecendentOrSelfIfExists(bean);
View Full Code Here

    // create the group array from the form's group list
    IGroupMember[] groupMembers = new IGroupMember[form.getGroups().size()];
    for (int i = 0; i < groupMembers.length; i++) {
      JsonEntityBean bean = form.getGroups().get(i);
      EntityEnum entityEnum = EntityEnum.getEntityEnum(bean.getEntityTypeAsString());
      if (entityEnum.isGroup()) {
        groupMembers[i] = GroupService.findGroup(bean.getId());
      } else {
              groupMembers[i] = GroupService.getGroupMember(bean.getId(), entityEnum.getClazz());
       
      }
    }

        // create the category array from the form's category list
View Full Code Here

  @SuppressWarnings("unchecked")
  public Set<JsonEntityBean> search(String entityType, String searchTerm) {
   
    Set<JsonEntityBean> results = new HashSet<JsonEntityBean>();

    EntityEnum entityEnum = EntityEnum.getEntityEnum(entityType);

    EntityIdentifier[] identifiers;
   
    Class identifierType;
   
    // if the entity type is a group, use the group service's findGroup method
    // to locate it
    if (entityEnum.isGroup()) {
      identifiers = GroupService.searchForGroups(searchTerm, GroupService.CONTAINS,
          entityEnum.getClazz());
      identifierType = IEntityGroup.class;
    }
   
    // otherwise use the getGroupMember method
    else {
      identifiers = GroupService.searchForEntities(searchTerm, GroupService.CONTAINS,
          entityEnum.getClazz());
      identifierType = entityEnum.getClazz();
    }
   
    for(int i=0;i<identifiers.length;i++) {
      if(identifiers[i].getType().equals(identifierType)) {
        IGroupMember entity = GroupService.getGroupMember(identifiers[i]);
View Full Code Here

   * (non-Javadoc)
   * @see org.jasig.portal.layout.dlm.remoting.IGroupListHelper#getRootEntity(java.lang.String)
   */
  public JsonEntityBean getRootEntity(String groupType) {
   
      EntityEnum type = EntityEnum.getEntityEnum(groupType);
     
    String rootKey;
    if (EntityEnum.GROUP.equals(type)) {
      rootKey = "local.0";
    } else if (EntityEnum.CATEGORY.equals(type)) {
View Full Code Here

     *
     * This method will require an update if more entity types are added
     * in the future.
     */
   
    EntityEnum type = EntityEnum.getEntityEnum(groupType);
    if (EntityEnum.GROUP.equals(type)) {
      set.add(EntityEnum.PERSON.toString());
    } else if (EntityEnum.CATEGORY.equals(type)) {
      set.add(EntityEnum.PORTLET.toString());
    } else {
View Full Code Here

TOP

Related Classes of org.jasig.portal.portlets.groupselector.EntityEnum

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.