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
21 public class ResourceGroup implements Serializable {
22 private static final long serialVersionUID = 1L;
23 private String groupName; // the resource group name
24 private Privilege privilege; // the privilege for this profile on the resource group
26 public ResourceGroup(String groupName, Privilege privilege) {
27 this.groupName = groupName;
28 this.privilege = privilege;
32 * Returns the name for this resource group
35 public String getGroupName() {
40 * Returns the privilege for this group on its resources
43 public Privilege getPrivilege() {
48 public int hashCode() {
51 result = prime * result
52 + ((groupName == null) ? 0 : groupName.hashCode());
53 result = prime * result
54 + ((privilege == null) ? 0 : privilege.hashCode());
59 public boolean equals(Object obj) {
64 if (getClass() != obj.getClass())
66 ResourceGroup other = (ResourceGroup) obj;
67 if (groupName == null) {
68 if (other.groupName != null)
70 } else if (!groupName.equals(other.groupName))
72 if (privilege != other.privilege)
78 public String toString() {
79 return "[" + groupName + ", " + privilege.toString() + "]";