Replace ecomp references
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / transport / ExternalAccessPerms.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 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  * 
37  */
38 package org.onap.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         
54         public ExternalAccessPerms() {
55                 super();
56         }
57         
58         
59         
60         public ExternalAccessPerms(String type, String instance, String action, String description) {
61                 super();
62                 this.type = type;
63                 this.instance = instance;
64                 this.action = action;
65                 this.description = description;
66         }
67
68         public ExternalAccessPerms(String type, String instance, String action) {
69                 super();
70                 this.type = type;
71                 this.instance = instance;
72                 this.action = action;
73         }
74
75
76         /**
77          * @return the type
78          */
79         public String getType() {
80                 return type;
81         }
82         /**
83          * @param type the type to set
84          */
85         public void setType(String type) {
86                 this.type = type;
87         }
88         /**
89          * @return the instance
90          */
91         public String getInstance() {
92                 return instance;
93         }
94         /**
95          * @param instance the instance to set
96          */
97         public void setInstance(String instance) {
98                 this.instance = instance;
99         }
100         /**
101          * @return the action
102          */
103         public String getAction() {
104                 return action;
105         }
106         /**
107          * @param action the action to set
108          */
109         public void setAction(String action) {
110                 this.action = action;
111         }
112
113         public String getDescription() {
114                 return description;
115         }
116
117         public void setDescription(String description) {
118                 this.description = description;
119         }
120
121
122         @Override
123         public int compareTo(Object obj){
124         ExternalAccessPerms other = (ExternalAccessPerms)obj;
125
126         String c1 = getInstance();
127         String c2 = other.getInstance();
128
129         return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
130         }
131
132
133
134         @Override
135         public int hashCode() {
136                 final int prime = 31;
137                 int result = 1;
138                 result = prime * result + ((action == null) ? 0 : action.hashCode());
139                 result = prime * result + ((description == null) ? 0 : description.hashCode());
140                 result = prime * result + ((instance == null) ? 0 : instance.hashCode());
141                 result = prime * result + ((type == null) ? 0 : type.hashCode());
142                 return result;
143         }
144
145
146
147         @Override
148         public boolean equals(Object obj) {
149                 if (this == obj)
150                         return true;
151                 if (obj == null)
152                         return false;
153                 if (getClass() != obj.getClass())
154                         return false;
155                 ExternalAccessPerms other = (ExternalAccessPerms) obj;
156                 if (action == null) {
157                         if (other.action != null)
158                                 return false;
159                 } else if (!action.equals(other.action))
160                         return false;
161                 if (description == null) {
162                         if (other.description != null)
163                                 return false;
164                 } else if (!description.equals(other.description))
165                         return false;
166                 if (instance == null) {
167                         if (other.instance != null)
168                                 return false;
169                 } else if (!instance.equals(other.instance))
170                         return false;
171                 if (type == null) {
172                         if (other.type != null)
173                                 return false;
174                 } else if (!type.equals(other.type))
175                         return false;
176                 return true;
177         }
178         
179         
180 }