Chore: Fix typo in INFO
[externalapi/nbi.git] / src / main / java / org / onap / nbi / apis / serviceorder / model / ServiceOrderItem.java
1 /**
2  *     Copyright (c) 2018 Orange
3  *
4  *     Licensed under the Apache License, Version 2.0 (the "License");
5  *     you may not use this file except in compliance with the License.
6  *     You may obtain a copy of the License at
7  *
8  *         http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *     Unless required by applicable law or agreed to in writing, software
11  *     distributed under the License is distributed on an "AS IS" BASIS,
12  *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *     See the License for the specific language governing permissions and
14  *     limitations under the License.
15  */
16 /*
17  * API ServiceOrder serviceOrder API designed for ONAP Beijing Release. This API is build from TMF
18  * open API16.5 + applied TMF guideline 3.0
19  *
20  * OpenAPI spec version: 0.1.1_inProgress
21  * 
22  *
23  * NOTE: This class is auto generated by the swagger code generator program.
24  * https://github.com/swagger-api/swagger-codegen.git Do not edit the class manually.
25  *
26  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
27  * in compliance with the License. You may obtain a copy of the License at
28  *
29  * http://www.apache.org/licenses/LICENSE-2.0
30  *
31  * Unless required by applicable law or agreed to in writing, software distributed under the License
32  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
33  * or implied. See the License for the specific language governing permissions and limitations under
34  * the License.
35  */
36
37 package org.onap.nbi.apis.serviceorder.model;
38
39 import com.fasterxml.jackson.annotation.JsonIgnore;
40 import com.fasterxml.jackson.annotation.JsonProperty;
41 import io.swagger.annotations.ApiModel;
42 import io.swagger.annotations.ApiModelProperty;
43 import java.util.ArrayList;
44 import java.util.List;
45 import java.util.Objects;
46 import javax.validation.Valid;
47 import javax.validation.constraints.NotNull;
48 import javax.validation.constraints.Pattern;
49
50 /**
51  * An identified part of the order. A service order is decomposed into one or more order items.
52  */
53 @ApiModel(description = "An identified part of the order. A service order is decomposed into one or more order items.")
54 @javax.annotation.Generated(
55         value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
56         date = "2018-02-19T14:00:30.767Z")
57 public class ServiceOrderItem {
58     @JsonProperty("id")
59     private String id = null;
60
61     @JsonProperty("action")
62     private ActionType action = null;
63
64     @JsonProperty("state")
65     private StateType state = null;
66
67     @JsonProperty("percentProgress")
68     private String percentProgress = "0";
69
70     @JsonProperty("@type")
71     private String type = null;
72
73     @JsonProperty("@schemaLocation")
74     private String schemaLocation = null;
75
76     @JsonProperty("@baseType")
77     private String baseType = null;
78
79     @JsonIgnore
80     private String requestId;
81
82     @JsonProperty("orderItemRelationship")
83     private List<OrderItemRelationship> orderItemRelationship = new ArrayList<>();
84
85     @JsonProperty("service")
86     private Service service = null;
87
88     @JsonProperty("orderMessage")
89     private List<OrderMessage> orderItemMessage = new ArrayList<>();
90
91     public ServiceOrderItem id(String id) {
92         this.id = id;
93         return this;
94     }
95
96     /**
97      * Identifier of the line item (generally it is a sequence number 01, 02, 03, …)
98      * 
99      * @return id
100      **/
101     @JsonProperty("id")
102     @ApiModelProperty(value = "Identifier of the line item (generally it is a sequence number 01, 02, 03, …)")
103     @NotNull(message = "order item id cannot be null")
104     @Pattern(regexp = "^(?!\\s*$).+", message = "order item id cannot be empty")
105     public String getId() {
106         return id;
107     }
108
109     public void setId(String id) {
110         this.id = id;
111     }
112
113     public ServiceOrderItem action(ActionType action) {
114         this.action = action;
115         return this;
116     }
117
118     /**
119      * The action to be carried out on the Service. Can be add, modify, delete, noChange
120      * 
121      * @return action
122      **/
123     @JsonProperty("action")
124     @ApiModelProperty(value = "The action to be carried out on the Service. Can be add, modify, delete, noChange")
125     public ActionType getAction() {
126         return action;
127     }
128
129     public void setAction(ActionType action) {
130         this.action = action;
131     }
132
133     public ServiceOrderItem state(StateType state) {
134         this.state = state;
135         return this;
136     }
137
138     /**
139      * State of the order item (described in the state machine diagram)
140      * 
141      * @return state
142      **/
143     @JsonProperty("state")
144     @ApiModelProperty(value = "State of the order item (described in the state machine diagram)")
145     public StateType getState() {
146         return state;
147     }
148
149     public void setState(StateType state) {
150         this.state = state;
151     }
152
153     public ServiceOrderItem type(String type) {
154         this.type = type;
155         return this;
156     }
157
158     /**
159      * Progress of the delivery in percentage
160      *
161      * @return percentProgress
162      **/
163     @JsonProperty("percentProgress")
164     @ApiModelProperty(required = false, value = "Progress of the delivery in percentage")
165     @NotNull(message = "order item PercentProgress cannot be null")
166     public String getPercentProgress() {
167         return percentProgress;
168     }
169
170     public void setPercentProgress(String percentProgress) {
171         this.percentProgress = percentProgress;
172     }
173
174     /**
175      * 
176      * @return type
177      **/
178     @JsonProperty("@type")
179     @ApiModelProperty(value = "")
180     public String getType() {
181         return type;
182     }
183
184     public void setType(String type) {
185         this.type = type;
186     }
187
188     public ServiceOrderItem schemaLocation(String schemaLocation) {
189         this.schemaLocation = schemaLocation;
190         return this;
191     }
192
193     /**
194      * 
195      * @return schemaLocation
196      **/
197     @JsonProperty("@schemaLocation")
198     @ApiModelProperty(value = "")
199     public String getSchemaLocation() {
200         return schemaLocation;
201     }
202
203     public void setSchemaLocation(String schemaLocation) {
204         this.schemaLocation = schemaLocation;
205     }
206
207     public ServiceOrderItem baseType(String baseType) {
208         this.baseType = baseType;
209         return this;
210     }
211
212     /**
213      * 
214      * @return baseType
215      **/
216     @JsonProperty("@baseType")
217     @ApiModelProperty(value = "")
218     public String getBaseType() {
219         return baseType;
220     }
221
222     public void setBaseType(String baseType) {
223         this.baseType = baseType;
224     }
225
226     public ServiceOrderItem orderItemRelationship(List<OrderItemRelationship> orderItemRelationship) {
227         this.orderItemRelationship = orderItemRelationship;
228         return this;
229     }
230
231     public ServiceOrderItem addOrderItemRelationshipItem(OrderItemRelationship orderItemRelationshipItem) {
232         if (this.orderItemRelationship == null) {
233             this.orderItemRelationship = new ArrayList<OrderItemRelationship>();
234         }
235         this.orderItemRelationship.add(orderItemRelationshipItem);
236         return this;
237     }
238
239     /**
240      * Linked order item to the one containing this attribute
241      * 
242      * @return orderItemRelationship
243      **/
244     @JsonProperty("orderItemRelationship")
245     @ApiModelProperty(value = "Linked order item to the one containing this attribute")
246     @Valid
247     public List<OrderItemRelationship> getOrderItemRelationship() {
248         return orderItemRelationship;
249     }
250
251     public void setOrderItemRelationship(List<OrderItemRelationship> orderItemRelationship) {
252         this.orderItemRelationship = orderItemRelationship;
253     }
254
255     public ServiceOrderItem service(Service service) {
256         this.service = service;
257         return this;
258     }
259
260     /**
261      * The Service to be acted on by the order item
262      * 
263      * @return service
264      **/
265     @JsonProperty("service")
266     @ApiModelProperty(required = true, value = "The Service to be acted on by the order item")
267     @NotNull(message = "order item service cannot be null")
268     @Valid
269     public Service getService() {
270         return service;
271     }
272
273     public void setService(Service service) {
274         this.service = service;
275     }
276
277     public String getRequestId() {
278         return requestId;
279     }
280
281     public void setRequestId(String requestId) {
282         this.requestId = requestId;
283     }
284
285     public ServiceOrderItem orderItemMessage(List<OrderMessage> orderItemMessage) {
286         this.orderItemMessage = orderItemMessage;
287         return this;
288     }
289
290     public ServiceOrderItem addOrderItemMessageItem(OrderMessage orderItemMessageItem) {
291         if (this.orderItemMessage == null) {
292             this.orderItemMessage = new ArrayList<OrderMessage>();
293         }
294         boolean mesageAlreadyExist = false;
295         for (OrderMessage message : this.orderItemMessage) {
296             if (message.getCode().equals(orderItemMessageItem.getCode())) {
297                 mesageAlreadyExist = true;
298
299             }
300         }
301         if (!mesageAlreadyExist) {
302             this.orderItemMessage.add(orderItemMessageItem);
303         }
304         return this;
305     }
306
307     /**
308      *
309      * @return orderItemMessage
310      **/
311     @JsonProperty("orderItemMessage")
312     @ApiModelProperty(value = "")
313     @Valid
314     public List<OrderMessage> getOrderItemMessage() {
315         return orderItemMessage;
316     }
317
318     public void setOrderMessage(List<OrderMessage> orderItemMessage) {
319         this.orderItemMessage = orderItemMessage;
320     }
321
322     @Override
323     public boolean equals(java.lang.Object o) {
324         if (this == o) {
325             return true;
326         }
327         if (o == null || getClass() != o.getClass()) {
328             return false;
329         }
330         ServiceOrderItem serviceOrderItem = (ServiceOrderItem) o;
331         return Objects.equals(this.id, serviceOrderItem.id) && Objects.equals(this.action, serviceOrderItem.action)
332                 && Objects.equals(this.state, serviceOrderItem.state)
333                 && Objects.equals(this.percentProgress, serviceOrderItem.percentProgress)
334                 && Objects.equals(this.type, serviceOrderItem.type)
335                 && Objects.equals(this.schemaLocation, serviceOrderItem.schemaLocation)
336                 && Objects.equals(this.baseType, serviceOrderItem.baseType)
337                 && Objects.equals(this.orderItemRelationship, serviceOrderItem.orderItemRelationship)
338                 && Objects.equals(this.service, serviceOrderItem.service)
339                 && Objects.equals(this.requestId, serviceOrderItem.requestId)
340                 && Objects.equals(this.orderItemMessage, serviceOrderItem.orderItemMessage);
341
342     }
343
344     @Override
345     public int hashCode() {
346         return Objects.hash(id, action, state, percentProgress, type, schemaLocation, baseType, orderItemRelationship,
347                 service, requestId, orderItemMessage);
348     }
349
350     @Override
351     public String toString() {
352         StringBuilder sb = new StringBuilder();
353         sb.append("class ServiceOrderItem {\n");
354         sb.append("    id: ").append(toIndentedString(id)).append("\n");
355         sb.append("    action: ").append(toIndentedString(action)).append("\n");
356         sb.append("    state: ").append(toIndentedString(state)).append("\n");
357         sb.append("    percentProgress: ").append(toIndentedString(percentProgress)).append("\n");
358         sb.append("    type: ").append(toIndentedString(type)).append("\n");
359         sb.append("    schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
360         sb.append("    baseType: ").append(toIndentedString(baseType)).append("\n");
361         sb.append("    orderItemRelationship: ").append(toIndentedString(orderItemRelationship)).append("\n");
362         sb.append("    requestId: ").append(toIndentedString(requestId)).append("\n");
363         sb.append("    service: ").append(toIndentedString(service)).append("\n");
364         sb.append("    service: ").append(toIndentedString(orderItemMessage)).append("\n");
365         sb.append("}");
366         return sb.toString();
367     }
368
369     /**
370      * Convert the given object to string with each line indented by 4 spaces (except the first
371      * line).
372      */
373     private String toIndentedString(java.lang.Object o) {
374         if (o == null) {
375             return "null";
376         }
377         return o.toString().replace("\n", "\n    ");
378     }
379 }