27d0dd0bf337fecc037ac00e11d0a79bfaca2148
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / transport / ExternalAccessPerms.java
1 package org.openecomp.portalapp.portal.transport;
2
3 import java.io.Serializable;
4
5 public class ExternalAccessPerms implements Serializable, Comparable{
6
7         /**
8          * 
9          */
10         private static final long serialVersionUID = -200964838466882602L;
11         public String type;
12         public String instance;
13         public String action;
14         public String description;
15         
16         
17         public ExternalAccessPerms() {
18                 super();
19         }
20         
21         
22         
23         public ExternalAccessPerms(String type, String instance, String action, String description) {
24                 super();
25                 this.type = type;
26                 this.instance = instance;
27                 this.action = action;
28                 this.description = description;
29         }
30
31         public ExternalAccessPerms(String type, String instance, String action) {
32                 super();
33                 this.type = type;
34                 this.instance = instance;
35                 this.action = action;
36         }
37
38
39         /**
40          * @return the type
41          */
42         public String getType() {
43                 return type;
44         }
45         /**
46          * @param type the type to set
47          */
48         public void setType(String type) {
49                 this.type = type;
50         }
51         /**
52          * @return the instance
53          */
54         public String getInstance() {
55                 return instance;
56         }
57         /**
58          * @param instance the instance to set
59          */
60         public void setInstance(String instance) {
61                 this.instance = instance;
62         }
63         /**
64          * @return the action
65          */
66         public String getAction() {
67                 return action;
68         }
69         /**
70          * @param action the action to set
71          */
72         public void setAction(String action) {
73                 this.action = action;
74         }
75
76         public String getDescription() {
77                 return description;
78         }
79
80         public void setDescription(String description) {
81                 this.description = description;
82         }
83
84
85         @Override
86         public int compareTo(Object obj){
87         ExternalAccessPerms other = (ExternalAccessPerms)obj;
88
89         String c1 = getInstance();
90         String c2 = other.getInstance();
91
92         return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
93         }
94
95
96
97         @Override
98         public int hashCode() {
99                 final int prime = 31;
100                 int result = 1;
101                 result = prime * result + ((action == null) ? 0 : action.hashCode());
102                 result = prime * result + ((description == null) ? 0 : description.hashCode());
103                 result = prime * result + ((instance == null) ? 0 : instance.hashCode());
104                 result = prime * result + ((type == null) ? 0 : type.hashCode());
105                 return result;
106         }
107
108
109
110         @Override
111         public boolean equals(Object obj) {
112                 if (this == obj)
113                         return true;
114                 if (obj == null)
115                         return false;
116                 if (getClass() != obj.getClass())
117                         return false;
118                 ExternalAccessPerms other = (ExternalAccessPerms) obj;
119                 if (action == null) {
120                         if (other.action != null)
121                                 return false;
122                 } else if (!action.equals(other.action))
123                         return false;
124                 if (description == null) {
125                         if (other.description != null)
126                                 return false;
127                 } else if (!description.equals(other.description))
128                         return false;
129                 if (instance == null) {
130                         if (other.instance != null)
131                                 return false;
132                 } else if (!instance.equals(other.instance))
133                         return false;
134                 if (type == null) {
135                         if (other.type != null)
136                                 return false;
137                 } else if (!type.equals(other.type))
138                         return false;
139                 return true;
140         }
141         
142         
143 }