Package org.sonatype.security.rest.model

Examples of org.sonatype.security.rest.model.AssignedPrivilegeListResource


  }

  protected void handlePrivilege(Privilege privilege, List<Role> parentList,
                                 AssignedPrivilegeListResourceResponse response)
  {
    AssignedPrivilegeListResource foundResource = null;

    // First check to see if resource already exists
    for (AssignedPrivilegeListResource resource : response.getData()) {
      if (resource.getId().equals(privilege.getId())) {
        foundResource = resource;
        break;
      }
    }

    // if not, create it
    if (foundResource == null) {
      foundResource = new AssignedPrivilegeListResource();
      foundResource.setId(privilege.getId());
      foundResource.setName(privilege.getName());
      response.addData(foundResource);
    }

    ParentNode root = null;
    ParentNode parent = null;

    // iterate through each role and add to tree
    for (Role role : parentList) {
      ParentNode newParent = new ParentNode();
      newParent.setId(role.getRoleId());
      newParent.setName(role.getName());

      // if we dont yet have a root, we are on first item
      if (root == null) {
        root = newParent;
        parent = root;
      }
      else {
        parent.addParent(newParent);
        parent = newParent;
      }
    }

    foundResource.addParent(root);
  }
View Full Code Here

TOP

Related Classes of org.sonatype.security.rest.model.AssignedPrivilegeListResource

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.