830ee4e52d11df402017c8ad1e4e4612a68e7da4
[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
38 package org.onap.nbi.apis.serviceorder.model;
39
40 import com.fasterxml.jackson.annotation.JsonIgnore;
41 import com.fasterxml.jackson.annotation.JsonProperty;
42 import io.swagger.annotations.ApiModel;
43 import io.swagger.annotations.ApiModelProperty;
44 import java.util.ArrayList;
45 import java.util.List;
46 import java.util.Objects;
47 import javax.validation.Valid;
48 import javax.validation.constraints.NotNull;
49 import javax.validation.constraints.Pattern;
50
51 /**
52  * An identified part of the order. A service order is decomposed into one or more order items.
53  */
54 @ApiModel(description = "An identified part of the order. A service order is decomposed into one or more order items.")
55 @javax.annotation.Generated(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
89     @JsonProperty("orderMessage")
90     private List<OrderMessage> orderItemMessage = new ArrayList<>();
91
92
93     public ServiceOrderItem id(String id) {
94         this.id = id;
95         return this;
96     }
97
98     /**
99      * Identifier of the line item (generally it is a sequence number 01, 02, 03, …)
100      * 
101      * @return id
102      **/
103     @JsonProperty("id")
104     @ApiModelProperty(
105             value = "Identifier of the line item (generally it is a sequence number 01, 02, 03, …)")
106     @NotNull(message = "order item id cannot be null")
107     @Pattern(regexp="^(?!\\s*$).+", message="order item id cannot be empty")
108     public String getId() {
109         return id;
110     }
111
112     public void setId(String id) {
113         this.id = id;
114     }
115
116     public ServiceOrderItem action(ActionType action) {
117         this.action = action;
118         return this;
119     }
120
121     /**
122      * The action to be carried out on the Service. Can be add, modify, delete, noChange
123      * 
124      * @return action
125      **/
126     @JsonProperty("action")
127     @ApiModelProperty(value = "The action to be carried out on the Service. Can be add, modify, delete, noChange")
128     public ActionType getAction() {
129         return action;
130     }
131
132     public void setAction(ActionType action) {
133         this.action = action;
134     }
135
136     public ServiceOrderItem state(StateType state) {
137         this.state = state;
138         return this;
139     }
140
141     /**
142      * State of the order item (described in the state machine diagram)
143      * 
144      * @return state
145      **/
146     @JsonProperty("state")
147     @ApiModelProperty(value = "State of the order item (described in the state machine diagram)")
148     public StateType getState() {
149         return state;
150     }
151
152     public void setState(StateType state) {
153         this.state = state;
154     }
155
156     public ServiceOrderItem type(String type) {
157         this.type = type;
158         return this;
159     }
160
161     /**
162      * Progress of the delivery in percentage
163      *
164      * @return percentProgress
165      **/
166     @JsonProperty("percentProgress")
167     @ApiModelProperty(required = false, value = "Progress of the delivery in percentage")
168     @NotNull(message = "order item PercentProgress cannot be null")
169     public String getPercentProgress() {
170         return percentProgress;
171     }
172
173     public void setPercentProgress(String percentProgress) {
174         this.percentProgress = percentProgress;
175     }
176
177     /**
178      * 
179      * @return type
180      **/
181     @JsonProperty("@type")
182     @ApiModelProperty(value = "")
183     public String getType() {
184         return type;
185     }
186
187     public void setType(String type) {
188         this.type = type;
189     }
190
191     public ServiceOrderItem schemaLocation(String schemaLocation) {
192         this.schemaLocation = schemaLocation;
193         return this;
194     }
195
196     /**
197      * 
198      * @return schemaLocation
199      **/
200     @JsonProperty("@schemaLocation")
201     @ApiModelProperty(value = "")
202     public String getSchemaLocation() {
203         return schemaLocation;
204     }
205
206     public void setSchemaLocation(String schemaLocation) {
207         this.schemaLocation = schemaLocation;
208     }
209
210     public ServiceOrderItem baseType(String baseType) {
211         this.baseType = baseType;
212         return this;
213     }
214
215     /**
216      * 
217      * @return baseType
218      **/
219     @JsonProperty("@baseType")
220     @ApiModelProperty(value = "")
221     public String getBaseType() {
222         return baseType;
223     }
224
225     public void setBaseType(String baseType) {
226         this.baseType = baseType;
227     }
228
229     public ServiceOrderItem orderItemRelationship(List<OrderItemRelationship> orderItemRelationship) {
230         this.orderItemRelationship = orderItemRelationship;
231         return this;
232     }
233
234     public ServiceOrderItem addOrderItemRelationshipItem(OrderItemRelationship orderItemRelationshipItem) {
235         if (this.orderItemRelationship == null) {
236             this.orderItemRelationship = new ArrayList<OrderItemRelationship>();
237         }
238         this.orderItemRelationship.add(orderItemRelationshipItem);
239         return this;
240     }
241
242     /**
243      * Linked order item to the one containing this attribute
244      * 
245      * @return orderItemRelationship
246      **/
247     @JsonProperty("orderItemRelationship")
248     @ApiModelProperty(value = "Linked order item to the one containing this attribute")
249     @Valid
250     public List<OrderItemRelationship> getOrderItemRelationship() {
251         return orderItemRelationship;
252     }
253
254     public void setOrderItemRelationship(List<OrderItemRelationship> orderItemRelationship) {
255         this.orderItemRelationship = orderItemRelationship;
256     }
257
258     public ServiceOrderItem service(Service service) {
259         this.service = service;
260         return this;
261     }
262
263     /**
264      * The Service to be acted on by the order item
265      * 
266      * @return service
267      **/
268     @JsonProperty("service")
269     @ApiModelProperty(required = true, value = "The Service to be acted on by the order item")
270     @NotNull(message = "order item service cannot be null")
271     @Valid
272     public Service getService() {
273         return service;
274     }
275
276     public void setService(Service service) {
277         this.service = service;
278     }
279
280
281     public String getRequestId() {
282         return requestId;
283     }
284
285     public void setRequestId(String requestId) {
286         this.requestId = requestId;
287     }
288
289
290     public ServiceOrderItem orderItemMessage(List<OrderMessage> orderItemMessage) {
291         this.orderItemMessage = orderItemMessage;
292         return this;
293     }
294
295     public ServiceOrderItem addOrderItemMessageItem(OrderMessage orderItemMessageItem) {
296         if (this.orderItemMessage == null) {
297             this.orderItemMessage = new ArrayList<OrderMessage>();
298         }
299         boolean mesageAlreadyExist=false;
300         for (OrderMessage message : this.orderItemMessage) {
301             if(message.getCode().equals(orderItemMessageItem.getCode())){
302                 mesageAlreadyExist=true;
303
304             }
305         }
306         if(!mesageAlreadyExist) {
307             this.orderItemMessage.add(orderItemMessageItem);
308         }
309         return this;
310     }
311
312     /**
313      *
314      * @return orderItemMessage
315      **/
316     @JsonProperty("orderItemMessage")
317     @ApiModelProperty(value = "")
318     @Valid
319     public List<OrderMessage> getOrderItemMessage() {
320         return orderItemMessage;
321     }
322
323     public void setOrderMessage(List<OrderMessage> orderItemMessage) {
324         this.orderItemMessage = orderItemMessage;
325     }
326
327
328
329
330     @Override
331     public boolean equals(java.lang.Object o) {
332         if (this == o) {
333             return true;
334         }
335         if (o == null || getClass() != o.getClass()) {
336             return false;
337         }
338         ServiceOrderItem serviceOrderItem = (ServiceOrderItem) o;
339         return Objects.equals(this.id, serviceOrderItem.id) && Objects.equals(this.action, serviceOrderItem.action)
340                 && Objects.equals(this.state, serviceOrderItem.state)
341                 && Objects.equals(this.percentProgress, serviceOrderItem.percentProgress)
342                 && Objects.equals(this.type, serviceOrderItem.type)
343                 && Objects.equals(this.schemaLocation, serviceOrderItem.schemaLocation)
344                 && Objects.equals(this.baseType, serviceOrderItem.baseType)
345                 && Objects.equals(this.orderItemRelationship, serviceOrderItem.orderItemRelationship)
346                 && Objects.equals(this.service, serviceOrderItem.service)
347                 && Objects.equals(this.requestId, serviceOrderItem.requestId)
348                 && Objects.equals(this.orderItemMessage, serviceOrderItem.orderItemMessage);
349
350     }
351
352     @Override
353     public int hashCode() {
354         return Objects.hash(id, action, state, percentProgress, type, schemaLocation, baseType, orderItemRelationship, service,
355                 requestId,orderItemMessage);
356     }
357
358
359     @Override
360     public String toString() {
361         StringBuilder sb = new StringBuilder();
362         sb.append("class ServiceOrderItem {\n");
363         sb.append("    id: ").append(toIndentedString(id)).append("\n");
364         sb.append("    action: ").append(toIndentedString(action)).append("\n");
365         sb.append("    state: ").append(toIndentedString(state)).append("\n");
366         sb.append("    percentProgress: ").append(toIndentedString(percentProgress)).append("\n");
367         sb.append("    type: ").append(toIndentedString(type)).append("\n");
368         sb.append("    schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
369         sb.append("    baseType: ").append(toIndentedString(baseType)).append("\n");
370         sb.append("    orderItemRelationship: ").append(toIndentedString(orderItemRelationship)).append("\n");
371         sb.append("    requestId: ").append(toIndentedString(requestId)).append("\n");
372         sb.append("    service: ").append(toIndentedString(service)).append("\n");
373         sb.append("    service: ").append(toIndentedString(orderItemMessage)).append("\n");
374         sb.append("}");
375         return sb.toString();
376     }
377
378     /**
379      * Convert the given object to string with each line indented by 4 spaces (except the first
380      * line).
381      */
382     private String toIndentedString(java.lang.Object o) {
383         if (o == null) {
384             return "null";
385         }
386         return o.toString().replace("\n", "\n    ");
387     }
388 }
389