Fix sonar issues in models: sdc to vfc
[policy/models.git] / models-interactions / model-impl / sdnr / src / main / java / org / onap / policy / sdnr / PciRequest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * sdnr
4  * ================================================================================
5  * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2019 Nordix Foundation.
7  * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file 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  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.policy.sdnr;
24
25 import com.google.gson.annotations.SerializedName;
26
27 import java.io.Serializable;
28
29 public class PciRequest implements Serializable {
30
31     private static final long serialVersionUID = 323235565922846624L;
32
33     @SerializedName(value = "CommonHeader")
34     private PciCommonHeader commonHeader;
35
36     @SerializedName(value = "Action")
37     private String action;
38
39     @SerializedName(value = "Payload")
40     private String payload;
41
42     public PciRequest() {
43         // Create a default PCI request
44     }
45
46     public PciCommonHeader getCommonHeader() {
47         return commonHeader;
48     }
49
50     public void setCommonHeader(PciCommonHeader commonHeader) {
51         this.commonHeader = commonHeader;
52     }
53
54     /**
55      * Get the action.
56      *
57      * @return the action
58      */
59     public String getAction() {
60         return action;
61     }
62
63     /**
64      * Set the action.
65      *
66      * @param action
67      *            the action to set
68      */
69     public void setAction(String action) {
70         this.action = action;
71     }
72
73     /**
74      * Get the payload.
75      *
76      * @return the payload
77      */
78
79     public String getPayload() {
80         return payload;
81     }
82
83     /**
84      * Set the payload.
85      *
86      * @param payload
87      *            the payload to set
88      */
89
90     public void setPayload(String payload) {
91         this.payload = payload;
92     }
93
94     @Override
95     public String toString() {
96         return "PciRequest[commonHeader=" + commonHeader + ", action=" + action + ", payload=" + payload + "]";
97     }
98
99     @Override
100     public int hashCode() {
101         final int prime = 31;
102         int result = 1;
103         result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode());
104         result = prime * result + ((action == null) ? 0 : action.hashCode());
105         result = prime * result + ((payload == null) ? 0 : payload.hashCode());
106         return result;
107     }
108
109     @Override
110     public boolean equals(Object obj) {
111         if (this == obj) {
112             return true;
113         }
114         if (obj == null) {
115             return false;
116         }
117         if (getClass() != obj.getClass()) {
118             return false;
119         }
120         PciRequest other = (PciRequest) obj;
121         if (commonHeader == null) {
122             if (other.commonHeader != null) {
123                 return false;
124             }
125         } else if (!commonHeader.equals(other.commonHeader)) {
126             return false;
127         }
128         if (action == null) {
129             if (other.action != null) {
130                 return false;
131             }
132         } else if (!action.equals(other.action)) {
133             return false;
134         }
135         if (payload == null) {
136             if (other.payload != null) {
137                 return false;
138             }
139         } else if (!payload.equals(other.payload)) {
140             return false;
141         }
142         return true;
143     }
144
145 }