Fix for Penetration test _ Session and cookie management
[vid.git] / vid-app-common / src / main / java / org / onap / vid / mso / rest / RequestStatus.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.mso.rest;
22
23 import com.fasterxml.jackson.annotation.*;
24 import org.apache.commons.lang.builder.EqualsBuilder;
25 import org.apache.commons.lang.builder.HashCodeBuilder;
26 import org.apache.commons.lang.builder.ToStringBuilder;
27
28 import java.util.HashMap;
29 import java.util.Map;
30
31
32 /**
33  * fields describing the status of a request
34  * 
35  */
36 @JsonInclude(JsonInclude.Include.NON_NULL)
37 @JsonPropertyOrder({
38     "percentProgress",
39     "requestState",
40     "statusMessage",
41     "timestamp",
42     "wasRolledBack"
43 })
44 public class RequestStatus {
45
46     public RequestStatus() {}
47
48     public RequestStatus(String requestState, String statusMessage, String timestamp) {
49         this.requestState = requestState;
50         this.statusMessage = statusMessage;
51         this.timestamp = timestamp;
52     }
53     public RequestStatus(String requestState, String statusMessage, String timestamp, String flowStatus) {
54         this.requestState = requestState;
55         this.statusMessage = statusMessage;
56         this.timestamp = timestamp;
57         this.flowStatus = flowStatus;
58     }
59
60     /**
61       * short description of the flow status
62       * (Required)
63       *
64       */
65     @JsonProperty("flowStatus")
66     private String flowStatus;
67
68
69     /**
70      * percentage complete estimate from 0 to 100
71      * 
72      */
73     @JsonProperty("percentProgress")
74     private Double percentProgress;
75     /**
76      * short description of the instantiation state
77      * (Required)
78      * 
79      */
80     @JsonProperty("requestState")
81     private String requestState;
82     /**
83      * additional descriptive information about the status
84      * 
85      */
86     @JsonProperty("statusMessage")
87     private String statusMessage;
88     /**
89      * GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT
90      * (Required)
91      * 
92      */
93     @JsonProperty("timestamp")
94     private String timestamp;
95     /**
96      * true or false boolean indicating whether the request was rolled back
97      * 
98      */
99     @JsonProperty("wasRolledBack")
100     private Boolean wasRolledBack;
101     @JsonIgnore
102     private Map<String, Object> additionalProperties = new HashMap<>();
103
104     /**
105      * percentage complete estimate from 0 to 100
106      * 
107      * @return
108      *     The percentProgress
109      */
110     @JsonProperty("percentProgress")
111     public Double getPercentProgress() {
112         return percentProgress;
113     }
114
115     /**
116      * percentage complete estimate from 0 to 100
117      * 
118      * @param percentProgress
119      *     The percentProgress
120      */
121     @JsonProperty("percentProgress")
122     public void setPercentProgress(Double percentProgress) {
123         this.percentProgress = percentProgress;
124     }
125
126     /**
127      * short description of the instantiation state
128      * (Required)
129      * 
130      * @return
131      *     The requestState
132      */
133     @JsonProperty("requestState")
134     public String getRequestState() {
135         return requestState;
136     }
137
138     /**
139      * short description of the instantiation state
140      * (Required)
141      * 
142      * @param requestState
143      *     The requestState
144      */
145     @JsonProperty("requestState")
146     public void setRequestState(String requestState) {
147         this.requestState = requestState;
148     }
149
150     /**
151      * additional descriptive information about the status
152      * 
153      * @return
154      *     The statusMessage
155      */
156     @JsonProperty("statusMessage")
157     public String getStatusMessage() {
158         return statusMessage;
159     }
160
161     /**
162      * additional descriptive information about the status
163      * 
164      * @param statusMessage
165      *     The statusMessage
166      */
167     @JsonProperty("statusMessage")
168     public void setStatusMessage(String statusMessage) {
169         this.statusMessage = statusMessage;
170     }
171
172     /**
173      * GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT
174      * (Required)
175      * 
176      * @return
177      *     The timestamp
178      */
179     @JsonProperty("timestamp")
180     public String getTimestamp() {
181         return timestamp;
182     }
183
184     /**
185      * GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT
186      * (Required)
187      * 
188      * @param timestamp
189      *     The timestamp
190      */
191     @JsonProperty("timestamp")
192     public void setTimestamp(String timestamp) {
193         this.timestamp = timestamp;
194     }
195
196     /**
197      * true or false boolean indicating whether the request was rolled back
198      * 
199      * @return
200      *     The wasRolledBack
201      */
202     @JsonProperty("wasRolledBack")
203     public Boolean getWasRolledBack() {
204         return wasRolledBack;
205     }
206
207     /**
208      * true or false boolean indicating whether the request was rolled back
209      * 
210      * @param wasRolledBack
211      *     The wasRolledBack
212      */
213     @JsonProperty("wasRolledBack")
214     public void setWasRolledBack(Boolean wasRolledBack) {
215         this.wasRolledBack = wasRolledBack;
216     }
217
218     @Override
219     public String toString() {
220         return ToStringBuilder.reflectionToString(this);
221     }
222
223     @JsonAnyGetter
224     public Map<String, Object> getAdditionalProperties() {
225         return this.additionalProperties;
226     }
227
228     @JsonAnySetter
229     public void setAdditionalProperty(String name, Object value) {
230         this.additionalProperties.put(name, value);
231     }
232
233     /**
234       * additional descriptive information about the status
235       *
236       * @return
237       *     The flowStatus
238       */
239     @JsonProperty("flowStatus")
240     public String getFlowStatus() {
241         return flowStatus;
242     }
243
244     /**
245       * additional descriptive information about the status
246       *
247       * @param flowStatus
248       *     The flowStatus
249       */
250     @JsonProperty("flowStatus")
251     public void setFlowStatus(String flowStatus) {
252         this.flowStatus = flowStatus;
253     }
254
255     @Override
256     public int hashCode() {
257         return new HashCodeBuilder().append(percentProgress).append(requestState).append(statusMessage).append(timestamp).append(wasRolledBack).append(additionalProperties).toHashCode();
258     }
259
260     @Override
261     public boolean equals(Object other) {
262         if (other == this) {
263             return true;
264         }
265         if (!(other instanceof RequestStatus)) {
266             return false;
267         }
268         RequestStatus rhs = ((RequestStatus) other);
269         return new EqualsBuilder().append(percentProgress, rhs.percentProgress).append(requestState, rhs.requestState).append(statusMessage, rhs.statusMessage).append(timestamp, rhs.timestamp).append(wasRolledBack, rhs.wasRolledBack).append(flowStatus, rhs.flowStatus).append(additionalProperties, rhs.additionalProperties).isEquals();
270     }
271
272 }