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