aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthieuGeerebaert <matthieu.geerebaert@orange.com>2018-03-29 00:42:08 +0200
committerMatthieuGeerebaert <matthieu.geerebaert@orange.com>2018-04-03 23:48:32 +0200
commit7d695d108ce9f5fd5ee977fe12e47b704f507623 (patch)
tree42b4d6e72ef5546c2c9c100323b2db1b33c4ab84
parent9ac6c3cc7e3f4aec9ba69e7a5bb0800471c4e8dc (diff)
Add serviceOrder rest services
- Add create, get, find serviceOrder operations - Add tests - Add Mongo / Mysql / H2 datasource management ( H2 test ) - Add VSCode restclient samples with .settings to play with serviceOrder operations - Resolve conflict 40291, with cherry pick Change-Id: I81a76a211fe5526a3a31deb945770f0a5e2c195f Issue-ID: EXTAPI-42 Signed-off-by: MatthieuGeerebaert <matthieu.geerebaert@orange.com>
-rw-r--r--pom.xml50
-rw-r--r--restclient/.vscode/settings.json12
-rw-r--r--restclient/json/serviceOrder_create_in_completed.json43
-rw-r--r--restclient/json/serviceOrder_create_in_rejected.json29
-rw-r--r--restclient/onap.http60
-rw-r--r--restclient/serviceOrder.http29
-rw-r--r--src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java4
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/jolt/FindServiceSpecJsonTransformer.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/jolt/GetServiceSpecJsonTransformer.java1
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java196
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java106
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/ServiceCatalogUrl.java21
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/ServiceInventoryUrl.java21
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java158
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java138
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java60
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/AppointmentRef.java150
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ErrorRepresentation.java256
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/Note.java154
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRef.java126
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java130
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java177
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/Place.java217
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java199
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java56
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/Service.java357
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java148
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java589
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java300
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRef.java126
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java132
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java265
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java72
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java124
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/serviceorder/model/Value.java143
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CloudConfiguration.java35
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java14
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetRequestStatusResponse.java45
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ModelInfo.java82
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Request.java42
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java62
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestInfo.java50
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestParameters.java60
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReference.java29
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java34
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestStatus.java53
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/SubscriberInfo.java30
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/UserParams.java29
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ExecutionTask.java96
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfo.java67
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfoJson.java43
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderItemInfo.java27
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/repositories/ExecutionTaskRepository.java25
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderInfoRepository.java9
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderRepository.java11
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ServiceOrderValidator.java26
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ValidServiceOrder.java18
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java18
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java145
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAICustomerManager.java29
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIServiceTypeManager.java58
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java94
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java349
-rw-r--r--src/main/java/org/onap/nbi/exceptions/ApiError.java10
-rw-r--r--src/main/java/org/onap/nbi/exceptions/ApiExceptionHandler.java10
-rw-r--r--src/main/java/org/onap/nbi/exceptions/BackendErrorHandler.java1
-rw-r--r--src/main/java/org/onap/nbi/exceptions/BackendFunctionalException.java2
-rw-r--r--src/main/java/org/onap/nbi/exceptions/TechnicalException.java2
-rw-r--r--src/main/java/org/onap/nbi/exceptions/ValidationException.java5
-rw-r--r--src/main/resources/application-localhost.properties29
-rw-r--r--src/main/resources/application.properties2
-rw-r--r--src/test/java/org/onap/nbi/apis/ApiTest.java591
-rw-r--r--src/test/java/org/onap/nbi/apis/ServiceOrderRepositoryTest.java45
-rw-r--r--src/test/java/org/onap/nbi/apis/StatusResourceTest.java (renamed from src/test/java/org/onap/nbi/apis/resources/StatusResourceTest.java)2
-rw-r--r--src/test/java/org/onap/nbi/apis/assertions/ServiceCatalogAssertions.java (renamed from src/test/java/org/onap/nbi/apis/resources/ServiceCatalogAssertions.java)14
-rw-r--r--src/test/java/org/onap/nbi/apis/assertions/ServiceInventoryAssertions.java (renamed from src/test/java/org/onap/nbi/apis/resources/ServiceInventoryAssertions.java)21
-rw-r--r--src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java206
-rw-r--r--src/test/java/org/onap/nbi/apis/resources/ApiTest.java161
-rw-r--r--src/test/resources/application.properties6
-rw-r--r--src/test/resources/mappings/sdc_find.json2
-rw-r--r--src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json2
-rw-r--r--src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json2
-rw-r--r--src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca.json2
-rw-r--r--src/test/resources/mappings/so_delete_service_instance.json18
-rw-r--r--src/test/resources/mappings/so_get_.json20
-rw-r--r--src/test/resources/mappings/so_post_create_service_instance.json18
86 files changed, 7192 insertions, 209 deletions
diff --git a/pom.xml b/pom.xml
index 2d04270..9e03cc6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,11 @@
</dependency>
<dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
@@ -86,11 +91,39 @@
</dependency>
<dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>2.0.1.Final</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
+ <!-- mongo -->
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-mongodb</artifactId>
+ </dependency>
+
+ <!-- mysql -->
+
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ </dependency>
+
+ <!-- swagger -->
+
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>1.5.18</version>
+ </dependency>
+
<!-- jackson -->
<dependency>
@@ -121,7 +154,22 @@
<scope>test</scope>
</dependency>
- <!-- wiremock -->
+ <!-- test h2 -->
+
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>de.flapdoodle.embed</groupId>
+ <artifactId>de.flapdoodle.embed.mongo</artifactId>
+ <version>${embedded-mongo.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- test wiremock -->
<dependency>
<groupId>org.springframework.cloud</groupId>
diff --git a/restclient/.vscode/settings.json b/restclient/.vscode/settings.json
new file mode 100644
index 0000000..1753f9a
--- /dev/null
+++ b/restclient/.vscode/settings.json
@@ -0,0 +1,12 @@
+{
+ // CHARLES WEB DEBUGGING PROXY
+ //"http.proxy": "http://localhost:8888/",
+ "http.proxyStrictSSL" :false,
+ // REST CLIENT
+ "rest-client.fontSize":12,
+ "rest-client.environmentVariables": {
+ "ONAP external api nbi local": {
+ "serviceOrder.url": "http://localhost:8080/nbi/api/v1"
+ }
+ }
+} \ No newline at end of file
diff --git a/restclient/json/serviceOrder_create_in_completed.json b/restclient/json/serviceOrder_create_in_completed.json
new file mode 100644
index 0000000..64fcec9
--- /dev/null
+++ b/restclient/json/serviceOrder_create_in_completed.json
@@ -0,0 +1,43 @@
+{
+ "externalId": "LudONAP001",
+ "priority": "1",
+ "description": "Ludo first ONAP Order",
+ "category": "Consumer",
+ "requestedStartDate": "2018-02-28T13:33:37.299Z",
+ "requestedCompletionDate": "2018-02-28T13:33:37.299Z",
+ "relatedParty": [
+ {
+ "id": "6490",
+ "role": "ONAPcustomer",
+ "name": "Jean Pontus",
+ "@referredType": "individual"
+ }
+ ],
+ "orderItem": [
+ {
+ "id": "A",
+ "action": "add",
+ "service": {
+ "serviceState": "active",
+ "serviceSpecification": {
+ "id": "1e3feeb0-8e36-46c6-862c-236d9c626439"
+ }
+ }
+ },
+ {
+ "id": "B",
+ "action": "add",
+ "service": {
+ "serviceState": "active",
+ "serviceSpecification": {
+ "id": "1e3feeb0-8e36-46c6-862c-236d9c626439"
+ }
+ },
+ "orderItemRelationship": [
+ {
+ "id": "A"
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/restclient/json/serviceOrder_create_in_rejected.json b/restclient/json/serviceOrder_create_in_rejected.json
new file mode 100644
index 0000000..fa0426c
--- /dev/null
+++ b/restclient/json/serviceOrder_create_in_rejected.json
@@ -0,0 +1,29 @@
+{
+ "externalId": "LudONAP001",
+ "priority": "1",
+ "description": "Ludo first ONAP Order",
+ "category": "Consumer",
+ "requestedStartDate": "2018-02-28T13:33:37.299Z",
+ "requestedCompletionDate": "2018-02-28T13:33:37.299Z",
+ "relatedParty": [
+ {
+ "id": "6490",
+ "role": "ONAPcustomer",
+ "name": "Jean Pontus",
+ "@referredType": "individual"
+ }
+ ],
+ "orderItem": [
+ {
+ "id": "1",
+ "action": "add",
+ "service": {
+ "id": "vFW0001",
+ "serviceState": "active",
+ "serviceSpecification": {
+ "id": "1e3feeb0-8e36-46c6-862c-236d9c626439"
+ }
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/restclient/onap.http b/restclient/onap.http
new file mode 100644
index 0000000..cbec294
--- /dev/null
+++ b/restclient/onap.http
@@ -0,0 +1,60 @@
+
+## SDC Get catalog service list
+
+GET {{sdc.url}}/sdc/v1/catalog/services HTTP/1.1
+Accept: application/json
+Authorization: {{sdc.token}}
+USER_ID: {{sdc.userId}}
+X-TransactionId: {{sdc.transactionId}}
+X-FromAppId: {{sdc.appId}}
+x-ecomp-instanceid: {{sdc.instanceId}}
+
+### SDC Get Vendor Software Products
+
+GET {{sdc.url}}/onboarding-api/v1.0/vendor-software-products HTTP/1.1
+Accept: application/json
+Authorization: {{sdc.token}}
+USER_ID: {{sdc.userId}}
+X-TransactionId: {{sdc.transactionId}}
+X-FromAppId: {{sdc.appId}}
+x-ecomp-instanceid: {{sdc.instanceId}}
+
+### SO Query orchestrationRequests
+
+GET {{so.url}} HTTP/1.1
+Accept: application/json
+Authorization: {{so.token}}
+X-TransactionId: {{so.transactionId}}
+X-FromAppId: {{so.appId}}
+
+### AAI Get all Customer Accounts
+
+GET {{aai.url}}/business/customers HTTP/1.1
+Accept: application/json
+Authorization: {{aai.token}}
+X-TransactionId: {{aai.transactionId}}
+X-FromAppId: {{aai.appId}}
+
+### AAI vnfs
+
+GET {{aai.url}}/network/generic-vnfs HTTP/1.1
+Accept: application/json
+Authorization: {{aai.token}}
+X-TransactionId: {{aai.transactionId}}
+X-FromAppId: {{aai.appId}}
+
+## AAI Services list
+
+GET {{aai.url}}/service-design-and-creation/services HTTP/1.1
+Accept: application/json
+Authorization: {{aai.token}}
+X-TransactionId: {{aai.transactionId}}
+X-FromAppId: {{aai.appId}}
+
+## AAI Serivce Instance for service vMRFaaS3
+
+GET {{aai.url}}/business/customers/customer/Sina/service-subscriptions/service-subscription/vIMS/service-instances/ HTTP/1.1
+Accept: application/json
+Authorization: {{aai.token}}
+X-TransactionId: {{aai.transactionId}}
+X-FromAppId: {{aai.appId}} \ No newline at end of file
diff --git a/restclient/serviceOrder.http b/restclient/serviceOrder.http
new file mode 100644
index 0000000..c8c6905
--- /dev/null
+++ b/restclient/serviceOrder.http
@@ -0,0 +1,29 @@
+### Create REJECTED
+POST {{serviceOrder.url}}/serviceOrder
+ ?fields=id,state,description,relatedParty.id,toto
+Accept: application/json
+Content-Type: application/json
+
+< ./json/serviceOrder_create_in_rejected.json
+
+### Create COMPLETED
+POST {{serviceOrder.url}}/serviceOrder
+ ?fields=id,state,description,relatedParty.id,toto
+Accept: application/json
+Content-Type: application/json
+
+< ./json/serviceOrder_create_in_completed.json
+
+### List
+GET {{serviceOrder.url}}/serviceOrder/
+Accept: application/json
+
+### List with fields
+GET {{serviceOrder.url}}/serviceOrder
+ ?fields=id,state,description,relatedParty.id
+Accept: application/json
+
+### List COMPLETED
+GET {{serviceOrder.url}}/serviceOrder
+ ?state=COMPLETED
+Accept: application/json \ No newline at end of file
diff --git a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
index 797fde8..3214f17 100644
--- a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
+++ b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
@@ -26,4 +26,8 @@ public final class OnapComponentsUrlPaths {
public static final String AAI_GET_SERVICE_INSTANCES_PATH =
"/aai/v11/business/customers/customer/$customerId/service-subscriptions/service-subscription/$serviceSpecName/service-instances/";
+ // MSO
+ public static final String MSO_CREATE_SERVICE_INSTANCE_PATH = "/ecomp/mso/infra/serviceInstance/v4";
+ public static final String MSO_GET_REQUEST_STATUS_PATH = "/ecomp/mso/infra/orchestrationRequests/v4/";
+ public static final String MSO_DELETE_REQUEST_STATUS_PATH = "/ecomp/mso/infra/serviceInstances/";
}
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/FindServiceSpecJsonTransformer.java b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/FindServiceSpecJsonTransformer.java
index b32f9fc..742a3d4 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/FindServiceSpecJsonTransformer.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/FindServiceSpecJsonTransformer.java
@@ -7,7 +7,6 @@ import org.onap.nbi.exceptions.TechnicalException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
-
import java.util.List;
@Service
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/GetServiceSpecJsonTransformer.java b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/GetServiceSpecJsonTransformer.java
index 784ed6f..27a8dee 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/GetServiceSpecJsonTransformer.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/GetServiceSpecJsonTransformer.java
@@ -7,7 +7,6 @@ import org.onap.nbi.exceptions.TechnicalException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
-
import java.util.List;
@Service
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java
new file mode 100644
index 0000000..223e408
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/MultiClient.java
@@ -0,0 +1,196 @@
+package org.onap.nbi.apis.serviceorder;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.onap.nbi.OnapComponentsUrlPaths;
+import org.onap.nbi.apis.serviceorder.model.consumer.SubscriberInfo;
+import org.onap.nbi.exceptions.BackendFunctionalException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.UriComponentsBuilder;
+
+@Service
+public class MultiClient {
+
+ @Autowired
+ private RestTemplate restTemplate;
+
+ @Value("${aai.host}")
+ private String aaiHost;
+
+ @Value("${aai.header.authorization}")
+ private String aaiHeaderAuthorization;
+
+ @Value("${aai.api.id}")
+ private String aaiApiId;
+
+ @Value("${onap.lcpCloudRegionId}")
+ private String lcpCloudRegionId;
+
+ @Value("${onap.tenantId}")
+ private String tenantId;
+
+ @Value("${onap.cloudOwner}")
+ private String cloudOwner;
+
+ @Autowired
+ private ServiceCatalogUrl serviceCatalogUrl;
+
+ @Autowired
+ private ServiceInventoryUrl serviceInventoryUrl;
+
+
+ private static final String HEADER_AUTHORIZATION = "Authorization";
+ private static final String X_FROM_APP_ID = "X-FromAppId";
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(MultiClient.class);
+
+ public ResponseEntity<Object> getServiceCatalog(String id) {
+ StringBuilder callURL = new StringBuilder().append(serviceCatalogUrl.getServiceCatalogUrl()).append(id);
+ ResponseEntity<Object> response = callApiGet(callURL.toString(), new HttpHeaders(), null);
+ return response;
+ }
+
+ public boolean doesServiceExistInServiceInventory(String id, String serviceName, String globalSubscriberId) {
+ StringBuilder callURL = new StringBuilder().append(serviceInventoryUrl.getServiceInventoryUrl()).append(id);
+ Map<String, String> param = new HashMap<>();
+ param.put("serviceSpecification.name", serviceName);
+ param.put("relatedParty.id", globalSubscriberId);
+
+ ResponseEntity<Object> response = callApiGet(callURL.toString(), new HttpHeaders(), param);
+ if (response == null || !response.getStatusCode().equals(HttpStatus.OK)) {
+ return false;
+ }
+ return true;
+ }
+
+
+ private HttpHeaders buildRequestHeaderForAAI() {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add(HEADER_AUTHORIZATION, aaiHeaderAuthorization);
+ httpHeaders.add(X_FROM_APP_ID, aaiApiId);
+ httpHeaders.add("Accept", "application/json");
+ httpHeaders.add("Content-Type", "application/json");
+ return httpHeaders;
+ }
+
+
+ public boolean isTenantIdPresentInAAI() {
+ StringBuilder callURL = new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_TENANTS_PATH);
+ String callUrlFormated = callURL.toString().replace("$onap.lcpCloudRegionId", lcpCloudRegionId);
+ callUrlFormated = callUrlFormated.replace("$onap.cloudOwner", cloudOwner);
+
+ ResponseEntity<Object> response = callApiGet(callUrlFormated, buildRequestHeaderForAAI(), null);
+ if (response != null) {
+ LinkedHashMap body = (LinkedHashMap) response.getBody();
+ List<LinkedHashMap> tenants = (List<LinkedHashMap>) body.get("tenant");
+ for (LinkedHashMap tenant : tenants) {
+ if (tenantId.equalsIgnoreCase((String) tenant.get("tenant-id"))) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean isCustomerPresentInAAI(String customerId) {
+ StringBuilder callURL = new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_CUSTOMER_PATH)
+ .append(customerId);
+ ResponseEntity<Object> response = callApiGet(callURL.toString(), buildRequestHeaderForAAI(), null);
+ if (response != null && response.getStatusCode().equals(HttpStatus.OK)) {
+ return true;
+ }
+ return false;
+ }
+
+
+ public void putCustomer(SubscriberInfo subscriberInfo) {
+ Map<String, String> param = new HashMap<>();
+ param.put("global-customer-id", subscriberInfo.getGlobalSubscriberId());
+ param.put("subscriber-name", subscriberInfo.getSubscriberName());
+ param.put("subscriber-type", "BSS");
+ String callURL =
+ aaiHost + OnapComponentsUrlPaths.AAI_GET_CUSTOMER_PATH + subscriberInfo.getGlobalSubscriberId();
+
+ putRequest(param, callURL, buildRequestHeaderForAAI());
+ }
+
+
+ public LinkedHashMap getServicesInAaiForCustomer(String customerId) {
+ StringBuilder callURL =
+ new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICES_FOR_CUSTOMER_PATH);
+ String callUrlFormated = callURL.toString().replace("$customerId", customerId);
+
+ ResponseEntity<Object> response = callApiGet(callUrlFormated, buildRequestHeaderForAAI(), null);
+ if (response != null && response.getStatusCode().equals(HttpStatus.OK)) {
+ return (LinkedHashMap) response.getBody();
+ }
+ return null;
+ }
+
+ public void putServiceType(String globalSubscriberId, String serviceName) {
+ Map<String, String> param = new HashMap<>();
+ param.put("service-type", serviceName);
+ String callURL = aaiHost + OnapComponentsUrlPaths.AAI_PUT_SERVICE_FOR_CUSTOMER_PATH + serviceName;
+ String callUrlFormated = callURL.toString().replace("$customerId", globalSubscriberId);
+ putRequest(param, callUrlFormated, buildRequestHeaderForAAI());
+ }
+
+
+ private void putRequest(Map<String, String> param, String callUrl, HttpHeaders httpHeaders) {
+ try {
+ ResponseEntity<Object> response =
+ restTemplate.exchange(callUrl, HttpMethod.PUT, new HttpEntity<>(param, httpHeaders), Object.class);
+ LOGGER.info("response status : " + response.getStatusCodeValue());
+ if (!response.getStatusCode().equals(HttpStatus.CREATED)) {
+ LOGGER.warn("HTTP call on " + callUrl + " returns " + response.getStatusCodeValue() + ", "
+ + response.getBody().toString());
+ }
+ } catch (BackendFunctionalException e) {
+ LOGGER.error("error on calling " + callUrl + " ," + e);
+ }
+ }
+
+ private ResponseEntity<Object> callApiGet(String callURL, HttpHeaders httpHeaders, Map<String, String> param) {
+
+
+ try {
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(callURL);
+ if (param != null) {
+ for (String paramName : param.keySet()) {
+ builder.queryParam(paramName, param.get(paramName));
+ }
+ }
+ String uriBuilder = builder.build().encode().toUriString();
+
+
+ ResponseEntity<Object> response =
+ restTemplate.exchange(uriBuilder, HttpMethod.GET, new HttpEntity<>(httpHeaders), Object.class);
+ LOGGER.debug("response body : " + response.getBody().toString());
+ LOGGER.info("response status : " + response.getStatusCodeValue());
+ if (!response.getStatusCode().equals(HttpStatus.OK)) {
+ LOGGER.warn("HTTP call on " + callURL + " returns " + response.getStatusCodeValue() + ", "
+ + response.getBody().toString());
+ }
+ return response;
+
+ } catch (BackendFunctionalException e) {
+ LOGGER.error("error on calling " + callURL + " ," + e);
+ return null;
+ }
+ }
+
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java b/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java
new file mode 100644
index 0000000..b15b1c5
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java
@@ -0,0 +1,106 @@
+package org.onap.nbi.apis.serviceorder;
+
+import org.onap.nbi.apis.serviceorder.model.StateType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.MultiValueMap;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class MultiCriteriaRequestBuilder {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ServiceOrderResource.class);
+
+
+ public Query buildRequest(MultiValueMap<String, String> params) {
+ Query query = new Query();
+
+ List<String> externalIds = params.get("externalId");
+ if (!CollectionUtils.isEmpty(externalIds)) {
+ String externalId = externalIds.get(0);
+ LOGGER.debug("add criterion externalId {0}", externalId);
+ query.addCriteria(Criteria.where("externalId").is(externalId));
+
+ }
+ List<String> states = params.get("state");
+ if (!CollectionUtils.isEmpty(states)) {
+ String state = states.get(0);
+ LOGGER.debug("add criterion state {0}", state);
+ query.addCriteria(Criteria.where("state").is(StateType.fromValue(state)));
+
+ }
+ List<String> descriptions = params.get("description");
+ if (!CollectionUtils.isEmpty(descriptions)) {
+ String description = descriptions.get(0);
+ LOGGER.debug("add criterion description {0}", description);
+ query.addCriteria(Criteria.where("description").is(description));
+
+ }
+
+ handleDate(params, query);
+
+ handleOffsetAndLimit(params, query);
+
+ return query;
+ }
+
+ private void handleDate(MultiValueMap<String, String> params, Query query) {
+ List<String> orderDateLts = params.get("orderDate.lt");
+ List<String> orderDateGts = params.get("orderDate.gt");
+ if (!CollectionUtils.isEmpty(orderDateLts) || !CollectionUtils.isEmpty(orderDateGts)) {
+ Criteria orderDateCriteria = Criteria.where("orderDate");
+
+ if (!CollectionUtils.isEmpty(orderDateLts)) {
+ String orderDateLt = orderDateLts.get(0);
+ LOGGER.debug("add criterion orderDate.lt {0}", orderDateLt);
+ orderDateCriteria.lt(convertDate(orderDateLt));
+ }
+ if (!CollectionUtils.isEmpty(orderDateGts)) {
+ String orderDateGt = orderDateGts.get(0);
+ LOGGER.debug("add criterion orderDate.gt {0}", orderDateGt);
+ orderDateCriteria.gt(convertDate(orderDateGt));
+ }
+ query.addCriteria(orderDateCriteria);
+ }
+ }
+
+ private void handleOffsetAndLimit(MultiValueMap<String, String> params, Query query) {
+ List<String> offsets = params.get("offset");
+ List<String> limits = params.get("limit");
+ if (!CollectionUtils.isEmpty(offsets) && !CollectionUtils.isEmpty(limits)) {
+ String offsetString = offsets.get(0);
+ String limitString = limits.get(0);
+ int offset = Integer.parseInt(offsetString);
+ int limit = Integer.parseInt(limitString);
+ final Pageable pageableRequest = new PageRequest(offset, limit);
+ query.with(pageableRequest);
+ } else if (!CollectionUtils.isEmpty(limits)) {
+ String limitString = limits.get(0);
+ int limit = Integer.parseInt(limitString);
+ final Pageable pageableRequest = new PageRequest(0, limit);
+ query.with(pageableRequest);
+ }
+ }
+
+ private Date convertDate(String dateString) {
+ String dateFormat = "yyyy-MM-dd HH:mm:ss.SSS";
+ SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
+ try {
+ return formatter.parse(dateString);
+ } catch (ParseException e) {
+ LOGGER.error("unable to convert date " + dateString + ", the pattern is " + dateFormat + " ; " + e);
+ }
+ return null;
+
+ }
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceCatalogUrl.java b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceCatalogUrl.java
new file mode 100644
index 0000000..d76bb2d
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceCatalogUrl.java
@@ -0,0 +1,21 @@
+package org.onap.nbi.apis.serviceorder;
+
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ServiceCatalogUrl {
+
+
+ @Value("${nbi.url}")
+ private String nbiUrl;
+
+ public String getServiceCatalogUrl() {
+
+ return new StringBuilder().append(nbiUrl).append("/serviceSpecification/").toString();
+
+ }
+
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceInventoryUrl.java b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceInventoryUrl.java
new file mode 100644
index 0000000..7165bb0
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceInventoryUrl.java
@@ -0,0 +1,21 @@
+package org.onap.nbi.apis.serviceorder;
+
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ServiceInventoryUrl {
+
+ @Value("${nbi.url}")
+ private String nbiUrl;
+
+
+ public String getServiceInventoryUrl() {
+
+ return new StringBuilder().append(nbiUrl).append("/service/").toString();
+
+ }
+
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java
new file mode 100644
index 0000000..1842cfe
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/ServiceOrderResource.java
@@ -0,0 +1,158 @@
+package org.onap.nbi.apis.serviceorder;
+
+import java.util.Date;
+import java.util.List;
+import javax.validation.Valid;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
+import org.onap.nbi.apis.serviceorder.model.StateType;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
+import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderInfoRepository;
+import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderRepository;
+import org.onap.nbi.apis.serviceorder.workflow.CheckOrderConsistenceManager;
+import org.onap.nbi.apis.serviceorder.workflow.CreateAAICustomerManager;
+import org.onap.nbi.apis.serviceorder.workflow.CreateAAIServiceTypeManager;
+import org.onap.nbi.apis.serviceorder.workflow.SOTaskManager;
+import org.onap.nbi.commons.JsonRepresentation;
+import org.onap.nbi.commons.ResourceManagement;
+import org.onap.nbi.exceptions.ValidationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.util.MultiValueMap;
+import org.springframework.validation.Errors;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/serviceOrder")
+@EnableScheduling
+public class ServiceOrderResource extends ResourceManagement<ServiceOrder> {
+
+ @Autowired
+ ServiceOrderRepository serviceOrderRepository;
+
+ @Autowired
+ CheckOrderConsistenceManager checkOrderConsistenceManager;
+
+ @Autowired
+ CreateAAICustomerManager createAAICustomer;
+
+ @Autowired
+ CreateAAIServiceTypeManager createAAIServiceType;
+
+ @Autowired
+ MongoTemplate mongoTemplate;
+
+ @Autowired
+ SOTaskManager serviceOrchestratorManager;
+
+ @Autowired
+ ServiceOrderInfoRepository serviceOrderInfoRepository;
+
+ @Autowired
+ MultiCriteriaRequestBuilder multiCriteriaRequestBuilder;
+
+
+ @GetMapping(value = "/{serviceOrderId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Object> getServiceOrder(@PathVariable String serviceOrderId,
+ @RequestParam MultiValueMap<String, String> params) {
+
+ ServiceOrder serviceOrder = serviceOrderRepository.findOne(serviceOrderId);
+ if (serviceOrder == null) {
+ return ResponseEntity.notFound().build();
+ }
+
+ JsonRepresentation filter = new JsonRepresentation(params);
+ return this.getResponse(serviceOrder, filter);
+ }
+
+ @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Object> findServiceOrder(@RequestParam MultiValueMap<String, String> params) {
+
+ Query query = multiCriteriaRequestBuilder.buildRequest(params);
+ List<ServiceOrder> serviceOrders = mongoTemplate.find(query, ServiceOrder.class);
+ JsonRepresentation filter = new JsonRepresentation(params);
+ long totalCount = serviceOrderRepository.count();
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("X-Total-Count", String.valueOf(totalCount));
+ headers.add("X-Result-Count", String.valueOf(serviceOrders.size()));
+
+ ResponseEntity<Object> response = this.findResponse(serviceOrders, filter, headers);
+ return response;
+
+ }
+
+ @DeleteMapping(value = "/{serviceOrderId}")
+ public ResponseEntity<Object> deleteServiceOrder(@PathVariable String serviceOrderId) {
+
+ serviceOrderRepository.delete(serviceOrderId);
+
+ return this.deleteResponse();
+
+ }
+
+ @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Object> createServiceOrder(@Valid @RequestBody ServiceOrder serviceOrder, Errors errors,
+ @RequestParam MultiValueMap<String, String> params) {
+
+
+ if (errors != null && errors.hasErrors()) {
+ throw new ValidationException(errors.getAllErrors());
+ }
+
+ serviceOrder.setState(StateType.ACKNOWLEDGED);
+ serviceOrder.setOrderDate(new Date());
+ for (ServiceOrderItem serviceOrderItem : serviceOrder.getOrderItem()) {
+ serviceOrderItem.setState(StateType.ACKNOWLEDGED);
+ }
+
+ ServiceOrder serviceOrderSaved = serviceOrderRepository.save(serviceOrder);
+ serviceOrderSaved.setHref("serviceOrder/" + serviceOrderSaved.getId());
+ serviceOrderRepository.save(serviceOrderSaved);
+ JsonRepresentation filter = new JsonRepresentation(params);
+ return this.createResponse(serviceOrderSaved, filter);
+
+ }
+
+ @Scheduled(fixedDelay = 5000)
+ public void scheduleCheckServiceOrders() {
+ List<ServiceOrder> acknowledgedOrders = serviceOrderRepository.findByState(StateType.ACKNOWLEDGED);
+ for (ServiceOrder serviceOrder : acknowledgedOrders) {
+ ServiceOrderInfo serviceOrderInfo = checkOrderConsistenceManager.checkServiceOrder(serviceOrder);
+ if (serviceOrderInfo.isServiceOrderRejected()) {
+ changeServiceOrderState(serviceOrder, StateType.REJECTED);
+ } else if (serviceOrderInfo.isAllItemsCompleted()) {
+ changeServiceOrderState(serviceOrder, StateType.COMPLETED);
+ } else {
+ serviceOrderRepository.save(serviceOrder);
+ createAAICustomer.createAAICustomer(serviceOrderInfo);
+ createAAIServiceType.createAAIServiceType(serviceOrder, serviceOrderInfo);
+ serviceOrchestratorManager.registerServiceOrder(serviceOrder, serviceOrderInfo);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param serviceOrder
+ * @param stateType
+ */
+ private void changeServiceOrderState(ServiceOrder serviceOrder, StateType stateType) {
+ serviceOrder.setState(stateType);
+ serviceOrder.setCompletionDateTime(new Date());
+ serviceOrderRepository.save(serviceOrder);
+ }
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
new file mode 100644
index 0000000..96d9893
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
@@ -0,0 +1,138 @@
+package org.onap.nbi.apis.serviceorder;
+
+import org.onap.nbi.OnapComponentsUrlPaths;
+import org.onap.nbi.apis.serviceorder.model.consumer.CreateServiceInstanceResponse;
+import org.onap.nbi.apis.serviceorder.model.consumer.GetRequestStatusResponse;
+import org.onap.nbi.apis.serviceorder.model.consumer.RequestDetails;
+import org.onap.nbi.exceptions.BackendFunctionalException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+@Service
+public class SoClient {
+
+ public static final String RESPONSE_STATUS = "response status : ";
+ public static final String RESPONSE_BODY = "response body : ";
+ public static final String RETURNS = " returns ";
+ public static final String ERROR_ON_CALLING = "error on calling ";
+ @Autowired
+ private RestTemplate restTemplate;
+
+ @Value("${so.host}")
+ private String soHostname;
+
+ @Value("${so.api.id}")
+ private String soApiId;
+
+ @Value("${so.header.authorization}")
+ private String soHeaderAuthorization;
+
+ private static final String HEADER_AUTHORIZATION = "Authorization";
+ private static final String X_FROM_APP_ID = "X-FromAppId";
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SoClient.class);
+
+
+ public ResponseEntity<CreateServiceInstanceResponse> callCreateServiceInstance(RequestDetails requestDetails) {
+
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Calling SO CreateServiceInstance with requestDetails : " + requestDetails.toString());
+ }
+
+ String url = soHostname + OnapComponentsUrlPaths.MSO_CREATE_SERVICE_INSTANCE_PATH;
+
+ HttpEntity<RequestDetails> requestDetailEntity = new HttpEntity<>(requestDetails, buildRequestHeader());
+
+ try {
+ ResponseEntity<CreateServiceInstanceResponse> response = restTemplate.exchange(url, HttpMethod.POST,
+ new HttpEntity<>(requestDetailEntity, buildRequestHeader()), CreateServiceInstanceResponse.class);
+
+ logResponsePost(url, response);
+ return response;
+
+ } catch (BackendFunctionalException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return null;
+ }
+ }
+
+ public ResponseEntity<CreateServiceInstanceResponse> callDeleteServiceInstance(RequestDetails requestDetails,
+ String serviceId) {
+
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Calling SO DeleteServiceInstance with requestDetails : " + requestDetails.toString());
+ }
+
+ String url = soHostname + OnapComponentsUrlPaths.MSO_DELETE_REQUEST_STATUS_PATH + serviceId;
+
+ HttpEntity<RequestDetails> requestDetailEntity = new HttpEntity<>(requestDetails, buildRequestHeader());
+
+ try {
+ ResponseEntity<CreateServiceInstanceResponse> response = restTemplate.exchange(url, HttpMethod.DELETE,
+ new HttpEntity<>(requestDetailEntity, buildRequestHeader()), CreateServiceInstanceResponse.class);
+
+ logResponsePost(url, response);
+ return response;
+
+ } catch (BackendFunctionalException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return null;
+ }
+
+ }
+
+ private void logResponsePost(String url, ResponseEntity<CreateServiceInstanceResponse> response) {
+ LOGGER.info(RESPONSE_STATUS + response.getStatusCodeValue());
+ LOGGER.debug(RESPONSE_BODY + response.getBody().toString());
+
+ if (!response.getStatusCode().equals(HttpStatus.CREATED)) {
+ LOGGER.warn("HTTP call SO on " + url + RETURNS + response.getStatusCodeValue() + ", "
+ + response.getBody().toString());
+ }
+ }
+
+
+ public GetRequestStatusResponse callGetRequestStatus(String requestId) {
+ String url = soHostname + OnapComponentsUrlPaths.MSO_GET_REQUEST_STATUS_PATH + requestId;
+
+ try {
+
+ ResponseEntity<GetRequestStatusResponse> response = restTemplate.exchange(url, HttpMethod.GET,
+ new HttpEntity<>(buildRequestHeader()), GetRequestStatusResponse.class);
+ logResponseGet(url, response);
+ return response.getBody();
+
+ } catch (BackendFunctionalException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return null;
+ }
+ }
+
+ private void logResponseGet(String url, ResponseEntity<GetRequestStatusResponse> response) {
+ LOGGER.debug(RESPONSE_BODY + response.getBody().toString());
+ LOGGER.info(RESPONSE_STATUS + response.getStatusCodeValue());
+ if (!response.getStatusCode().equals(HttpStatus.OK)) {
+ LOGGER.warn("HTTP call on " + url + RETURNS + response.getStatusCodeValue() + ", "
+ + response.getBody().toString());
+ }
+ }
+
+ private HttpHeaders buildRequestHeader() {
+ HttpHeaders httpHeaders = new HttpHeaders();
+ httpHeaders.add(HEADER_AUTHORIZATION, soHeaderAuthorization);
+ httpHeaders.add(X_FROM_APP_ID, soApiId);
+ httpHeaders.add("Accept", "application/json");
+ httpHeaders.add("Content-Type", "application/json");
+ return httpHeaders;
+ }
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java
new file mode 100644
index 0000000..f9543e6
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ActionType.java
@@ -0,0 +1,60 @@
+package org.onap.nbi.apis.serviceorder.model;
+/*
+ * 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.
+ */
+
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+/**
+ *
+ */
+public enum ActionType {
+
+ ADD("add"),
+
+ MODIFY("modify"),
+
+ DELETE("delete"),
+
+ NOCHANGE("noChange");
+
+ private String value;
+
+ ActionType(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ @JsonCreator
+ public static ActionType fromValue(String text) {
+ for (ActionType b : ActionType.values()) {
+ if (String.valueOf(b.value).equals(text)) {
+ return b;
+ }
+ }
+ return null;
+ }
+}
+
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
new file mode 100755
index 0000000..98ac0a1
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/AppointmentRef.java
@@ -0,0 +1,150 @@
+/*
+ * 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
new file mode 100755
index 0000000..ed35a63
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ErrorRepresentation.java
@@ -0,0 +1,256 @@
+/*
+ * 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
new file mode 100755
index 0000000..04cef33
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/Note.java
@@ -0,0 +1,154 @@
+/*
+ * 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
new file mode 100755
index 0000000..141726d
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRef.java
@@ -0,0 +1,126 @@
+/*
+ * 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
new file mode 100755
index 0000000..0bd296c
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderItemRelationship.java
@@ -0,0 +1,130 @@
+/*
+ * 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;
+
+/**
+ * Linked order item to the one containing this attribute
+ */
+@ApiModel(description = "Linked order item to the one containing this attribute")
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+ date = "2018-02-19T14:00:30.767Z")
+public class OrderItemRelationship {
+ @JsonProperty("type")
+ private RelationshipType type = null;
+
+ @JsonProperty("id")
+ private String id = null;
+
+ public OrderItemRelationship type(RelationshipType type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * The type of related order item, can be : dependancy if the order item needs to be “not
+ * started” until another order item is complete
+ *
+ * @return type
+ **/
+ @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
+ public RelationshipType getType() {
+ return type;
+ }
+
+ public void setType(RelationshipType type) {
+ this.type = type;
+ }
+
+ public OrderItemRelationship id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Unique identifier of an order item
+ *
+ * @return id
+ **/
+ @JsonProperty("id")
+ @ApiModelProperty(required = true, value = "Unique identifier of an order item")
+ @NotNull
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ OrderItemRelationship orderItemRelationship = (OrderItemRelationship) o;
+ return Objects.equals(this.type, orderItemRelationship.type)
+ && Objects.equals(this.id, orderItemRelationship.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type, id);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class OrderItemRelationship {\n");
+
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append(" id: ").append(toIndentedString(id)).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/OrderRelationship.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java
new file mode 100755
index 0000000..4856d7e
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/OrderRelationship.java
@@ -0,0 +1,177 @@
+/*
+ * 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;
+
+/**
+ * Linked order to the one containing this attribute
+ */
+@ApiModel(description = "Linked order to the one containing this attribute")
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+ date = "2018-02-19T14:00:30.767Z")
+public class OrderRelationship {
+ @JsonProperty("type")
+ private String type = null;
+
+ @JsonProperty("id")
+ private String id = null;
+
+ @JsonProperty("href")
+ private String href = null;
+
+ @JsonProperty("@referredType")
+ private String referredType = null;
+
+ public OrderRelationship type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * The type of related order, can be : “dependency” if the order needs to be “not started” until
+ * another order item is complete (a service order in this case) or “cross-ref” to keep track of
+ * the source order (a productOrder)
+ *
+ * @return type
+ **/
+ @JsonProperty("type")
+ @ApiModelProperty(
+ value = "The type of related order, can be : “dependency” if the order needs to be “not started” until another order item is complete (a service order in this case) or “cross-ref” to keep track of the source order (a productOrder)")
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public OrderRelationship id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * The id of the related order
+ *
+ * @return id
+ **/
+ @JsonProperty("id")
+ @ApiModelProperty(required = true, value = "The id of the related order")
+ @NotNull
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public OrderRelationship href(String href) {
+ this.href = href;
+ return this;
+ }
+
+ /**
+ * A hyperlink to the related order
+ *
+ * @return href
+ **/
+ @JsonProperty("href")
+ @ApiModelProperty(value = "A hyperlink to the related order")
+ public String getHref() {
+ return href;
+ }
+
+ public void setHref(String href) {
+ this.href = href;
+ }
+
+ public OrderRelationship 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;
+ }
+ OrderRelationship orderRelationship = (OrderRelationship) o;
+ return Objects.equals(this.type, orderRelationship.type) && Objects.equals(this.id, orderRelationship.id)
+ && Objects.equals(this.href, orderRelationship.href)
+ && Objects.equals(this.referredType, orderRelationship.referredType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type, id, href, referredType);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class OrderRelationship {\n");
+
+ sb.append(" type: ").append(toIndentedString(type)).append("\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/Place.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/Place.java
new file mode 100755
index 0000000..f39fa95
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/Place.java
@@ -0,0 +1,217 @@
+/*
+ * 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
new file mode 100755
index 0000000..ae69f67
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelatedParty.java
@@ -0,0 +1,199 @@
+/*
+ * 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;
+
+/**
+ * A related party defines party which are involved in this order and the role they are playing
+ */
+@ApiModel(description = "A related party defines party which are involved in this order and the role they are playing")
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+ date = "2018-02-19T14:00:30.767Z")
+public class RelatedParty {
+ @JsonProperty("id")
+ private String id = null;
+
+ @JsonProperty("href")
+ private String href = null;
+
+ @JsonProperty("role")
+ private String role = null;
+
+ @JsonProperty("name")
+ private String name = null;
+
+ @JsonProperty("@referredType")
+ private String referredType = null;
+
+ public RelatedParty id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Unique identifier of a related party
+ *
+ * @return id
+ **/
+ @JsonProperty("id")
+ @ApiModelProperty(required = true, value = "Unique identifier of a related party")
+ @NotNull
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public RelatedParty href(String href) {
+ this.href = href;
+ return this;
+ }
+
+ /**
+ * An hyperlink to the party
+ *
+ * @return href
+ **/
+ @JsonProperty("href")
+ @ApiModelProperty(value = "An hyperlink to the party")
+ public String getHref() {
+ return href;
+ }
+
+ public void setHref(String href) {
+ this.href = href;
+ }
+
+ public RelatedParty role(String role) {
+ this.role = role;
+ return this;
+ }
+
+ /**
+ * The role of the related party (e.g. Owner, requester, fullfiller etc)
+ *
+ * @return role
+ **/
+ @JsonProperty("role")
+ @ApiModelProperty(required = true, value = "The role of the related party (e.g. Owner, requester, fullfiller etc)")
+ @NotNull
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ public RelatedParty name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Name of the related party
+ *
+ * @return name
+ **/
+ @JsonProperty("name")
+ @ApiModelProperty(value = "Name of the related party")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public RelatedParty 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;
+ }
+ RelatedParty relatedParty = (RelatedParty) o;
+ return Objects.equals(this.id, relatedParty.id) && Objects.equals(this.href, relatedParty.href)
+ && Objects.equals(this.role, relatedParty.role) && Objects.equals(this.name, relatedParty.name)
+ && Objects.equals(this.referredType, relatedParty.referredType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, href, role, name, referredType);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class RelatedParty {\n");
+
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" href: ").append(toIndentedString(href)).append("\n");
+ sb.append(" role: ").append(toIndentedString(role)).append("\n");
+ sb.append(" name: ").append(toIndentedString(name)).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/RelationshipType.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java
new file mode 100644
index 0000000..396bd04
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/RelationshipType.java
@@ -0,0 +1,56 @@
+package org.onap.nbi.apis.serviceorder.model;
+
+/*
+ * 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.
+ */
+
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+/**
+ *
+ */
+public enum RelationshipType {
+
+ RELIESON("reliesOn");
+
+ private String value;
+
+ RelationshipType(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ @JsonCreator
+ public static RelationshipType fromValue(String text) {
+ for (RelationshipType b : RelationshipType.values()) {
+ if (String.valueOf(b.value).equals(text)) {
+ return b;
+ }
+ }
+ return null;
+ }
+}
+
+
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
new file mode 100755
index 0000000..1253ce6
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/Service.java
@@ -0,0 +1,357 @@
+/*
+ * 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.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * Service attributes description (these are as per the Service ODE model as used in the Service
+ * Inventory specification)
+ */
+@ApiModel(
+ description = "Service attributes description (these are as per the Service ODE model as used in the Service Inventory specification)")
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+ date = "2018-02-19T14:00:30.767Z")
+public class Service {
+ @JsonProperty("id")
+ private String id = null;
+
+ @JsonProperty("href")
+ private String href = null;
+
+ @JsonProperty("name")
+ private String name = null;
+
+ @JsonProperty("serviceState")
+ private String serviceState = null;
+
+ @JsonProperty("@type")
+ private String type = null;
+
+ @JsonProperty("@schemaLocation")
+ private String schemaLocation = null;
+
+ @JsonProperty("serviceCharacteristic")
+ private List<ServiceCharacteristic> serviceCharacteristic = null;
+
+ @JsonProperty("serviceRelationship")
+ private List<ServiceRelationship> serviceRelationship = null;
+
+ @JsonProperty("relatedParty")
+ private List<RelatedParty> relatedParty = null;
+
+ @JsonProperty("serviceSpecification")
+ private ServiceSpecificationRef serviceSpecification = null;
+
+ public Service id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Identifier of a service instance
+ *
+ * @return id
+ **/
+ @JsonProperty("id")
+ @ApiModelProperty(required = true, value = "Identifier of a service instance")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public Service href(String href) {
+ this.href = href;
+ return this;
+ }
+
+ /**
+ * Reference to the owned Service (useful for delete or modify command)
+ *
+ * @return href
+ **/
+ @JsonProperty("href")
+ @ApiModelProperty(value = "Reference to the owned Service (useful for delete or modify command)")
+ public String getHref() {
+ return href;
+ }
+
+ public void setHref(String href) {
+ this.href = href;
+ }
+
+ public Service name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Name of the service
+ *
+ * @return name
+ **/
+ @JsonProperty("name")
+ @ApiModelProperty(value = "Name of the service")
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Service serviceState(String serviceState) {
+ this.serviceState = serviceState;
+ return this;
+ }
+
+ /**
+ * The lifecycle state of the service
+ *
+ * @return serviceState
+ **/
+ @JsonProperty("serviceState")
+ @ApiModelProperty(value = "The lifecycle state of the service")
+ public String getServiceState() {
+ return serviceState;
+ }
+
+ public void setServiceState(String serviceState) {
+ this.serviceState = serviceState;
+ }
+
+ public Service type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * @return type
+ **/
+ @JsonProperty("@type")
+ @ApiModelProperty(value = "")
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Service 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;
+ }
+
+ public Service serviceCharacteristic(List<ServiceCharacteristic> serviceCharacteristic) {
+ this.serviceCharacteristic = serviceCharacteristic;
+ return this;
+ }
+
+ public Service addServiceCharacteristicItem(ServiceCharacteristic serviceCharacteristicItem) {
+ if (this.serviceCharacteristic == null) {
+ this.serviceCharacteristic = new ArrayList<ServiceCharacteristic>();
+ }
+ this.serviceCharacteristic.add(serviceCharacteristicItem);
+ return this;
+ }
+
+ /**
+ * 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 \&quot;name\&quot; can exist
+ *
+ * @return serviceCharacteristic
+ **/
+ @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")
+ public List<ServiceCharacteristic> getServiceCharacteristic() {
+ return serviceCharacteristic;
+ }
+
+ public void setServiceCharacteristic(List<ServiceCharacteristic> serviceCharacteristic) {
+ this.serviceCharacteristic = serviceCharacteristic;
+ }
+
+ public Service serviceRelationship(List<ServiceRelationship> serviceRelationship) {
+ this.serviceRelationship = serviceRelationship;
+ return this;
+ }
+
+ public Service addServiceRelationshipItem(ServiceRelationship serviceRelationshipItem) {
+ if (this.serviceRelationship == null) {
+ this.serviceRelationship = new ArrayList<ServiceRelationship>();
+ }
+ this.serviceRelationship.add(serviceRelationshipItem);
+ return this;
+ }
+
+ /**
+ * 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
+ *
+ * @return serviceRelationship
+ **/
+ @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")
+ public List<ServiceRelationship> getServiceRelationship() {
+ return serviceRelationship;
+ }
+
+ public void setServiceRelationship(List<ServiceRelationship> serviceRelationship) {
+ this.serviceRelationship = serviceRelationship;
+ }
+
+ public Service relatedParty(List<RelatedParty> relatedParty) {
+ this.relatedParty = relatedParty;
+ return this;
+ }
+
+ public Service addRelatedPartyItem(RelatedParty relatedPartyItem) {
+ if (this.relatedParty == null) {
+ this.relatedParty = new ArrayList<RelatedParty>();
+ }
+ this.relatedParty.add(relatedPartyItem);
+ return this;
+ }
+
+ /**
+ * A list of related party parties linked at the Service level (it may be a User for example)
+ *
+ * @return relatedParty
+ **/
+ @JsonProperty("relatedParty")
+ @ApiModelProperty(
+ value = "A list of related party parties linked at the Service level (it may be a User for example)")
+ public List<RelatedParty> getRelatedParty() {
+ return relatedParty;
+ }
+
+ public void setRelatedParty(List<RelatedParty> relatedParty) {
+ this.relatedParty = relatedParty;
+ }
+
+ public Service serviceSpecification(ServiceSpecificationRef serviceSpecification) {
+ this.serviceSpecification = serviceSpecification;
+ return this;
+ }
+
+ /**
+ * @return serviceSpecification
+ **/
+ @JsonProperty("serviceSpecification")
+ @ApiModelProperty(value = "")
+ @NotNull
+ public ServiceSpecificationRef getServiceSpecification() {
+ return serviceSpecification;
+ }
+
+ public void setServiceSpecification(ServiceSpecificationRef serviceSpecification) {
+ this.serviceSpecification = serviceSpecification;
+ }
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Service service = (Service) o;
+ return Objects.equals(this.id, service.id) && Objects.equals(this.href, service.href)
+ && Objects.equals(this.name, service.name) && Objects.equals(this.serviceState, service.serviceState)
+ && Objects.equals(this.type, service.type)
+ && Objects.equals(this.schemaLocation, service.schemaLocation)
+ && Objects.equals(this.serviceCharacteristic, service.serviceCharacteristic)
+ && Objects.equals(this.serviceRelationship, service.serviceRelationship)
+ && Objects.equals(this.relatedParty, service.relatedParty)
+ && Objects.equals(this.serviceSpecification, service.serviceSpecification);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, href, name, serviceState, type, schemaLocation, serviceCharacteristic,
+ serviceRelationship, relatedParty, serviceSpecification);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Service {\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(" serviceState: ").append(toIndentedString(serviceState)).append("\n");
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append(" schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
+ sb.append(" serviceCharacteristic: ").append(toIndentedString(serviceCharacteristic)).append("\n");
+ sb.append(" serviceRelationship: ").append(toIndentedString(serviceRelationship)).append("\n");
+ sb.append(" relatedParty: ").append(toIndentedString(relatedParty)).append("\n");
+ sb.append(" serviceSpecification: ").append(toIndentedString(serviceSpecification)).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/ServiceCharacteristic.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java
new file mode 100755
index 0000000..a0eaa86
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceCharacteristic.java
@@ -0,0 +1,148 @@
+/*
+ * 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;
+
+/**
+ * ServiceCharacteristic
+ */
+@ApiModel(description = "ServiceCharacteristic")
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+ date = "2018-02-19T14:00:30.767Z")
+public class ServiceCharacteristic {
+ @JsonProperty("name")
+ private String name = null;
+
+ @JsonProperty("valueType")
+ private String valueType = null;
+
+ @JsonProperty("value")
+ private Value value = null;
+
+ public ServiceCharacteristic name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Name of characteristic
+ *
+ * @return name
+ **/
+ @JsonProperty("name")
+ @ApiModelProperty(required = true, value = "Name of characteristic")
+ @NotNull
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public ServiceCharacteristic valueType(String valueType) {
+ this.valueType = valueType;
+ return this;
+ }
+
+ /**
+ * @return valueType
+ **/
+ @JsonProperty("valueType")
+ @ApiModelProperty(value = "")
+ public String getValueType() {
+ return valueType;
+ }
+
+ public void setValueType(String valueType) {
+ this.valueType = valueType;
+ }
+
+ public ServiceCharacteristic value(Value value) {
+ this.value = value;
+ return this;
+ }
+
+ /**
+ * @return value
+ **/
+ @JsonProperty("value")
+ @ApiModelProperty(value = "")
+ public Value getValue() {
+ return value;
+ }
+
+ public void setValue(Value value) {
+ this.value = value;
+ }
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ServiceCharacteristic serviceCharacteristic = (ServiceCharacteristic) o;
+ return Objects.equals(this.name, serviceCharacteristic.name)
+ && Objects.equals(this.valueType, serviceCharacteristic.valueType)
+ && Objects.equals(this.value, serviceCharacteristic.value);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name, valueType, value);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ServiceCharacteristic {\n");
+
+ sb.append(" name: ").append(toIndentedString(name)).append("\n");
+ sb.append(" valueType: ").append(toIndentedString(valueType)).append("\n");
+ sb.append(" value: ").append(toIndentedString(value)).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/ServiceOrder.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java
new file mode 100755
index 0000000..1726f0e
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrder.java
@@ -0,0 +1,589 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+import org.hibernate.validator.constraints.NotEmpty;
+import org.onap.nbi.apis.serviceorder.serviceordervalidator.ValidServiceOrder;
+import org.onap.nbi.commons.Resource;
+import org.springframework.data.annotation.Id;
+import org.springframework.data.mongodb.core.mapping.Document;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 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
+ */
+@ApiModel(
+ 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")
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+ date = "2018-02-19T14:00:30.767Z")
+@Document
+@ValidServiceOrder
+public class ServiceOrder implements Resource {
+
+ @Id
+ @JsonProperty("id")
+ private String id = null;
+
+ @JsonProperty("href")
+ private String href = null;
+
+ @JsonProperty("externalId")
+ private String externalId = null;
+
+ @JsonProperty("priority")
+ private String priority = null;
+
+ @JsonProperty("description")
+ private String description = null;
+
+ @JsonProperty("category")
+ private String category = null;
+
+ @JsonProperty("state")
+ private StateType state = null;
+
+ @JsonProperty("orderDate")
+ private Date orderDate = null;
+
+ @JsonProperty("completionDateTime")
+ private Date completionDateTime = null;
+
+ @JsonProperty("expectedCompletionDate")
+ private Date expectedCompletionDate = null;
+
+ @JsonProperty("requestedStartDate")
+ private Date requestedStartDate = null;
+
+ @JsonProperty("requestedCompletionDate")
+ private Date requestedCompletionDate = null;
+
+ @JsonProperty("startDate")
+ private Date startDate = null;
+
+ @JsonProperty("@baseType")
+ private String baseType = null;
+
+ @JsonProperty("@type")
+ private String type = null;
+
+ @JsonProperty("@schemaLocation")
+ private String schemaLocation = null;
+
+ @JsonProperty("relatedParty")
+ private List<RelatedParty> relatedParty = null;
+
+ @JsonProperty("orderRelationship")
+ private List<OrderRelationship> orderRelationship = null;
+
+ @JsonProperty("orderItem")
+ private List<ServiceOrderItem> orderItem = null;
+
+ public ServiceOrder id(String id) {
+ this.id = id;
+ return this;
+ }
+
+
+ /**
+ * ID created on repository side
+ *
+ * @return id
+ **/
+ @Override
+ @JsonProperty("id")
+ @ApiModelProperty(required = true, value = "ID created on repository side")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ServiceOrder href(String href) {
+ this.href = href;
+ return this;
+ }
+
+ /**
+ * Hyperlink to access the order
+ *
+ * @return href
+ **/
+ @JsonProperty("href")
+ @ApiModelProperty(value = "Hyperlink to access the order")
+ public String getHref() {
+ return href;
+ }
+
+ public void setHref(String href) {
+ this.href = href;
+ }
+
+ public ServiceOrder externalId(String externalId) {
+ this.externalId = externalId;
+ return this;
+ }
+
+ /**
+ * ID given by the consumer and only understandable by him (to facilitate his searches)
+ *
+ * @return externalId
+ **/
+ @JsonProperty("externalId")
+ @ApiModelProperty(value = "ID given by the consumer and only understandable by him (to facilitate his searches)")
+ public String getExternalId() {
+ return externalId;
+ }
+
+ public void setExternalId(String externalId) {
+ this.externalId = externalId;
+ }
+
+ public ServiceOrder priority(String priority) {
+ this.priority = priority;
+ return this;
+ }
+
+ /**
+ * 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)
+ *
+ * @return priority
+ **/
+ @JsonProperty("priority")
+ @ApiModelProperty(
+ 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)")
+ public String getPriority() {
+ return priority;
+ }
+
+ public void setPriority(String priority) {
+ this.priority = priority;
+ }
+
+ public ServiceOrder description(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * A free-text description of the service order
+ *
+ * @return description
+ **/
+ @JsonProperty("description")
+ @ApiModelProperty(value = "A free-text description of the service order")
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public ServiceOrder category(String category) {
+ this.category = category;
+ return this;
+ }
+
+ /**
+ * Used to categorize the order that can be useful for the OM system (e.g. “broadband”,
+ * “TVOption”, ...)
+ *
+ * @return category
+ **/
+ @JsonProperty("category")
+ @ApiModelProperty(
+ value = "Used to categorize the order that can be useful for the OM system (e.g. “broadband”, “TVOption”, ...)")
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public ServiceOrder state(StateType state) {
+ this.state = state;
+ return this;
+ }
+
+ /**
+ * State of the order : described in the state-machine diagram
+ *
+ * @return state
+ **/
+ @JsonProperty("state")
+ @ApiModelProperty(value = "State of the order : described in the state-machine diagram")
+ public StateType getState() {
+ return state;
+ }
+
+ public void setState(StateType state) {
+ this.state = state;
+ }
+
+ public ServiceOrder orderDate(Date orderDate) {
+ this.orderDate = orderDate;
+ return this;
+ }
+
+ /**
+ * @return orderDate
+ **/
+ @JsonProperty("orderDate")
+ @ApiModelProperty(value = "")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ public Date getOrderDate() {
+ return orderDate;
+ }
+
+ public void setOrderDate(Date orderDate) {
+ this.orderDate = orderDate;
+ }
+
+ public ServiceOrder completionDateTime(Date completionDateTime) {
+ this.completionDateTime = completionDateTime;
+ return this;
+ }
+
+ /**
+ * Date when the order was completed
+ *
+ * @return completionDateTime
+ **/
+ @JsonProperty("completionDateTime")
+ @ApiModelProperty(value = "Date when the order was completed")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ public Date getCompletionDateTime() {
+ return completionDateTime;
+ }
+
+ public void setCompletionDateTime(Date completionDateTime) {
+ this.completionDateTime = completionDateTime;
+ }
+
+
+ /**
+ * @return expectedCompletionDate
+ **/
+ @JsonProperty("expectedCompletionDate")
+ @ApiModelProperty(value = "")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ public Date getExpectedCompletionDate() {
+ return expectedCompletionDate;
+ }
+
+ public void setExpectedCompletionDate(Date expectedCompletionDate) {
+ this.expectedCompletionDate = expectedCompletionDate;
+ }
+
+ public ServiceOrder requestedStartDate(Date requestedStartDate) {
+ this.requestedStartDate = requestedStartDate;
+ return this;
+ }
+
+ /**
+ * Order start date wished by the requestor
+ *
+ * @return requestedStartDate
+ **/
+ @JsonProperty("requestedStartDate")
+ @ApiModelProperty(value = "Order start date wished by the requestor")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ public Date getRequestedStartDate() {
+ return requestedStartDate;
+ }
+
+ public void setRequestedStartDate(Date requestedStartDate) {
+ this.requestedStartDate = requestedStartDate;
+ }
+
+ public ServiceOrder requestedCompletionDate(Date requestedCompletionDate) {
+ this.requestedCompletionDate = requestedCompletionDate;
+ return this;
+ }
+
+ /**
+ * Requested delivery date from the requestor perspective
+ *
+ * @return requestedCompletionDate
+ **/
+ @JsonProperty("requestedCompletionDate")
+ @ApiModelProperty(value = "Requested delivery date from the requestor perspective")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ public Date getRequestedCompletionDate() {
+ return requestedCompletionDate;
+ }
+
+ public void setRequestedCompletionDate(Date requestedCompletionDate) {
+ this.requestedCompletionDate = requestedCompletionDate;
+ }
+
+ public ServiceOrder startDate(Date startDate) {
+ this.startDate = startDate;
+ return this;
+ }
+
+ /**
+ * Date when the order was started for processing
+ *
+ * @return startDate
+ **/
+ @JsonProperty("startDate")
+ @ApiModelProperty(value = "Date when the order was started for processing")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(Date startDate) {
+ this.startDate = startDate;
+ }
+
+ public ServiceOrder baseType(String baseType) {
+ this.baseType = baseType;
+ return this;
+ }
+
+ /**
+ * @return baseType
+ **/
+ @JsonProperty("@baseType")
+ @ApiModelProperty(value = "")
+ public String getBaseType() {
+ return baseType;
+ }
+
+ public void setBaseType(String baseType) {
+ this.baseType = baseType;
+ }
+
+ public ServiceOrder type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * @return type
+ **/
+ @JsonProperty("@type")
+ @ApiModelProperty(value = "")
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public ServiceOrder 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;
+ }
+
+ public ServiceOrder relatedParty(List<RelatedParty> relatedParty) {
+ this.relatedParty = relatedParty;
+ return this;
+ }
+
+ public ServiceOrder addRelatedPartyItem(RelatedParty relatedPartyItem) {
+ if (this.relatedParty == null) {
+ this.relatedParty = new ArrayList<RelatedParty>();
+ }
+ this.relatedParty.add(relatedPartyItem);
+ return this;
+ }
+
+ /**
+ * A list of related parties which are involved in this order and the role they are playing.
+ *
+ * @return relatedParty
+ **/
+ @JsonProperty("relatedParty")
+ @ApiModelProperty(
+ value = "A list of related parties which are involved in this order and the role they are playing.")
+ public List<RelatedParty> getRelatedParty() {
+ return relatedParty;
+ }
+
+ public void setRelatedParty(List<RelatedParty> relatedParty) {
+ this.relatedParty = relatedParty;
+ }
+
+ public ServiceOrder orderRelationship(List<OrderRelationship> orderRelationship) {
+ this.orderRelationship = orderRelationship;
+ return this;
+ }
+
+ public ServiceOrder addOrderRelationshipItem(OrderRelationship orderRelationshipItem) {
+ if (this.orderRelationship == null) {
+ this.orderRelationship = new ArrayList<OrderRelationship>();
+ }
+ this.orderRelationship.add(orderRelationshipItem);
+ return this;
+ }
+
+ /**
+ * A list of related order references .Linked order to the one containing this attribute
+ *
+ * @return orderRelationship
+ **/
+ @JsonProperty("orderRelationship")
+ @ApiModelProperty(value = "A list of related order references .Linked order to the one containing this attribute")
+ public List<OrderRelationship> getOrderRelationship() {
+ return orderRelationship;
+ }
+
+ public void setOrderRelationship(List<OrderRelationship> orderRelationship) {
+ this.orderRelationship = orderRelationship;
+ }
+
+ public ServiceOrder orderItem(List<ServiceOrderItem> orderItem) {
+ this.orderItem = orderItem;
+ return this;
+ }
+
+ public ServiceOrder addOrderItemItem(ServiceOrderItem orderItemItem) {
+ if (this.orderItem == null) {
+ this.orderItem = new ArrayList<ServiceOrderItem>();
+ }
+ this.orderItem.add(orderItemItem);
+ return this;
+ }
+
+ /**
+ * A list of order items that have to be processed.
+ *
+ * @return orderItem
+ **/
+ @JsonProperty("orderItem")
+ @ApiModelProperty(value = "A list of order items that have to be processed.")
+ @NotEmpty
+ public List<ServiceOrderItem> getOrderItem() {
+ return orderItem;
+ }
+
+ public void setOrderItem(List<ServiceOrderItem> orderItem) {
+ this.orderItem = orderItem;
+ }
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ServiceOrder serviceOrder = (ServiceOrder) o;
+ return Objects.equals(this.id, serviceOrder.id) && Objects.equals(this.href, serviceOrder.href)
+ && Objects.equals(this.externalId, serviceOrder.externalId)
+ && Objects.equals(this.priority, serviceOrder.priority)
+ && Objects.equals(this.description, serviceOrder.description)
+ && Objects.equals(this.category, serviceOrder.category)
+ && Objects.equals(this.state, serviceOrder.state)
+ && Objects.equals(this.orderDate, serviceOrder.orderDate)
+ && Objects.equals(this.completionDateTime, serviceOrder.completionDateTime)
+ && Objects.equals(this.expectedCompletionDate, serviceOrder.expectedCompletionDate)
+ && Objects.equals(this.requestedStartDate, serviceOrder.requestedStartDate)
+ && Objects.equals(this.requestedCompletionDate, serviceOrder.requestedCompletionDate)
+ && Objects.equals(this.startDate, serviceOrder.startDate)
+ && Objects.equals(this.baseType, serviceOrder.baseType) && Objects.equals(this.type, serviceOrder.type)
+ && Objects.equals(this.schemaLocation, serviceOrder.schemaLocation)
+ && Objects.equals(this.relatedParty, serviceOrder.relatedParty)
+ && Objects.equals(this.orderRelationship, serviceOrder.orderRelationship)
+ && Objects.equals(this.orderItem, serviceOrder.orderItem);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, href, externalId, priority, description, category, state, orderDate, completionDateTime,
+ expectedCompletionDate, requestedStartDate, requestedCompletionDate, startDate, baseType, type,
+ schemaLocation, relatedParty, orderRelationship, orderItem);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ServiceOrder {\n");
+
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" href: ").append(toIndentedString(href)).append("\n");
+ sb.append(" externalId: ").append(toIndentedString(externalId)).append("\n");
+ sb.append(" priority: ").append(toIndentedString(priority)).append("\n");
+ sb.append(" description: ").append(toIndentedString(description)).append("\n");
+ sb.append(" category: ").append(toIndentedString(category)).append("\n");
+ sb.append(" state: ").append(toIndentedString(state)).append("\n");
+ sb.append(" orderDate: ").append(toIndentedString(orderDate)).append("\n");
+ sb.append(" completionDateTime: ").append(toIndentedString(completionDateTime)).append("\n");
+ sb.append(" expectedCompletionDate: ").append(toIndentedString(expectedCompletionDate)).append("\n");
+ sb.append(" requestedStartDate: ").append(toIndentedString(requestedStartDate)).append("\n");
+ sb.append(" requestedCompletionDate: ").append(toIndentedString(requestedCompletionDate)).append("\n");
+ sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n");
+ sb.append(" baseType: ").append(toIndentedString(baseType)).append("\n");
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append(" schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
+ sb.append(" relatedParty: ").append(toIndentedString(relatedParty)).append("\n");
+ sb.append(" orderRelationship: ").append(toIndentedString(orderRelationship)).append("\n");
+ sb.append(" orderItem: ").append(toIndentedString(orderItem)).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/ServiceOrderItem.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java
new file mode 100755
index 0000000..50f9cfe
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceOrderItem.java
@@ -0,0 +1,300 @@
+/*
+ * 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.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;
+
+/**
+ * An identified part of the order. A service order is decomposed into one or more order items.
+ */
+@ApiModel(description = "An identified part of the order. A service order is decomposed into one or more order items.")
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+ date = "2018-02-19T14:00:30.767Z")
+public class ServiceOrderItem {
+ @JsonProperty("id")
+ private String id = null;
+
+ @JsonProperty("action")
+ private ActionType action = null;
+
+ @JsonProperty("state")
+ private StateType state = null;
+
+ @JsonProperty("@type")
+ private String type = null;
+
+ @JsonProperty("@schemaLocation")
+ private String schemaLocation = null;
+
+ @JsonProperty("@baseType")
+ private String baseType = null;
+
+ @JsonIgnore
+ private String requestId;
+
+ @JsonProperty("orderItemRelationship")
+ private List<OrderItemRelationship> orderItemRelationship = new ArrayList<>();
+
+ @JsonProperty("service")
+ private Service service = null;
+
+ public ServiceOrderItem id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Identifier of the line item (generally it is a sequence number 01, 02, 03, …)
+ *
+ * @return id
+ **/
+ @JsonProperty("id")
+ @ApiModelProperty(required = true,
+ value = "Identifier of the line item (generally it is a sequence number 01, 02, 03, …)")
+ @NotNull
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ServiceOrderItem action(ActionType action) {
+ this.action = action;
+ return this;
+ }
+
+ /**
+ * The action to be carried out on the Service. Can be add, modify, delete, noChange
+ *
+ * @return action
+ **/
+ @JsonProperty("action")
+ @ApiModelProperty(value = "The action to be carried out on the Service. Can be add, modify, delete, noChange")
+ public ActionType getAction() {
+ return action;
+ }
+
+ public void setAction(ActionType action) {
+ this.action = action;
+ }
+
+ public ServiceOrderItem state(StateType state) {
+ this.state = state;
+ return this;
+ }
+
+ /**
+ * State of the order item (described in the state machine diagram)
+ *
+ * @return state
+ **/
+ @JsonProperty("state")
+ @ApiModelProperty(value = "State of the order item (described in the state machine diagram)")
+ public StateType getState() {
+ return state;
+ }
+
+ public void setState(StateType state) {
+ this.state = state;
+ }
+
+ public ServiceOrderItem type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ *
+ * @return type
+ **/
+ @JsonProperty("@type")
+ @ApiModelProperty(value = "")
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public ServiceOrderItem 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;
+ }
+
+ public ServiceOrderItem baseType(String baseType) {
+ this.baseType = baseType;
+ return this;
+ }
+
+ /**
+ *
+ * @return baseType
+ **/
+ @JsonProperty("@baseType")
+ @ApiModelProperty(value = "")
+ public String getBaseType() {
+ return baseType;
+ }
+
+ public void setBaseType(String baseType) {
+ this.baseType = baseType;
+ }
+
+ public ServiceOrderItem orderItemRelationship(List<OrderItemRelationship> orderItemRelationship) {
+ this.orderItemRelationship = orderItemRelationship;
+ return this;
+ }
+
+ public ServiceOrderItem addOrderItemRelationshipItem(OrderItemRelationship orderItemRelationshipItem) {
+ if (this.orderItemRelationship == null) {
+ this.orderItemRelationship = new ArrayList<OrderItemRelationship>();
+ }
+ this.orderItemRelationship.add(orderItemRelationshipItem);
+ return this;
+ }
+
+ /**
+ * Linked order item to the one containing this attribute
+ *
+ * @return orderItemRelationship
+ **/
+ @JsonProperty("orderItemRelationship")
+ @ApiModelProperty(value = "Linked order item to the one containing this attribute")
+ public List<OrderItemRelationship> getOrderItemRelationship() {
+ return orderItemRelationship;
+ }
+
+ public void setOrderItemRelationship(List<OrderItemRelationship> orderItemRelationship) {
+ this.orderItemRelationship = orderItemRelationship;
+ }
+
+ public ServiceOrderItem service(Service service) {
+ this.service = service;
+ return this;
+ }
+
+ /**
+ * The Service to be acted on by the order item
+ *
+ * @return service
+ **/
+ @JsonProperty("service")
+ @ApiModelProperty(required = true, value = "The Service to be acted on by the order item")
+ @NotNull
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ServiceOrderItem serviceOrderItem = (ServiceOrderItem) o;
+ return Objects.equals(this.id, serviceOrderItem.id) && Objects.equals(this.action, serviceOrderItem.action)
+ && Objects.equals(this.state, serviceOrderItem.state)
+ && Objects.equals(this.type, serviceOrderItem.type)
+ && Objects.equals(this.schemaLocation, serviceOrderItem.schemaLocation)
+ && Objects.equals(this.baseType, serviceOrderItem.baseType)
+ && Objects.equals(this.orderItemRelationship, serviceOrderItem.orderItemRelationship)
+ && Objects.equals(this.service, serviceOrderItem.service)
+ && Objects.equals(this.requestId, serviceOrderItem.requestId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, action, state, type, schemaLocation, baseType, orderItemRelationship, service,
+ requestId);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ServiceOrderItem {\n");
+
+ sb.append(" id: ").append(toIndentedString(id)).append("\n");
+ sb.append(" action: ").append(toIndentedString(action)).append("\n");
+ sb.append(" state: ").append(toIndentedString(state)).append("\n");
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append(" schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
+ sb.append(" baseType: ").append(toIndentedString(baseType)).append("\n");
+ sb.append(" orderItemRelationship: ").append(toIndentedString(orderItemRelationship)).append("\n");
+ sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n");
+ sb.append(" service: ").append(toIndentedString(service)).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/ServiceRef.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRef.java
new file mode 100755
index 0000000..e538d09
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRef.java
@@ -0,0 +1,126 @@
+/*
+ * 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
new file mode 100755
index 0000000..2119916
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceRelationship.java
@@ -0,0 +1,132 @@
+/*
+ * 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;
+
+/**
+ * Linked Services to the one instantiate
+ */
+@ApiModel(description = "Linked Services to the one instantiate")
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+ date = "2018-02-19T14:00:30.767Z")
+public class ServiceRelationship {
+ @JsonProperty("type")
+ private RelationshipType type = null;
+
+ @JsonProperty("service")
+ private Service service = null;
+
+ public ServiceRelationship type(RelationshipType type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * 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
+ *
+ * @return type
+ **/
+ @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
+ public RelationshipType getType() {
+ return type;
+ }
+
+ public void setType(RelationshipType type) {
+ this.type = type;
+ }
+
+ public ServiceRelationship service(Service service) {
+ this.service = service;
+ return this;
+ }
+
+ /**
+ * Service reference
+ *
+ * @return service
+ **/
+ @JsonProperty("service")
+ @ApiModelProperty(required = true, value = "Service reference")
+ @NotNull
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ServiceRelationship serviceRelationship = (ServiceRelationship) o;
+ return Objects.equals(this.type, serviceRelationship.type)
+ && Objects.equals(this.service, serviceRelationship.service);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type, service);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ServiceRelationship {\n");
+
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append(" service: ").append(toIndentedString(service)).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/ServiceSpecificationRef.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java
new file mode 100755
index 0000000..2a22216
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/ServiceSpecificationRef.java
@@ -0,0 +1,265 @@
+/*
+ * 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;
+
+/**
+ * The service specification (default values, etc. are fetched from the catalogue).
+ */
+@ApiModel(description = "The service specification (default values, etc. are fetched from the catalogue).")
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+ date = "2018-02-19T14:00:30.767Z")
+public class ServiceSpecificationRef {
+ @JsonProperty("id")
+ private String id = null;
+
+ @JsonProperty("href")
+ private String href = null;
+
+ @JsonProperty("name")
+ private String name = null;
+
+ @JsonProperty("version")
+ private String version = null;
+
+ @JsonProperty("targetServiceSchema")
+ private TargetServiceSchema targetServiceSchema = null;
+
+ @JsonProperty("@type")
+ private String type = null;
+
+ @JsonProperty("@schemaLocation")
+ private String schemaLocation = null;
+
+ @JsonProperty("@baseType")
+ private String baseType = null;
+
+ public ServiceSpecificationRef id(String id) {
+ this.id = id;
+ return this;
+ }
+
+ /**
+ * Unique identifier of the service specification
+ *
+ * @return id
+ **/
+ @JsonProperty("id")
+ @ApiModelProperty(required = true, value = "Unique identifier of the service specification")
+ @NotNull
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ServiceSpecificationRef href(String href) {
+ this.href = href;
+ return this;
+ }
+
+ /**
+ * Reference of the service specification
+ *
+ * @return href
+ **/
+ @JsonProperty("href")
+ @ApiModelProperty(value = "Reference of the service specification")
+ public String getHref() {
+ return href;
+ }
+
+ public void setHref(String href) {
+ this.href = href;
+ }
+
+ public ServiceSpecificationRef 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 ServiceSpecificationRef version(String version) {
+ this.version = version;
+ return this;
+ }
+
+ /**
+ * @return version
+ **/
+ @JsonProperty("version")
+ @ApiModelProperty(value = "")
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public ServiceSpecificationRef targetServiceSchema(TargetServiceSchema targetServiceSchema) {
+ this.targetServiceSchema = targetServiceSchema;
+ return this;
+ }
+
+ /**
+ * @return targetServiceSchema
+ **/
+ @JsonProperty("targetServiceSchema")
+ @ApiModelProperty(value = "")
+ public TargetServiceSchema getTargetServiceSchema() {
+ return targetServiceSchema;
+ }
+
+ public void setTargetServiceSchema(TargetServiceSchema targetServiceSchema) {
+ this.targetServiceSchema = targetServiceSchema;
+ }
+
+ public ServiceSpecificationRef type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * @return type
+ **/
+ @JsonProperty("@type")
+ @ApiModelProperty(value = "")
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public ServiceSpecificationRef 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;
+ }
+
+ public ServiceSpecificationRef baseType(String baseType) {
+ this.baseType = baseType;
+ return this;
+ }
+
+ /**
+ * @return baseType
+ **/
+ @JsonProperty("@baseType")
+ @ApiModelProperty(value = "")
+ public String getBaseType() {
+ return baseType;
+ }
+
+ public void setBaseType(String baseType) {
+ this.baseType = baseType;
+ }
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ ServiceSpecificationRef serviceSpecificationRef = (ServiceSpecificationRef) o;
+ return Objects.equals(this.id, serviceSpecificationRef.id)
+ && Objects.equals(this.href, serviceSpecificationRef.href)
+ && Objects.equals(this.name, serviceSpecificationRef.name)
+ && Objects.equals(this.version, serviceSpecificationRef.version)
+ && Objects.equals(this.targetServiceSchema, serviceSpecificationRef.targetServiceSchema)
+ && Objects.equals(this.type, serviceSpecificationRef.type)
+ && Objects.equals(this.schemaLocation, serviceSpecificationRef.schemaLocation)
+ && Objects.equals(this.baseType, serviceSpecificationRef.baseType);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, href, name, version, targetServiceSchema, type, schemaLocation, baseType);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class ServiceSpecificationRef {\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(" version: ").append(toIndentedString(version)).append("\n");
+ sb.append(" targetServiceSchema: ").append(toIndentedString(targetServiceSchema)).append("\n");
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append(" schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
+ sb.append(" baseType: ").append(toIndentedString(baseType)).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/StateType.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java
new file mode 100755
index 0000000..9e26a1b
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/StateType.java
@@ -0,0 +1,72 @@
+/*
+ * 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.JsonCreator;
+
+/**
+ *
+ */
+public enum StateType {
+
+ ACKNOWLEDGED("acknowledged"),
+
+ REJECTED("rejected"),
+
+ PENDING("pending"),
+
+ HELD("held"),
+
+ INPROGRESS("inProgress"),
+
+ CANCELLED("cancelled"),
+
+ COMPLETED("completed"),
+
+ FAILED("failed"),
+
+ PARTIAL("partial");
+
+ private String value;
+
+ StateType(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ @JsonCreator
+ public static StateType fromValue(String text) {
+ for (StateType b : StateType.values()) {
+ if (String.valueOf(b.value).equals(text)) {
+ return b;
+ }
+ }
+ return null;
+ }
+}
+
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
new file mode 100755
index 0000000..98e6052
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/TargetServiceSchema.java
@@ -0,0 +1,124 @@
+/*
+ * 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 TargetServiceSchema {
+ @JsonProperty("@type")
+ private String type = null;
+
+ @JsonProperty("@schemaLocation")
+ private String schemaLocation = null;
+
+ public TargetServiceSchema type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * @return type
+ **/
+ @JsonProperty("@type")
+ @ApiModelProperty(required = true, value = "")
+ @NotNull
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public TargetServiceSchema schemaLocation(String schemaLocation) {
+ this.schemaLocation = schemaLocation;
+ return this;
+ }
+
+ /**
+ * @return schemaLocation
+ **/
+ @JsonProperty("@schemaLocation")
+ @ApiModelProperty(required = true, value = "")
+ @NotNull
+ 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;
+ }
+ TargetServiceSchema targetServiceSchema = (TargetServiceSchema) o;
+ return Objects.equals(this.type, targetServiceSchema.type)
+ && Objects.equals(this.schemaLocation, targetServiceSchema.schemaLocation);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type, schemaLocation);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class TargetServiceSchema {\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/Value.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/Value.java
new file mode 100755
index 0000000..4d5acaa
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/Value.java
@@ -0,0 +1,143 @@
+/*
+ * 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 java.util.Objects;
+
+/**
+ * Value is a descriptive structure for service characteristic
+ */
+@ApiModel(description = "Value is a descriptive structure for service characteristic")
+@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen",
+ date = "2018-02-19T14:00:30.767Z")
+public class Value {
+ @JsonProperty("@type")
+ private String type = null;
+
+ @JsonProperty("@schemaLocation")
+ private String schemaLocation = null;
+
+ @JsonProperty("serviceCharacteristicValue")
+ private String serviceCharacteristicValue = null;
+
+ public Value type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * @return type
+ **/
+ @JsonProperty("@type")
+ @ApiModelProperty(value = "")
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Value 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;
+ }
+
+ public Value serviceCharacteristicValue(String serviceCharacteristicValue) {
+ this.serviceCharacteristicValue = serviceCharacteristicValue;
+ return this;
+ }
+
+ /**
+ * @return serviceCharacteristicValue
+ **/
+ @JsonProperty("serviceCharacteristicValue")
+ @ApiModelProperty(value = "")
+ public String getServiceCharacteristicValue() {
+ return serviceCharacteristicValue;
+ }
+
+ public void setServiceCharacteristicValue(String serviceCharacteristicValue) {
+ this.serviceCharacteristicValue = serviceCharacteristicValue;
+ }
+
+
+ @Override
+ public boolean equals(java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ Value value = (Value) o;
+ return Objects.equals(this.type, value.type) && Objects.equals(this.schemaLocation, value.schemaLocation)
+ && Objects.equals(this.serviceCharacteristicValue, value.serviceCharacteristicValue);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type, schemaLocation, serviceCharacteristicValue);
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Value {\n");
+
+ sb.append(" type: ").append(toIndentedString(type)).append("\n");
+ sb.append(" schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n");
+ sb.append(" serviceCharacteristicValue: ").append(toIndentedString(serviceCharacteristicValue)).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/consumer/CloudConfiguration.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CloudConfiguration.java
new file mode 100644
index 0000000..e905c09
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CloudConfiguration.java
@@ -0,0 +1,35 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class CloudConfiguration {
+
+ private String lcpCloudRegionId;
+
+ private String tenantId;
+
+ public CloudConfiguration(String lcpCloudRegionId, String tenantId) {
+ this.lcpCloudRegionId = lcpCloudRegionId;
+ this.tenantId = tenantId;
+ }
+
+ public String getLcpCloudRegionId() {
+ return lcpCloudRegionId;
+ }
+
+ public void setLcpCloudRegionId(String lcpCloudRegionId) {
+ this.lcpCloudRegionId = lcpCloudRegionId;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ @Override
+ public String toString() {
+ return "CloudConfiguration{" + "lcpCloudRegionId='" + lcpCloudRegionId + '\'' + ", tenantId='" + tenantId + '\''
+ + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java
new file mode 100644
index 0000000..46268cb
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/CreateServiceInstanceResponse.java
@@ -0,0 +1,14 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class CreateServiceInstanceResponse {
+
+ public RequestReference getRequestReference() {
+ return requestReference;
+ }
+
+ public void setRequestReference(RequestReference requestReference) {
+ this.requestReference = requestReference;
+ }
+
+ private RequestReference requestReference;
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetRequestStatusResponse.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetRequestStatusResponse.java
new file mode 100644
index 0000000..d3c2ccf
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/GetRequestStatusResponse.java
@@ -0,0 +1,45 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+import java.util.Objects;
+
+public class GetRequestStatusResponse {
+
+ private Request request;
+
+
+ public Request getRequest() {
+
+ return request;
+ }
+
+ public void setRequest(Request request) {
+ this.request = request;
+ }
+
+ public GetRequestStatusResponse(Request request) {
+
+ this.request = request;
+ }
+
+ public GetRequestStatusResponse() {}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ GetRequestStatusResponse that = (GetRequestStatusResponse) o;
+ return Objects.equals(request, that.request);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(request);
+ }
+
+ @Override
+ public String toString() {
+ return "GetRequestStatusResponse{" + "request=" + request + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ModelInfo.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ModelInfo.java
new file mode 100644
index 0000000..0efd4ee
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/ModelInfo.java
@@ -0,0 +1,82 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class ModelInfo {
+
+ private String modelType;
+
+ private String modelInvariantId;
+
+ private String modelNameVersionId;
+
+ private String modelName;
+
+ private String modelVersion;
+
+ private String modelCustomizationName;
+
+ private String modelCustomizationId;
+
+ public String getModelType() {
+ return modelType;
+ }
+
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelNameVersionId() {
+ return modelNameVersionId;
+ }
+
+ public void setModelNameVersionId(String modelNameVersionId) {
+ this.modelNameVersionId = modelNameVersionId;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ @Override
+ public String toString() {
+ return "ModelInfo{" + "modelType='" + modelType + '\'' + ", modelInvariantId='" + modelInvariantId + '\''
+ + ", modelNameVersionId='" + modelNameVersionId + '\'' + ", modelName='" + modelName + '\''
+ + ", modelVersion='" + modelVersion + '\'' + ", modelCustomizationName='" + modelCustomizationName
+ + '\'' + ", modelCustomizationId='" + modelCustomizationId + '\'' + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Request.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Request.java
new file mode 100644
index 0000000..8f4313f
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/Request.java
@@ -0,0 +1,42 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+import java.util.Objects;
+
+public class Request {
+
+ private RequestStatus requestStatus;
+
+ public Request() {}
+
+ public Request(RequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ public RequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+
+ public void setRequestStatus(RequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ Request request = (Request) o;
+ return Objects.equals(requestStatus, request.requestStatus);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(requestStatus);
+ }
+
+ @Override
+ public String toString() {
+ return "Request{" + "requestStatus=" + requestStatus + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java
new file mode 100644
index 0000000..020e454
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestDetails.java
@@ -0,0 +1,62 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class RequestDetails {
+
+ private ModelInfo modelInfo;
+
+ private SubscriberInfo subscriberInfo;
+
+ private RequestInfo requestInfo;
+
+ private RequestParameters requestParameters;
+
+ private CloudConfiguration cloudConfiguration;
+
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public SubscriberInfo getSubscriberInfo() {
+ return subscriberInfo;
+ }
+
+ public void setSubscriberInfo(SubscriberInfo subscriberInfo) {
+ this.subscriberInfo = subscriberInfo;
+ }
+
+ public RequestInfo getRequestInfo() {
+ return requestInfo;
+ }
+
+ public void setRequestInfo(RequestInfo requestInfo) {
+ this.requestInfo = requestInfo;
+ }
+
+ public RequestParameters getRequestParameters() {
+ return requestParameters;
+ }
+
+ public void setRequestParameters(RequestParameters requestParameters) {
+ this.requestParameters = requestParameters;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestDetails{" + "modelInfo=" + modelInfo + ", subscriberInfo=" + subscriberInfo + ", requestInfo="
+ + requestInfo + ", requestParameters=" + requestParameters + ", cloudConfiguration="
+ + cloudConfiguration + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestInfo.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestInfo.java
new file mode 100644
index 0000000..a05e9db
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestInfo.java
@@ -0,0 +1,50 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class RequestInfo {
+
+ private String instanceName;
+
+ private String productFamilyId;
+
+ private String source;
+
+ private boolean suppressRollback;
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public boolean isSuppressRollback() {
+ return suppressRollback;
+ }
+
+ public void setSuppressRollback(boolean suppressRollback) {
+ this.suppressRollback = suppressRollback;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestInfo{" + "instanceName='" + instanceName + '\'' + ", productFamilyId='" + productFamilyId + '\''
+ + ", source='" + source + '\'' + ", suppressRollback=" + suppressRollback + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestParameters.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestParameters.java
new file mode 100644
index 0000000..9f66f21
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestParameters.java
@@ -0,0 +1,60 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+import java.util.List;
+import java.util.Objects;
+
+public class RequestParameters {
+
+ private String subscriptionServiceType;
+
+ private List<UserParams> userParams;
+
+ private boolean aLaCarte;
+
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public List<UserParams> getUserParams() {
+ return userParams;
+ }
+
+ public void setUserParams(List<UserParams> userParams) {
+ this.userParams = userParams;
+ }
+
+ public boolean isaLaCarte() {
+ return aLaCarte;
+ }
+
+ public void setaLaCarte(boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ RequestParameters that = (RequestParameters) o;
+ return aLaCarte == that.aLaCarte && Objects.equals(subscriptionServiceType, that.subscriptionServiceType)
+ && Objects.equals(userParams, that.userParams);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(subscriptionServiceType, userParams, aLaCarte);
+ }
+
+ @Override
+ public String toString() {
+ return "RequestParameters{" + "subscriptionServiceType='" + subscriptionServiceType + '\'' + ", userParams="
+ + userParams + ", aLaCarte=" + aLaCarte + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReference.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReference.java
new file mode 100644
index 0000000..7c7d481
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestReference.java
@@ -0,0 +1,29 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class RequestReference {
+
+ private String instanceId;
+
+ private String requestId;
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestReference{" + "instanceId='" + instanceId + '\'' + ", requestId='" + requestId + '\'' + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java
new file mode 100644
index 0000000..c657f9b
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestState.java
@@ -0,0 +1,34 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+public enum RequestState {
+
+ FAILED("FAILED"),
+
+ COMPLETE("COMPLETE");
+
+ private String value;
+
+ RequestState(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ @JsonCreator
+ public static RequestState fromValue(String text) {
+ for (RequestState b : RequestState.values()) {
+ if (String.valueOf(b.value).equals(text)) {
+ return b;
+ }
+ }
+ return null;
+ }
+
+
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestStatus.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestStatus.java
new file mode 100644
index 0000000..06e5961
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/RequestStatus.java
@@ -0,0 +1,53 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+import java.util.Objects;
+
+public class RequestStatus {
+
+ private RequestState requestState;
+
+ private int percentProgress;
+
+ public RequestStatus(RequestState requestState, int percentProgress) {
+ this.requestState = requestState;
+ this.percentProgress = percentProgress;
+ }
+
+ public RequestStatus() {}
+
+ public RequestState getRequestState() {
+ return requestState;
+ }
+
+ public void setRequestState(RequestState requestState) {
+ this.requestState = requestState;
+ }
+
+ public int getPercentProgress() {
+ return percentProgress;
+ }
+
+ public void setPercentProgress(int percentProgress) {
+ this.percentProgress = percentProgress;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ RequestStatus that = (RequestStatus) o;
+ return percentProgress == that.percentProgress && requestState == that.requestState;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(requestState, percentProgress);
+ }
+
+ @Override
+ public String toString() {
+ return "RequestStatus{" + "requestState=" + requestState + ", percentProgress=" + percentProgress + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/SubscriberInfo.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/SubscriberInfo.java
new file mode 100644
index 0000000..0a26ff8
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/SubscriberInfo.java
@@ -0,0 +1,30 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class SubscriberInfo {
+
+ private String globalSubscriberId;
+
+ private String subscriberName;
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ public void setSubscriberName(String subscriberName) {
+ this.subscriberName = subscriberName;
+ }
+
+ @Override
+ public String toString() {
+ return "SubscriberInfo{" + "globalSubscriberId='" + globalSubscriberId + '\'' + ", subscriberName='"
+ + subscriberName + '\'' + '}';
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/UserParams.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/UserParams.java
new file mode 100644
index 0000000..1f82744
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/consumer/UserParams.java
@@ -0,0 +1,29 @@
+package org.onap.nbi.apis.serviceorder.model.consumer;
+
+public class UserParams {
+
+ private String name;
+
+ private String value;
+
+ public UserParams(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ExecutionTask.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ExecutionTask.java
new file mode 100644
index 0000000..0556939
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ExecutionTask.java
@@ -0,0 +1,96 @@
+package org.onap.nbi.apis.serviceorder.model.orchestrator;
+
+import java.util.Date;
+import java.util.Objects;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+
+@Entity
+public class ExecutionTask {
+
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long internalId;
+
+ private String orderItemId;
+
+ private String reliedTasks;
+
+ private int nbRetries;
+
+ private Date lastAttemptDate;
+
+ @OneToOne
+ private ServiceOrderInfoJson serviceOrderInfoJson;
+
+ public ServiceOrderInfoJson getServiceOrderInfoJson() {
+ return serviceOrderInfoJson;
+ }
+
+ public void setServiceOrderInfoJson(ServiceOrderInfoJson serviceOrderInfoJson) {
+ this.serviceOrderInfoJson = serviceOrderInfoJson;
+ }
+
+ public Date getLastAttemptDate() {
+ return lastAttemptDate;
+ }
+
+ public void setLastAttemptDate(Date lastAttemptDate) {
+ this.lastAttemptDate = lastAttemptDate;
+ }
+
+ public String getOrderItemId() {
+ return orderItemId;
+ }
+
+ public void setOrderItemId(String orderItemId) {
+ this.orderItemId = orderItemId;
+ }
+
+ public String getReliedTasks() {
+ return reliedTasks;
+ }
+
+ public void setReliedTasks(String reliedTasks) {
+ this.reliedTasks = reliedTasks;
+ }
+
+ public int getNbRetries() {
+ return nbRetries;
+ }
+
+ public void setNbRetries(int nbRetries) {
+ this.nbRetries = nbRetries;
+ }
+
+ public Long getInternalId() {
+ return internalId;
+ }
+
+ public void setInternalId(Long internalId) {
+ this.internalId = internalId;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ ExecutionTask that = (ExecutionTask) o;
+ return nbRetries == that.nbRetries && Objects.equals(internalId, that.internalId)
+ && Objects.equals(orderItemId, that.orderItemId) && Objects.equals(reliedTasks, that.reliedTasks)
+ && Objects.equals(lastAttemptDate, that.lastAttemptDate)
+ && Objects.equals(serviceOrderInfoJson, that.serviceOrderInfoJson);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(internalId, orderItemId, reliedTasks, nbRetries, lastAttemptDate, serviceOrderInfoJson);
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfo.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfo.java
new file mode 100644
index 0000000..6a6c966
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfo.java
@@ -0,0 +1,67 @@
+package org.onap.nbi.apis.serviceorder.model.orchestrator;
+
+
+import org.onap.nbi.apis.serviceorder.model.consumer.SubscriberInfo;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ServiceOrderInfo {
+
+ private boolean useServiceOrderCustomer;
+ private SubscriberInfo subscriberInfo;
+ private Map<String, ServiceOrderItemInfo> serviceOrderItemInfos = new HashMap<>();
+ private boolean allItemsInAdd;
+ private boolean allItemsCompleted;
+ private boolean serviceOrderRejected;
+
+ public boolean isAllItemsInAdd() {
+ return allItemsInAdd;
+ }
+
+ public void setAllItemsInAdd(boolean allItemsInAdd) {
+ this.allItemsInAdd = allItemsInAdd;
+ }
+
+ public boolean isAllItemsCompleted() {
+ return allItemsCompleted;
+ }
+
+ public void setAllItemsCompleted(boolean allItemsCompleted) {
+ this.allItemsCompleted = allItemsCompleted;
+ }
+
+ public boolean isServiceOrderRejected() {
+ return serviceOrderRejected;
+ }
+
+ public void setIsServiceOrderRejected(boolean isServiceOrderRejected) {
+ this.serviceOrderRejected = isServiceOrderRejected;
+ }
+
+ public Map<String, ServiceOrderItemInfo> getServiceOrderItemInfos() {
+ return serviceOrderItemInfos;
+ }
+
+ public void addServiceOrderItemInfos(String id, ServiceOrderItemInfo serviceOrderItemInfo) {
+ this.serviceOrderItemInfos.put(id, serviceOrderItemInfo);
+ }
+
+ public SubscriberInfo getSubscriberInfo() {
+ return subscriberInfo;
+ }
+
+ public void setSubscriberInfo(SubscriberInfo subscriberInfo) {
+ this.subscriberInfo = subscriberInfo;
+ }
+
+
+ public boolean isUseServiceOrderCustomer() {
+ return useServiceOrderCustomer;
+ }
+
+ public void setUseServiceOrderCustomer(boolean useServiceOrderCustomer) {
+ this.useServiceOrderCustomer = useServiceOrderCustomer;
+ }
+
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfoJson.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfoJson.java
new file mode 100644
index 0000000..eca36ae
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderInfoJson.java
@@ -0,0 +1,43 @@
+package org.onap.nbi.apis.serviceorder.model.orchestrator;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+
+@Entity
+public class ServiceOrderInfoJson {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long internalId;
+
+ private String serviceOrderId;
+
+ @Lob
+ private String serviceOrderInfoJson;
+
+ public ServiceOrderInfoJson() {}
+
+ public ServiceOrderInfoJson(String serviceOrderId, String serviceOrderInfoJson) {
+ this.serviceOrderId = serviceOrderId;
+ this.serviceOrderInfoJson = serviceOrderInfoJson;
+ }
+
+ public String getServiceOrderId() {
+ return serviceOrderId;
+ }
+
+ public void setServiceOrderId(String serviceOrderId) {
+ this.serviceOrderId = serviceOrderId;
+ }
+
+ public String getServiceOrderInfoJson() {
+ return serviceOrderInfoJson;
+ }
+
+ public void setServiceOrderInfoJson(String serviceOrderInfoJson) {
+ this.serviceOrderInfoJson = serviceOrderInfoJson;
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderItemInfo.java b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderItemInfo.java
new file mode 100644
index 0000000..a37c0b5
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/model/orchestrator/ServiceOrderItemInfo.java
@@ -0,0 +1,27 @@
+package org.onap.nbi.apis.serviceorder.model.orchestrator;
+
+
+import java.util.LinkedHashMap;
+
+public class ServiceOrderItemInfo {
+
+ private String id;
+
+ private LinkedHashMap catalogResponse;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public LinkedHashMap getCatalogResponse() {
+ return catalogResponse;
+ }
+
+ public void setCatalogResponse(LinkedHashMap catalogResponse) {
+ this.catalogResponse = catalogResponse;
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ExecutionTaskRepository.java b/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ExecutionTaskRepository.java
new file mode 100644
index 0000000..31d882b
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ExecutionTaskRepository.java
@@ -0,0 +1,25 @@
+package org.onap.nbi.apis.serviceorder.repositories;
+
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+public interface ExecutionTaskRepository extends CrudRepository<ExecutionTask, Long> {
+
+ @Query("SELECT t FROM ExecutionTask t WHERE TRIM(t.reliedTasks) LIKE '' ")
+ List<ExecutionTask> findByReliedTasksIsEmpty();
+
+ @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
+ @Modifying
+ @Query("UPDATE ExecutionTask t SET t.reliedTasks = REPLACE(t.reliedTasks, :internalId, '') WHERE t.reliedTasks "
+ + "LIKE CONCAT('%', :internalId, '%')")
+ void updateReliedTaskAfterDelete(@Param("internalId") Long internalId);
+
+ @Query("SELECT t FROM ExecutionTask t WHERE t.reliedTasks LIKE CONCAT('%', :internalId, '%')")
+ List<ExecutionTask> findTasksReliedToAnOrderItemId(@Param("internalId") Long internalId);
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderInfoRepository.java b/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderInfoRepository.java
new file mode 100644
index 0000000..4689b20
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderInfoRepository.java
@@ -0,0 +1,9 @@
+package org.onap.nbi.apis.serviceorder.repositories;
+
+
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfoJson;
+import org.springframework.data.repository.CrudRepository;
+
+public interface ServiceOrderInfoRepository extends CrudRepository<ServiceOrderInfoJson, String> {
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderRepository.java b/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderRepository.java
new file mode 100644
index 0000000..165ad44
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/repositories/ServiceOrderRepository.java
@@ -0,0 +1,11 @@
+package org.onap.nbi.apis.serviceorder.repositories;
+
+import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
+import org.onap.nbi.apis.serviceorder.model.StateType;
+import org.springframework.data.mongodb.repository.MongoRepository;
+import java.util.List;
+
+public interface ServiceOrderRepository extends MongoRepository<ServiceOrder, String> {
+
+ List<ServiceOrder> findByState(StateType state);
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ServiceOrderValidator.java b/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ServiceOrderValidator.java
new file mode 100644
index 0000000..f26e95b
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ServiceOrderValidator.java
@@ -0,0 +1,26 @@
+package org.onap.nbi.apis.serviceorder.serviceordervalidator;
+
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import org.onap.nbi.apis.serviceorder.model.ActionType;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
+import org.springframework.util.StringUtils;
+
+public class ServiceOrderValidator implements ConstraintValidator<ValidServiceOrder, ServiceOrder> {
+
+
+ @Override
+ public boolean isValid(ServiceOrder serviceOrder, ConstraintValidatorContext context) {
+ for (ServiceOrderItem serviceOrderItem : serviceOrder.getOrderItem()) {
+ if (ActionType.ADD != serviceOrderItem.getAction()
+ && StringUtils.isEmpty(serviceOrderItem.getService().getId())) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ValidServiceOrder.java b/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ValidServiceOrder.java
new file mode 100644
index 0000000..105703b
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/serviceordervalidator/ValidServiceOrder.java
@@ -0,0 +1,18 @@
+package org.onap.nbi.apis.serviceorder.serviceordervalidator;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.*;
+
+
+@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = ServiceOrderValidator.class)
+@Documented
+public @interface ValidServiceOrder {
+ String message() default "one of orderItem action is not add : serviceOrderItem.service.id is mandatory.";
+
+ Class<?>[] groups() default {};
+
+ Class<? extends Payload>[] payload() default {};
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java b/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java
new file mode 100644
index 0000000..f63f9c5
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/utils/JsonEntityConverter.java
@@ -0,0 +1,18 @@
+package org.onap.nbi.apis.serviceorder.utils;
+
+import java.io.IOException;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public final class JsonEntityConverter {
+
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ public static String convertServiceOrderInfoToJson(ServiceOrderInfo serviceOrderInfo) {
+ return MAPPER.valueToTree(serviceOrderInfo).toString();
+ }
+
+ public static ServiceOrderInfo convertJsonToServiceOrderInfo(String serviceOrderInfoJson) throws IOException {
+ return MAPPER.treeToValue(MAPPER.readTree(serviceOrderInfoJson), ServiceOrderInfo.class);
+ }
+}
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
new file mode 100644
index 0000000..44e3db0
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CheckOrderConsistenceManager.java
@@ -0,0 +1,145 @@
+package org.onap.nbi.apis.serviceorder.workflow;
+
+import org.onap.nbi.apis.serviceorder.MultiClient;
+import org.onap.nbi.apis.serviceorder.model.RelatedParty;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
+import org.onap.nbi.apis.serviceorder.model.StateType;
+import org.onap.nbi.apis.serviceorder.model.consumer.SubscriberInfo;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderItemInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+import java.util.LinkedHashMap;
+
+@Service
+public class CheckOrderConsistenceManager {
+
+
+ @Autowired
+ private MultiClient serviceOrderConsumerService;
+
+ public ServiceOrderInfo checkServiceOrder(ServiceOrder serviceOrder) {
+ ServiceOrderInfo serviceOrderInfo = new ServiceOrderInfo();
+ manageCustomer(serviceOrder, serviceOrderInfo);
+ int nbItemsCompleted = 0;
+ boolean isServiceOrderRejected = false;
+ boolean isAllItemsInAdd = true;
+
+ for (ServiceOrderItem serviceOrderItem : serviceOrder.getOrderItem()) {
+ ServiceOrderItemInfo serviceOrderItemInfo = new ServiceOrderItemInfo();
+ serviceOrderItemInfo.setId(serviceOrderItem.getId());
+ handleServiceFromCatalog(serviceOrderItem, serviceOrderItemInfo);
+ switch (serviceOrderItem.getAction()) {
+ case ADD:
+ if (existServiceInCatalog(serviceOrderItemInfo)
+ && StringUtils.isEmpty(serviceOrderItem.getService().getId())
+ && serviceOrderConsumerService.isTenantIdPresentInAAI()) {
+ serviceOrderInfo.addServiceOrderItemInfos(serviceOrderItem.getId(), serviceOrderItemInfo);
+ } else {
+ isServiceOrderRejected = true;
+ serviceOrderItem.setState(StateType.REJECTED);
+ }
+ break;
+ case MODIFY:
+ case DELETE:
+ isAllItemsInAdd = false;
+ if (isCustomerFromServiceOrderPresentInInventory(serviceOrderInfo)
+ && existServiceInInventory(serviceOrderItem, serviceOrderItemInfo,
+ serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId())) {
+ serviceOrderInfo.addServiceOrderItemInfos(serviceOrderItem.getId(), serviceOrderItemInfo);
+ } else {
+ isServiceOrderRejected = true;
+ serviceOrderItem.setState(StateType.REJECTED);
+ }
+ break;
+ case NOCHANGE:
+ isAllItemsInAdd = false;
+ serviceOrderItem.setState(StateType.COMPLETED);
+ nbItemsCompleted++;
+ break;
+ }
+ }
+ if (serviceOrder.getOrderItem().size() != nbItemsCompleted) {
+ serviceOrderInfo.setAllItemsCompleted(false);
+ } else {
+ serviceOrderInfo.setAllItemsCompleted(true);
+ }
+ serviceOrderInfo.setAllItemsInAdd(isAllItemsInAdd);
+ serviceOrderInfo.setIsServiceOrderRejected(isServiceOrderRejected);
+
+ return serviceOrderInfo;
+
+ }
+
+ private void manageCustomer(ServiceOrder serviceOrder, ServiceOrderInfo serviceOrderInfo) {
+ RelatedParty customerFromServiceOrder = getCustomerFromServiceOrder(serviceOrder);
+ SubscriberInfo subscriberInfo = new SubscriberInfo();
+ if (customerFromServiceOrder != null) {
+ subscriberInfo.setSubscriberName(customerFromServiceOrder.getName());
+ subscriberInfo.setGlobalSubscriberId(customerFromServiceOrder.getId());
+ serviceOrderInfo.setUseServiceOrderCustomer(true);
+ } else {
+ subscriberInfo.setSubscriberName("generic");
+ subscriberInfo.setGlobalSubscriberId("generic");
+ serviceOrderInfo.setUseServiceOrderCustomer(false);
+ }
+ serviceOrderInfo.setSubscriberInfo(subscriberInfo);
+
+ }
+
+
+ private RelatedParty getCustomerFromServiceOrder(ServiceOrder serviceOrder) {
+ for (RelatedParty relatedParty : serviceOrder.getRelatedParty()) {
+ if ("ONAPcustomer".equalsIgnoreCase(relatedParty.getRole())) {
+ return relatedParty;
+ }
+ }
+ return null;
+ }
+
+ private boolean isCustomerFromServiceOrderPresentInInventory(ServiceOrderInfo serviceOrderInfo) {
+
+ if (serviceOrderInfo.isUseServiceOrderCustomer()) {
+
+ boolean customerPresentInAAI = serviceOrderConsumerService
+ .isCustomerPresentInAAI(serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId());
+ return customerPresentInAAI;
+ }
+ return true;
+ }
+
+ private boolean existServiceInInventory(ServiceOrderItem serviceOrderItem,
+ ServiceOrderItemInfo serviceOrderItemInfo, String globalSubscriberId) {
+ if (!StringUtils.isEmpty(serviceOrderItem.getService().getId())) {
+ String serviceName = (String) serviceOrderItemInfo.getCatalogResponse().get("name");
+ boolean serviceExistInInventory = serviceOrderConsumerService.doesServiceExistInServiceInventory(
+ serviceOrderItem.getService().getId(), serviceName, globalSubscriberId);
+ if (serviceExistInInventory) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean existServiceInCatalog(ServiceOrderItemInfo serviceOrderItemInfo) {
+ return serviceOrderItemInfo.getCatalogResponse() != null;
+ }
+
+ private void handleServiceFromCatalog(ServiceOrderItem serviceOrderItem,
+ ServiceOrderItemInfo serviceOrderItemInfo) {
+ ResponseEntity<Object> response = serviceOrderConsumerService
+ .getServiceCatalog(serviceOrderItem.getService().getServiceSpecification().getId());
+ if (response != null && (response.getStatusCode().equals(HttpStatus.OK)
+ || response.getStatusCode().equals(HttpStatus.PARTIAL_CONTENT))) {
+ LinkedHashMap body = (LinkedHashMap) response.getBody();
+ serviceOrderItemInfo.setCatalogResponse(body);
+ }
+ }
+
+
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAICustomerManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAICustomerManager.java
new file mode 100644
index 0000000..6b8c55b
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAICustomerManager.java
@@ -0,0 +1,29 @@
+package org.onap.nbi.apis.serviceorder.workflow;
+
+import org.onap.nbi.apis.serviceorder.MultiClient;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class CreateAAICustomerManager {
+
+
+ @Autowired
+ private MultiClient serviceOrderConsumerService;
+
+
+ public void createAAICustomer(ServiceOrderInfo serviceOrderInfo) {
+
+
+ if (serviceOrderInfo.isUseServiceOrderCustomer() && serviceOrderInfo.isAllItemsInAdd()
+ && !serviceOrderConsumerService
+ .isCustomerPresentInAAI(serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId())) {
+ serviceOrderConsumerService.putCustomer(serviceOrderInfo.getSubscriberInfo());
+ }
+ }
+
+
+}
+
+
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIServiceTypeManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIServiceTypeManager.java
new file mode 100644
index 0000000..625a869
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/CreateAAIServiceTypeManager.java
@@ -0,0 +1,58 @@
+package org.onap.nbi.apis.serviceorder.workflow;
+
+import org.onap.nbi.apis.serviceorder.MultiClient;
+import org.onap.nbi.apis.serviceorder.model.ActionType;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderItemInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+@Service
+public class CreateAAIServiceTypeManager {
+
+ @Autowired
+ private MultiClient serviceOrderConsumerService;
+
+
+ public void createAAIServiceType(ServiceOrder serviceOrder, ServiceOrderInfo serviceOrderInfo) {
+
+ LinkedHashMap servicesInAaiForCustomer = serviceOrderConsumerService
+ .getServicesInAaiForCustomer(serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId());
+
+ for (ServiceOrderItem serviceOrderItem : serviceOrder.getOrderItem()) {
+ if (ActionType.ADD == serviceOrderItem.getAction()) {
+ ServiceOrderItemInfo serviceOrderItemInfo =
+ serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId());
+ String sdcServiceName = (String) serviceOrderItemInfo.getCatalogResponse().get("name");
+ if (!serviceNameExistsInAAI(servicesInAaiForCustomer, sdcServiceName)) {
+ serviceOrderConsumerService.putServiceType(
+ serviceOrderInfo.getSubscriberInfo().getGlobalSubscriberId(), sdcServiceName);
+ }
+ }
+ }
+
+ }
+
+ private boolean serviceNameExistsInAAI(LinkedHashMap servicesInAaiForCustomer, String sdcServiceName) {
+
+ if (servicesInAaiForCustomer != null && servicesInAaiForCustomer.get("service-subscription") != null) {
+ List<LinkedHashMap> servicesInAAI =
+ (List<LinkedHashMap>) servicesInAaiForCustomer.get("service-subscription");
+ for (LinkedHashMap service : servicesInAAI) {
+ String serviceType = (String) service.get("service-type");
+ if (sdcServiceName.equalsIgnoreCase(serviceType)) {
+ return true;
+ }
+
+ }
+ }
+
+ return false;
+
+ }
+
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java
new file mode 100644
index 0000000..57d3621
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java
@@ -0,0 +1,94 @@
+package org.onap.nbi.apis.serviceorder.workflow;
+
+import org.onap.nbi.apis.serviceorder.model.OrderItemRelationship;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfoJson;
+import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository;
+import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderInfoRepository;
+import org.onap.nbi.apis.serviceorder.utils.JsonEntityConverter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@EnableScheduling
+public class SOTaskManager {
+
+ @Autowired
+ private ExecutionTaskRepository executionTaskRepository;
+
+ @Autowired
+ private ServiceOrderInfoRepository serviceOrderInfoRepository;
+
+ @Autowired
+ private SOTaskProcessor soTaskProcessor;
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SOTaskManager.class);
+
+ /**
+ * @param orderItems
+ * @param serviceOrderInfoJson
+ */
+ private void registerOrderItemExecutionPlan(List<ServiceOrderItem> orderItems,
+ ServiceOrderInfoJson serviceOrderInfoJson) {
+ List<ExecutionTask> executionTasksSaved = new ArrayList<>();
+ Map<String, Long> internalIdOrderItemsMap = new HashMap<>();
+ if (orderItems != null) {
+ // first we save create all the execution tasks with order item id in relied tasks
+ for (ServiceOrderItem orderItem : orderItems) {
+ ExecutionTask task = new ExecutionTask();
+ task.setOrderItemId(orderItem.getId());
+ task.setNbRetries(3);
+ StringBuilder sb = new StringBuilder();
+ for (OrderItemRelationship orderItemRelationship : orderItem.getOrderItemRelationship()) {
+ sb.append(orderItemRelationship.getId()).append(" ");
+ }
+ task.setReliedTasks(sb.toString());
+ task.setServiceOrderInfoJson(serviceOrderInfoJson);
+ ExecutionTask savedTask = executionTaskRepository.save(task);
+ executionTasksSaved.add(savedTask);
+ internalIdOrderItemsMap.put(savedTask.getOrderItemId(), savedTask.getInternalId());
+ }
+ // then we replace all orderitem ids in reliedtasks field with internalid of the tasks
+ for (ExecutionTask executionTask : executionTasksSaved) {
+ for (String key : internalIdOrderItemsMap.keySet()) {
+ String replace = executionTask.getReliedTasks().replace(key,
+ String.valueOf(internalIdOrderItemsMap.get(key)));
+ executionTask.setReliedTasks(replace);
+ }
+ executionTaskRepository.save(executionTask);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param serviceOrder
+ * @param serviceOrderInfo
+ */
+ public void registerServiceOrder(ServiceOrder serviceOrder, ServiceOrderInfo serviceOrderInfo) {
+ String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
+ ServiceOrderInfoJson serviceOrderInfoJson = new ServiceOrderInfoJson(serviceOrder.getId(), json);
+ serviceOrderInfoRepository.save(serviceOrderInfoJson);
+ registerOrderItemExecutionPlan(serviceOrder.getOrderItem(), serviceOrderInfoJson);
+ }
+
+
+ @Scheduled(fixedRate = 2000)
+ private void processExecutionPlan() {
+ List<ExecutionTask> taskToExecute = executionTaskRepository.findByReliedTasksIsEmpty();
+ for (ExecutionTask executionTask : taskToExecute) {
+ soTaskProcessor.processOrderItem(executionTask);
+ }
+ }
+}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
new file mode 100644
index 0000000..0bc7185
--- /dev/null
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskProcessor.java
@@ -0,0 +1,349 @@
+package org.onap.nbi.apis.serviceorder.workflow;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import org.onap.nbi.apis.serviceorder.SoClient;
+import org.onap.nbi.apis.serviceorder.model.ServiceCharacteristic;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
+import org.onap.nbi.apis.serviceorder.model.StateType;
+import org.onap.nbi.apis.serviceorder.model.consumer.CloudConfiguration;
+import org.onap.nbi.apis.serviceorder.model.consumer.CreateServiceInstanceResponse;
+import org.onap.nbi.apis.serviceorder.model.consumer.GetRequestStatusResponse;
+import org.onap.nbi.apis.serviceorder.model.consumer.ModelInfo;
+import org.onap.nbi.apis.serviceorder.model.consumer.RequestDetails;
+import org.onap.nbi.apis.serviceorder.model.consumer.RequestInfo;
+import org.onap.nbi.apis.serviceorder.model.consumer.RequestParameters;
+import org.onap.nbi.apis.serviceorder.model.consumer.RequestState;
+import org.onap.nbi.apis.serviceorder.model.consumer.SubscriberInfo;
+import org.onap.nbi.apis.serviceorder.model.consumer.UserParams;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfoJson;
+import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository;
+import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderRepository;
+import org.onap.nbi.apis.serviceorder.utils.JsonEntityConverter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+@Service
+public class SOTaskProcessor {
+
+ @Value("${nbi.callForVNF}")
+ private boolean enableCallForVNF;
+
+ @Value("${onap.lcpCloudRegionId}")
+ private String lcpCloudRegionId;
+
+ @Value("${onap.tenantId}")
+ private String tenantId;
+
+ @Autowired
+ private ServiceOrderRepository serviceOrderRepository;
+
+ @Autowired
+ private ExecutionTaskRepository executionTaskRepository;
+
+ @Autowired
+ private SoClient soClient;
+
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SOTaskProcessor.class);
+
+ /**
+ * Run the ServiceOrchestrator processing for a serviceOrderItem which with any sub relations
+ */
+ public void processOrderItem(ExecutionTask executionTask) {
+
+
+ ServiceOrderInfoJson serviceOrderInfoJson = executionTask.getServiceOrderInfoJson();
+ ServiceOrder serviceOrder = serviceOrderRepository.findOne(serviceOrderInfoJson.getServiceOrderId());
+ ServiceOrderItem serviceOrderItem = null;
+ for (ServiceOrderItem item : serviceOrder.getOrderItem()) {
+ if (item.getId().equals(executionTask.getOrderItemId())) {
+ serviceOrderItem = item;
+ }
+ }
+
+ ServiceOrderInfo serviceOrderInfo = null;
+ try {
+ serviceOrderInfo =
+ JsonEntityConverter.convertJsonToServiceOrderInfo(serviceOrderInfoJson.getServiceOrderInfoJson());
+ } catch (IOException e) {
+ LOGGER.error("Unable to read ServiceOrderInfo Json for serviceOrderId " + serviceOrder.getId() + ", "
+ + e.getMessage());
+ }
+
+ if (StateType.ACKNOWLEDGED == serviceOrderItem.getState()) {
+
+ ResponseEntity<CreateServiceInstanceResponse> response = postSORequest(serviceOrderItem, serviceOrderInfo);
+
+ updateServiceOrderItem(response.getBody(), serviceOrderItem);
+
+ if (response.getStatusCode() != HttpStatus.CREATED || response.getBody() == null
+ || response.getBody().getRequestReference() == null) {
+ serviceOrderItem.setState(StateType.FAILED);
+ } else {
+ serviceOrderItem.setState(StateType.INPROGRESS);
+ }
+ }
+
+ if (executionTask.getNbRetries() > 0) {
+ // TODO lancer en asynchrone
+ pollSoRequestStatus(serviceOrderItem);
+ if (serviceOrderItem.getState().equals(StateType.COMPLETED)) {
+ updateSuccessTask(executionTask);
+ } else {
+ int nbRetries = executionTask.getNbRetries();
+ executionTask.setNbRetries(--nbRetries);
+ executionTask.setLastAttemptDate(new Date());
+ executionTaskRepository.save(executionTask);
+ }
+ } else {
+ updateFailedTask(executionTask, serviceOrder);
+ }
+
+
+ updateServiceOrder(serviceOrder);
+ }
+
+ private ResponseEntity<CreateServiceInstanceResponse> postSORequest(ServiceOrderItem serviceOrderItem,
+ ServiceOrderInfo serviceOrderInfo) {
+ RequestDetails requestDetails = buildSoRequest(serviceOrderItem,
+ serviceOrderInfo.getServiceOrderItemInfos().get(serviceOrderItem.getId()).getCatalogResponse(),
+ serviceOrderInfo.getSubscriberInfo());
+ ResponseEntity<CreateServiceInstanceResponse> response = null;
+
+ switch (serviceOrderItem.getAction()) {
+ case ADD:
+ response = soClient.callCreateServiceInstance(requestDetails);
+ break;
+ case DELETE:
+ response = soClient.callDeleteServiceInstance(requestDetails, serviceOrderItem.getService().getId());
+ break;
+ default:
+ break;
+ }
+ return response;
+ }
+
+ private void updateServiceOrder(ServiceOrder serviceOrder) {
+ boolean atLeastOneCompleted = false;
+ boolean atLeastOneNotFinished = false;
+ boolean atLeastOneFailed = false;
+
+
+ for (ServiceOrderItem serviceOrderItem : serviceOrder.getOrderItem()) {
+ switch (serviceOrderItem.getState()) {
+ case COMPLETED:
+ atLeastOneCompleted = true;
+ break;
+ case INPROGRESS:
+ case ACKNOWLEDGED:
+ atLeastOneNotFinished = true;
+ break;
+ case FAILED:
+ atLeastOneFailed = true;
+ break;
+ default:
+ break;
+
+ }
+ }
+
+ if (atLeastOneNotFinished) {
+ serviceOrder.setState(StateType.INPROGRESS);
+ } else {
+ serviceOrder.setCompletionDateTime(new Date());
+ if (atLeastOneFailed) {
+ if (!atLeastOneCompleted) {
+ serviceOrder.setState(StateType.FAILED);
+ } else {
+ serviceOrder.setState(StateType.PARTIAL);
+ }
+ } else {
+ serviceOrder.setState(StateType.COMPLETED);
+ }
+ }
+ serviceOrderRepository.save(serviceOrder);
+ }
+
+
+ /**
+ * * @param orderItem
+ */
+ private void pollSoRequestStatus(ServiceOrderItem orderItem) {
+ boolean stopPolling = false;
+ String requestId = orderItem.getRequestId();
+ GetRequestStatusResponse response = null;
+ int nbRetries = 0;
+
+ while (!stopPolling) {
+ response = soClient.callGetRequestStatus(requestId);
+ if (response != null) {
+ if (response.getRequest().getRequestStatus().getPercentProgress() != 100) {
+ nbRetries++;
+ orderItem.setState(StateType.INPROGRESS);
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ } else if (RequestState.COMPLETE != response.getRequest().getRequestStatus().getRequestState()) {
+ orderItem.setState(StateType.FAILED);
+ stopPolling = true;
+ } else {
+ orderItem.setState(StateType.COMPLETED);
+ stopPolling = true;
+ }
+ } else {
+ orderItem.setState(StateType.INPROGRESS);
+ stopPolling = true;
+ }
+ if (nbRetries == 3) {
+ stopPolling = true;
+ }
+ }
+ }
+
+ /**
+ * Build SO CREATE request from the ServiceOrder and catalog informations from SDC
+ *
+ * @param orderItem
+ * @param sdcInfos
+ * @param subscriberInfo
+ * @return
+ */
+ private RequestDetails buildSoRequest(ServiceOrderItem orderItem, LinkedHashMap<String, Object> sdcInfos,
+ SubscriberInfo subscriberInfo) {
+ RequestDetails requestDetails = new RequestDetails();
+
+ requestDetails.setSubscriberInfo(subscriberInfo);
+
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelType("service");
+ modelInfo.setModelInvariantId((String) sdcInfos.get("invariantUUID"));
+ modelInfo.setModelNameVersionId(orderItem.getService().getServiceSpecification().getId());
+ modelInfo.setModelName((String) sdcInfos.get("name"));
+ modelInfo.setModelVersion((String) sdcInfos.get("version"));
+ requestDetails.setModelInfo(modelInfo);
+
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setInstanceName(orderItem.getService().getName());
+ requestInfo.setSource("VID");
+ requestInfo.setSuppressRollback(false);
+ requestDetails.setRequestInfo(requestInfo);
+
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setSubscriptionServiceType((String) sdcInfos.get("name"));
+ requestParameters.setUserParams(
+ retrieveUserParamsFromServiceCharacteristics(orderItem.getService().getServiceCharacteristic()));
+ requestParameters.setaLaCarte(true);
+ requestDetails.setRequestParameters(requestParameters);
+
+ CloudConfiguration cloudConfiguration = new CloudConfiguration(lcpCloudRegionId, tenantId);
+ requestDetails.setCloudConfiguration(cloudConfiguration);
+ return requestDetails;
+ }
+
+ /**
+ * Build a list of UserParams for the SO request by browsing a list of ServiceCharacteristics
+ * from SDC
+ *
+ * @param characteristics
+ * @return
+ */
+ private List<UserParams> retrieveUserParamsFromServiceCharacteristics(List<ServiceCharacteristic> characteristics) {
+ List<UserParams> userParams = new ArrayList<UserParams>();
+
+ if (!CollectionUtils.isEmpty(characteristics)) {
+ for (ServiceCharacteristic characteristic : characteristics) {
+ UserParams userParam = new UserParams(characteristic.getName(),
+ characteristic.getValue().getServiceCharacteristicValue());
+ userParams.add(userParam);
+ }
+ }
+
+ return userParams;
+ }
+
+
+ /**
+ * Update ServiceOrderItem with SO response by using serviceOrderRepository with the
+ * serviceOrderId
+ *
+ * @param createServiceInstanceResponse
+ * @param orderItem
+ */
+ private void updateServiceOrderItem(CreateServiceInstanceResponse createServiceInstanceResponse,
+ ServiceOrderItem orderItem) {
+
+ if (createServiceInstanceResponse != null && !orderItem.getState().equals(StateType.FAILED)) {
+ orderItem.getService().setId(createServiceInstanceResponse.getRequestReference().getInstanceId());
+ orderItem.setRequestId(createServiceInstanceResponse.getRequestReference().getRequestId());
+ }
+ }
+
+ /**
+ * Update an executionTask in database when it's process with a success
+ *
+ * @param executionTask
+ */
+ private void updateSuccessTask(ExecutionTask executionTask) {
+ executionTaskRepository.delete(executionTask.getInternalId());
+ executionTaskRepository.updateReliedTaskAfterDelete(executionTask.getInternalId());
+ }
+
+ /**
+ * @param executionTask
+ * @param serviceOrder
+ */
+ private void updateFailedTask(ExecutionTask executionTask, ServiceOrder serviceOrder) {
+ List<ExecutionTask> executionTasksToDelete = findExecutionTasksRecursively(executionTask);
+ for (ExecutionTask taskId : executionTasksToDelete) {
+ executionTaskRepository.delete(taskId);
+ }
+
+ for (ServiceOrderItem item : serviceOrder.getOrderItem()) {
+ for (ExecutionTask taskToDelete : executionTasksToDelete) {
+ if (taskToDelete.getOrderItemId().equals(item.getId())) {
+ item.setState(StateType.FAILED);
+ }
+ }
+ }
+ }
+
+ /**
+ * @param executionTask
+ * @return
+ */
+ private List<ExecutionTask> findExecutionTasksRecursively(ExecutionTask executionTask) {
+
+ List<ExecutionTask> executionTasks = new ArrayList<>();
+
+ List<ExecutionTask> tasksReliedToAnOrderItemId =
+ executionTaskRepository.findTasksReliedToAnOrderItemId(executionTask.getInternalId());
+
+ if (CollectionUtils.isEmpty(tasksReliedToAnOrderItemId)) {
+ return Arrays.asList(executionTask);
+ } else {
+ for (ExecutionTask task : tasksReliedToAnOrderItemId) {
+ executionTasks.addAll(findExecutionTasksRecursively(task));
+ }
+ }
+ executionTasks.add(executionTask);
+ return executionTasks;
+ }
+
+
+}
diff --git a/src/main/java/org/onap/nbi/exceptions/ApiError.java b/src/main/java/org/onap/nbi/exceptions/ApiError.java
index 5e030f8..d829aae 100644
--- a/src/main/java/org/onap/nbi/exceptions/ApiError.java
+++ b/src/main/java/org/onap/nbi/exceptions/ApiError.java
@@ -6,12 +6,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "Error", propOrder = {
- "code",
- "message",
- "description",
- "infoURL"
-})
+@XmlType(name = "Error", propOrder = {"code", "message", "description", "infoURL"})
public class ApiError {
@XmlElement(required = true)
protected String code;
@@ -22,8 +17,7 @@ public class ApiError {
@XmlElement(required = true)
protected String infoURL;
- public ApiError() {
- }
+ public ApiError() {}
public ApiError(String code, String message, String description, String infoURL) {
this.code = code;
diff --git a/src/main/java/org/onap/nbi/exceptions/ApiExceptionHandler.java b/src/main/java/org/onap/nbi/exceptions/ApiExceptionHandler.java
index 1f109cb..1781701 100644
--- a/src/main/java/org/onap/nbi/exceptions/ApiExceptionHandler.java
+++ b/src/main/java/org/onap/nbi/exceptions/ApiExceptionHandler.java
@@ -18,22 +18,24 @@ public class ApiExceptionHandler {
@ExceptionHandler(BackendFunctionalException.class)
@ResponseBody
public ResponseEntity<ApiError> backendExceptionHandler(final BackendFunctionalException exception) {
- ApiError apiError = new ApiError(String.valueOf(exception.getHttpStatus().value()), exception.getMessage(), "", "");
+ ApiError apiError =
+ new ApiError(String.valueOf(exception.getHttpStatus().value()), exception.getMessage(), "", "");
return new ResponseEntity<ApiError>(apiError, exception.getHttpStatus());
}
@ExceptionHandler(TechnicalException.class)
@ResponseBody
public ResponseEntity<ApiError> technicalExceptionHandler(final TechnicalException exception) {
- ApiError apiError = new ApiError(String.valueOf(exception.getHttpStatus().value()), exception.getMessage(), "", "");
+ ApiError apiError =
+ new ApiError(String.valueOf(exception.getHttpStatus().value()), exception.getMessage(), "", "");
return new ResponseEntity<ApiError>(apiError, exception.getHttpStatus());
}
@ExceptionHandler(RestClientException.class)
@ResponseBody
public ResponseEntity<ApiError> RestClientExceptionHandler(final RestClientException exception) {
- ApiError apiError = new ApiError("500", HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), "Unable to " +
- "reach ONAP services", "");
+ ApiError apiError = new ApiError("500", HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(),
+ "Unable to " + "reach ONAP services", "");
return new ResponseEntity<ApiError>(apiError, HttpStatus.INTERNAL_SERVER_ERROR);
}
diff --git a/src/main/java/org/onap/nbi/exceptions/BackendErrorHandler.java b/src/main/java/org/onap/nbi/exceptions/BackendErrorHandler.java
index 34c4ac5..7c28b05 100644
--- a/src/main/java/org/onap/nbi/exceptions/BackendErrorHandler.java
+++ b/src/main/java/org/onap/nbi/exceptions/BackendErrorHandler.java
@@ -3,7 +3,6 @@ package org.onap.nbi.exceptions;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.ResponseErrorHandler;
-
import java.io.IOException;
public class BackendErrorHandler implements ResponseErrorHandler {
diff --git a/src/main/java/org/onap/nbi/exceptions/BackendFunctionalException.java b/src/main/java/org/onap/nbi/exceptions/BackendFunctionalException.java
index 176186f..cfddb2b 100644
--- a/src/main/java/org/onap/nbi/exceptions/BackendFunctionalException.java
+++ b/src/main/java/org/onap/nbi/exceptions/BackendFunctionalException.java
@@ -19,4 +19,4 @@ public class BackendFunctionalException extends ApiException {
return httpStatus;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/nbi/exceptions/TechnicalException.java b/src/main/java/org/onap/nbi/exceptions/TechnicalException.java
index a2abe3e..e30006e 100644
--- a/src/main/java/org/onap/nbi/exceptions/TechnicalException.java
+++ b/src/main/java/org/onap/nbi/exceptions/TechnicalException.java
@@ -23,4 +23,4 @@ public class TechnicalException extends ApiException {
this.httpStatus = httpStatus;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/nbi/exceptions/ValidationException.java b/src/main/java/org/onap/nbi/exceptions/ValidationException.java
index 316e8f2..72ea01b 100644
--- a/src/main/java/org/onap/nbi/exceptions/ValidationException.java
+++ b/src/main/java/org/onap/nbi/exceptions/ValidationException.java
@@ -2,7 +2,6 @@ package org.onap.nbi.exceptions;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
-
import java.util.List;
public class ValidationException extends ApiException {
@@ -14,9 +13,7 @@ public class ValidationException extends ApiException {
StringBuilder sb = new StringBuilder();
for (ObjectError error : listErrors) {
if (error instanceof FieldError) {
- sb.append(((FieldError) error).getField())
- .append(" ")
- .append(((FieldError) error).getDefaultMessage())
+ sb.append(((FieldError) error).getField()).append(" ").append(((FieldError) error).getDefaultMessage())
.append(". ");
} else {
sb.append(" ").append(error.getDefaultMessage()).append(". ");
diff --git a/src/main/resources/application-localhost.properties b/src/main/resources/application-localhost.properties
index e753488..6a210a7 100644
--- a/src/main/resources/application-localhost.properties
+++ b/src/main/resources/application-localhost.properties
@@ -1,5 +1,5 @@
# LOGGING
-logging.level.org.onap.nbi=DEBUG
+logging.level.org.onap.nbi=INFO
# ONAP
onap.lcpCloudRegionId=RegionOne
@@ -8,6 +8,7 @@ onap.cloudOwner=CloudOwner
# NBI
nbi.url=http://127.0.0.1:8080/nbi/api/v1
+nbi.callForVNF=false
# SDC
sdc.host=http://127.0.0.1:8090
@@ -19,5 +20,31 @@ aai.host=http://127.0.0.1:8090
aai.header.authorization=Basic QUFJOkFBSQ==
aai.api.id=AAI
+# SO
+so.host=http://127.0.0.1:8090
+so.header.authorization=
+so.api.id=SO
+# MONGO
+spring.data.mongodb.host=localhost
+spring.data.mongodb.port=27017
+spring.data.mongodb.database=ServiceOrderDB
+# MYSQL
+spring.datasource.testWhileIdle=true
+spring.datasource.validationQuery=SELECT 1
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.url=jdbc:mysql://localhost:3306/nbi
+spring.jpa.show-sql=false
+spring.datasource.username=root
+spring.datasource.password=toto
+spring.jpa.hibernate.ddl-auto=update
+spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
+
+# H2
+# spring.datasource.url=jdbc:h2:mem:~/db
+# spring.datasource.username=sa
+# spring.datasource.password=
+# spring.datasource.driver-class-name=org.h2.Driver
+# spring.h2.console.enabled=true
+# spring.h2.console.path=/h2-console \ No newline at end of file
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 10e0d7d..61f2d0c 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -3,5 +3,5 @@ server.contextPath=/nbi/api/v1
server.port = 8080
# LOGGING
-logging.level.=WARN
+logging.level.=INFO
diff --git a/src/test/java/org/onap/nbi/apis/ApiTest.java b/src/test/java/org/onap/nbi/apis/ApiTest.java
new file mode 100644
index 0000000..cdd9f61
--- /dev/null
+++ b/src/test/java/org/onap/nbi/apis/ApiTest.java
@@ -0,0 +1,591 @@
+package org.onap.nbi.apis;
+
+
+import static org.assertj.core.api.Assertions.assertThat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.nbi.apis.assertions.ServiceCatalogAssertions;
+import org.onap.nbi.apis.assertions.ServiceInventoryAssertions;
+import org.onap.nbi.apis.assertions.ServiceOrderAssertions;
+import org.onap.nbi.apis.servicecatalog.ServiceSpecificationResource;
+import org.onap.nbi.apis.serviceinventory.ServiceInventoryResource;
+import org.onap.nbi.apis.serviceorder.ServiceOrderResource;
+import org.onap.nbi.apis.serviceorder.model.ActionType;
+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.StateType;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
+import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository;
+import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderInfoRepository;
+import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderRepository;
+import org.onap.nbi.apis.serviceorder.workflow.SOTaskProcessor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.stubbing.ListStubMappingsResult;
+import com.github.tomakehurst.wiremock.stubbing.StubMapping;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
+public class ApiTest {
+
+ @LocalServerPort
+ int randomServerPort;
+
+ String realServerPort;
+
+ static public WireMockServer wireMockServer = new WireMockServer(8091);
+
+ @Autowired
+ ServiceSpecificationResource serviceSpecificationResource;
+
+ @Autowired
+ ServiceInventoryResource serviceInventoryResource;
+
+ @Autowired
+ ServiceOrderResource serviceOrderResource;
+
+ @Autowired
+ ServiceOrderRepository serviceOrderRepository;
+
+ @Autowired
+ ServiceOrderInfoRepository serviceOrderInfoRepository;
+
+ @Autowired
+ ExecutionTaskRepository executionTaskRepository;
+
+ @Autowired
+ SOTaskProcessor SoTaskProcessor;
+
+ static Validator validator;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ wireMockServer.start();
+ ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
+ validator = factory.getValidator();
+ }
+
+ @AfterClass
+ public static void tearsDown() throws Exception {
+ wireMockServer.stop();
+
+ }
+
+ @After
+ public void tearsDownUpPort() throws Exception {
+ executionTaskRepository.deleteAll();
+ serviceOrderInfoRepository.deleteAll();
+ serviceOrderRepository.deleteAll();
+ wireMockServer.resetToDefaultMappings();
+
+ }
+
+
+ public ExecutionTask getExecutionTask(String orderItemId) {
+ for (ExecutionTask executionTask : executionTaskRepository.findAll()) {
+ if (executionTask.getOrderItemId().equalsIgnoreCase(orderItemId)) {
+ return executionTask;
+ }
+
+ }
+ return null;
+ }
+
+ // serviceCatalog
+
+ @Test
+ @Ignore
+ public void testServiceResourceGetCatalog() throws Exception {
+
+ ResponseEntity<Object> resource =
+ serviceSpecificationResource.getServiceSpecification("1e3feeb0-8e36-46c6-862c-236d9c626439", null);
+ ServiceCatalogAssertions.assertGetServiceCatalog(resource);
+
+ }
+
+ @Test
+ public void testServiceCatalogGetResourceWithoutTosca() throws Exception {
+
+ ResponseEntity<Object> resource = serviceSpecificationResource
+ .getServiceSpecification("1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca", null);
+ ServiceCatalogAssertions.asserGetServiceCatalogWithoutTosca(resource);
+
+ }
+
+ @Test
+ public void testServiceCatalogFind() throws Exception {
+
+ ResponseEntity<Object> resource = serviceSpecificationResource.findServiceSpecification(null);
+ ServiceCatalogAssertions.assertFindServiceCatalog(resource);
+
+ }
+
+
+ @Test
+ public void testServiceCatalogFindWithFilter() throws Exception {
+
+ MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+ params.add("fields", "name");
+ ResponseEntity<Object> resource = serviceSpecificationResource.findServiceSpecification(params);
+ ServiceCatalogAssertions.assertFindServiceCatalogWIthFilter(resource);
+
+ }
+
+ // serviceInventory
+
+ @Test
+ public void testServiceResourceGetInventory() throws Exception {
+
+ String serviceName = "vFW";
+ String serviceId = "e4688e5f-61a0-4f8b-ae02-a2fbde623bcb";
+ MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+ params.add("serviceSpecification.name", serviceName);
+ params.add("relatedParty.id", "6490");
+ ResponseEntity<Object> resource = serviceInventoryResource.getServiceInventory(serviceId, params);
+ ServiceInventoryAssertions.assertServiceInventoryGet(resource);
+
+ }
+
+
+ @Test
+ public void testServiceResourceGetInventoryWithServiceSpecId() throws Exception {
+
+ String serviceId = "e4688e5f-61a0-4f8b-ae02-a2fbde623bcb";
+ MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+ params.add("serviceSpecification.id", "1e3feeb0-8e36-46c6-862c-236d9c626439");
+ params.add("relatedParty.id", "6490");
+ ResponseEntity<Object> resource = serviceInventoryResource.getServiceInventory(serviceId, params);
+ ServiceInventoryAssertions.assertServiceInventoryGet(resource);
+
+ }
+
+
+ @Test
+ public void testServiceInventoryFind() throws Exception {
+
+ MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+ String serviceName = "vFW";
+ params.add("serviceSpecification.name", serviceName);
+ params.add("relatedParty.id", "6490");
+
+ ResponseEntity<Object> resource = serviceInventoryResource.findServiceInventory(params);
+ ServiceInventoryAssertions.assertServiceInventoryFind(resource);
+
+ }
+
+
+ @Test
+ public void testServiceInventoryFindWithServiceSpecId() throws Exception {
+
+ MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+ params.add("serviceSpecification.id", "1e3feeb0-8e36-46c6-862c-236d9c626439");
+ params.add("relatedParty.id", "6490");
+
+ ResponseEntity<Object> resource = serviceInventoryResource.findServiceInventory(params);
+ ServiceInventoryAssertions.assertServiceInventoryFind(resource);
+
+ }
+
+
+ @Test
+ public void testServiceInventoryFindWithoutParameter() throws Exception {
+
+ MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+ params.add("relatedParty.id", "6490");
+
+ ResponseEntity<Object> resource = serviceInventoryResource.findServiceInventory(params);
+ ServiceInventoryAssertions.assertServiceInventoryFindWithoutParameter(resource);
+
+ }
+
+ @Test
+ public void testCreateServiceOrderResource() throws Exception {
+
+ ResponseEntity<Object> serviceOrder = serviceOrderResource
+ .createServiceOrder(ServiceOrderAssertions.createTestServiceOrder(ActionType.ADD), null, null);
+ assertThat(serviceOrder.getStatusCodeValue()).isEqualTo(201);
+ ServiceOrder body = (ServiceOrder) serviceOrder.getBody();
+ assertThat(body.getId()).isNotNull();
+ assertThat(body.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+
+
+ }
+
+ @Test
+ public void testCheckServiceOrder() throws Exception {
+
+ ServiceOrder testServiceOrder = ServiceOrderAssertions.createTestServiceOrder(ActionType.ADD);
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ serviceOrderResource.scheduleCheckServiceOrders();
+
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+
+ }
+
+ @Test
+ public void testCheckServiceOrderWithGenericCustomer() throws Exception {
+
+ ServiceOrder testServiceOrder = ServiceOrderAssertions.createTestServiceOrder(ActionType.ADD);
+ testServiceOrder.setRelatedParty(new ArrayList<>());
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ serviceOrderResource.scheduleCheckServiceOrders();
+
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+
+ }
+
+ @Test
+ public void testCheckServiceOrderWithUnKnonwCustomer() throws Exception {
+
+ ServiceOrder testServiceOrder = ServiceOrderAssertions.createTestServiceOrder(ActionType.ADD);
+ List<RelatedParty> customers = new ArrayList<>();
+ RelatedParty customer = new RelatedParty();
+ customer.setId("new");
+ customer.setRole("ONAPcustomer");
+ customer.setName("romain");
+ customers.add(customer);
+ testServiceOrder.setRelatedParty(customers);
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ serviceOrderResource.scheduleCheckServiceOrders();
+
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+
+ }
+
+ @Test
+ public void testCheckServiceOrderDelete() throws Exception {
+
+ ServiceOrder testServiceOrder = ServiceOrderAssertions.createTestServiceOrder(ActionType.DELETE);
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
+ serviceOrderItem.setState(StateType.ACKNOWLEDGED);
+ }
+ serviceOrderRepository.save(testServiceOrder);
+
+ serviceOrderResource.scheduleCheckServiceOrders();
+
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+
+ }
+
+ @Test
+ public void testCheckServiceOrderDeleteRejected() throws Exception {
+
+ ServiceOrder testServiceOrder = ServiceOrderAssertions.createTestServiceOrder(ActionType.DELETE);
+ for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
+ serviceOrderItem.getService().setId("no_response");
+
+ }
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ serviceOrderResource.scheduleCheckServiceOrders();
+
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.REJECTED);
+
+ }
+
+ @Test
+ public void testCheckServiceOrderNoChange() throws Exception {
+
+ ServiceOrder testServiceOrder = ServiceOrderAssertions.createTestServiceOrder(ActionType.DELETE);
+ for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
+ serviceOrderItem.setAction(ActionType.NOCHANGE);
+ }
+
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ serviceOrderResource.scheduleCheckServiceOrders();
+
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ }
+
+ }
+
+
+
+ @Test
+ public void testCheckServiceOrderNoChangeAndDelete() throws Exception {
+
+ ServiceOrder testServiceOrder = ServiceOrderAssertions.createTestServiceOrder(ActionType.DELETE);
+ for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ serviceOrderItem.setAction(ActionType.NOCHANGE);
+ }
+ serviceOrderItem.setState(StateType.ACKNOWLEDGED);
+ }
+
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ serviceOrderResource.scheduleCheckServiceOrders();
+
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A"))
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ }
+ }
+
+
+
+ @Test
+ public void testCheckServiceOrderRejected() throws Exception {
+
+
+ ServiceOrder testServiceOrder = ServiceOrderAssertions.createTestServiceOrderRejected();
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ serviceOrderResource.scheduleCheckServiceOrders();
+
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.REJECTED);
+
+ }
+
+ @Test
+ public void validateServiceOrderBeanWithAnnotation() {
+ ServiceOrder serviceOrder = ServiceOrderAssertions.createTestServiceOrder(ActionType.ADD);
+ Set violations = validator.validate(serviceOrder);
+ assertThat(violations).isEmpty();
+
+ ServiceOrderItem item = new ServiceOrderItem();
+ item.setAction(ActionType.DELETE);
+ item.setService(new Service());
+ serviceOrder.addOrderItemItem(item);
+
+ violations = validator.validate(serviceOrder);
+ assertThat(violations).isNotEmpty();
+ }
+
+
+
+ @Test
+ public void testFindAndGetServiceOrder() throws Exception {
+
+ ServiceOrder testServiceOrder = ServiceOrderAssertions.createTestServiceOrder(ActionType.ADD);
+ for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
+ serviceOrderItem.setState(StateType.ACKNOWLEDGED);
+ }
+ testServiceOrder.setExternalId("extid1");
+ testServiceOrder.setOrderDate(new Date());
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setDescription("toto");
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+
+ ServiceOrder testServiceOrder2 = ServiceOrderAssertions.createTestServiceOrder(ActionType.ADD);
+ testServiceOrder2.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder2.setDescription("toto");
+ testServiceOrder2.setId("test2");
+ testServiceOrder2.setExternalId("extid2");
+ testServiceOrder2.setOrderDate(new Date());
+
+ serviceOrderRepository.save(testServiceOrder2);
+
+
+ MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+ params.add("fields", "id");
+
+ ResponseEntity<Object> serviceOrdersResponse = serviceOrderResource.findServiceOrder(params);
+ ArrayList serviceOrders = (ArrayList) serviceOrdersResponse.getBody();
+ assertThat(serviceOrders.size()).isEqualTo(2);
+
+ params.add("externalId", "extid1");
+ params.add("state", "acknowledged");
+
+ serviceOrdersResponse = serviceOrderResource.findServiceOrder(params);
+ serviceOrders = (ArrayList) serviceOrdersResponse.getBody();
+ assertThat(serviceOrders.size()).isEqualTo(1);
+
+ MultiValueMap<String, String> paramsDate = new LinkedMultiValueMap<>();
+ paramsDate.add("orderDate.gt", "2017-01-01 00:00:00.000");
+ paramsDate.add("orderDate.lt", "2030-01-01 00:00:00.000");
+ paramsDate.add("offset", "0");
+ paramsDate.add("limit", "2");
+
+ serviceOrdersResponse = serviceOrderResource.findServiceOrder(paramsDate);
+ serviceOrders = (ArrayList) serviceOrdersResponse.getBody();
+ assertThat(serviceOrders.size()).isEqualTo(2);
+
+
+ ResponseEntity<Object> serviceOrderResponse =
+ serviceOrderResource.getServiceOrder("test2", new LinkedMultiValueMap<>());
+ ServiceOrder serviceOrder = (ServiceOrder) serviceOrderResponse.getBody();
+ assertThat(serviceOrder).isNotNull();
+ }
+
+
+
+ @Test
+ public void testExecutionTaskSuccess() throws Exception {
+
+ ExecutionTask executionTaskA = ServiceOrderAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
+ serviceOrderInfoRepository, executionTaskRepository, ActionType.ADD);
+ ExecutionTask executionTaskB;
+
+
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
+
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+
+ }
+
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB).isNull();
+
+
+ }
+
+
+ @Test
+ public void testExecutionTaskDeleteSuccess() throws Exception {
+
+ ExecutionTask executionTaskA = ServiceOrderAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
+ serviceOrderInfoRepository, executionTaskRepository, ActionType.DELETE);
+ ExecutionTask executionTaskB;
+
+
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB.getReliedTasks()).isNullOrEmpty();
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA).isNull();
+
+ SoTaskProcessor.processOrderItem(executionTaskB);
+ serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.COMPLETED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.COMPLETED);
+
+ }
+
+ executionTaskB = getExecutionTask("B");
+ assertThat(executionTaskB).isNull();
+
+
+ }
+
+
+ @Test
+ public void testExecutionTaskFailed() throws Exception {
+
+ ExecutionTask executionTaskA = ServiceOrderAssertions.setUpBddForExecutionTaskSucess(serviceOrderRepository,
+ serviceOrderInfoRepository, executionTaskRepository, ActionType.ADD);
+
+ ListStubMappingsResult listStubMappingsResult = wireMockServer.listAllStubMappings();
+ StubMapping mappingToDelete = null;
+ List<StubMapping> mappings = listStubMappingsResult.getMappings();
+ for (StubMapping mapping : mappings) {
+ if (mapping.getRequest().getUrl().equals("/ecomp/mso/infra/orchestrationRequests/v4/requestId")) {
+ mappingToDelete = mapping;
+ }
+ }
+ wireMockServer.removeStubMapping(mappingToDelete);
+
+
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ ServiceOrder serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.INPROGRESS);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ if (serviceOrderItem.getId().equals("A")) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.INPROGRESS);
+ } else {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.ACKNOWLEDGED);
+ }
+ }
+ executionTaskA = getExecutionTask("A");
+ assertThat(executionTaskA.getNbRetries()).isEqualTo(2);
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ executionTaskA = getExecutionTask("A");
+ SoTaskProcessor.processOrderItem(executionTaskA);
+ executionTaskA = getExecutionTask("A");
+ SoTaskProcessor.processOrderItem(executionTaskA);
+
+ serviceOrderChecked = serviceOrderRepository.findOne("test");
+ assertThat(serviceOrderChecked.getState()).isEqualTo(StateType.FAILED);
+ for (ServiceOrderItem serviceOrderItem : serviceOrderChecked.getOrderItem()) {
+ assertThat(serviceOrderItem.getState()).isEqualTo(StateType.FAILED);
+
+ }
+
+ ExecutionTask executionTaskB = executionTaskRepository.findOne(Long.parseLong("2"));
+ assertThat(executionTaskB).isNull();
+
+
+ }
+
+}
diff --git a/src/test/java/org/onap/nbi/apis/ServiceOrderRepositoryTest.java b/src/test/java/org/onap/nbi/apis/ServiceOrderRepositoryTest.java
new file mode 100644
index 0000000..93c9000
--- /dev/null
+++ b/src/test/java/org/onap/nbi/apis/ServiceOrderRepositoryTest.java
@@ -0,0 +1,45 @@
+package org.onap.nbi.apis;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
+import org.onap.nbi.apis.serviceorder.model.StateType;
+import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class ServiceOrderRepositoryTest {
+
+ @Autowired
+ ServiceOrderRepository serviceOrderRepository;
+
+
+ @Before
+ public void setUp() {
+ ServiceOrder serviceOrder = new ServiceOrder();
+ serviceOrder.setId("test");
+ serviceOrder.setState(StateType.INPROGRESS);
+ serviceOrderRepository.save(serviceOrder);
+ }
+
+ @Test
+ public void findById() {
+ ServiceOrder result = serviceOrderRepository.findOne("test");
+ assertNotNull(result);
+ }
+
+ @Test
+ public void findByState() {
+ List<ServiceOrder> result = serviceOrderRepository.findByState(StateType.INPROGRESS);
+ assertFalse(result.isEmpty());
+ }
+
+}
diff --git a/src/test/java/org/onap/nbi/apis/resources/StatusResourceTest.java b/src/test/java/org/onap/nbi/apis/StatusResourceTest.java
index 40e11c2..f988996 100644
--- a/src/test/java/org/onap/nbi/apis/resources/StatusResourceTest.java
+++ b/src/test/java/org/onap/nbi/apis/StatusResourceTest.java
@@ -1,4 +1,4 @@
-package org.onap.nbi.apis.resources;
+package org.onap.nbi.apis;
import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/src/test/java/org/onap/nbi/apis/resources/ServiceCatalogAssertions.java b/src/test/java/org/onap/nbi/apis/assertions/ServiceCatalogAssertions.java
index 19e2a2a..3f44640 100644
--- a/src/test/java/org/onap/nbi/apis/resources/ServiceCatalogAssertions.java
+++ b/src/test/java/org/onap/nbi/apis/assertions/ServiceCatalogAssertions.java
@@ -1,13 +1,11 @@
-package org.onap.nbi.apis.resources;
+package org.onap.nbi.apis.assertions;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-
import java.util.ArrayList;
import java.util.LinkedHashMap;
-
import static org.assertj.core.api.Assertions.assertThat;
@@ -20,7 +18,8 @@ public class ServiceCatalogAssertions {
assertThat(service.get("id")).isEqualTo("1e3feeb0-8e36-46c6-862c-236d9c626439");
assertThat(service.get("name")).isEqualTo("vFW");
assertThat(service.get("invariantUUID")).isEqualTo("b58a118e-eeb9-4f6e-bdca-e292f84d17df");
- assertThat(service.get("toscaModelURL")).isEqualTo("/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/toscaModel");
+ assertThat(service.get("toscaModelURL"))
+ .isEqualTo("/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/toscaModel");
assertThat(service.get("distributionStatus")).isEqualTo("DISTRIBUTED");
assertThat(service.get("version")).isEqualTo("2.0");
assertThat(service.get("lifecycleStatus")).isEqualTo("CERTIFIED");
@@ -47,7 +46,8 @@ public class ServiceCatalogAssertions {
if (serviceSPecCharacteristicMap.get("name").toString().equals("cpus")) {
assertThat(serviceSPecCharacteristicMap.get("valueType")).isEqualTo("integer");
assertThat(serviceSPecCharacteristicMap.get("@type")).isEqualTo("ONAPserviceCharacteristic");
- ArrayList serviceSpecCharacteristicValues = (ArrayList) serviceSPecCharacteristicMap.get("serviceSpecCharacteristicValue");
+ ArrayList serviceSpecCharacteristicValues =
+ (ArrayList) serviceSPecCharacteristicMap.get("serviceSpecCharacteristicValue");
for (Object serviceSpecCharacteristicValue : serviceSpecCharacteristicValues) {
LinkedHashMap serviceSpecCharacteristicValueMap = (LinkedHashMap) serviceSpecCharacteristicValue;
if (serviceSpecCharacteristicValueMap.get("value").toString().equals("2")) {
@@ -70,7 +70,8 @@ public class ServiceCatalogAssertions {
assertThat(service.get("id")).isEqualTo("1e3feeb0-8e36-46c6-862c-236d9c626439");
assertThat(service.get("name")).isEqualTo("vFW");
assertThat(service.get("invariantUUID")).isEqualTo("b58a118e-eeb9-4f6e-bdca-e292f84d17df");
- assertThat(service.get("toscaModelURL")).isEqualTo("/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439toto/toscaModel");
+ assertThat(service.get("toscaModelURL"))
+ .isEqualTo("/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439toto/toscaModel");
assertThat(service.get("distributionStatus")).isEqualTo("DISTRIBUTED");
assertThat(service.get("version")).isEqualTo("2.0");
assertThat(service.get("lifecycleStatus")).isEqualTo("CERTIFIED");
@@ -95,7 +96,6 @@ public class ServiceCatalogAssertions {
-
public static void assertFindServiceCatalog(ResponseEntity<Object> resource) {
assertThat(resource.getStatusCode()).isEqualTo(HttpStatus.OK);
ArrayList body = (ArrayList) resource.getBody();
diff --git a/src/test/java/org/onap/nbi/apis/resources/ServiceInventoryAssertions.java b/src/test/java/org/onap/nbi/apis/assertions/ServiceInventoryAssertions.java
index e8afc9c..426b1a1 100644
--- a/src/test/java/org/onap/nbi/apis/resources/ServiceInventoryAssertions.java
+++ b/src/test/java/org/onap/nbi/apis/assertions/ServiceInventoryAssertions.java
@@ -1,22 +1,19 @@
-package org.onap.nbi.apis.resources;
+package org.onap.nbi.apis.assertions;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-
import java.util.ArrayList;
import java.util.LinkedHashMap;
-
import static org.assertj.core.api.Assertions.assertThat;
public class ServiceInventoryAssertions {
-
public static void assertServiceInventoryGet(ResponseEntity<Object> resource) {
assertThat(resource.getStatusCode()).isEqualTo(HttpStatus.OK);
- LinkedHashMap service = (LinkedHashMap)resource.getBody();
+ LinkedHashMap service = (LinkedHashMap) resource.getBody();
assertThat(service.get("id")).isEqualTo("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
assertThat(service.get("name")).isEqualTo("NewFreeRadius-service-instance-01");
assertThat(service.get("hasStarted")).isEqualTo("yes");
@@ -25,13 +22,13 @@ public class ServiceInventoryAssertions {
LinkedHashMap relatedParty = (LinkedHashMap) service.get("relatedParty");
assertThat(relatedParty.get("role")).isEqualTo("ONAPcustomer");
assertThat(relatedParty.get("id")).isEqualTo("6490");
- LinkedHashMap serviceSpecification = (LinkedHashMap)service.get("serviceSpecification");
+ LinkedHashMap serviceSpecification = (LinkedHashMap) service.get("serviceSpecification");
assertThat(serviceSpecification.get("id")).isEqualTo("98d95267-5e0f-4531-abf8-f14b90031dc5");
assertThat(serviceSpecification.get("invariantUUID")).isEqualTo("709d157b-52fb-4250-976e-7133dff5c347");
assertThat(serviceSpecification.get("@type")).isEqualTo("ONAPservice");
- assertThat(((ArrayList)service.get("supportingResource")).size()).isEqualTo(2);
+ assertThat(((ArrayList) service.get("supportingResource")).size()).isEqualTo(2);
LinkedHashMap resource1 = (LinkedHashMap) ((ArrayList) service.get("supportingResource")).get(0);
assertThat(resource1.get("id")).isEqualTo("cb80fbb6-9aa7-4ac5-9541-e14f45de533e");
assertThat(resource1.get("name")).isEqualTo("NewFreeRadius-VNF-instance-01");
@@ -44,9 +41,9 @@ public class ServiceInventoryAssertions {
public static void assertServiceInventoryFind(ResponseEntity<Object> resource) {
assertThat(resource.getStatusCode()).isEqualTo(HttpStatus.OK);
- ArrayList body = (ArrayList)resource.getBody();
+ ArrayList body = (ArrayList) resource.getBody();
assertThat(body.size()).isEqualTo(1);
- LinkedHashMap service1 = (LinkedHashMap)body.get(0);
+ LinkedHashMap service1 = (LinkedHashMap) body.get(0);
assertThat(service1.get("id")).isEqualTo("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
assertThat(service1.get("name")).isEqualTo("NewFreeRadius-service-instance-01");
LinkedHashMap relatedParty = (LinkedHashMap) service1.get("relatedParty");
@@ -60,9 +57,9 @@ public class ServiceInventoryAssertions {
public static void assertServiceInventoryFindWithoutParameter(ResponseEntity<Object> resource) {
assertThat(resource.getStatusCode()).isEqualTo(HttpStatus.OK);
- ArrayList body = (ArrayList)resource.getBody();
+ ArrayList body = (ArrayList) resource.getBody();
assertThat(body.size()).isEqualTo(2);
- LinkedHashMap service1 = (LinkedHashMap)body.get(0);
+ LinkedHashMap service1 = (LinkedHashMap) body.get(0);
assertThat(service1.get("id")).isEqualTo("vfw-service-id");
assertThat(service1.get("name")).isEqualTo("vfw-service-name");
LinkedHashMap relatedParty = (LinkedHashMap) service1.get("relatedParty");
@@ -73,7 +70,7 @@ public class ServiceInventoryAssertions {
assertThat(serviceSpecification.get("id")).isEqualTo("9vfw-service-modek-version-id");
- LinkedHashMap service2 = (LinkedHashMap)body.get(1);
+ LinkedHashMap service2 = (LinkedHashMap) body.get(1);
assertThat(service2.get("id")).isEqualTo("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
assertThat(service2.get("name")).isEqualTo("NewFreeRadius-service-instance-01");
relatedParty = (LinkedHashMap) service1.get("relatedParty");
diff --git a/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java
new file mode 100644
index 0000000..2e89a8a
--- /dev/null
+++ b/src/test/java/org/onap/nbi/apis/assertions/ServiceOrderAssertions.java
@@ -0,0 +1,206 @@
+package org.onap.nbi.apis.assertions;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+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.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.consumer.SubscriberInfo;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfoJson;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderItemInfo;
+import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository;
+import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderInfoRepository;
+import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderRepository;
+import org.onap.nbi.apis.serviceorder.utils.JsonEntityConverter;
+
+
+public class ServiceOrderAssertions {
+
+ public static ServiceOrder createTestServiceOrderRejected() {
+ ServiceOrder serviceOrder = new ServiceOrder();
+ serviceOrder.setExternalId("LudONAP001");
+ serviceOrder.setPriority("1");
+ serviceOrder.setDescription("Ludo first ONAP Order");
+ serviceOrder.setCategory("Consumer");
+ serviceOrder.setRequestedStartDate(new Date());
+ serviceOrder.setRequestedCompletionDate(new Date());
+
+ RelatedParty party = new RelatedParty();
+ party.setId("6490");
+ party.setRole("ONAPcustomer");
+ party.setReferredType("individual");
+ party.setName("Jean Pontus");
+ List<RelatedParty> relatedPartyList = new ArrayList<>();
+ relatedPartyList.add(party);
+ serviceOrder.setRelatedParty(relatedPartyList);
+
+ List<ServiceOrderItem> items = new ArrayList<>();
+
+ ServiceOrderItem itemA = new ServiceOrderItem();
+ itemA.id("A");
+ itemA.action(ActionType.ADD);
+ Service serviceA = new Service();
+ serviceA.setServiceState("active");
+ ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
+ serviceSpecificationRefA.setId("333");
+ serviceA.setServiceSpecification(serviceSpecificationRefA);
+ itemA.setService(serviceA);
+ items.add(itemA);
+
+ ServiceOrderItem itemB = new ServiceOrderItem();
+ itemB.id("B");
+ itemB.action(ActionType.ADD);
+ Service serviceB = new Service();
+ serviceB.setServiceState("active");
+ ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
+ serviceSpecificationRefB.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
+ serviceB.setServiceSpecification(serviceSpecificationRefB);
+ itemB.setService(serviceB);
+ List<OrderItemRelationship> orderItemRelationships = new ArrayList<>();
+ OrderItemRelationship orderItemRelationship = new OrderItemRelationship();
+ orderItemRelationship.setId("A");
+ orderItemRelationships.add(orderItemRelationship);
+ itemB.setOrderItemRelationship(orderItemRelationships);
+ items.add(itemB);
+ serviceOrder.setOrderItem(items);
+ return serviceOrder;
+
+ }
+
+
+ public static ServiceOrder createTestServiceOrder(ActionType actionType) {
+ ServiceOrder serviceOrder = new ServiceOrder();
+ serviceOrder.setExternalId("LudONAP001");
+ serviceOrder.setPriority("1");
+ serviceOrder.setDescription("Ludo first ONAP Order");
+ serviceOrder.setCategory("Consumer");
+ serviceOrder.setRequestedStartDate(new Date());
+ serviceOrder.setRequestedCompletionDate(new Date());
+ serviceOrder.setBaseType("toto");
+ serviceOrder.setCompletionDateTime(new Date());
+ serviceOrder.setExpectedCompletionDate(new Date());
+ serviceOrder.setSchemaLocation("/tutu");
+
+ OrderRelationship orderRelationship = new OrderRelationship();
+ orderRelationship.setId("test");
+ orderRelationship.setHref("test");
+ orderRelationship.setReferredType("test");
+ orderRelationship.setType("type");
+ List<OrderRelationship> relationships = new ArrayList<>();
+ serviceOrder.setOrderRelationship(relationships);
+
+ RelatedParty party = new RelatedParty();
+ party.setId("6490");
+ party.setRole("ONAPcustomer");
+ party.setReferredType("individual");
+ party.setName("Jean Pontus");
+ List<RelatedParty> relatedPartyList = new ArrayList<>();
+ relatedPartyList.add(party);
+ serviceOrder.setRelatedParty(relatedPartyList);
+
+ List<ServiceOrderItem> items = new ArrayList<>();
+
+ ServiceOrderItem itemA = new ServiceOrderItem();
+ itemA.id("A");
+ itemA.action(actionType);
+ Service serviceA = new Service();
+ if (actionType != ActionType.ADD) {
+ serviceA.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
+ }
+ serviceA.setServiceState("active");
+ ServiceSpecificationRef serviceSpecificationRefA = new ServiceSpecificationRef();
+ serviceSpecificationRefA.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
+ serviceA.setServiceSpecification(serviceSpecificationRefA);
+ itemA.setService(serviceA);
+ items.add(itemA);
+
+ ServiceOrderItem itemB = new ServiceOrderItem();
+ itemB.id("B");
+ itemB.action(actionType);
+ Service serviceB = new Service();
+ if (actionType != ActionType.ADD) {
+ serviceB.setId("e4688e5f-61a0-4f8b-ae02-a2fbde623bcb");
+ }
+ serviceB.setServiceState("active");
+ ServiceSpecificationRef serviceSpecificationRefB = new ServiceSpecificationRef();
+ serviceSpecificationRefB.setId("1e3feeb0-8e36-46c6-862c-236d9c626439");
+ serviceB.setServiceSpecification(serviceSpecificationRefB);
+ itemB.setService(serviceB);
+ List<OrderItemRelationship> orderItemRelationships = new ArrayList<>();
+ OrderItemRelationship orderItemRelationship = new OrderItemRelationship();
+ orderItemRelationship.setId("A");
+ orderItemRelationships.add(orderItemRelationship);
+ itemB.setOrderItemRelationship(orderItemRelationships);
+ items.add(itemB);
+ serviceOrder.setOrderItem(items);
+ return serviceOrder;
+
+ }
+
+
+ public static ExecutionTask setUpBddForExecutionTaskSucess(ServiceOrderRepository serviceOrderRepository,
+ ServiceOrderInfoRepository serviceOrderInfoRepository, ExecutionTaskRepository executionTaskRepository,
+ ActionType actionType) {
+ ServiceOrder testServiceOrder = createTestServiceOrder(actionType);
+
+ for (ServiceOrderItem serviceOrderItem : testServiceOrder.getOrderItem()) {
+ serviceOrderItem.setState(StateType.ACKNOWLEDGED);
+ }
+
+ testServiceOrder.setState(StateType.ACKNOWLEDGED);
+ testServiceOrder.setId("test");
+ serviceOrderRepository.save(testServiceOrder);
+
+ LinkedHashMap<String, String> sdcResponse = new LinkedHashMap<>();
+ sdcResponse.put("invariantUUID", "uuid");
+ sdcResponse.put("name", "vFW");
+ sdcResponse.put("version", "v1");
+
+ ServiceOrderInfo serviceOrderInfo = new ServiceOrderInfo();
+
+ SubscriberInfo subscriberInfo = new SubscriberInfo();
+ subscriberInfo.setGlobalSubscriberId("6490");
+ subscriberInfo.setSubscriberName("edgar");
+ serviceOrderInfo.setSubscriberInfo(subscriberInfo);
+
+ ServiceOrderItemInfo serviceOrderItemInfoA = new ServiceOrderItemInfo();
+ serviceOrderItemInfoA.setId("A");
+ serviceOrderItemInfoA.setCatalogResponse(sdcResponse);
+
+ ServiceOrderItemInfo serviceOrderItemInfoB = new ServiceOrderItemInfo();
+ serviceOrderItemInfoB.setId("B");
+ serviceOrderItemInfoB.setCatalogResponse(sdcResponse);
+ serviceOrderInfo.addServiceOrderItemInfos("A", serviceOrderItemInfoA);
+ serviceOrderInfo.addServiceOrderItemInfos("B", serviceOrderItemInfoB);
+
+ String json = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
+ ServiceOrderInfoJson serviceOrderInfoJson = new ServiceOrderInfoJson("test", json);
+ serviceOrderInfoRepository.save(serviceOrderInfoJson);
+
+ ExecutionTask executionTaskA = new ExecutionTask();
+ executionTaskA.setNbRetries(3);
+ executionTaskA.setOrderItemId("A");
+ executionTaskA.setServiceOrderInfoJson(serviceOrderInfoJson);
+ executionTaskA = executionTaskRepository.save(executionTaskA);
+ ExecutionTask executionTaskB = new ExecutionTask();
+ executionTaskB.setNbRetries(3);
+ executionTaskB.setOrderItemId("B");
+ executionTaskB.setReliedTasks(String.valueOf(executionTaskA.getInternalId()));
+ executionTaskB.setServiceOrderInfoJson(serviceOrderInfoJson);
+ executionTaskRepository.save(executionTaskB);
+ return executionTaskA;
+ }
+
+
+
+}
diff --git a/src/test/java/org/onap/nbi/apis/resources/ApiTest.java b/src/test/java/org/onap/nbi/apis/resources/ApiTest.java
deleted file mode 100644
index df2fb24..0000000
--- a/src/test/java/org/onap/nbi/apis/resources/ApiTest.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.onap.nbi.apis.resources;
-
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.nbi.apis.servicecatalog.ServiceSpecificationResource;
-import org.onap.nbi.apis.serviceinventory.ServiceInventoryResource;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.embedded.LocalServerPort;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.http.ResponseEntity;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-import com.github.tomakehurst.wiremock.WireMockServer;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
-public class ApiTest {
-
- @LocalServerPort
- int randomServerPort;
-
- String realServerPort;
-
- static public WireMockServer wireMockServer = new WireMockServer(8091);
-
- @Autowired
- ServiceSpecificationResource serviceSpecificationResource;
-
- @Autowired
- ServiceInventoryResource serviceInventoryResource;
-
- @BeforeClass
- public static void setUp() throws Exception {
- wireMockServer.start();
- }
-
- @AfterClass
- public static void tearsDown() throws Exception {
- wireMockServer.stop();
-
- }
-
- @After
- public void tearsDownUpPort() throws Exception {
- wireMockServer.resetToDefaultMappings();
- }
-
- // serviceCatalog
-
- @Test
- @Ignore
- public void testServiceResourceGetCatalog() throws Exception {
-
- ResponseEntity<Object> resource =
- serviceSpecificationResource.getServiceSpecification("1e3feeb0-8e36-46c6-862c-236d9c626439", null);
- ServiceCatalogAssertions.assertGetServiceCatalog(resource);
-
- }
-
- @Test
- public void testServiceCatalogGetResourceWithoutTosca() throws Exception {
-
- ResponseEntity<Object> resource = serviceSpecificationResource
- .getServiceSpecification("1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca", null);
- ServiceCatalogAssertions.asserGetServiceCatalogWithoutTosca(resource);
-
- }
-
- @Test
- public void testServiceCatalogFind() throws Exception {
-
- ResponseEntity<Object> resource = serviceSpecificationResource.findServiceSpecification(null);
- ServiceCatalogAssertions.assertFindServiceCatalog(resource);
-
- }
-
-
- @Test
- public void testServiceCatalogFindWithFilter() throws Exception {
-
- MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
- params.add("fields", "name");
- ResponseEntity<Object> resource = serviceSpecificationResource.findServiceSpecification(params);
- ServiceCatalogAssertions.assertFindServiceCatalogWIthFilter(resource);
-
- }
-
- // serviceInventory
-
- @Test
- public void testServiceResourceGetInventory() throws Exception {
-
- String serviceName = "vFW";
- String serviceId = "e4688e5f-61a0-4f8b-ae02-a2fbde623bcb";
- MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
- params.add("serviceSpecification.name", serviceName);
- params.add("relatedParty.id", "6490");
- ResponseEntity<Object> resource = serviceInventoryResource.getServiceInventory(serviceId, params);
- ServiceInventoryAssertions.assertServiceInventoryGet(resource);
-
- }
-
-
- @Test
- public void testServiceResourceGetInventoryWithServiceSpecId() throws Exception {
-
- String serviceId = "e4688e5f-61a0-4f8b-ae02-a2fbde623bcb";
- MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
- params.add("serviceSpecification.id", "1e3feeb0-8e36-46c6-862c-236d9c626439");
- params.add("relatedParty.id", "6490");
- ResponseEntity<Object> resource = serviceInventoryResource.getServiceInventory(serviceId, params);
- ServiceInventoryAssertions.assertServiceInventoryGet(resource);
-
- }
-
-
- @Test
- public void testServiceInventoryFind() throws Exception {
-
- MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
- String serviceName = "vFW";
- params.add("serviceSpecification.name", serviceName);
- params.add("relatedParty.id", "6490");
-
- ResponseEntity<Object> resource = serviceInventoryResource.findServiceInventory(params);
- ServiceInventoryAssertions.assertServiceInventoryFind(resource);
-
- }
-
-
- @Test
- public void testServiceInventoryFindWithServiceSpecId() throws Exception {
-
- MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
- params.add("serviceSpecification.id", "1e3feeb0-8e36-46c6-862c-236d9c626439");
- params.add("relatedParty.id", "6490");
-
- ResponseEntity<Object> resource = serviceInventoryResource.findServiceInventory(params);
- ServiceInventoryAssertions.assertServiceInventoryFind(resource);
-
- }
-
-
- @Test
- public void testServiceInventoryFindWithoutParameter() throws Exception {
-
- MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
- params.add("relatedParty.id", "6490");
-
- ResponseEntity<Object> resource = serviceInventoryResource.findServiceInventory(params);
- ServiceInventoryAssertions.assertServiceInventoryFindWithoutParameter(resource);
-
- }
-
-}
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
index f778b8a..793da56 100644
--- a/src/test/resources/application.properties
+++ b/src/test/resources/application.properties
@@ -12,6 +12,7 @@ onap.cloudOwner=CloudOwner
# NBI
nbi.url=http://127.0.0.1:8080/nbi/api/v1
+nbi.callForVNF=false
# SDC
sdc.host=http://127.0.0.1:8091
@@ -23,4 +24,9 @@ aai.host=http://127.0.0.1:8091
aai.header.authorization=Basic QUFJOkFBSQ==
aai.api.id=AAI
+# SO
+so.host=http://127.0.0.1:8091
+so.header.authorization=
+so.api.id=SO
+
diff --git a/src/test/resources/mappings/sdc_find.json b/src/test/resources/mappings/sdc_find.json
index e992f2b..6aa4dc5 100644
--- a/src/test/resources/mappings/sdc_find.json
+++ b/src/test/resources/mappings/sdc_find.json
@@ -1,7 +1,7 @@
{
"request": {
"method": "GET",
- "urlPath": "/sdc/v1/catalog/services/"
+ "url": "/sdc/v1/catalog/services/"
},
"response": {
"status": 200,
diff --git a/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json b/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json
index 3aeff82..4956be7 100644
--- a/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json
+++ b/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json
@@ -1,7 +1,7 @@
{
"request": {
"method": "GET",
- "urlPath": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/metadata"
+ "url": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/metadata"
},
"response": {
"status": 200,
diff --git a/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json b/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json
index 2090397..ebf72bb 100644
--- a/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json
+++ b/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json
@@ -1,7 +1,7 @@
{
"request": {
"method": "GET",
- "urlPath": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/toscaModel"
+ "url": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439/toscaModel"
},
"response": {
"status": 200,
diff --git a/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca.json b/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca.json
index 567503a..55edc99 100644
--- a/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca.json
+++ b/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca.json
@@ -1,7 +1,7 @@
{
"request": {
"method": "GET",
- "urlPath": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca/metadata"
+ "url": "/sdc/v1/catalog/services/1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca/metadata"
},
"response": {
"status": 200,
diff --git a/src/test/resources/mappings/so_delete_service_instance.json b/src/test/resources/mappings/so_delete_service_instance.json
new file mode 100644
index 0000000..a2e854e
--- /dev/null
+++ b/src/test/resources/mappings/so_delete_service_instance.json
@@ -0,0 +1,18 @@
+{
+ "request": {
+ "method": "DELETE",
+ "url": "/ecomp/mso/infra/serviceInstances/e4688e5f-61a0-4f8b-ae02-a2fbde623bcb"
+ },
+ "response": {
+ "status": 201,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "jsonBody": {
+ "requestReference": {
+ "instanceId": "instanceId",
+ "requestId": "requestId"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/mappings/so_get_.json b/src/test/resources/mappings/so_get_.json
new file mode 100644
index 0000000..5d4148f
--- /dev/null
+++ b/src/test/resources/mappings/so_get_.json
@@ -0,0 +1,20 @@
+{
+ "request": {
+ "method": "GET",
+ "url": "/ecomp/mso/infra/orchestrationRequests/v4/requestId"
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "jsonBody": {
+ "request": {
+ "requestStatus": {
+ "requestState": "COMPLETE",
+ "percentProgress": 100
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/mappings/so_post_create_service_instance.json b/src/test/resources/mappings/so_post_create_service_instance.json
new file mode 100644
index 0000000..4b61b2c
--- /dev/null
+++ b/src/test/resources/mappings/so_post_create_service_instance.json
@@ -0,0 +1,18 @@
+{
+ "request": {
+ "method": "POST",
+ "url": "/ecomp/mso/infra/serviceInstance/v4"
+ },
+ "response": {
+ "status": 201,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "jsonBody": {
+ "requestReference": {
+ "instanceId": "instanceId",
+ "requestId": "requestId"
+ }
+ }
+ }
+} \ No newline at end of file