Format Java code with respect to ONAP Code Style
[externalapi/nbi.git] / src / main / java / org / onap / nbi / apis / serviceorder / model / ServiceOrder.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 java.util.ArrayList;
40 import java.util.Date;
41 import java.util.List;
42 import java.util.Objects;
43 import javax.validation.Valid;
44 import javax.validation.constraints.NotNull;
45 import org.hibernate.validator.constraints.NotEmpty;
46 import org.onap.nbi.apis.serviceorder.serviceordervalidator.ValidServiceOrder;
47 import org.onap.nbi.commons.Resource;
48 import org.springframework.data.annotation.Id;
49 import org.springframework.data.mongodb.core.mapping.Document;
50 import com.fasterxml.jackson.annotation.JsonFormat;
51 import com.fasterxml.jackson.annotation.JsonProperty;
52 import io.swagger.annotations.ApiModel;
53 import io.swagger.annotations.ApiModelProperty;
54
55 /**
56  * A Service Order is a type of order which can be used to place an order between a customer and a
57  * service provider or between a service provider and a partner and vice versa
58  */
59 @ApiModel(
60         description = "A Service Order is a type of order which can be used to place an order between a customer and a service provider or between a service provider and a partner and vice versa")
61 @javax.annotation.Generated(
62         value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
63         date = "2018-02-19T14:00:30.767Z")
64 @Document
65 @ValidServiceOrder
66 public class ServiceOrder implements Resource {
67
68     @Id
69     @JsonProperty("id")
70     private String id = null;
71
72     @JsonProperty("href")
73     private String href = null;
74
75     @JsonProperty("externalId")
76     private String externalId = null;
77
78     @JsonProperty("priority")
79     private String priority = null;
80
81     @JsonProperty("description")
82     private String description = null;
83
84     @JsonProperty("category")
85     private String category = null;
86
87     @JsonProperty("state")
88     private StateType state = null;
89
90     @JsonProperty("orderDate")
91     private Date orderDate = null;
92
93     @JsonProperty("completionDateTime")
94     private Date completionDateTime = null;
95
96     @JsonProperty("expectedCompletionDate")
97     private Date expectedCompletionDate = null;
98
99     @JsonProperty("requestedStartDate")
100     private Date requestedStartDate = null;
101
102     @JsonProperty("requestedCompletionDate")
103     private Date requestedCompletionDate = null;
104
105     @JsonProperty("startDate")
106     private Date startDate = null;
107
108     @JsonProperty("@baseType")
109     private String baseType = null;
110
111     @JsonProperty("@type")
112     private String type = null;
113
114     @JsonProperty("@schemaLocation")
115     private String schemaLocation = null;
116
117     @JsonProperty("relatedParty")
118     private List<RelatedParty> relatedParty = null;
119
120     @JsonProperty("orderRelationship")
121     private List<OrderRelationship> orderRelationship = null;
122
123     @JsonProperty("orderItem")
124     private List<ServiceOrderItem> orderItem = null;
125
126     @JsonProperty("orderMessage")
127     private List<OrderMessage> orderMessage = null;
128
129     public ServiceOrder id(String id) {
130         this.id = id;
131         return this;
132     }
133
134     /**
135      * ID created on repository side
136      *
137      * @return id
138      **/
139     @Override
140     @JsonProperty("id")
141     @ApiModelProperty(required = true, value = "ID created on repository side")
142     public String getId() {
143         return id;
144     }
145
146     public void setId(String id) {
147         this.id = id;
148     }
149
150     public ServiceOrder href(String href) {
151         this.href = href;
152         return this;
153     }
154
155     /**
156      * Hyperlink to access the order
157      *
158      * @return href
159      **/
160     @JsonProperty("href")
161     @ApiModelProperty(value = "Hyperlink to access the order")
162     public String getHref() {
163         return href;
164     }
165
166     public void setHref(String href) {
167         this.href = href;
168     }
169
170     public ServiceOrder externalId(String externalId) {
171         this.externalId = externalId;
172         return this;
173     }
174
175     /**
176      * ID given by the consumer and only understandable by him (to facilitate his searches)
177      *
178      * @return externalId
179      **/
180     @JsonProperty("externalId")
181     @ApiModelProperty(value = "ID given by the consumer and only understandable by him (to facilitate his searches)")
182     public String getExternalId() {
183         return externalId;
184     }
185
186     public void setExternalId(String externalId) {
187         this.externalId = externalId;
188     }
189
190     public ServiceOrder priority(String priority) {
191         this.priority = priority;
192         return this;
193     }
194
195     /**
196      * A way that can be used by consumers to prioritize orders in Service Order Management system
197      * (from 0 to 4 : 0 is the highest priority, and 4 the lowest)
198      *
199      * @return priority
200      **/
201     @JsonProperty("priority")
202     @ApiModelProperty(
203             value = "A way that can be used by consumers to prioritize orders in Service Order Management system (from 0 to 4 : 0 is the highest priority, and 4 the lowest)")
204     public String getPriority() {
205         return priority;
206     }
207
208     public void setPriority(String priority) {
209         this.priority = priority;
210     }
211
212     public ServiceOrder description(String description) {
213         this.description = description;
214         return this;
215     }
216
217     /**
218      * A free-text description of the service order
219      *
220      * @return description
221      **/
222     @JsonProperty("description")
223     @ApiModelProperty(value = "A free-text description of the service order")
224     public String getDescription() {
225         return description;
226     }
227
228     public void setDescription(String description) {
229         this.description = description;
230     }
231
232     public ServiceOrder category(String category) {
233         this.category = category;
234         return this;
235     }
236
237     /**
238      * Used to categorize the order that can be useful for the OM system (e.g. “broadband”,
239      * “TVOption”, ...)
240      *
241      * @return category
242      **/
243     @JsonProperty("category")
244     @ApiModelProperty(
245             value = "Used to categorize the order that can be useful for the OM system (e.g. “broadband”, “TVOption”, ...)")
246     public String getCategory() {
247         return category;
248     }
249
250     public void setCategory(String category) {
251         this.category = category;
252     }
253
254     public ServiceOrder state(StateType state) {
255         this.state = state;
256         return this;
257     }
258
259     /**
260      * State of the order : described in the state-machine diagram
261      *
262      * @return state
263      **/
264     @JsonProperty("state")
265     @ApiModelProperty(value = "State of the order : described in the state-machine diagram")
266     public StateType getState() {
267         return state;
268     }
269
270     public void setState(StateType state) {
271         this.state = state;
272     }
273
274     public ServiceOrder orderDate(Date orderDate) {
275         this.orderDate = orderDate;
276         return this;
277     }
278
279     /**
280      * @return orderDate
281      **/
282     @JsonProperty("orderDate")
283     @ApiModelProperty(value = "")
284     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
285     public Date getOrderDate() {
286         return orderDate;
287     }
288
289     public void setOrderDate(Date orderDate) {
290         this.orderDate = orderDate;
291     }
292
293     public ServiceOrder completionDateTime(Date completionDateTime) {
294         this.completionDateTime = completionDateTime;
295         return this;
296     }
297
298     /**
299      * Date when the order was completed
300      *
301      * @return completionDateTime
302      **/
303     @JsonProperty("completionDateTime")
304     @ApiModelProperty(value = "Date when the order was completed")
305     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
306     public Date getCompletionDateTime() {
307         return completionDateTime;
308     }
309
310     public void setCompletionDateTime(Date completionDateTime) {
311         this.completionDateTime = completionDateTime;
312     }
313
314     /**
315      * @return expectedCompletionDate
316      **/
317     @JsonProperty("expectedCompletionDate")
318     @ApiModelProperty(value = "")
319     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
320     public Date getExpectedCompletionDate() {
321         return expectedCompletionDate;
322     }
323
324     public void setExpectedCompletionDate(Date expectedCompletionDate) {
325         this.expectedCompletionDate = expectedCompletionDate;
326     }
327
328     public ServiceOrder requestedStartDate(Date requestedStartDate) {
329         this.requestedStartDate = requestedStartDate;
330         return this;
331     }
332
333     /**
334      * Order start date wished by the requestor
335      *
336      * @return requestedStartDate
337      **/
338     @JsonProperty("requestedStartDate")
339     @ApiModelProperty(value = "Order start date wished by the requestor")
340     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
341     public Date getRequestedStartDate() {
342         return requestedStartDate;
343     }
344
345     public void setRequestedStartDate(Date requestedStartDate) {
346         this.requestedStartDate = requestedStartDate;
347     }
348
349     public ServiceOrder requestedCompletionDate(Date requestedCompletionDate) {
350         this.requestedCompletionDate = requestedCompletionDate;
351         return this;
352     }
353
354     /**
355      * Requested delivery date from the requestor perspective
356      *
357      * @return requestedCompletionDate
358      **/
359     @JsonProperty("requestedCompletionDate")
360     @ApiModelProperty(value = "Requested delivery date from the requestor perspective")
361     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
362     public Date getRequestedCompletionDate() {
363         return requestedCompletionDate;
364     }
365
366     public void setRequestedCompletionDate(Date requestedCompletionDate) {
367         this.requestedCompletionDate = requestedCompletionDate;
368     }
369
370     public ServiceOrder startDate(Date startDate) {
371         this.startDate = startDate;
372         return this;
373     }
374
375     /**
376      * Date when the order was started for processing
377      *
378      * @return startDate
379      **/
380     @JsonProperty("startDate")
381     @ApiModelProperty(value = "Date when the order was started for processing")
382     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
383     public Date getStartDate() {
384         return startDate;
385     }
386
387     public void setStartDate(Date startDate) {
388         this.startDate = startDate;
389     }
390
391     public ServiceOrder baseType(String baseType) {
392         this.baseType = baseType;
393         return this;
394     }
395
396     /**
397      * @return baseType
398      **/
399     @JsonProperty("@baseType")
400     @ApiModelProperty(value = "")
401     public String getBaseType() {
402         return baseType;
403     }
404
405     public void setBaseType(String baseType) {
406         this.baseType = baseType;
407     }
408
409     public ServiceOrder type(String type) {
410         this.type = type;
411         return this;
412     }
413
414     /**
415      * @return type
416      **/
417     @JsonProperty("@type")
418     @ApiModelProperty(value = "")
419     public String getType() {
420         return type;
421     }
422
423     public void setType(String type) {
424         this.type = type;
425     }
426
427     public ServiceOrder schemaLocation(String schemaLocation) {
428         this.schemaLocation = schemaLocation;
429         return this;
430     }
431
432     /**
433      * @return schemaLocation
434      **/
435     @JsonProperty("@schemaLocation")
436     @ApiModelProperty(value = "")
437     public String getSchemaLocation() {
438         return schemaLocation;
439     }
440
441     public void setSchemaLocation(String schemaLocation) {
442         this.schemaLocation = schemaLocation;
443     }
444
445     public ServiceOrder relatedParty(List<RelatedParty> relatedParty) {
446         this.relatedParty = relatedParty;
447         return this;
448     }
449
450     public ServiceOrder addRelatedPartyItem(RelatedParty relatedPartyItem) {
451         if (this.relatedParty == null) {
452             this.relatedParty = new ArrayList<RelatedParty>();
453         }
454         this.relatedParty.add(relatedPartyItem);
455         return this;
456     }
457
458     /**
459      * A list of related parties which are involved in this order and the role they are playing.
460      *
461      * @return relatedParty
462      **/
463     @JsonProperty("relatedParty")
464     @ApiModelProperty(
465             value = "A list of related parties which are involved in this order and the role they are playing.")
466     @Valid
467     public List<RelatedParty> getRelatedParty() {
468         return relatedParty;
469     }
470
471     public void setRelatedParty(List<RelatedParty> relatedParty) {
472         this.relatedParty = relatedParty;
473     }
474
475     public ServiceOrder orderRelationship(List<OrderRelationship> orderRelationship) {
476         this.orderRelationship = orderRelationship;
477         return this;
478     }
479
480     public ServiceOrder addOrderRelationshipItem(OrderRelationship orderRelationshipItem) {
481         if (this.orderRelationship == null) {
482             this.orderRelationship = new ArrayList<OrderRelationship>();
483         }
484         this.orderRelationship.add(orderRelationshipItem);
485         return this;
486     }
487
488     /**
489      * A list of related order references .Linked order to the one containing this attribute
490      *
491      * @return orderRelationship
492      **/
493     @JsonProperty("orderRelationship")
494     @ApiModelProperty(value = "A list of related order references .Linked order to the one containing this attribute")
495     @Valid
496     public List<OrderRelationship> getOrderRelationship() {
497         return orderRelationship;
498     }
499
500     public void setOrderRelationship(List<OrderRelationship> orderRelationship) {
501         this.orderRelationship = orderRelationship;
502     }
503
504     public ServiceOrder orderItem(List<ServiceOrderItem> orderItem) {
505         this.orderItem = orderItem;
506         return this;
507     }
508
509     public ServiceOrder addOrderItemItem(ServiceOrderItem orderItemItem) {
510         if (this.orderItem == null) {
511             this.orderItem = new ArrayList<ServiceOrderItem>();
512         }
513         this.orderItem.add(orderItemItem);
514         return this;
515     }
516
517     /**
518      * A list of order items that have to be processed.
519      *
520      * @return orderItem
521      **/
522     @JsonProperty("orderItem")
523     @ApiModelProperty(value = "A list of order items that have to be processed.")
524     @NotEmpty
525     @Valid
526     public List<ServiceOrderItem> getOrderItem() {
527         return orderItem;
528     }
529
530     public void setOrderItem(List<ServiceOrderItem> orderItem) {
531         this.orderItem = orderItem;
532     }
533
534     public ServiceOrder orderMessage(List<OrderMessage> orderMessage) {
535         this.orderMessage = orderMessage;
536         return this;
537     }
538
539     public ServiceOrder addOrderMessageItem(OrderMessage orderMessageItem) {
540         if (this.orderMessage == null) {
541             this.orderMessage = new ArrayList<OrderMessage>();
542         }
543         boolean mesageAlreadyExist = false;
544         for (OrderMessage message : this.orderMessage) {
545             if (message.getCode().equals(orderMessageItem.getCode())) {
546                 mesageAlreadyExist = true;
547
548             }
549         }
550         if (!mesageAlreadyExist) {
551             this.orderMessage.add(orderMessageItem);
552         }
553         return this;
554     }
555
556     /**
557      *
558      * @return orderMessage
559      **/
560     @JsonProperty("orderMessage")
561     @ApiModelProperty(value = "")
562     @Valid
563     public List<OrderMessage> getOrderMessage() {
564         return orderMessage;
565     }
566
567     public void setOrderMessage(List<OrderMessage> orderMessage) {
568         this.orderMessage = orderMessage;
569     }
570
571     @Override
572     public boolean equals(java.lang.Object o) {
573         if (this == o) {
574             return true;
575         }
576         if (o == null || getClass() != o.getClass()) {
577             return false;
578         }
579         ServiceOrder serviceOrder = (ServiceOrder) o;
580         return Objects.equals(this.id, serviceOrder.id) && Objects.equals(this.href, serviceOrder.href)
581                 && Objects.equals(this.externalId, serviceOrder.externalId)
582                 && Objects.equals(this.priority, serviceOrder.priority)
583                 && Objects.equals(this.description, serviceOrder.description)
584                 && Objects.equals(this.category, serviceOrder.category)
585                 && Objects.equals(this.state, serviceOrder.state)
586                 && Objects.equals(this.orderDate, serviceOrder.orderDate)
587                 && Objects.equals(this.completionDateTime, serviceOrder.completionDateTime)
588                 && Objects.equals(this.expectedCompletionDate, serviceOrder.expectedCompletionDate)
589                 && Objects.equals(this.requestedStartDate, serviceOrder.requestedStartDate)
590                 && Objects.equals(this.requestedCompletionDate, serviceOrder.requestedCompletionDate)
591                 && Objects.equals(this.startDate, serviceOrder.startDate)
592                 && Objects.equals(this.baseType, serviceOrder.baseType) && Objects.equals(this.type, serviceOrder.type)
593                 && Objects.equals(this.schemaLocation, serviceOrder.schemaLocation)
594                 && Objects.equals(this.relatedParty, serviceOrder.relatedParty)
595                 && Objects.equals(this.orderRelationship, serviceOrder.orderRelationship)
596                 && Objects.equals(this.orderItem, serviceOrder.orderItem)
597                 && Objects.equals(this.orderMessage, serviceOrder.orderMessage);
598     }
599
600     @Override
601     public int hashCode() {
602         return Objects.hash(id, href, externalId, priority, description, category, state, orderDate, completionDateTime,
603                 expectedCompletionDate, requestedStartDate, requestedCompletionDate, startDate, baseType, type,
604                 schemaLocation, relatedParty, orderRelationship, orderItem, orderMessage);
605     }
606
607     @Override
608     public String toString() {
609         StringBuilder sb = new StringBuilder();
610         sb.append("class ServiceOrder {\n");
611
612         sb.append("    id: ").append(toIndentedString(id)).append("\n");
613         sb.append("    href: ").append(toIndentedString(href)).append("\n");
614         sb.append("    externalId: ").append(toIndentedString(externalId)).append("\n");
615         sb.append("    priority: ").append(toIndentedString(priority)).append("\n");
616         sb.append("    description: ").append(toIndentedString(description)).append("\n");
617         sb.append("    category: ").append(toIndentedString(category)).append("\n");
618         sb.append("    state: ").append(toIndentedString(state)).append("\n");
619         sb.append("    orderDate: ").append(toIndentedString(orderDate)).append("\n");
620         sb.append("    completionDateTime: ").append(toIndentedString(completionDateTime)).append("\n");
621         sb.append("    expectedCompletionDate: ").append(toIndentedString(expectedCompletionDate)).append("\n");
622         sb.append("    requestedStartDate: ").append(toIndentedString(requestedStartDate)).append("\n");
623         sb.append("    requestedCompletionDate: ").append(toIndentedString(requestedCompletionDate)).append("\n");
624         sb.append("    startDate: ").append(toIndentedString(startDate)).append("\n");
625         sb.append("    baseType: ").append(toIndentedString(baseType)).append("\n");
626         sb.append("    type: ").append(toIndentedString(type)).append("\n");
627         sb.append("    schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
628         sb.append("    relatedParty: ").append(toIndentedString(relatedParty)).append("\n");
629         sb.append("    orderRelationship: ").append(toIndentedString(orderRelationship)).append("\n");
630         sb.append("    orderItem: ").append(toIndentedString(orderItem)).append("\n");
631         sb.append("    orderMessage: ").append(toIndentedString(orderMessage)).append("\n");
632         sb.append("}");
633         return sb.toString();
634     }
635
636     /**
637      * Convert the given object to string with each line indented by 4 spaces (except the first
638      * line).
639      */
640     private String toIndentedString(java.lang.Object o) {
641         if (o == null) {
642             return "null";
643         }
644         return o.toString().replace("\n", "\n    ");
645     }
646 }