c68af37772e32243ecaf526f7fbabf354f295c07
[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 javax.validation.constraints.NotNull;
45 import java.util.ArrayList;
46 import java.util.List;
47 import java.util.Objects;
48
49 /**
50  * An identified part of the order. A service order is decomposed into one or more order items.
51  */
52 @ApiModel(description = "An identified part of the order. A service order is decomposed into one or more order items.")
53 @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
54         date = "2018-02-19T14:00:30.767Z")
55 public class ServiceOrderItem {
56     @JsonProperty("id")
57     private String id = null;
58
59     @JsonProperty("action")
60     private ActionType action = null;
61
62     @JsonProperty("state")
63     private StateType state = null;
64
65     @JsonProperty("percentProgress")
66     private String percentProgress = null;
67
68     @JsonProperty("@type")
69     private String type = null;
70
71     @JsonProperty("@schemaLocation")
72     private String schemaLocation = null;
73
74     @JsonProperty("@baseType")
75     private String baseType = null;
76
77     @JsonIgnore
78     private String requestId;
79
80     @JsonProperty("orderItemRelationship")
81     private List<OrderItemRelationship> orderItemRelationship = new ArrayList<>();
82
83     @JsonProperty("service")
84     private Service service = null;
85
86
87     @JsonProperty("orderMessage")
88     private List<OrderMessage> orderItemMessage = new ArrayList<>();
89
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(required = true,
103             value = "Identifier of the line item (generally it is a sequence number 01, 02, 03, …)")
104     @NotNull
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
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     public List<OrderItemRelationship> getOrderItemRelationship() {
247         return orderItemRelationship;
248     }
249
250     public void setOrderItemRelationship(List<OrderItemRelationship> orderItemRelationship) {
251         this.orderItemRelationship = orderItemRelationship;
252     }
253
254     public ServiceOrderItem service(Service service) {
255         this.service = service;
256         return this;
257     }
258
259     /**
260      * The Service to be acted on by the order item
261      * 
262      * @return service
263      **/
264     @JsonProperty("service")
265     @ApiModelProperty(required = true, value = "The Service to be acted on by the order item")
266     @NotNull
267     public Service getService() {
268         return service;
269     }
270
271     public void setService(Service service) {
272         this.service = service;
273     }
274
275
276     public String getRequestId() {
277         return requestId;
278     }
279
280     public void setRequestId(String requestId) {
281         this.requestId = requestId;
282     }
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     public List<OrderMessage> getOrderItemMessage() {
314         return orderItemMessage;
315     }
316
317     public void setOrderMessage(List<OrderMessage> orderItemMessage) {
318         this.orderItemMessage = orderItemMessage;
319     }
320
321
322
323
324     @Override
325     public boolean equals(java.lang.Object o) {
326         if (this == o) {
327             return true;
328         }
329         if (o == null || getClass() != o.getClass()) {
330             return false;
331         }
332         ServiceOrderItem serviceOrderItem = (ServiceOrderItem) o;
333         return Objects.equals(this.id, serviceOrderItem.id) && Objects.equals(this.action, serviceOrderItem.action)
334                 && Objects.equals(this.state, serviceOrderItem.state)
335                 && Objects.equals(this.percentProgress, serviceOrderItem.percentProgress)
336                 && Objects.equals(this.type, serviceOrderItem.type)
337                 && Objects.equals(this.schemaLocation, serviceOrderItem.schemaLocation)
338                 && Objects.equals(this.baseType, serviceOrderItem.baseType)
339                 && Objects.equals(this.orderItemRelationship, serviceOrderItem.orderItemRelationship)
340                 && Objects.equals(this.service, serviceOrderItem.service)
341                 && Objects.equals(this.requestId, serviceOrderItem.requestId)
342                 && Objects.equals(this.orderItemMessage, serviceOrderItem.orderItemMessage);
343
344     }
345
346     @Override
347     public int hashCode() {
348         return Objects.hash(id, action, state, percentProgress, type, schemaLocation, baseType, orderItemRelationship, service,
349                 requestId,orderItemMessage);
350     }
351
352
353     @Override
354     public String toString() {
355         StringBuilder sb = new StringBuilder();
356         sb.append("class ServiceOrderItem {\n");
357         sb.append("    id: ").append(toIndentedString(id)).append("\n");
358         sb.append("    action: ").append(toIndentedString(action)).append("\n");
359         sb.append("    state: ").append(toIndentedString(state)).append("\n");
360         sb.append("    percentProgress: ").append(toIndentedString(percentProgress)).append("\n");
361         sb.append("    type: ").append(toIndentedString(type)).append("\n");
362         sb.append("    schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
363         sb.append("    baseType: ").append(toIndentedString(baseType)).append("\n");
364         sb.append("    orderItemRelationship: ").append(toIndentedString(orderItemRelationship)).append("\n");
365         sb.append("    requestId: ").append(toIndentedString(requestId)).append("\n");
366         sb.append("    service: ").append(toIndentedString(service)).append("\n");
367         sb.append("    service: ").append(toIndentedString(orderItemMessage)).append("\n");
368         sb.append("}");
369         return sb.toString();
370     }
371
372     /**
373      * Convert the given object to string with each line indented by 4 spaces (except the first
374      * line).
375      */
376     private String toIndentedString(java.lang.Object o) {
377         if (o == null) {
378             return "null";
379         }
380         return o.toString().replace("\n", "\n    ");
381     }
382 }
383