Implant vid-app-common org.onap.vid.job (main and test)
[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
54     /**
55      * percentage complete estimate from 0 to 100
56      * 
57      */
58     @JsonProperty("percentProgress")
59     private Double percentProgress;
60     /**
61      * short description of the instantiation state
62      * (Required)
63      * 
64      */
65     @JsonProperty("requestState")
66     private String requestState;
67     /**
68      * additional descriptive information about the status
69      * 
70      */
71     @JsonProperty("statusMessage")
72     private String statusMessage;
73     /**
74      * GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT
75      * (Required)
76      * 
77      */
78     @JsonProperty("timestamp")
79     private String timestamp;
80     /**
81      * true or false boolean indicating whether the request was rolled back
82      * 
83      */
84     @JsonProperty("wasRolledBack")
85     private Boolean wasRolledBack;
86     @JsonIgnore
87     private Map<String, Object> additionalProperties = new HashMap<>();
88
89     /**
90      * percentage complete estimate from 0 to 100
91      * 
92      * @return
93      *     The percentProgress
94      */
95     @JsonProperty("percentProgress")
96     public Double getPercentProgress() {
97         return percentProgress;
98     }
99
100     /**
101      * percentage complete estimate from 0 to 100
102      * 
103      * @param percentProgress
104      *     The percentProgress
105      */
106     @JsonProperty("percentProgress")
107     public void setPercentProgress(Double percentProgress) {
108         this.percentProgress = percentProgress;
109     }
110
111     /**
112      * short description of the instantiation state
113      * (Required)
114      * 
115      * @return
116      *     The requestState
117      */
118     @JsonProperty("requestState")
119     public String getRequestState() {
120         return requestState;
121     }
122
123     /**
124      * short description of the instantiation state
125      * (Required)
126      * 
127      * @param requestState
128      *     The requestState
129      */
130     @JsonProperty("requestState")
131     public void setRequestState(String requestState) {
132         this.requestState = requestState;
133     }
134
135     /**
136      * additional descriptive information about the status
137      * 
138      * @return
139      *     The statusMessage
140      */
141     @JsonProperty("statusMessage")
142     public String getStatusMessage() {
143         return statusMessage;
144     }
145
146     /**
147      * additional descriptive information about the status
148      * 
149      * @param statusMessage
150      *     The statusMessage
151      */
152     @JsonProperty("statusMessage")
153     public void setStatusMessage(String statusMessage) {
154         this.statusMessage = statusMessage;
155     }
156
157     /**
158      * GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT
159      * (Required)
160      * 
161      * @return
162      *     The timestamp
163      */
164     @JsonProperty("timestamp")
165     public String getTimestamp() {
166         return timestamp;
167     }
168
169     /**
170      * GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT
171      * (Required)
172      * 
173      * @param timestamp
174      *     The timestamp
175      */
176     @JsonProperty("timestamp")
177     public void setTimestamp(String timestamp) {
178         this.timestamp = timestamp;
179     }
180
181     /**
182      * true or false boolean indicating whether the request was rolled back
183      * 
184      * @return
185      *     The wasRolledBack
186      */
187     @JsonProperty("wasRolledBack")
188     public Boolean getWasRolledBack() {
189         return wasRolledBack;
190     }
191
192     /**
193      * true or false boolean indicating whether the request was rolled back
194      * 
195      * @param wasRolledBack
196      *     The wasRolledBack
197      */
198     @JsonProperty("wasRolledBack")
199     public void setWasRolledBack(Boolean wasRolledBack) {
200         this.wasRolledBack = wasRolledBack;
201     }
202
203     @Override
204     public String toString() {
205         return ToStringBuilder.reflectionToString(this);
206     }
207
208     @JsonAnyGetter
209     public Map<String, Object> getAdditionalProperties() {
210         return this.additionalProperties;
211     }
212
213     @JsonAnySetter
214     public void setAdditionalProperty(String name, Object value) {
215         this.additionalProperties.put(name, value);
216     }
217
218     @Override
219     public int hashCode() {
220         return new HashCodeBuilder().append(percentProgress).append(requestState).append(statusMessage).append(timestamp).append(wasRolledBack).append(additionalProperties).toHashCode();
221     }
222
223     @Override
224     public boolean equals(Object other) {
225         if (other == this) {
226             return true;
227         }
228         if (!(other instanceof RequestStatus)) {
229             return false;
230         }
231         RequestStatus rhs = ((RequestStatus) other);
232         return new EqualsBuilder().append(percentProgress, rhs.percentProgress).append(requestState, rhs.requestState).append(statusMessage, rhs.statusMessage).append(timestamp, rhs.timestamp).append(wasRolledBack, rhs.wasRolledBack).append(additionalProperties, rhs.additionalProperties).isEquals();
233     }
234
235 }