2665313d706e423b05b3b7c967cc408d75416145
[vid.git] / vid-app-common / src / main / java / org / onap / vid / model / ServiceInstanceSearchResult.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.vid.model;
22
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import org.apache.commons.lang3.StringUtils;
25 import org.onap.vid.roles.WithPermissionPropertiesSubscriberAndServiceType;
26
27 public class ServiceInstanceSearchResult implements WithPermissionPropertiesSubscriberAndServiceType {
28
29         private final String SUBSCRIBER_ID_FRONTEND_ALIAS = "globalCustomerId";
30
31         private String serviceInstanceId;
32
33         private String subscriberId;
34
35         private String serviceType;
36
37         private String serviceInstanceName;
38
39         private String subscriberName;
40
41         private String aaiModelInvariantId;
42
43         private String aaiModelVersionId;
44
45         private boolean isPermitted;
46
47         public ServiceInstanceSearchResult(){
48         }
49         
50         public ServiceInstanceSearchResult(String serviceInstanceId, String subscriberId, String serviceType,
51                                                                            String serviceInstanceName, String subscriberName, String aaiModelInvariantId,
52                                                                            String aaiModelVersionId, boolean isPermitted) {
53                 this.serviceInstanceId = serviceInstanceId;
54                 this.subscriberId = subscriberId;
55                 this.serviceType = serviceType;
56                 this.serviceInstanceName = serviceInstanceName;
57                 this.subscriberName = subscriberName;
58                 this.aaiModelInvariantId = aaiModelInvariantId;
59                 this.aaiModelVersionId = aaiModelVersionId;
60                 this.isPermitted = isPermitted;
61         }
62
63         public String getServiceInstanceId() {
64                 return serviceInstanceId;
65         }
66
67         public void setServiceInstanceId(String serviceInstanceId) {
68                 this.serviceInstanceId = serviceInstanceId;
69         }
70
71         @Override
72         @JsonProperty(SUBSCRIBER_ID_FRONTEND_ALIAS)
73         public String getSubscriberId() {
74                 return subscriberId;
75         }
76
77         public void setSubscriberId(String subscriberId) {
78                 this.subscriberId = subscriberId;
79         }
80
81         @Override
82         public String getServiceType() {
83                 return serviceType;
84         }
85
86         public void setServiceType(String serviceType) {
87                 this.serviceType = serviceType;
88         }
89
90         public String getServiceInstanceName() {
91                 return serviceInstanceName;
92         }
93
94         public void setServiceInstanceName(String serviceInstanceName) {
95                 this.serviceInstanceName = serviceInstanceName;
96         }
97
98         public String getSubscriberName() {
99                 return subscriberName;
100         }
101
102         public void setSubscriberName(String subscriberName) {
103                 this.subscriberName = subscriberName;
104         }
105
106         public String getAaiModelInvariantId() {
107                 return aaiModelInvariantId;
108         }
109
110         public void setAaiModelInvariantId(String aaiModelInvariantId) {
111                 this.aaiModelInvariantId = aaiModelInvariantId;
112         }
113
114         public String getAaiModelVersionId() {
115                 return aaiModelVersionId;
116         }
117
118         public void setAaiModelVersionId(String aaiModelVersionId) {
119                 this.aaiModelVersionId = aaiModelVersionId;
120         }
121
122         public boolean getIsPermitted() {
123                 return isPermitted;
124         }
125
126         public void setIsPermitted(boolean isPermitted) {
127                 this.isPermitted = isPermitted;
128         }
129
130         @Override
131         public boolean equals(Object o) {
132                 if (this == o) {
133                         return true;
134                 }
135                 if (o == null || getClass() != o.getClass()) {
136                         return false;
137                 }
138
139                 ServiceInstanceSearchResult that = (ServiceInstanceSearchResult) o;
140
141                 return StringUtils.equals(serviceInstanceId, that.serviceInstanceId);
142         }
143
144         @Override
145         public int hashCode() {
146                 return serviceInstanceId != null ? serviceInstanceId.hashCode() : 0;
147         }
148 }