summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2018-09-11 11:32:52 +0200
committerromaingimbert <romain.gimbert@orange.com>2018-09-11 11:32:52 +0200
commitbf18ae431c5e12fc7c480392d6a4881c080942f9 (patch)
tree1eb5655fcb95932cf6aa1a72a1056c31be4eca94 /src
parente1e184ce87a59d632253de00ebeedfe4e3f46796 (diff)
service order constraints control
-check data constraints of the service order -add test Change-Id: I73a0c405555938f191b594a4cfd2737c9c1563ec Issue-ID: EXTAPI-148 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/AppointmentRef.java165
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ErrorRepresentation.java271
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/Note.java169
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRef.java141
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java6
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/OrderMessage.java4
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java5
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/Place.java232
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java7
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/Service.java9
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java6
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java6
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java18
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRef.java141
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java7
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java8
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java7
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java4
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java2
-rw-r--r--src/test/java/org/onap/nbi/apis/ApiTest.java10
-rw-r--r--src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java2
21 files changed, 74 insertions, 1146 deletions
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/AppointmentRef.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/AppointmentRef.java
deleted file mode 100755
index 8535e13..0000000
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/AppointmentRef.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Copyright (c) 2018 Orange
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * API ServiceOrder serviceOrder API designed for ONAP Beijing Release. This API is build from TMF
- * open API16.5 + applied TMF guideline 3.0
- *
- * OpenAPI spec version: 0.1.1_inProgress
- *
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git Do not edit the class manually.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-
-package org.onap.nbi.apis.serviceorder.model;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import javax.validation.constraints.NotNull;
-import java.util.Objects;
-
-/**
- * Used to precise that an appointment was set-up with a related party for this order item
- */
-@ApiModel(description = "Used to precise that an appointment was set-up with a related party for this order item")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
- date = "2018-02-19T14:00:30.767Z")
-public class AppointmentRef {
- @JsonProperty("id")
- private String id = null;
-
- @JsonProperty("href")
- private String href = null;
-
- @JsonProperty("@referredType")
- private String referredType = null;
-
- public AppointmentRef id(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Unique identifier of the appointment
- *
- * @return id
- **/
- @JsonProperty("id")
- @ApiModelProperty(required = true, value = "Unique identifier of the appointment")
- @NotNull
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public AppointmentRef href(String href) {
- this.href = href;
- return this;
- }
-
- /**
- * Reference of the appointmenrt
- *
- * @return href
- **/
- @JsonProperty("href")
- @ApiModelProperty(required = true, value = "Reference of the appointmenrt")
- @NotNull
- public String getHref() {
- return href;
- }
-
- public void setHref(String href) {
- this.href = href;
- }
-
- public AppointmentRef referredType(String referredType) {
- this.referredType = referredType;
- return this;
- }
-
- /**
- * @return referredType
- **/
- @JsonProperty("@referredType")
- @ApiModelProperty(value = "")
- public String getReferredType() {
- return referredType;
- }
-
- public void setReferredType(String referredType) {
- this.referredType = referredType;
- }
-
-
- @Override
- public boolean equals(java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- AppointmentRef appointmentRef = (AppointmentRef) o;
- return Objects.equals(this.id, appointmentRef.id) && Objects.equals(this.href, appointmentRef.href)
- && Objects.equals(this.referredType, appointmentRef.referredType);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, href, referredType);
- }
-
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("class AppointmentRef {\n");
-
- sb.append(" id: ").append(toIndentedString(id)).append("\n");
- sb.append(" href: ").append(toIndentedString(href)).append("\n");
- sb.append(" referredType: ").append(toIndentedString(referredType)).append("\n");
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces (except the first
- * line).
- */
- private String toIndentedString(java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ErrorRepresentation.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ErrorRepresentation.java
deleted file mode 100755
index 57e1872..0000000
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ErrorRepresentation.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/**
- * Copyright (c) 2018 Orange
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * API ServiceOrder serviceOrder API designed for ONAP Beijing Release. This API is build from TMF
- * open API16.5 + applied TMF guideline 3.0
- *
- * OpenAPI spec version: 0.1.1_inProgress
- *
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git Do not edit the class manually.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-
-package org.onap.nbi.apis.serviceorder.model;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import javax.validation.constraints.NotNull;
-import java.util.Objects;
-
-/**
- *
- */
-@ApiModel(description = "")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
- date = "2018-02-19T14:00:30.767Z")
-public class ErrorRepresentation {
- @JsonProperty("code")
- private Integer code = null;
-
- @JsonProperty("reason")
- private String reason = null;
-
- @JsonProperty("message")
- private String message = null;
-
- @JsonProperty("status")
- private String status = null;
-
- @JsonProperty("referenceError")
- private String referenceError = null;
-
- @JsonProperty("@type")
- private String type = null;
-
- @JsonProperty("@schemaLocation")
- private String schemaLocation = null;
-
- public ErrorRepresentation code(Integer code) {
- this.code = code;
- return this;
- }
-
- /**
- * Application related code (as defined in the API or from a common list)
- *
- * @return code
- **/
- @JsonProperty("code")
- @ApiModelProperty(required = true, value = "Application related code (as defined in the API or from a common list)")
- @NotNull
- public Integer getCode() {
- return code;
- }
-
- public void setCode(Integer code) {
- this.code = code;
- }
-
- public ErrorRepresentation reason(String reason) {
- this.reason = reason;
- return this;
- }
-
- /**
- * Text that explains the reason for error. This can be shown to a client user.
- *
- * @return reason
- **/
- @JsonProperty("reason")
- @ApiModelProperty(required = true,
- value = "Text that explains the reason for error. This can be shown to a client user.")
- @NotNull
- public String getReason() {
- return reason;
- }
-
- public void setReason(String reason) {
- this.reason = reason;
- }
-
- public ErrorRepresentation message(String message) {
- this.message = message;
- return this;
- }
-
- /**
- * Text that provide more details and corrective actions related to the error. This can be shown
- * to a client user
- *
- * @return message
- **/
- @JsonProperty("message")
- @ApiModelProperty(
- value = "Text that provide more details and corrective actions related to the error. This can be shown to a client user")
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public ErrorRepresentation status(String status) {
- this.status = status;
- return this;
- }
-
- /**
- * http error code extension like 400-2
- *
- * @return status
- **/
- @JsonProperty("status")
- @ApiModelProperty(value = "http error code extension like 400-2")
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public ErrorRepresentation referenceError(String referenceError) {
- this.referenceError = referenceError;
- return this;
- }
-
- /**
- * url pointing to documentation describing the error
- *
- * @return referenceError
- **/
- @JsonProperty("referenceError")
- @ApiModelProperty(value = "url pointing to documentation describing the error")
- public String getReferenceError() {
- return referenceError;
- }
-
- public void setReferenceError(String referenceError) {
- this.referenceError = referenceError;
- }
-
- public ErrorRepresentation type(String type) {
- this.type = type;
- return this;
- }
-
- /**
- * The class type of a REST resource
- *
- * @return type
- **/
- @JsonProperty("@type")
- @ApiModelProperty(value = "The class type of a REST resource")
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public ErrorRepresentation schemaLocation(String schemaLocation) {
- this.schemaLocation = schemaLocation;
- return this;
- }
-
- /**
- * it provides a link to the schema describing a REST resource
- *
- * @return schemaLocation
- **/
- @JsonProperty("@schemaLocation")
- @ApiModelProperty(value = "it provides a link to the schema describing a REST resource")
- public String getSchemaLocation() {
- return schemaLocation;
- }
-
- public void setSchemaLocation(String schemaLocation) {
- this.schemaLocation = schemaLocation;
- }
-
-
- @Override
- public boolean equals(java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- ErrorRepresentation errorRepresentation = (ErrorRepresentation) o;
- return Objects.equals(this.code, errorRepresentation.code)
- && Objects.equals(this.reason, errorRepresentation.reason)
- && Objects.equals(this.message, errorRepresentation.message)
- && Objects.equals(this.status, errorRepresentation.status)
- && Objects.equals(this.referenceError, errorRepresentation.referenceError)
- && Objects.equals(this.type, errorRepresentation.type)
- && Objects.equals(this.schemaLocation, errorRepresentation.schemaLocation);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(code, reason, message, status, referenceError, type, schemaLocation);
- }
-
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("class ErrorRepresentation {\n");
-
- sb.append(" code: ").append(toIndentedString(code)).append("\n");
- sb.append(" reason: ").append(toIndentedString(reason)).append("\n");
- sb.append(" message: ").append(toIndentedString(message)).append("\n");
- sb.append(" status: ").append(toIndentedString(status)).append("\n");
- sb.append(" referenceError: ").append(toIndentedString(referenceError)).append("\n");
- sb.append(" type: ").append(toIndentedString(type)).append("\n");
- sb.append(" schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces (except the first
- * line).
- */
- private String toIndentedString(java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/Note.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/Note.java
deleted file mode 100755
index edd485f..0000000
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/Note.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Copyright (c) 2018 Orange
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * API ServiceOrder serviceOrder API designed for ONAP Beijing Release. This API is build from TMF
- * open API16.5 + applied TMF guideline 3.0
- *
- * OpenAPI spec version: 0.1.1_inProgress
- *
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git Do not edit the class manually.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-
-package org.onap.nbi.apis.serviceorder.model;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import java.util.Date;
-import java.util.Objects;
-
-/**
- * Extra-information about the order (e.g. useful to add extra delivery information that could be
- * useful for a human process
- */
-@ApiModel(
- description = "Extra-information about the order (e.g. useful to add extra delivery information that could be useful for a human process")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
- date = "2018-02-19T14:00:30.767Z")
-public class Note {
- @JsonProperty("date")
- private Date date = null;
-
- @JsonProperty("author")
- private String author = null;
-
- @JsonProperty("text")
- private String text = null;
-
- public Note date(Date date) {
- this.date = date;
- return this;
- }
-
- /**
- * Date of the note
- *
- * @return date
- **/
- @JsonProperty("date")
- @ApiModelProperty(value = "Date of the note")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
- public Note author(String author) {
- this.author = author;
- return this;
- }
-
- /**
- * Author of the note
- *
- * @return author
- **/
- @JsonProperty("author")
- @ApiModelProperty(value = "Author of the note")
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public Note text(String text) {
- this.text = text;
- return this;
- }
-
- /**
- * Text of the note
- *
- * @return text
- **/
- @JsonProperty("text")
- @ApiModelProperty(value = "Text of the note")
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
-
- @Override
- public boolean equals(java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Note note = (Note) o;
- return Objects.equals(this.date, note.date) && Objects.equals(this.author, note.author)
- && Objects.equals(this.text, note.text);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(date, author, text);
- }
-
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("class Note {\n");
-
- sb.append(" date: ").append(toIndentedString(date)).append("\n");
- sb.append(" author: ").append(toIndentedString(author)).append("\n");
- sb.append(" text: ").append(toIndentedString(text)).append("\n");
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces (except the first
- * line).
- */
- private String toIndentedString(java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRef.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRef.java
deleted file mode 100755
index c4860f1..0000000
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRef.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Copyright (c) 2018 Orange
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * API ServiceOrder serviceOrder API designed for ONAP Beijing Release. This API is build from TMF
- * open API16.5 + applied TMF guideline 3.0
- *
- * OpenAPI spec version: 0.1.1_inProgress
- *
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git Do not edit the class manually.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-
-package org.onap.nbi.apis.serviceorder.model;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import javax.validation.constraints.NotNull;
-import java.util.Objects;
-
-/**
- * Reference of an order item
- */
-@ApiModel(description = "Reference of an order item")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
- date = "2018-02-19T14:00:30.767Z")
-public class OrderItemRef {
- @JsonProperty("id")
- private String id = null;
-
- @JsonProperty("href")
- private String href = null;
-
- public OrderItemRef id(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Unique identifier of the order irtem
- *
- * @return id
- **/
- @JsonProperty("id")
- @ApiModelProperty(required = true, value = "Unique identifier of the order irtem")
- @NotNull
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public OrderItemRef href(String href) {
- this.href = href;
- return this;
- }
-
- /**
- * Unique reference of the order item
- *
- * @return href
- **/
- @JsonProperty("href")
- @ApiModelProperty(value = "Unique reference of the order item")
- public String getHref() {
- return href;
- }
-
- public void setHref(String href) {
- this.href = href;
- }
-
-
- @Override
- public boolean equals(java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- OrderItemRef orderItemRef = (OrderItemRef) o;
- return Objects.equals(this.id, orderItemRef.id) && Objects.equals(this.href, orderItemRef.href);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, href);
- }
-
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("class OrderItemRef {\n");
-
- sb.append(" id: ").append(toIndentedString(id)).append("\n");
- sb.append(" href: ").append(toIndentedString(href)).append("\n");
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces (except the first
- * line).
- */
- private String toIndentedString(java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java
index ecb3116..bcf776f 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java
@@ -42,6 +42,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
import java.util.Objects;
+import javax.validation.constraints.Pattern;
/**
* Linked order item to the one containing this attribute
@@ -70,7 +71,7 @@ public class OrderItemRelationship {
@JsonProperty("type")
@ApiModelProperty(required = true,
value = "The type of related order item, can be : dependancy if the order item needs to be “not started” until another order item is complete")
- @NotNull
+ @NotNull(message = "RelationshipType type cannot be null")
public RelationshipType getType() {
return type;
}
@@ -91,7 +92,8 @@ public class OrderItemRelationship {
**/
@JsonProperty("id")
@ApiModelProperty(required = true, value = "Unique identifier of an order item")
- @NotNull
+ @NotNull(message = "RelationshipType id cannot be null")
+ @Pattern(regexp="^(?!\\s*$).+", message="RelationshipType id cannot be empty")
public String getId() {
return id;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderMessage.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderMessage.java
index 0e9204b..305be15 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderMessage.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderMessage.java
@@ -140,7 +140,7 @@ public class OrderMessage {
**/
@JsonProperty("severity")
@ApiModelProperty(required = true,value = "Gravity of this message")
- @NotNull
+ @NotNull(message = "OrderMessage severity cannot be null")
public SeverityMessage getSeverity() {
return severity;
}
@@ -162,7 +162,7 @@ public class OrderMessage {
**/
@JsonProperty("correctionRequired")
@ApiModelProperty(required = true,value = "Indicator that an action is required to allow service order fullfilment to follow up")
- @NotNull
+ @NotNull(message = "OrderMessage correctionRequired cannot be null")
public boolean getCorrectionRequired() {
return correctionRequired;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java
index 9732fe2..a6d77d7 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java
@@ -40,8 +40,10 @@ package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Objects;
+import javax.validation.constraints.Pattern;
/**
* Linked order to the one containing this attribute
@@ -97,7 +99,8 @@ public class OrderRelationship {
**/
@JsonProperty("id")
@ApiModelProperty(required = true, value = "The id of the related order")
- @NotNull
+ @NotNull(message = "OrderRelationship id cannot be null")
+ @Pattern(regexp="^(?!\\s*$).+", message="OrderRelationship id cannot be empty")
public String getId() {
return id;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/Place.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/Place.java
deleted file mode 100755
index dbd17bc..0000000
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/Place.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/**
- * Copyright (c) 2018 Orange
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * API ServiceOrder serviceOrder API designed for ONAP Beijing Release. This API is build from TMF
- * open API16.5 + applied TMF guideline 3.0
- *
- * OpenAPI spec version: 0.1.1_inProgress
- *
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git Do not edit the class manually.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-
-package org.onap.nbi.apis.serviceorder.model;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import javax.validation.constraints.NotNull;
-import java.util.Objects;
-
-/**
- * Used to defined a place useful for the service (for example a delivery geographical place)
- */
-@ApiModel(description = "Used to defined a place useful for the service (for example a delivery geographical place)")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
- date = "2018-02-19T14:00:30.767Z")
-public class Place {
- @JsonProperty("id")
- private String id = null;
-
- @JsonProperty("href")
- private String href = null;
-
- @JsonProperty("name")
- private String name = null;
-
- @JsonProperty("role")
- private String role = null;
-
- @JsonProperty("@referredType")
- private String referredType = null;
-
- @JsonProperty("@schemaLocation")
- private String schemaLocation = null;
-
- public Place id(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * @return id
- **/
- @JsonProperty("id")
- @ApiModelProperty(value = "")
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Place href(String href) {
- this.href = href;
- return this;
- }
-
- /**
- * Reference of a place (for instance in google map)
- *
- * @return href
- **/
- @JsonProperty("href")
- @ApiModelProperty(value = "Reference of a place (for instance in google map)")
- public String getHref() {
- return href;
- }
-
- public void setHref(String href) {
- this.href = href;
- }
-
- public Place name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * @return name
- **/
- @JsonProperty("name")
- @ApiModelProperty(value = "")
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Place role(String role) {
- this.role = role;
- return this;
- }
-
- /**
- * The role of the place (e.g. delivery address, install site etc)
- *
- * @return role
- **/
- @JsonProperty("role")
- @ApiModelProperty(required = true, value = "The role of the place (e.g. delivery address, install site etc)")
- @NotNull
- public String getRole() {
- return role;
- }
-
- public void setRole(String role) {
- this.role = role;
- }
-
- public Place referredType(String referredType) {
- this.referredType = referredType;
- return this;
- }
-
- /**
- * @return referredType
- **/
- @JsonProperty("@referredType")
- @ApiModelProperty(value = "")
- public String getReferredType() {
- return referredType;
- }
-
- public void setReferredType(String referredType) {
- this.referredType = referredType;
- }
-
- public Place schemaLocation(String schemaLocation) {
- this.schemaLocation = schemaLocation;
- return this;
- }
-
- /**
- * @return schemaLocation
- **/
- @JsonProperty("@schemaLocation")
- @ApiModelProperty(value = "")
- public String getSchemaLocation() {
- return schemaLocation;
- }
-
- public void setSchemaLocation(String schemaLocation) {
- this.schemaLocation = schemaLocation;
- }
-
-
- @Override
- public boolean equals(java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Place place = (Place) o;
- return Objects.equals(this.id, place.id) && Objects.equals(this.href, place.href)
- && Objects.equals(this.name, place.name) && Objects.equals(this.role, place.role)
- && Objects.equals(this.referredType, place.referredType)
- && Objects.equals(this.schemaLocation, place.schemaLocation);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, href, name, role, referredType, schemaLocation);
- }
-
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("class Place {\n");
-
- sb.append(" id: ").append(toIndentedString(id)).append("\n");
- sb.append(" href: ").append(toIndentedString(href)).append("\n");
- sb.append(" name: ").append(toIndentedString(name)).append("\n");
- sb.append(" role: ").append(toIndentedString(role)).append("\n");
- sb.append(" referredType: ").append(toIndentedString(referredType)).append("\n");
- sb.append(" schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces (except the first
- * line).
- */
- private String toIndentedString(java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java
index 4f7474c..ba97162 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java
@@ -42,6 +42,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
import java.util.Objects;
+import javax.validation.constraints.Pattern;
/**
* A related party defines party which are involved in this order and the role they are playing
@@ -77,7 +78,8 @@ public class RelatedParty {
**/
@JsonProperty("id")
@ApiModelProperty(required = true, value = "Unique identifier of a related party")
- @NotNull
+ @NotNull(message = "RelatedParty Id cannot be null")
+ @Pattern(regexp="^(?!\\s*$).+", message="RelatedParty Id cannot be empty")
public String getId() {
return id;
}
@@ -118,7 +120,8 @@ public class RelatedParty {
**/
@JsonProperty("role")
@ApiModelProperty(required = true, value = "The role of the related party (e.g. Owner, requester, fullfiller etc)")
- @NotNull
+ @NotNull(message = "RelatedParty role cannot be null")
+ @Pattern(regexp="^(?!\\s*$).+", message="RelatedParty role cannot be empty")
public String getRole() {
return role;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java
index 8a65269..50bd2af 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java
@@ -40,6 +40,7 @@ package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
@@ -95,7 +96,7 @@ public class Service {
* @return id
**/
@JsonProperty("id")
- @ApiModelProperty(required = true, value = "Identifier of a service instance")
+ @ApiModelProperty(value = "Identifier of a service instance")
public String getId() {
return id;
}
@@ -223,6 +224,7 @@ public class Service {
@JsonProperty("serviceCharacteristic")
@ApiModelProperty(
value = "A list of service characteristics .A name/value pair list used to store instance specific values of attributes. The behavior is equivalent to a MAP data structure where only one entry for any given value of \"name\" can exist")
+ @Valid
public List<ServiceCharacteristic> getServiceCharacteristic() {
return serviceCharacteristic;
}
@@ -256,6 +258,7 @@ public class Service {
@JsonProperty("serviceRelationship")
@ApiModelProperty(
value = "A list or service relationships (ServiceRelationship[*]). Linked Services to the one instantiate, it can be : “reliesOn” if the Service needs another already owned Service to rely on (e.g. an option on an already owned mobile access Service) or “targets” or “isTargeted” (depending on the way of expressing the link) for any other kind of links that may be useful")
+ @Valid
public List<ServiceRelationship> getServiceRelationship() {
return serviceRelationship;
}
@@ -285,6 +288,7 @@ public class Service {
@JsonProperty("relatedParty")
@ApiModelProperty(
value = "A list of related party parties linked at the Service level (it may be a User for example)")
+ @Valid
public List<RelatedParty> getRelatedParty() {
return relatedParty;
}
@@ -303,7 +307,8 @@ public class Service {
**/
@JsonProperty("serviceSpecification")
@ApiModelProperty(value = "")
- @NotNull
+ @NotNull(message = "ServiceSpecification cannot be null")
+ @Valid
public ServiceSpecificationRef getServiceSpecification() {
return serviceSpecification;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java
index 8b2c307..f639f80 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java
@@ -40,8 +40,10 @@ package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Objects;
+import javax.validation.constraints.Pattern;
/**
* ServiceCharacteristic
@@ -71,7 +73,8 @@ public class ServiceCharacteristic {
**/
@JsonProperty("name")
@ApiModelProperty(required = true, value = "Name of characteristic")
- @NotNull
+ @NotNull(message = "ServiceCharacteristic name cannot be null")
+ @Pattern(regexp="^(?!\\s*$).+", message="ServiceCharacteristic name cannot be empty")
public String getName() {
return name;
}
@@ -108,6 +111,7 @@ public class ServiceCharacteristic {
**/
@JsonProperty("value")
@ApiModelProperty(value = "")
+ @Valid
public Value getValue() {
return value;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java
index bd86f35..4306834 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java
@@ -41,6 +41,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotEmpty;
import org.onap.nbi.apis.serviceorder.serviceordervalidator.ValidServiceOrder;
import org.onap.nbi.commons.Resource;
@@ -463,6 +465,7 @@ public class ServiceOrder implements Resource {
@JsonProperty("relatedParty")
@ApiModelProperty(
value = "A list of related parties which are involved in this order and the role they are playing.")
+ @Valid
public List<RelatedParty> getRelatedParty() {
return relatedParty;
}
@@ -491,6 +494,7 @@ public class ServiceOrder implements Resource {
**/
@JsonProperty("orderRelationship")
@ApiModelProperty(value = "A list of related order references .Linked order to the one containing this attribute")
+ @Valid
public List<OrderRelationship> getOrderRelationship() {
return orderRelationship;
}
@@ -520,6 +524,7 @@ public class ServiceOrder implements Resource {
@JsonProperty("orderItem")
@ApiModelProperty(value = "A list of order items that have to be processed.")
@NotEmpty
+ @Valid
public List<ServiceOrderItem> getOrderItem() {
return orderItem;
}
@@ -557,6 +562,7 @@ public class ServiceOrder implements Resource {
**/
@JsonProperty("orderMessage")
@ApiModelProperty(value = "")
+ @Valid
public List<OrderMessage> getOrderMessage() {
return orderMessage;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java
index c68af37..830ee4e 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java
@@ -41,10 +41,12 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
-import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
/**
* An identified part of the order. A service order is decomposed into one or more order items.
@@ -63,7 +65,7 @@ public class ServiceOrderItem {
private StateType state = null;
@JsonProperty("percentProgress")
- private String percentProgress = null;
+ private String percentProgress = "0";
@JsonProperty("@type")
private String type = null;
@@ -99,9 +101,10 @@ public class ServiceOrderItem {
* @return id
**/
@JsonProperty("id")
- @ApiModelProperty(required = true,
+ @ApiModelProperty(
value = "Identifier of the line item (generally it is a sequence number 01, 02, 03, …)")
- @NotNull
+ @NotNull(message = "order item id cannot be null")
+ @Pattern(regexp="^(?!\\s*$).+", message="order item id cannot be empty")
public String getId() {
return id;
}
@@ -162,7 +165,7 @@ public class ServiceOrderItem {
**/
@JsonProperty("percentProgress")
@ApiModelProperty(required = false, value = "Progress of the delivery in percentage")
- @NotNull
+ @NotNull(message = "order item PercentProgress cannot be null")
public String getPercentProgress() {
return percentProgress;
}
@@ -243,6 +246,7 @@ public class ServiceOrderItem {
**/
@JsonProperty("orderItemRelationship")
@ApiModelProperty(value = "Linked order item to the one containing this attribute")
+ @Valid
public List<OrderItemRelationship> getOrderItemRelationship() {
return orderItemRelationship;
}
@@ -263,7 +267,8 @@ public class ServiceOrderItem {
**/
@JsonProperty("service")
@ApiModelProperty(required = true, value = "The Service to be acted on by the order item")
- @NotNull
+ @NotNull(message = "order item service cannot be null")
+ @Valid
public Service getService() {
return service;
}
@@ -310,6 +315,7 @@ public class ServiceOrderItem {
**/
@JsonProperty("orderItemMessage")
@ApiModelProperty(value = "")
+ @Valid
public List<OrderMessage> getOrderItemMessage() {
return orderItemMessage;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRef.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRef.java
deleted file mode 100755
index e39abe6..0000000
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRef.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Copyright (c) 2018 Orange
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * API ServiceOrder serviceOrder API designed for ONAP Beijing Release. This API is build from TMF
- * open API16.5 + applied TMF guideline 3.0
- *
- * OpenAPI spec version: 0.1.1_inProgress
- *
- *
- * NOTE: This class is auto generated by the swagger code generator program.
- * https://github.com/swagger-api/swagger-codegen.git Do not edit the class manually.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-
-package org.onap.nbi.apis.serviceorder.model;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import javax.validation.constraints.NotNull;
-import java.util.Objects;
-
-/**
- * Service references
- */
-@ApiModel(description = "Service references")
-@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
- date = "2018-02-19T14:00:30.767Z")
-public class ServiceRef {
- @JsonProperty("id")
- private String id = null;
-
- @JsonProperty("href")
- private String href = null;
-
- public ServiceRef id(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Unique identifier of the service
- *
- * @return id
- **/
- @JsonProperty("id")
- @ApiModelProperty(required = true, value = "Unique identifier of the service")
- @NotNull
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public ServiceRef href(String href) {
- this.href = href;
- return this;
- }
-
- /**
- * Reference of the service
- *
- * @return href
- **/
- @JsonProperty("href")
- @ApiModelProperty(value = "Reference of the service")
- public String getHref() {
- return href;
- }
-
- public void setHref(String href) {
- this.href = href;
- }
-
-
- @Override
- public boolean equals(java.lang.Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- ServiceRef serviceRef = (ServiceRef) o;
- return Objects.equals(this.id, serviceRef.id) && Objects.equals(this.href, serviceRef.href);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, href);
- }
-
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("class ServiceRef {\n");
-
- sb.append(" id: ").append(toIndentedString(id)).append("\n");
- sb.append(" href: ").append(toIndentedString(href)).append("\n");
- sb.append("}");
- return sb.toString();
- }
-
- /**
- * Convert the given object to string with each line indented by 4 spaces (except the first
- * line).
- */
- private String toIndentedString(java.lang.Object o) {
- if (o == null) {
- return "null";
- }
- return o.toString().replace("\n", "\n ");
- }
-}
-
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java
index e8370e9..867ae1a 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java
@@ -40,6 +40,7 @@ package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Objects;
@@ -72,7 +73,8 @@ public class ServiceRelationship {
@JsonProperty("type")
@ApiModelProperty(required = true,
value = "Relationship type. It can be : “reliesOn” if the Service needs another already owned Service to rely on (e.g. an option on an already owned mobile access Service) or “targets” or “isTargeted” (depending on the way of expressing the link) for any other kind of links that may be useful")
- @NotNull
+ @NotNull(message = "Relationship type cannot be null")
+ @Valid
public RelationshipType getType() {
return type;
}
@@ -93,7 +95,8 @@ public class ServiceRelationship {
**/
@JsonProperty("service")
@ApiModelProperty(required = true, value = "Service reference")
- @NotNull
+ @NotNull(message = "Relationship service cannot be null")
+ @Valid
public Service getService() {
return service;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java
index 33033b6..f4ec4e2 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java
@@ -40,8 +40,10 @@ package org.onap.nbi.apis.serviceorder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
-import javax.validation.constraints.NotNull;
import java.util.Objects;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
/**
* The service specification (default values, etc. are fetched from the catalogue).
@@ -86,7 +88,8 @@ public class ServiceSpecificationRef {
**/
@JsonProperty("id")
@ApiModelProperty(required = true, value = "Unique identifier of the service specification")
- @NotNull
+ @NotNull(message = "ServiceSpecification id cannot be null")
+ @Pattern(regexp="^(?!\\s*$).+", message="ServiceSpecification id cannot be empty")
public String getId() {
return id;
}
@@ -161,6 +164,7 @@ public class ServiceSpecificationRef {
**/
@JsonProperty("targetServiceSchema")
@ApiModelProperty(value = "")
+ @Valid
public TargetServiceSchema getTargetServiceSchema() {
return targetServiceSchema;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java
index c0e2517..42bdf9e 100755
--- a/src/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java
@@ -42,6 +42,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
import java.util.Objects;
+import javax.validation.constraints.Pattern;
/**
*
@@ -66,7 +67,8 @@ public class TargetServiceSchema {
**/
@JsonProperty("@type")
@ApiModelProperty(required = true, value = "")
- @NotNull
+ @NotNull(message = "TargetServiceSchema @type cannot be null")
+ @Pattern(regexp="^(?!\\s*$).+", message="TargetServiceSchema @type cannot be empty")
public String getType() {
return type;
}
@@ -85,7 +87,8 @@ public class TargetServiceSchema {
**/
@JsonProperty("@schemaLocation")
@ApiModelProperty(required = true, value = "")
- @NotNull
+ @NotNull(message = "TargetServiceSchema @schemaLocation cannot be null")
+ @Pattern(regexp="^(?!\\s*$).+", message="TargetServiceSchema @schemaLocation cannot be empty")
public String getSchemaLocation() {
return schemaLocation;
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java b/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java
index badc33d..c6544af 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/service/ServiceOrderService.java
@@ -137,10 +137,6 @@ public class ServiceOrderService {
orderMessage.setMessageInformation("Incorrect service.id provided – not found in Inventory (AAI)");
serviceOrderItem.addOrderItemMessageItem(orderMessage);
}
- if ("107".equalsIgnoreCase(code)) {
- orderMessage.setMessageInformation("tenantId not found in AAI");
- serviceOrderItem.addOrderItemMessageItem(orderMessage);
- }
serviceOrderRepository.save(serviceOrder);
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java
index 88db614..4ef802e 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java
@@ -122,7 +122,7 @@ public class CheckOrderConsistenceManager {
} else if (!e2eService && !serviceOrderConsumerService.isTenantIdPresentInAAI(serviceOrder)) {
LOGGER.warn("serviceOrderItem {} for serviceOrder {} rejected cause tenantId not found in AAI",
serviceOrderItem.getId(), serviceOrderId);
- serviceOrderService.addOrderItemMessage(serviceOrder,serviceOrderItem, "107");
+ serviceOrderService.addOrderMessage(serviceOrder,"503");
return false;
}
diff --git a/src/test/java/org/onap/nbi/apis/ApiTest.java b/src/test/java/org/onap/nbi/apis/ApiTest.java
index 4d24062..489af4e 100644
--- a/src/test/java/org/onap/nbi/apis/ApiTest.java
+++ b/src/test/java/org/onap/nbi/apis/ApiTest.java
@@ -47,6 +47,7 @@ import org.onap.nbi.apis.serviceorder.model.RelatedParty;
import org.onap.nbi.apis.serviceorder.model.Service;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
+import org.onap.nbi.apis.serviceorder.model.ServiceSpecificationRef;
import org.onap.nbi.apis.serviceorder.model.StateType;
import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository;
@@ -736,6 +737,15 @@ public class ApiTest {
violations = validator.validate(serviceOrder);
assertThat(violations).isNotEmpty();
+
+ ServiceOrder serviceOrder2 = ServiceOrderAssertions.createTestServiceOrder(ActionType.ADD);
+ serviceOrder2.getOrderItem().get(0).getService().getServiceSpecification().setId("");
+ serviceOrder2.getOrderItem().get(1).getService().getServiceSpecification().setId(" ");
+
+ violations = validator.validate(serviceOrder2);
+ assertThat(violations).isNotEmpty();
+ assertThat(violations.size()).isEqualTo(2);
+
}
diff --git a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java
index 65686d2..5ff1816 100644
--- a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java
+++ b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java
@@ -23,6 +23,7 @@ import org.onap.nbi.apis.serviceorder.model.ActionType;
import org.onap.nbi.apis.serviceorder.model.OrderItemRelationship;
import org.onap.nbi.apis.serviceorder.model.OrderRelationship;
import org.onap.nbi.apis.serviceorder.model.RelatedParty;
+import org.onap.nbi.apis.serviceorder.model.RelationshipType;
import org.onap.nbi.apis.serviceorder.model.ResourceSpecification;
import org.onap.nbi.apis.serviceorder.model.Service;
import org.onap.nbi.apis.serviceorder.model.ServiceCharacteristic;
@@ -155,6 +156,7 @@ public class ServiceOrderAssertions {
List<OrderItemRelationship> orderItemRelationships = new ArrayList<>();
OrderItemRelationship orderItemRelationship = new OrderItemRelationship();
orderItemRelationship.setId("A");
+ orderItemRelationship.setType(RelationshipType.RELIESON);
orderItemRelationships.add(orderItemRelationship);
itemB.setOrderItemRelationship(orderItemRelationships);
items.add(itemB);