Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package hudson.plugins.collabnet.auth;
  
  
This class stores information about each CollabNet Role (name, description, associated hudson permissions, etc.)
 
 public class CollabNetRole {
     private String name;
     private String description;
     private Collection<Permissionpermissions;
 
     public CollabNetRole(String nameString description
                          Collection<Permissionpermissions) {
         this. = name;
         this. = description;
         if (permissions != null) {
             this. = new ArrayList<Permission>(permissions);
         } else {
             this. = new ArrayList<Permission>();
         }
     }
 
     public CollabNetRole(String nameString description) {
         this. = name;
         this. = description;
         this. = new ArrayList<Permission>();
     }
 
     public CollabNetRole(String name) {
         this. = name;
         this. = new ArrayList<Permission>();
     }

    

Returns:
the name of the role.
 
     public String getName() {
         return this.;
     }

    

Returns:
the description of the role.
 
     public String getDescription() {
         return this.;
     }

    

Returns:
the Hudson Permissions granted by this role.
 
     public Collection<PermissiongetPermissions() {
         return this.;
     }

    

Parameters:
permission to add.
 
     public void addPermission(Permission permission) {
         this..add(permission);
     }

    

Returns:
true if the role has this permission.
 
     public boolean hasPermission(Permission permission) {
         if (this..contains(permission)) {
             return true;
         } else {
             return false;
         }
     }

    
Any two CollabNetRoles with the same name are equal.
 
     public boolean equals(Object obj) {
         if (this == obj) {
             return true;
         }
         if ((obj == null) || (obj.getClass() != this.getClass())) {
             return false;
         }
         CollabNetRole other = (CollabNetRoleobj;
         return (other.getName().equals(this.getName()));
     }

    
Override hashcode so it remains consistent with equals.
 
     public int hashCode() {
         if (this. == null) {
             return 0;
         } else {
             return this..hashCode();
        }
    }

    
Override for prettier logging.
    public String toString() {
        String str = "CollabNetRole: {name: " + this.getName() + 
            ", description: " + this.getDescription() + ", permissions: " 
            + this.getPermissions();
        return str;
    }
New to GrepCode? Check out our FAQ X