Initial opendaylight infrastructure commit!!
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / authorization / ResourceGroup.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
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
8  */
9
10 package org.opendaylight.controller.sal.authorization;
11
12 import java.io.Serializable;
13
14 import org.apache.commons.lang3.builder.EqualsBuilder;
15 import org.apache.commons.lang3.builder.HashCodeBuilder;
16
17 /**
18  * Represents a group of resources along with the privilege associated to it
19  *
20  *
21  *
22  */
23 public class ResourceGroup implements Serializable {
24     private static final long serialVersionUID = 1L;
25     private String groupName; // the resource group name
26     private Privilege privilege; // the privilege for this profile on the resource group
27
28     public ResourceGroup(String groupName, Privilege privilege) {
29         this.groupName = groupName;
30         this.privilege = privilege;
31     }
32
33     /**
34      * Returns the name for this resource group
35      * @return
36      */
37     public String getGroupName() {
38         return groupName;
39     }
40
41     /**
42      * Returns the privilege for this group on its resources
43      * @return
44      */
45     public Privilege getPrivilege() {
46         return privilege;
47     }
48
49     @Override
50     public int hashCode() {
51         return HashCodeBuilder.reflectionHashCode(this);
52     }
53
54     @Override
55     public boolean equals(Object obj) {
56         return EqualsBuilder.reflectionEquals(this, obj);
57     }
58
59     @Override
60     public String toString() {
61         return "[" + groupName + ", " + privilege.toString() + "]";
62     }
63 }