3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.sal.authorization;
12 import java.io.Serializable;
15 * Represents a group of resources along with the privilege associated to it
20 public class ResourceGroup implements Serializable {
21 private static final long serialVersionUID = 1L;
22 private String groupName; // the resource group name
23 private Privilege privilege; // the privilege for this profile on the resource group
25 public ResourceGroup(String groupName, Privilege privilege) {
26 this.groupName = groupName;
27 this.privilege = privilege;
31 * Returns the name for this resource group
34 public String getGroupName() {
39 * Returns the privilege for this group on its resources
42 public Privilege getPrivilege() {
47 public int hashCode() {
50 result = prime * result
51 + ((groupName == null) ? 0 : groupName.hashCode());
52 result = prime * result
53 + ((privilege == null) ? 0 : privilege.hashCode());
58 public boolean equals(Object obj) {
63 if (getClass() != obj.getClass())
65 ResourceGroup other = (ResourceGroup) obj;
66 if (groupName == null) {
67 if (other.groupName != null)
69 } else if (!groupName.equals(other.groupName))
71 if (privilege != other.privilege)
77 public String toString() {
78 return "[" + groupName + ", " + privilege.toString() + "]";