Update license; improve coverage; add docs dir
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / transport / ExternalAccessPerms.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the “License”);
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
37  */
38 package org.openecomp.portalapp.portal.transport;
39
40 import java.io.Serializable;
41
42 public class ExternalAccessPerms implements Serializable, Comparable {
43
44         /**
45          * 
46          */
47         private static final long serialVersionUID = -200964838466882602L;
48         public String type;
49         public String instance;
50         public String action;
51         public String description;
52
53         public ExternalAccessPerms() {
54                 super();
55         }
56
57         public ExternalAccessPerms(String type, String instance, String action, String description) {
58                 super();
59                 this.type = type;
60                 this.instance = instance;
61                 this.action = action;
62                 this.description = description;
63         }
64
65         public ExternalAccessPerms(String type, String instance, String action) {
66                 super();
67                 this.type = type;
68                 this.instance = instance;
69                 this.action = action;
70         }
71
72         /**
73          * @return the type
74          */
75         public String getType() {
76                 return type;
77         }
78
79         /**
80          * @param type
81          *            the type to set
82          */
83         public void setType(String type) {
84                 this.type = type;
85         }
86
87         /**
88          * @return the instance
89          */
90         public String getInstance() {
91                 return instance;
92         }
93
94         /**
95          * @param instance
96          *            the instance to set
97          */
98         public void setInstance(String instance) {
99                 this.instance = instance;
100         }
101
102         /**
103          * @return the action
104          */
105         public String getAction() {
106                 return action;
107         }
108
109         /**
110          * @param action
111          *            the action to set
112          */
113         public void setAction(String action) {
114                 this.action = action;
115         }
116
117         public String getDescription() {
118                 return description;
119         }
120
121         public void setDescription(String description) {
122                 this.description = description;
123         }
124
125         @Override
126         public int compareTo(Object obj) {
127                 ExternalAccessPerms other = (ExternalAccessPerms) obj;
128
129                 String c1 = getInstance();
130                 String c2 = other.getInstance();
131
132                 return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
133         }
134
135         @Override
136         public int hashCode() {
137                 final int prime = 31;
138                 int result = 1;
139                 result = prime * result + ((action == null) ? 0 : action.hashCode());
140                 result = prime * result + ((description == null) ? 0 : description.hashCode());
141                 result = prime * result + ((instance == null) ? 0 : instance.hashCode());
142                 result = prime * result + ((type == null) ? 0 : type.hashCode());
143                 return result;
144         }
145
146         @Override
147         public boolean equals(Object obj) {
148                 if (this == obj)
149                         return true;
150                 if (obj == null)
151                         return false;
152                 if (getClass() != obj.getClass())
153                         return false;
154                 ExternalAccessPerms other = (ExternalAccessPerms) obj;
155                 if (action == null) {
156                         if (other.action != null)
157                                 return false;
158                 } else if (!action.equals(other.action))
159                         return false;
160                 if (description == null) {
161                         if (other.description != null)
162                                 return false;
163                 } else if (!description.equals(other.description))
164                         return false;
165                 if (instance == null) {
166                         if (other.instance != null)
167                                 return false;
168                 } else if (!instance.equals(other.instance))
169                         return false;
170                 if (type == null) {
171                         if (other.type != null)
172                                 return false;
173                 } else if (!type.equals(other.type))
174                         return false;
175                 return true;
176         }
177
178 }