move actors code in drools-applications to policy/models
[policy/models.git] / models-interactions / model-impl / so / src / main / java / org / onap / policy / so / SoResponseWrapper.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * so
4  * ================================================================================
5  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2019 Nordix Foundation.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.so;
23
24 import com.google.gson.annotations.SerializedName;
25
26 import java.io.Serializable;
27
28 public class SoResponseWrapper implements Serializable {
29
30     private static final long serialVersionUID = 7673023687132889069L;
31
32     @SerializedName("SoResponse")
33     private SoResponse soResponse;
34
35     private transient String requestId;
36
37     public SoResponseWrapper(SoResponse response, String reqId) {
38         this.soResponse = response;
39         this.requestId = reqId;
40     }
41
42     @Override
43     public boolean equals(Object obj) {
44         if (this == obj) {
45             return true;
46         }
47         if (obj == null) {
48             return false;
49         }
50         if (getClass() != obj.getClass()) {
51             return false;
52         }
53         SoResponseWrapper other = (SoResponseWrapper) obj;
54         if (soResponse == null) {
55             if (other.soResponse != null) {
56                 return false;
57             }
58         }
59         else if (!soResponse.equals(other.soResponse)) {
60             return false;
61         }
62         if (requestId == null) {
63             if (other.requestId != null) {
64                 return false;
65             }
66         }
67         else if (!requestId.equals(other.requestId)) {
68             return false;
69         }
70         return true;
71     }
72
73     public String getRequestId() {
74         return requestId;
75     }
76
77     public SoResponse getSoResponse() {
78         return soResponse;
79     }
80
81     @Override
82     public int hashCode() {
83         final int prime = 31;
84         int result = super.hashCode();
85         result = prime * result + ((soResponse == null) ? 0 : soResponse.hashCode());
86         result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
87         return result;
88     }
89
90     public void setRequestId(String requestId) {
91         this.requestId = requestId;
92     }
93
94     public void setSoResponse(SoResponse response) {
95         soResponse = response;
96     }
97
98     @Override
99     public String toString() {
100         return "SOResponseWrapper [SOResponse=" + soResponse + ", RequestId=" + requestId + "]";
101     }
102
103 }