2 * Copyright (c) 2018 Orange
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
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
20 * OpenAPI spec version: 0.1.1_inProgress
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.
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
29 * http://www.apache.org/licenses/LICENSE-2.0
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
38 package org.onap.nbi.apis.serviceorder.model;
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;
52 * An identified part of the order. A service order is decomposed into one or more order items.
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 {
59 private String id = null;
61 @JsonProperty("action")
62 private ActionType action = null;
64 @JsonProperty("state")
65 private StateType state = null;
67 @JsonProperty("percentProgress")
68 private String percentProgress = "0";
70 @JsonProperty("@type")
71 private String type = null;
73 @JsonProperty("@schemaLocation")
74 private String schemaLocation = null;
76 @JsonProperty("@baseType")
77 private String baseType = null;
80 private String requestId;
82 @JsonProperty("orderItemRelationship")
83 private List<OrderItemRelationship> orderItemRelationship = new ArrayList<>();
85 @JsonProperty("service")
86 private Service service = null;
89 @JsonProperty("orderMessage")
90 private List<OrderMessage> orderItemMessage = new ArrayList<>();
93 public ServiceOrderItem id(String id) {
99 * Identifier of the line item (generally it is a sequence number 01, 02, 03, …)
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() {
112 public void setId(String id) {
116 public ServiceOrderItem action(ActionType action) {
117 this.action = action;
122 * The action to be carried out on the Service. Can be add, modify, delete, noChange
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() {
132 public void setAction(ActionType action) {
133 this.action = action;
136 public ServiceOrderItem state(StateType state) {
142 * State of the order item (described in the state machine diagram)
146 @JsonProperty("state")
147 @ApiModelProperty(value = "State of the order item (described in the state machine diagram)")
148 public StateType getState() {
152 public void setState(StateType state) {
156 public ServiceOrderItem type(String type) {
162 * Progress of the delivery in percentage
164 * @return percentProgress
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;
173 public void setPercentProgress(String percentProgress) {
174 this.percentProgress = percentProgress;
181 @JsonProperty("@type")
182 @ApiModelProperty(value = "")
183 public String getType() {
187 public void setType(String type) {
191 public ServiceOrderItem schemaLocation(String schemaLocation) {
192 this.schemaLocation = schemaLocation;
198 * @return schemaLocation
200 @JsonProperty("@schemaLocation")
201 @ApiModelProperty(value = "")
202 public String getSchemaLocation() {
203 return schemaLocation;
206 public void setSchemaLocation(String schemaLocation) {
207 this.schemaLocation = schemaLocation;
210 public ServiceOrderItem baseType(String baseType) {
211 this.baseType = baseType;
219 @JsonProperty("@baseType")
220 @ApiModelProperty(value = "")
221 public String getBaseType() {
225 public void setBaseType(String baseType) {
226 this.baseType = baseType;
229 public ServiceOrderItem orderItemRelationship(List<OrderItemRelationship> orderItemRelationship) {
230 this.orderItemRelationship = orderItemRelationship;
234 public ServiceOrderItem addOrderItemRelationshipItem(OrderItemRelationship orderItemRelationshipItem) {
235 if (this.orderItemRelationship == null) {
236 this.orderItemRelationship = new ArrayList<OrderItemRelationship>();
238 this.orderItemRelationship.add(orderItemRelationshipItem);
243 * Linked order item to the one containing this attribute
245 * @return orderItemRelationship
247 @JsonProperty("orderItemRelationship")
248 @ApiModelProperty(value = "Linked order item to the one containing this attribute")
250 public List<OrderItemRelationship> getOrderItemRelationship() {
251 return orderItemRelationship;
254 public void setOrderItemRelationship(List<OrderItemRelationship> orderItemRelationship) {
255 this.orderItemRelationship = orderItemRelationship;
258 public ServiceOrderItem service(Service service) {
259 this.service = service;
264 * The Service to be acted on by the order item
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")
272 public Service getService() {
276 public void setService(Service service) {
277 this.service = service;
281 public String getRequestId() {
285 public void setRequestId(String requestId) {
286 this.requestId = requestId;
290 public ServiceOrderItem orderItemMessage(List<OrderMessage> orderItemMessage) {
291 this.orderItemMessage = orderItemMessage;
295 public ServiceOrderItem addOrderItemMessageItem(OrderMessage orderItemMessageItem) {
296 if (this.orderItemMessage == null) {
297 this.orderItemMessage = new ArrayList<OrderMessage>();
299 boolean mesageAlreadyExist=false;
300 for (OrderMessage message : this.orderItemMessage) {
301 if(message.getCode().equals(orderItemMessageItem.getCode())){
302 mesageAlreadyExist=true;
306 if(!mesageAlreadyExist) {
307 this.orderItemMessage.add(orderItemMessageItem);
314 * @return orderItemMessage
316 @JsonProperty("orderItemMessage")
317 @ApiModelProperty(value = "")
319 public List<OrderMessage> getOrderItemMessage() {
320 return orderItemMessage;
323 public void setOrderMessage(List<OrderMessage> orderItemMessage) {
324 this.orderItemMessage = orderItemMessage;
331 public boolean equals(java.lang.Object o) {
335 if (o == null || getClass() != o.getClass()) {
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);
353 public int hashCode() {
354 return Objects.hash(id, action, state, percentProgress, type, schemaLocation, baseType, orderItemRelationship, service,
355 requestId,orderItemMessage);
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");
375 return sb.toString();
379 * Convert the given object to string with each line indented by 4 spaces (except the first
382 private String toIndentedString(java.lang.Object o) {
386 return o.toString().replace("\n", "\n ");