From 9839849afae52b40b3654490fba00233bfd825b3 Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Wed, 7 Aug 2024 20:07:19 +0300 Subject: [PATCH 1/8] tests --- pom.xml | 2 + .../SwaggerDocumentationConfig.java | 86 +++-- .../etsi/osl/tmf/pim637/api/ApiException.java | 10 + .../osl/tmf/pim637/api/ApiOriginFilter.java | 30 ++ .../tmf/pim637/api/ApiResponseMessage.java | 69 ++++ .../org/etsi/osl/tmf/pim637/api/HubApi.java | 77 ++++ .../osl/tmf/pim637/api/HubApiController.java | 57 +++ .../etsi/osl/tmf/pim637/api/ListenerApi.java | 158 ++++++++ .../tmf/pim637/api/ListenerApiController.java | 117 ++++++ .../osl/tmf/pim637/api/NotFoundException.java | 10 + .../etsi/osl/tmf/pim637/api/ProductApi.java | 158 ++++++++ .../tmf/pim637/api/ProductApiController.java | 112 ++++++ .../tmf/po622/api/ListenerApiController.java | 2 +- .../osl/tmf/po622/api/ProductOrderApi.java | 3 +- .../po622/api/ProductOrderApiController.java | 97 ++++- .../po622/repo/ProductOrderRepository.java | 55 +++ .../reposervices/ProductOrderRepoService.java | 257 ++++++++++++ .../po622/ProductOrderRepoServiceTest.java | 365 ++++++++++++++++++ 18 files changed, 1628 insertions(+), 37 deletions(-) create mode 100644 src/main/java/org/etsi/osl/tmf/pim637/api/ApiException.java create mode 100644 src/main/java/org/etsi/osl/tmf/pim637/api/ApiOriginFilter.java create mode 100644 src/main/java/org/etsi/osl/tmf/pim637/api/ApiResponseMessage.java create mode 100644 src/main/java/org/etsi/osl/tmf/pim637/api/HubApi.java create mode 100644 src/main/java/org/etsi/osl/tmf/pim637/api/HubApiController.java create mode 100644 src/main/java/org/etsi/osl/tmf/pim637/api/ListenerApi.java create mode 100644 src/main/java/org/etsi/osl/tmf/pim637/api/ListenerApiController.java create mode 100644 src/main/java/org/etsi/osl/tmf/pim637/api/NotFoundException.java create mode 100644 src/main/java/org/etsi/osl/tmf/pim637/api/ProductApi.java create mode 100644 src/main/java/org/etsi/osl/tmf/pim637/api/ProductApiController.java create mode 100644 src/main/java/org/etsi/osl/tmf/po622/repo/ProductOrderRepository.java create mode 100644 src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java create mode 100644 src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java diff --git a/pom.xml b/pom.xml index 885c306..cd2166e 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,8 @@ org.etsi.osl.tmf.api org.etsi.osl.tmf.api + ${org.etsi.osl.tmf.api.version>} + UTF-8 diff --git a/src/main/java/org/etsi/osl/tmf/configuration/SwaggerDocumentationConfig.java b/src/main/java/org/etsi/osl/tmf/configuration/SwaggerDocumentationConfig.java index 239be29..8c74d14 100644 --- a/src/main/java/org/etsi/osl/tmf/configuration/SwaggerDocumentationConfig.java +++ b/src/main/java/org/etsi/osl/tmf/configuration/SwaggerDocumentationConfig.java @@ -73,7 +73,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -109,7 +109,7 @@ public class SwaggerDocumentationConfig { .description("## TMF API Reference: TMF620 - Product Catalog Management ### Release : 19.0 - June 2019 Product Catalog API is one of Catalog Management API Family. Product Catalog API goal is to provide a catalog of products. ### Operations Product Catalog API performs the following operations on the resources : - Retrieve an entity or a collection of entities depending on filter criteria - Partial update of an entity (including updating rules) - Create an entity (including default values and creation rules) - Delete an entity - Manage notification of events") .version("4.0.0") - .license(new License().name("Apache 2.0").url("http://openslice.io"))) + .license(new License().name("Apache 2.0").url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -139,7 +139,7 @@ public class SwaggerDocumentationConfig { @Bean - public OpenApiCustomizer scm622OpenAPI() { + public OpenApiCustomizer po622OpenAPI() { return openApi -> openApi .specVersion( SpecVersion.V30 ).addSecurityItem(new SecurityRequirement().addList("security_auth")) .info(new Info().title("TMF 622 Product Ordering") @@ -148,7 +148,7 @@ public class SwaggerDocumentationConfig { .version("1.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -161,12 +161,48 @@ public class SwaggerDocumentationConfig { SpringDocUtils.getConfig().replaceWithClass(java.time.OffsetDateTime.class, java.util.Date.class); return GroupedOpenApi.builder() .group("tmf-api-622-ProductOrderingManagement-v4.0.0") - .addOpenApiCustomizer( this.scm622OpenAPI() ) + .addOpenApiCustomizer( this.po622OpenAPI() ) .packagesToScan("org.etsi.osl.tmf.po622.api") .build(); } + + /** + * TMF 637 Product Inventory Management + * @return + */ + @Bean + public OpenApiCustomizer pim637penAPI() { + + + return openApi -> openApi + .specVersion( SpecVersion.V30 ).addSecurityItem(new SecurityRequirement().addList("security_auth")) + .info(new Info().title("TMF 637 Product Inventory Management") + .description("**TMF API Reference : TMF 637 - Product Inventory Management** Release : 19.0 - June 2019\n\nThe Product Inventory Management API provides standardized mechanism for product inventory management such as creation, update and retrieval of the representation of a product in the inventory. It also allows the notification of events related to product lifecycle **Product resource** A product offering procured by a customer or other interested party playing a party role. A product is realized as one or more service(s) and / or resource(s). Product Inventory API performs the following operations on product : - Retrieval of a product or a collection of products depending on filter criteria - Partial update of a product (including updating rules and for administration purpose) - Creation of a product (including default values and creation rules and for administration purpose) - Deletion of a product (for administration purposes) - Notification of events on product. Copyright © TM Forum 2019. All Rights Reserved ") + + .version("4.0.0") + .license(new License().name("Apache 2.0").url("https://osl.etsi.org"))) + .externalDocs(new ExternalDocumentation() + .description("TMF API Tables") + .url("https://www.tmforum.org/oda/open-apis/table")); + + } + + +@Bean +public GroupedOpenApi pim637() { + + SpringDocUtils.getConfig().replaceWithClass(java.time.LocalDate.class, java.sql.Date.class); + SpringDocUtils.getConfig().replaceWithClass(java.time.OffsetDateTime.class, java.util.Date.class); + return GroupedOpenApi.builder() + .group("tmf-api-637-ProductInventoryManagement-v4.0.0") + .addOpenApiCustomizer( this.pim637penAPI() ) + .packagesToScan("org.etsi.osl.tmf.pim637.api") + .build(); + +} + /** * TMF 634 Resource Catalog Management @@ -183,7 +219,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -217,7 +253,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -255,7 +291,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -291,7 +327,7 @@ public class SwaggerDocumentationConfig { .version("2.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -328,7 +364,7 @@ public class SwaggerDocumentationConfig { .version("2.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -366,7 +402,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -403,7 +439,7 @@ public class SwaggerDocumentationConfig { .version("2.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -442,7 +478,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -479,7 +515,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -516,7 +552,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -555,7 +591,7 @@ public class SwaggerDocumentationConfig { // .version("3.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -594,7 +630,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -633,7 +669,7 @@ public class SwaggerDocumentationConfig { .version("1.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -671,7 +707,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -709,7 +745,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -744,7 +780,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -781,10 +817,10 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("Openslice") - .url("http://openslice.io")); + .url("https://osl.etsi.org")); } @Bean @@ -826,10 +862,10 @@ public class SwaggerDocumentationConfig { .version("1.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("Openslice") - .url("http://openslice.io")); + .url("https://osl.etsi.org")); } @Bean diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/ApiException.java b/src/main/java/org/etsi/osl/tmf/pim637/api/ApiException.java new file mode 100644 index 0000000..dee19e4 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/ApiException.java @@ -0,0 +1,10 @@ +package org.etsi.osl.tmf.pim637.api; + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +public class ApiException extends Exception { + private int code; + public ApiException (int code, String msg) { + super(msg); + this.code = code; + } +} diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/ApiOriginFilter.java b/src/main/java/org/etsi/osl/tmf/pim637/api/ApiOriginFilter.java new file mode 100644 index 0000000..653abc4 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/ApiOriginFilter.java @@ -0,0 +1,30 @@ +package org.etsi.osl.tmf.pim637.api; + +import java.io.IOException; +import jakarta.servlet.FilterChain; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletResponse; + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +public class ApiOriginFilter implements jakarta.servlet.Filter { + @Override + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + @Override + public void destroy() { + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } +} diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/ApiResponseMessage.java b/src/main/java/org/etsi/osl/tmf/pim637/api/ApiResponseMessage.java new file mode 100644 index 0000000..8bf7d4c --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/ApiResponseMessage.java @@ -0,0 +1,69 @@ +package org.etsi.osl.tmf.pim637.api; + +import jakarta.xml.bind.annotation.XmlTransient; + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +@jakarta.xml.bind.annotation.XmlRootElement +public class ApiResponseMessage { + public static final int ERROR = 1; + public static final int WARNING = 2; + public static final int INFO = 3; + public static final int OK = 4; + public static final int TOO_BUSY = 5; + + int code; + String type; + String message; + + public ApiResponseMessage(){} + + public ApiResponseMessage(int code, String message){ + this.code = code; + switch(code){ + case ERROR: + setType("error"); + break; + case WARNING: + setType("warning"); + break; + case INFO: + setType("info"); + break; + case OK: + setType("ok"); + break; + case TOO_BUSY: + setType("too busy"); + break; + default: + setType("unknown"); + break; + } + this.message = message; + } + + @XmlTransient + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/HubApi.java b/src/main/java/org/etsi/osl/tmf/pim637/api/HubApi.java new file mode 100644 index 0000000..7dc3b86 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/HubApi.java @@ -0,0 +1,77 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (3.0.60). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pim637.api; + +import org.etsi.osl.tmf.pim637.model.Error; +import org.etsi.osl.tmf.pim637.model.EventSubscription; +import org.etsi.osl.tmf.pim637.model.EventSubscriptionInput; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +@Validated +public interface HubApi { + + @Operation(summary = "Register a listener", description = "Sets the communication endpoint address the service instance must use to deliver information about its health state, execution state, failures and metrics.", tags={ "events subscription" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Subscribed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = EventSubscription.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/hub", + produces = { "application/json;charset=utf-8" }, + consumes = { "application/json;charset=utf-8" }, + method = RequestMethod.POST) + ResponseEntity registerListener(@Parameter(in = ParameterIn.DEFAULT, description = "Data containing the callback endpoint to deliver the information", required=true, schema=@Schema()) @Valid @RequestBody EventSubscriptionInput body +); + + + @Operation(summary = "Unregister a listener", description = "Resets the communication endpoint address the service instance must use to deliver information about its health state, execution state, failures and metrics.", tags={ "events subscription" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "Deleted"), + + @ApiResponse(responseCode = "400", description = "Bad request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/hub/{id}", + produces = { "application/json;charset=utf-8" }, + method = RequestMethod.DELETE) + ResponseEntity unregisterListener(@Parameter(in = ParameterIn.PATH, description = "The id of the registered listener", required=true, schema=@Schema()) @PathVariable("id") String id +); + +} + diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/HubApiController.java b/src/main/java/org/etsi/osl/tmf/pim637/api/HubApiController.java new file mode 100644 index 0000000..19e6954 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/HubApiController.java @@ -0,0 +1,57 @@ +package org.etsi.osl.tmf.pim637.api; + +import java.io.IOException; +import jakarta.servlet.http.HttpServletRequest; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.etsi.osl.tmf.pim637.model.EventSubscription; +import org.etsi.osl.tmf.pim637.model.EventSubscriptionInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +@RestController +public class HubApiController implements HubApi { + + private static final Logger log = LoggerFactory.getLogger(HubApiController.class); + + private final ObjectMapper objectMapper; + + private final HttpServletRequest request; + + @org.springframework.beans.factory.annotation.Autowired + public HubApiController(ObjectMapper objectMapper, HttpServletRequest request) { + this.objectMapper = objectMapper; + this.request = request; + } + + public ResponseEntity registerListener(@Parameter(in = ParameterIn.DEFAULT, description = "Data containing the callback endpoint to deliver the information", required=true, schema=@Schema()) @Valid @RequestBody EventSubscriptionInput body +) { + String accept = request.getHeader("Accept"); + if (accept != null && accept.contains("application/json")) { + try { + return new ResponseEntity(objectMapper.readValue("{\r\n \"query\" : \"query\",\r\n \"callback\" : \"callback\",\r\n \"id\" : \"id\"\r\n}", EventSubscription.class), HttpStatus.NOT_IMPLEMENTED); + } catch (IOException e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + + public ResponseEntity unregisterListener(@Parameter(in = ParameterIn.PATH, description = "The id of the registered listener", required=true, schema=@Schema()) @PathVariable("id") String id +) { + String accept = request.getHeader("Accept"); + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/ListenerApi.java b/src/main/java/org/etsi/osl/tmf/pim637/api/ListenerApi.java new file mode 100644 index 0000000..8ea75df --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/ListenerApi.java @@ -0,0 +1,158 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (3.0.60). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pim637.api; + +import org.etsi.osl.tmf.pim637.model.Error; +import org.etsi.osl.tmf.pim637.model.EventSubscription; +import org.etsi.osl.tmf.pim637.model.ProductAttributeValueChangeEvent; +import org.etsi.osl.tmf.pim637.model.ProductBatchEvent; +import org.etsi.osl.tmf.pim637.model.ProductCreateEvent; +import org.etsi.osl.tmf.pim637.model.ProductDeleteEvent; +import org.etsi.osl.tmf.pim637.model.ProductStateChangeEvent; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +@Validated +public interface ListenerApi { + + @Operation(summary = "Client listener for entity ProductAttributeValueChangeEvent", description = "Example of a client listener for receiving the notification ProductAttributeValueChangeEvent", tags={ "notification listeners (client side)" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Notified", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = EventSubscription.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/listener/productAttributeValueChangeEvent", + produces = { "application/json;charset=utf-8" }, + consumes = { "application/json;charset=utf-8" }, + method = RequestMethod.POST) + ResponseEntity listenToProductAttributeValueChangeEvent(@Parameter(in = ParameterIn.DEFAULT, description = "The event data", required=true, schema=@Schema()) @Valid @RequestBody ProductAttributeValueChangeEvent body +); + + + @Operation(summary = "Client listener for entity ProductBatchEvent", description = "Example of a client listener for receiving the notification ProductBatchEvent", tags={ "notification listeners (client side)" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Notified", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = EventSubscription.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/listener/productBatchEvent", + produces = { "application/json;charset=utf-8" }, + consumes = { "application/json;charset=utf-8" }, + method = RequestMethod.POST) + ResponseEntity listenToProductBatchEvent(@Parameter(in = ParameterIn.DEFAULT, description = "The event data", required=true, schema=@Schema()) @Valid @RequestBody ProductBatchEvent body +); + + + @Operation(summary = "Client listener for entity ProductCreateEvent", description = "Example of a client listener for receiving the notification ProductCreateEvent", tags={ "notification listeners (client side)" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Notified", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = EventSubscription.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/listener/productCreateEvent", + produces = { "application/json;charset=utf-8" }, + consumes = { "application/json;charset=utf-8" }, + method = RequestMethod.POST) + ResponseEntity listenToProductCreateEvent(@Parameter(in = ParameterIn.DEFAULT, description = "The event data", required=true, schema=@Schema()) @Valid @RequestBody ProductCreateEvent body +); + + + @Operation(summary = "Client listener for entity ProductDeleteEvent", description = "Example of a client listener for receiving the notification ProductDeleteEvent", tags={ "notification listeners (client side)" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Notified", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = EventSubscription.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/listener/productDeleteEvent", + produces = { "application/json;charset=utf-8" }, + consumes = { "application/json;charset=utf-8" }, + method = RequestMethod.POST) + ResponseEntity listenToProductDeleteEvent(@Parameter(in = ParameterIn.DEFAULT, description = "The event data", required=true, schema=@Schema()) @Valid @RequestBody ProductDeleteEvent body +); + + + @Operation(summary = "Client listener for entity ProductStateChangeEvent", description = "Example of a client listener for receiving the notification ProductStateChangeEvent", tags={ "notification listeners (client side)" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Notified", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = EventSubscription.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/listener/productStateChangeEvent", + produces = { "application/json;charset=utf-8" }, + consumes = { "application/json;charset=utf-8" }, + method = RequestMethod.POST) + ResponseEntity listenToProductStateChangeEvent(@Parameter(in = ParameterIn.DEFAULT, description = "The event data", required=true, schema=@Schema()) @Valid @RequestBody ProductStateChangeEvent body +); + +} + diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/ListenerApiController.java b/src/main/java/org/etsi/osl/tmf/pim637/api/ListenerApiController.java new file mode 100644 index 0000000..475d90f --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/ListenerApiController.java @@ -0,0 +1,117 @@ +package org.etsi.osl.tmf.pim637.api; + +import java.io.IOException; +import jakarta.servlet.http.HttpServletRequest; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.etsi.osl.tmf.pim637.model.EventSubscription; +import org.etsi.osl.tmf.pim637.model.ProductAttributeValueChangeEvent; +import org.etsi.osl.tmf.pim637.model.ProductBatchEvent; +import org.etsi.osl.tmf.pim637.model.ProductCreateEvent; +import org.etsi.osl.tmf.pim637.model.ProductDeleteEvent; +import org.etsi.osl.tmf.pim637.model.ProductStateChangeEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +@Controller("ListenerApiController637") +@RequestMapping("/productInventoryManagement/v4/") +public class ListenerApiController implements ListenerApi { + + private static final Logger log = LoggerFactory.getLogger(ListenerApiController.class); + + private final ObjectMapper objectMapper; + + private final HttpServletRequest request; + + @org.springframework.beans.factory.annotation.Autowired + public ListenerApiController(ObjectMapper objectMapper, HttpServletRequest request) { + this.objectMapper = objectMapper; + this.request = request; + } + + public ResponseEntity listenToProductAttributeValueChangeEvent(@Parameter(in = ParameterIn.DEFAULT, description = "The event data", required=true, schema=@Schema()) @Valid @RequestBody ProductAttributeValueChangeEvent body +) { + String accept = request.getHeader("Accept"); + if (accept != null && accept.contains("application/json")) { + try { + return new ResponseEntity(objectMapper.readValue("{\r\n \"query\" : \"query\",\r\n \"callback\" : \"callback\",\r\n \"id\" : \"id\"\r\n}", EventSubscription.class), HttpStatus.NOT_IMPLEMENTED); + } catch (IOException e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + + public ResponseEntity listenToProductBatchEvent(@Parameter(in = ParameterIn.DEFAULT, description = "The event data", required=true, schema=@Schema()) @Valid @RequestBody ProductBatchEvent body +) { + String accept = request.getHeader("Accept"); + if (accept != null && accept.contains("application/json")) { + try { + return new ResponseEntity(objectMapper.readValue("{\r\n \"query\" : \"query\",\r\n \"callback\" : \"callback\",\r\n \"id\" : \"id\"\r\n}", EventSubscription.class), HttpStatus.NOT_IMPLEMENTED); + } catch (IOException e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + + public ResponseEntity listenToProductCreateEvent(@Parameter(in = ParameterIn.DEFAULT, description = "The event data", required=true, schema=@Schema()) @Valid @RequestBody ProductCreateEvent body +) { + String accept = request.getHeader("Accept"); + if (accept != null && accept.contains("application/json")) { + try { + return new ResponseEntity(objectMapper.readValue("{\r\n \"query\" : \"query\",\r\n \"callback\" : \"callback\",\r\n \"id\" : \"id\"\r\n}", EventSubscription.class), HttpStatus.NOT_IMPLEMENTED); + } catch (IOException e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + + public ResponseEntity listenToProductDeleteEvent(@Parameter(in = ParameterIn.DEFAULT, description = "The event data", required=true, schema=@Schema()) @Valid @RequestBody ProductDeleteEvent body +) { + String accept = request.getHeader("Accept"); + if (accept != null && accept.contains("application/json")) { + try { + return new ResponseEntity(objectMapper.readValue("{\r\n \"query\" : \"query\",\r\n \"callback\" : \"callback\",\r\n \"id\" : \"id\"\r\n}", EventSubscription.class), HttpStatus.NOT_IMPLEMENTED); + } catch (IOException e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + + public ResponseEntity listenToProductStateChangeEvent(@Parameter(in = ParameterIn.DEFAULT, description = "The event data", required=true, schema=@Schema()) @Valid @RequestBody ProductStateChangeEvent body +) { + String accept = request.getHeader("Accept"); + if (accept != null && accept.contains("application/json")) { + try { + return new ResponseEntity(objectMapper.readValue("{\r\n \"query\" : \"query\",\r\n \"callback\" : \"callback\",\r\n \"id\" : \"id\"\r\n}", EventSubscription.class), HttpStatus.NOT_IMPLEMENTED); + } catch (IOException e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/NotFoundException.java b/src/main/java/org/etsi/osl/tmf/pim637/api/NotFoundException.java new file mode 100644 index 0000000..37767fe --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/NotFoundException.java @@ -0,0 +1,10 @@ +package org.etsi.osl.tmf.pim637.api; + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +public class NotFoundException extends ApiException { + private int code; + public NotFoundException (int code, String msg) { + super(code, msg); + this.code = code; + } +} diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/ProductApi.java b/src/main/java/org/etsi/osl/tmf/pim637/api/ProductApi.java new file mode 100644 index 0000000..c4f9f78 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/ProductApi.java @@ -0,0 +1,158 @@ +/** + * NOTE: This class is auto generated by the swagger code generator program (3.0.60). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pim637.api; + +import java.util.List; +import org.etsi.osl.tmf.pim637.model.Error; +import org.etsi.osl.tmf.pim637.model.Product; +import org.etsi.osl.tmf.pim637.model.ProductCreate; +import org.etsi.osl.tmf.pim637.model.ProductUpdate; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +@Validated +public interface ProductApi { + + @Operation(summary = "Creates a Product", description = "This operation creates a Product entity.", tags={ "product" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Created", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Product.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/product", + produces = { "application/json;charset=utf-8" }, + consumes = { "application/json;charset=utf-8" }, + method = RequestMethod.POST) + ResponseEntity createProduct(@Parameter(in = ParameterIn.DEFAULT, description = "The Product to be created", required=true, schema=@Schema()) @Valid @RequestBody ProductCreate body +); + + + @Operation(summary = "Deletes a Product", description = "This operation deletes a Product entity.", tags={ "product" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "Deleted"), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/product/{id}", + produces = { "application/json;charset=utf-8" }, + method = RequestMethod.DELETE) + ResponseEntity deleteProduct(@Parameter(in = ParameterIn.PATH, description = "Identifier of the Product", required=true, schema=@Schema()) @PathVariable("id") String id +); + + + @Operation(summary = "List or find Product objects", description = "This operation list or find Product entities", tags={ "product" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Success", content = @Content(mediaType = "application/json;charset=utf-8", array = @ArraySchema(schema = @Schema(implementation = Product.class)))), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/product", + produces = { "application/json;charset=utf-8" }, + method = RequestMethod.GET) + ResponseEntity> listProduct(@Parameter(in = ParameterIn.QUERY, description = "Comma-separated properties to be provided in response" ,schema=@Schema()) @Valid @RequestParam(value = "fields", required = false) String fields +, @Parameter(in = ParameterIn.QUERY, description = "Requested index for start of resources to be provided in response" ,schema=@Schema()) @Valid @RequestParam(value = "offset", required = false) Integer offset +, @Parameter(in = ParameterIn.QUERY, description = "Requested number of resources to be provided in response" ,schema=@Schema()) @Valid @RequestParam(value = "limit", required = false) Integer limit +); + + + @Operation(summary = "Updates partially a Product", description = "This operation updates partially a Product entity.", tags={ "product" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Updated", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Product.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/product/{id}", + produces = { "application/json;charset=utf-8" }, + consumes = { "application/json;charset=utf-8" }, + method = RequestMethod.PATCH) + ResponseEntity patchProduct(@Parameter(in = ParameterIn.PATH, description = "Identifier of the Product", required=true, schema=@Schema()) @PathVariable("id") String id +, @Parameter(in = ParameterIn.DEFAULT, description = "The Product to be updated", required=true, schema=@Schema()) @Valid @RequestBody ProductUpdate body +); + + + @Operation(summary = "Retrieves a Product by ID", description = "This operation retrieves a Product entity. Attribute selection is enabled for all first level attributes.", tags={ "product" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "Success", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Product.class))), + + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))), + + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))) }) + @RequestMapping(value = "/product/{id}", + produces = { "application/json;charset=utf-8" }, + method = RequestMethod.GET) + ResponseEntity retrieveProduct(@Parameter(in = ParameterIn.PATH, description = "Identifier of the Product", required=true, schema=@Schema()) @PathVariable("id") String id +, @Parameter(in = ParameterIn.QUERY, description = "Comma-separated properties to provide in response" ,schema=@Schema()) @Valid @RequestParam(value = "fields", required = false) String fields +); + +} + diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/ProductApiController.java b/src/main/java/org/etsi/osl/tmf/pim637/api/ProductApiController.java new file mode 100644 index 0000000..f53ce22 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/ProductApiController.java @@ -0,0 +1,112 @@ +package org.etsi.osl.tmf.pim637.api; + +import java.io.IOException; +import java.util.List; +import jakarta.servlet.http.HttpServletRequest; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.etsi.osl.tmf.pim637.model.Product; +import org.etsi.osl.tmf.pim637.model.ProductCreate; +import org.etsi.osl.tmf.pim637.model.ProductUpdate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +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; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +@Controller("productApiController637") +@RequestMapping("/productInventoryManagement/v4/") +public class ProductApiController implements ProductApi { + + private static final Logger log = LoggerFactory.getLogger(ProductApiController.class); + + private final ObjectMapper objectMapper; + + private final HttpServletRequest request; + + @org.springframework.beans.factory.annotation.Autowired + public ProductApiController(ObjectMapper objectMapper, HttpServletRequest request) { + this.objectMapper = objectMapper; + this.request = request; + } + + public ResponseEntity createProduct(@Parameter(in = ParameterIn.DEFAULT, description = "The Product to be created", required=true, schema=@Schema()) @Valid @RequestBody ProductCreate body +) { + String accept = request.getHeader("Accept"); + if (accept != null && accept.contains("application/json")) { + try { + return new ResponseEntity(objectMapper.readValue("{\r\n \"isBundle\" : true,\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ null, null ],\r\n \"description\" : \"description\",\r\n \"billingAccount\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productOrderItem\" : [ null, null ],\r\n \"realizingService\" : [ null, null ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ null, null ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ {\r\n \"isBundle\" : true,\r\n \"productSpecification\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"targetProductSchema\" : {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"@schemaLocation\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"version\" : \"version\"\r\n },\r\n \"@referredType\" : \"@referredType\",\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n }, {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n } ],\r\n \"description\" : \"description\",\r\n \"productOrderItem\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n } ],\r\n \"realizingService\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n } ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ null, null ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ null, null ],\r\n \"agreement\" : [ null, null ],\r\n \"productOffering\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productTerm\" : [ {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"relatedParty\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n }, {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n } ],\r\n \"status\" : \"created\"\r\n }, {\r\n \"isBundle\" : true,\r\n \"productSpecification\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"targetProductSchema\" : {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"@schemaLocation\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"version\" : \"version\"\r\n },\r\n \"@referredType\" : \"@referredType\",\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n }, {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n } ],\r\n \"description\" : \"description\",\r\n \"productOrderItem\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n } ],\r\n \"realizingService\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n } ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ null, null ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ null, null ],\r\n \"agreement\" : [ null, null ],\r\n \"productOffering\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productTerm\" : [ {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"relatedParty\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n }, {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n } ],\r\n \"status\" : \"created\"\r\n } ],\r\n \"agreement\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"agreementItemId\" : \"agreementItemId\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"agreementItemId\" : \"agreementItemId\"\r\n } ],\r\n \"productTerm\" : [ null, null ],\r\n \"relatedParty\" : [ null, null ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ null, null ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ null, null ]\r\n}", Product.class), HttpStatus.NOT_IMPLEMENTED); + } catch (IOException e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + + public ResponseEntity deleteProduct(@Parameter(in = ParameterIn.PATH, description = "Identifier of the Product", required=true, schema=@Schema()) @PathVariable("id") String id +) { + String accept = request.getHeader("Accept"); + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + + public ResponseEntity> listProduct(@Parameter(in = ParameterIn.QUERY, description = "Comma-separated properties to be provided in response" ,schema=@Schema()) @Valid @RequestParam(value = "fields", required = false) String fields +,@Parameter(in = ParameterIn.QUERY, description = "Requested index for start of resources to be provided in response" ,schema=@Schema()) @Valid @RequestParam(value = "offset", required = false) Integer offset +,@Parameter(in = ParameterIn.QUERY, description = "Requested number of resources to be provided in response" ,schema=@Schema()) @Valid @RequestParam(value = "limit", required = false) Integer limit +) { + String accept = request.getHeader("Accept"); + if (accept != null && accept.contains("application/json")) { + try { + return new ResponseEntity>(objectMapper.readValue("[ {\r\n \"isBundle\" : true,\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ null, null ],\r\n \"description\" : \"description\",\r\n \"billingAccount\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productOrderItem\" : [ null, null ],\r\n \"realizingService\" : [ null, null ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ null, null ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ {\r\n \"isBundle\" : true,\r\n \"productSpecification\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"targetProductSchema\" : {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"@schemaLocation\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"version\" : \"version\"\r\n },\r\n \"@referredType\" : \"@referredType\",\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n }, {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n } ],\r\n \"description\" : \"description\",\r\n \"productOrderItem\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n } ],\r\n \"realizingService\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n } ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ null, null ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ null, null ],\r\n \"agreement\" : [ null, null ],\r\n \"productOffering\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productTerm\" : [ {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"relatedParty\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n }, {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n } ],\r\n \"status\" : \"created\"\r\n }, {\r\n \"isBundle\" : true,\r\n \"productSpecification\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"targetProductSchema\" : {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"@schemaLocation\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"version\" : \"version\"\r\n },\r\n \"@referredType\" : \"@referredType\",\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n }, {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n } ],\r\n \"description\" : \"description\",\r\n \"productOrderItem\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n } ],\r\n \"realizingService\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n } ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ null, null ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ null, null ],\r\n \"agreement\" : [ null, null ],\r\n \"productOffering\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productTerm\" : [ {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"relatedParty\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n }, {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n } ],\r\n \"status\" : \"created\"\r\n } ],\r\n \"agreement\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"agreementItemId\" : \"agreementItemId\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"agreementItemId\" : \"agreementItemId\"\r\n } ],\r\n \"productTerm\" : [ null, null ],\r\n \"relatedParty\" : [ null, null ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ null, null ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ null, null ]\r\n}, {\r\n \"isBundle\" : true,\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ null, null ],\r\n \"description\" : \"description\",\r\n \"billingAccount\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productOrderItem\" : [ null, null ],\r\n \"realizingService\" : [ null, null ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ null, null ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ {\r\n \"isBundle\" : true,\r\n \"productSpecification\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"targetProductSchema\" : {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"@schemaLocation\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"version\" : \"version\"\r\n },\r\n \"@referredType\" : \"@referredType\",\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n }, {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n } ],\r\n \"description\" : \"description\",\r\n \"productOrderItem\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n } ],\r\n \"realizingService\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n } ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ null, null ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ null, null ],\r\n \"agreement\" : [ null, null ],\r\n \"productOffering\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productTerm\" : [ {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"relatedParty\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n }, {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n } ],\r\n \"status\" : \"created\"\r\n }, {\r\n \"isBundle\" : true,\r\n \"productSpecification\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"targetProductSchema\" : {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"@schemaLocation\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"version\" : \"version\"\r\n },\r\n \"@referredType\" : \"@referredType\",\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n }, {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n } ],\r\n \"description\" : \"description\",\r\n \"productOrderItem\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n } ],\r\n \"realizingService\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n } ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ null, null ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ null, null ],\r\n \"agreement\" : [ null, null ],\r\n \"productOffering\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productTerm\" : [ {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"relatedParty\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n }, {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n } ],\r\n \"status\" : \"created\"\r\n } ],\r\n \"agreement\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"agreementItemId\" : \"agreementItemId\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"agreementItemId\" : \"agreementItemId\"\r\n } ],\r\n \"productTerm\" : [ null, null ],\r\n \"relatedParty\" : [ null, null ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ null, null ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ null, null ]\r\n} ]", List.class), HttpStatus.NOT_IMPLEMENTED); + } catch (IOException e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + return new ResponseEntity>(HttpStatus.NOT_IMPLEMENTED); + } + + public ResponseEntity patchProduct(@Parameter(in = ParameterIn.PATH, description = "Identifier of the Product", required=true, schema=@Schema()) @PathVariable("id") String id +,@Parameter(in = ParameterIn.DEFAULT, description = "The Product to be updated", required=true, schema=@Schema()) @Valid @RequestBody ProductUpdate body +) { + String accept = request.getHeader("Accept"); + if (accept != null && accept.contains("application/json")) { + try { + return new ResponseEntity(objectMapper.readValue("{\r\n \"isBundle\" : true,\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ null, null ],\r\n \"description\" : \"description\",\r\n \"billingAccount\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productOrderItem\" : [ null, null ],\r\n \"realizingService\" : [ null, null ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ null, null ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ {\r\n \"isBundle\" : true,\r\n \"productSpecification\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"targetProductSchema\" : {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"@schemaLocation\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"version\" : \"version\"\r\n },\r\n \"@referredType\" : \"@referredType\",\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n }, {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n } ],\r\n \"description\" : \"description\",\r\n \"productOrderItem\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n } ],\r\n \"realizingService\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n } ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ null, null ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ null, null ],\r\n \"agreement\" : [ null, null ],\r\n \"productOffering\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productTerm\" : [ {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"relatedParty\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n }, {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n } ],\r\n \"status\" : \"created\"\r\n }, {\r\n \"isBundle\" : true,\r\n \"productSpecification\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"targetProductSchema\" : {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"@schemaLocation\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"version\" : \"version\"\r\n },\r\n \"@referredType\" : \"@referredType\",\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n }, {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n } ],\r\n \"description\" : \"description\",\r\n \"productOrderItem\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n } ],\r\n \"realizingService\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n } ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ null, null ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ null, null ],\r\n \"agreement\" : [ null, null ],\r\n \"productOffering\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productTerm\" : [ {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"relatedParty\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n }, {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n } ],\r\n \"status\" : \"created\"\r\n } ],\r\n \"agreement\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"agreementItemId\" : \"agreementItemId\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"agreementItemId\" : \"agreementItemId\"\r\n } ],\r\n \"productTerm\" : [ null, null ],\r\n \"relatedParty\" : [ null, null ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ null, null ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ null, null ]\r\n}", Product.class), HttpStatus.NOT_IMPLEMENTED); + } catch (IOException e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + + public ResponseEntity retrieveProduct(@Parameter(in = ParameterIn.PATH, description = "Identifier of the Product", required=true, schema=@Schema()) @PathVariable("id") String id +,@Parameter(in = ParameterIn.QUERY, description = "Comma-separated properties to provide in response" ,schema=@Schema()) @Valid @RequestParam(value = "fields", required = false) String fields +) { + String accept = request.getHeader("Accept"); + if (accept != null && accept.contains("application/json")) { + try { + return new ResponseEntity(objectMapper.readValue("{\r\n \"isBundle\" : true,\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ null, null ],\r\n \"description\" : \"description\",\r\n \"billingAccount\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productOrderItem\" : [ null, null ],\r\n \"realizingService\" : [ null, null ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ null, null ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ {\r\n \"isBundle\" : true,\r\n \"productSpecification\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"targetProductSchema\" : {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"@schemaLocation\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"version\" : \"version\"\r\n },\r\n \"@referredType\" : \"@referredType\",\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n }, {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n } ],\r\n \"description\" : \"description\",\r\n \"productOrderItem\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n } ],\r\n \"realizingService\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n } ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ null, null ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ null, null ],\r\n \"agreement\" : [ null, null ],\r\n \"productOffering\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productTerm\" : [ {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"relatedParty\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n }, {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n } ],\r\n \"status\" : \"created\"\r\n }, {\r\n \"isBundle\" : true,\r\n \"productSpecification\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"targetProductSchema\" : {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"@schemaLocation\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"version\" : \"version\"\r\n },\r\n \"@referredType\" : \"@referredType\",\r\n \"@type\" : \"@type\",\r\n \"productCharacteristic\" : [ {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n }, {\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"valueType\" : \"valueType\",\r\n \"name\" : \"name\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : { }\r\n } ],\r\n \"description\" : \"description\",\r\n \"productOrderItem\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"productOrderHref\" : \"productOrderHref\",\r\n \"@baseType\" : \"@baseType\",\r\n \"orderItemId\" : \"orderItemId\",\r\n \"@type\" : \"@type\",\r\n \"productOrderId\" : \"productOrderId\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"orderItemAction\" : \"orderItemAction\"\r\n } ],\r\n \"realizingService\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"terminationDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"@baseType\" : \"@baseType\",\r\n \"realizingResource\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"value\" : \"value\"\r\n } ],\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"place\" : [ null, null ],\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"product\" : [ null, null ],\r\n \"agreement\" : [ null, null ],\r\n \"productOffering\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"productTerm\" : [ {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"duration\" : {\r\n \"amount\" : 2.302136,\r\n \"units\" : \"units\"\r\n },\r\n \"@baseType\" : \"@baseType\",\r\n \"validFor\" : {\r\n \"startDateTime\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"endDateTime\" : \"2000-01-23T04:56:07.000+00:00\"\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"description\" : \"description\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"relatedParty\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"role\" : \"role\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"relationshipType\" : \"relationshipType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n }, {\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"price\" : {\r\n \"taxRate\" : 6.0274563,\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"percentage\" : 0.8008282,\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"dutyFreeAmount\" : {\r\n \"unit\" : \"unit\",\r\n \"value\" : 1.4658129\r\n }\r\n },\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"productOfferingPrice\" : {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n },\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"productPriceAlteration\" : [ {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n }, {\r\n \"applicationDuration\" : 5,\r\n \"unitOfMeasure\" : \"unitOfMeasure\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"priceType\" : \"priceType\",\r\n \"description\" : \"description\",\r\n \"priority\" : 5,\r\n \"recurringChargePeriod\" : \"recurringChargePeriod\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\"\r\n } ]\r\n } ],\r\n \"status\" : \"created\"\r\n } ],\r\n \"agreement\" : [ {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"agreementItemId\" : \"agreementItemId\"\r\n }, {\r\n \"@referredType\" : \"@referredType\",\r\n \"@baseType\" : \"@baseType\",\r\n \"@type\" : \"@type\",\r\n \"name\" : \"name\",\r\n \"id\" : \"id\",\r\n \"href\" : \"href\",\r\n \"@schemaLocation\" : \"http://example.com/aeiou\",\r\n \"agreementItemId\" : \"agreementItemId\"\r\n } ],\r\n \"productTerm\" : [ null, null ],\r\n \"relatedParty\" : [ null, null ],\r\n \"productSerialNumber\" : \"productSerialNumber\",\r\n \"name\" : \"name\",\r\n \"productRelationship\" : [ null, null ],\r\n \"isCustomerVisible\" : true,\r\n \"orderDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"startDate\" : \"2000-01-23T04:56:07.000+00:00\",\r\n \"productPrice\" : [ null, null ]\r\n}", Product.class), HttpStatus.NOT_IMPLEMENTED); + } catch (IOException e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/po622/api/ListenerApiController.java b/src/main/java/org/etsi/osl/tmf/po622/api/ListenerApiController.java index 540440c..0a183b7 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/api/ListenerApiController.java +++ b/src/main/java/org/etsi/osl/tmf/po622/api/ListenerApiController.java @@ -30,7 +30,7 @@ import jakarta.servlet.http.HttpServletRequest; @jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-10-30T10:29:21.184964400+02:00[Europe/Athens]") @Controller("ListenerApiController622") -@RequestMapping("/productOrder/v4/") +@RequestMapping("/productOrderingManagement/v4/") public class ListenerApiController implements ListenerApi { private final ObjectMapper objectMapper; diff --git a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApi.java b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApi.java index b3851c5..10da8d5 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApi.java +++ b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApi.java @@ -25,6 +25,7 @@ package org.etsi.osl.tmf.po622.api; import java.io.IOException; +import java.security.Principal; import java.util.List; import java.util.Optional; @@ -79,7 +80,7 @@ public interface ProductOrderApi { produces = { "application/json;charset=utf-8" }, consumes = { "application/json;charset=utf-8" }, method = RequestMethod.POST) - default ResponseEntity createProductOrder(@Parameter(description = "The ProductOrder to be created" ,required=true ) @Valid @RequestBody ProductOrderCreate body + default ResponseEntity createProductOrder(Principal principal, @Parameter(description = "The ProductOrder to be created" ,required=true ) @Valid @RequestBody ProductOrderCreate body ) { if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { if (getAcceptHeader().get().contains("application/json")) { diff --git a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java index bf80e2d..4414d2f 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java +++ b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java @@ -19,22 +19,42 @@ */ package org.etsi.osl.tmf.po622.api; +import java.security.Principal; import java.util.Optional; import com.fasterxml.jackson.databind.ObjectMapper; - +import org.etsi.osl.tmf.common.model.UserPartRoleType; +import org.etsi.osl.tmf.po622.model.ProductOrder; +import org.etsi.osl.tmf.po622.model.ProductOrderCreate; +import org.etsi.osl.tmf.po622.reposervices.ProductOrderRepoService; +import org.etsi.osl.tmf.so641.api.NotFoundException; +import org.etsi.osl.tmf.util.AddUserAsOwnerToRelatedParties; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.oauth2.jwt.Jwt; +import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; - +import io.swagger.v3.oas.annotations.Parameter; import jakarta.servlet.http.HttpServletRequest; +import jakarta.validation.Valid; @jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-10-30T10:29:21.184964400+02:00[Europe/Athens]") -@Controller +@Controller("ProductOrderApiController622") @RequestMapping("/productOrderingManagement/v4/") public class ProductOrderApiController implements ProductOrderApi { private final ObjectMapper objectMapper; private final HttpServletRequest request; + + + + @Autowired + ProductOrderRepoService productOrderRepoService; @org.springframework.beans.factory.annotation.Autowired public ProductOrderApiController(ObjectMapper objectMapper, HttpServletRequest request) { @@ -42,14 +62,71 @@ public class ProductOrderApiController implements ProductOrderApi { this.request = request; } - @Override - public Optional getObjectMapper() { - return Optional.ofNullable(objectMapper); - } + @PreAuthorize("hasAnyAuthority('ROLE_USER')" ) @Override - public Optional getRequest() { - return Optional.ofNullable(request); - } + public ResponseEntity createProductOrder( + Principal principal, + @Parameter(description = "The ProductOrder to be created", required = true) @Valid @RequestBody ProductOrderCreate productOrder + ) { + + try { + //Object attr = request.getSession().getAttribute("SPRING_SECURITY_CONTEXT"); + //SecurityContextHolder.setContext( (SecurityContext) attr ); + + + log.info("authentication= " + principal.toString()); + String extInfo = null; + try { + + if ( principal instanceof JwtAuthenticationToken) { + + JwtAuthenticationToken pr = ( JwtAuthenticationToken ) principal; + + Jwt lp = (Jwt) pr.getPrincipal(); + extInfo = lp.getClaimAsString("email"); + log.debug("extInfo= " + extInfo); + + productOrder.setRelatedParty(AddUserAsOwnerToRelatedParties.addUser( + principal.getName(), + //user.getId()+"", + principal.getName(), + UserPartRoleType.REQUESTER, + extInfo, + productOrder.getRelatedParty())); + } + else if ( principal instanceof UsernamePasswordAuthenticationToken ) { + productOrder.setRelatedParty(AddUserAsOwnerToRelatedParties.addUser( + principal.getName(), + //user.getId()+"", + principal.getName(), + UserPartRoleType.REQUESTER, + extInfo, + productOrder.getRelatedParty())); + } + + + }finally { + + } + + + + + + + ProductOrder c = productOrderRepoService.addProductOrder(productOrder); + + return new ResponseEntity(c, HttpStatus.OK); + + + } catch (NotFoundException e) { + log.error("Couldn't create Service Order. ", e); + return new ResponseEntity(HttpStatus.BAD_REQUEST); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } } diff --git a/src/main/java/org/etsi/osl/tmf/po622/repo/ProductOrderRepository.java b/src/main/java/org/etsi/osl/tmf/po622/repo/ProductOrderRepository.java new file mode 100644 index 0000000..0569c0c --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/po622/repo/ProductOrderRepository.java @@ -0,0 +1,55 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.tmf.api + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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. + * =========================LICENSE_END================================== + */ +package org.etsi.osl.tmf.po622.repo; + +import java.util.List; +import java.util.Optional; +import org.etsi.osl.tmf.common.model.UserPartRoleType; +import org.etsi.osl.tmf.po622.model.ProductOrder; +import org.etsi.osl.tmf.po622.model.ProductOrderStateType; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.stereotype.Repository; + + +@Repository +public interface ProductOrderRepository extends CrudRepository, PagingAndSortingRepository { + + + Optional findByUuid(String id); + Iterable findByState( ProductOrderStateType state); + @Query("SELECT por FROM ProductOrder por JOIN FETCH por.relatedParty rp WHERE rp.name = ?1 AND rp.role = ?2 ORDER BY por.orderDate DESC") + Iterable findByRolenameAndRoleType(String rolename, UserPartRoleType requester); + @Query("SELECT por FROM ProductOrder por JOIN FETCH por.relatedParty rp WHERE rp.name = ?1") + Iterable findByRolename(String rolename); + + List findByOrderByOrderDateDesc(); + + @Query("SELECT por FROM ProductOrder por JOIN FETCH por.relatedParty rp ORDER BY por.orderDate DESC") + List findAllOptimized(); + + + + @Query("SELECT por FROM ProductOrder por JOIN FETCH por.note an " + + "WHERE por.uuid = ?1 " + + "ORDER BY an.date ASC") + Optional findNotesOfProdOrder(String id); +} diff --git a/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java b/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java new file mode 100644 index 0000000..bc21350 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java @@ -0,0 +1,257 @@ +/*- + * ========================LICENSE_START================================= + * org.etsi.osl.tmf.api + * %% + * Copyright (C) 2019 openslice.io + * %% + * 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. + * =========================LICENSE_END================================== + */ +package org.etsi.osl.tmf.po622.reposervices; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.hibernate5.jakarta.Hibernate5JakartaModule; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.etsi.osl.tmf.common.model.service.Note; +import org.etsi.osl.tmf.pcm620.model.ProductOffering; +import org.etsi.osl.tmf.pcm620.model.ProductOfferingRef; +import org.etsi.osl.tmf.pcm620.model.ProductSpecification; +import org.etsi.osl.tmf.pcm620.model.ProductSpecificationRef; +import org.etsi.osl.tmf.pcm620.reposervices.ProductOfferingRepoService; +import org.etsi.osl.tmf.pcm620.reposervices.ProductSpecificationRepoService; +import org.etsi.osl.tmf.po622.model.ProductOrder; +import org.etsi.osl.tmf.po622.model.ProductOrderCreate; +import org.etsi.osl.tmf.po622.model.ProductOrderItem; +import org.etsi.osl.tmf.po622.model.ProductOrderItemStateType; +import org.etsi.osl.tmf.po622.model.ProductOrderMapper; +import org.etsi.osl.tmf.po622.model.ProductOrderStateType; +import org.etsi.osl.tmf.po622.model.ProductOrderUpdate; +import org.etsi.osl.tmf.po622.repo.ProductOrderRepository; +import org.etsi.osl.tmf.rpm685.model.ResourcePoolMapper; +import org.etsi.osl.tmf.so641.api.NotFoundException; +import org.etsi.osl.tmf.so641.model.ServiceOrder; +import org.etsi.osl.tmf.so641.model.ServiceOrderStateType; +import org.hibernate.SessionFactory; +import org.mapstruct.factory.Mappers; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import jakarta.persistence.EntityManagerFactory; +import jakarta.validation.Valid; + +@Service +public class ProductOrderRepoService { + + private static final transient Log logger = + LogFactory.getLog(ProductOrderRepoService.class.getName()); + + @Autowired + ObjectMapper objectMapper; + + @Autowired + ProductOrderRepository productOrderRepo; + + + @Autowired + ProductSpecificationRepoService productSpecificationRepoService; + + @Autowired + ProductOfferingRepoService productOfferingRepoService; + + + private SessionFactory sessionFactory; + + + @Autowired + public ProductOrderRepoService(EntityManagerFactory factory) { + if (factory.unwrap(SessionFactory.class) == null) { + throw new NullPointerException("factory is not a hibernate factory"); + } + this.sessionFactory = factory.unwrap(SessionFactory.class); + } + + + public List findAll() { + + // return (List) this.productOrderRepo.findAll(); + // return (List) this.productOrderRepo.findByOrderByOrderDateDesc(); + return (List) this.productOrderRepo.findAllOptimized(); + } + + + public List findAllParams(Map allParams) { + logger.info("findAll with params:" + allParams.toString()); + if ( ( allParams !=null) && allParams.get("state") !=null) { + ProductOrderStateType state = ProductOrderStateType.fromValue( allParams.get("state") ); + logger.info("find by state:" + state ); + return (List) this.productOrderRepo.findByState(state); + }else { + return findAll(); + } + } + + + public String findAllParamsJsonOrderIDs(Map allParams) throws JsonProcessingException { + List lso = findAllParams(allParams); + ArrayList oids = new ArrayList<>(); + for (ProductOrder object : lso) { + oids.add(object.getId()); + } + ObjectMapper mapper = new ObjectMapper(); + // Registering Hibernate4Module to support lazy objects + // this will fetch all lazy objects before marshaling + mapper.registerModule(new Hibernate5JakartaModule()); + String res = mapper.writeValueAsString( oids ); + + return res; + } + + + @Transactional + public ProductOrder addProductOrder(@Valid ProductOrderCreate productOrderCreate) throws NotFoundException { + + // Ensure that all Product Specifications exist + List productOrderItemList = productOrderCreate.getProductOrderItem(); + for (ProductOrderItem productOrderItem: productOrderItemList) { + + @Valid + ProductOfferingRef pOfferf = productOrderItem.getProductOffering(); + + if (pOfferf==null) { + throw new NotFoundException(400, "There is no ProductOfferingRef in Product Order Create request"); + } + + ProductOffering pOffer = productOfferingRepoService.findByUuid( pOfferf.getId() ); + @Valid + ProductSpecificationRef prodSpec = pOffer.getProductSpecification(); + String prodSpecificationId = prodSpec.getId(); + + ProductSpecification prodSpecification = productSpecificationRepoService.findByUuid(prodSpecificationId); + + if (prodSpecification == null) + throw new NotFoundException(400, "There is no Product Specification with Id: " + prodSpecificationId); + } + + + ProductOrder so = new ProductOrder(); + so.setOrderDate(OffsetDateTime.now(ZoneOffset.UTC)); + so.setCategory(productOrderCreate.getCategory()); + so.setDescription(productOrderCreate.getDescription()); + so.setExternalId(productOrderCreate.getExternalId()); + so.setNotificationContact(productOrderCreate.getNotificationContact()); + so.priority(productOrderCreate.getPriority()); + so.requestedCompletionDate(productOrderCreate.getRequestedCompletionDate()); + so.requestedStartDate(productOrderCreate.getRequestedStartDate() ); + so.setExpectedCompletionDate( productOrderCreate.getRequestedCompletionDate() ); //this is by default + if (productOrderCreate.getNote() != null) { + so.getNote().addAll(productOrderCreate.getNote()); + } + + + + + boolean allAcknowledged = false; + if (productOrderCreate.getProductOrderItem() != null) { + allAcknowledged = true; + so.getProductOrderItem().addAll(productOrderCreate.getProductOrderItem()); + for (ProductOrderItem soi : so.getProductOrderItem()) { + if ( ! soi.getState().equals( ProductOrderItemStateType.ACKNOWLEDGED )) { + allAcknowledged = false; + } + } + } + + if (productOrderCreate.getRelatedParty() != null) { + so.getRelatedParty().addAll(productOrderCreate.getRelatedParty()); + } + + + Note noteItem = new Note(); + noteItem.setText("Product Order " + ProductOrderStateType.INITIAL); + noteItem.setAuthor("PO622API-addProductOrder"); + noteItem.setDate(OffsetDateTime.now(ZoneOffset.UTC) ); + so.addNoteItem(noteItem); + + so = this.productOrderRepo.save(so); + + if (allAcknowledged) { //in the case were order items are automatically acknowledged + so.setState( ProductOrderStateType.ACKNOWLEDGED ); + noteItem = new Note(); + noteItem.setText("Product Order " + ProductOrderStateType.ACKNOWLEDGED); + noteItem.setAuthor("PO622API-addProductOrder"); + noteItem.setDate(OffsetDateTime.now(ZoneOffset.UTC) ); + so.addNoteItem(noteItem); + + so = this.productOrderRepo.save(so); + } + + raisePOCreateNotification(so); + + return so; + } + + @Transactional + public ProductOrder updateProductOrder(String id, @Valid ProductOrderUpdate prodOrderUpd) { + + logger.info("Will updateProductOrder:" + id); + + ProductOrder po = this.findByUuid(id); + boolean stateChanged = false; + boolean expectedCompletionDateChanged = false; + + ProductOrderMapper mapper = Mappers.getMapper( ProductOrderMapper.class ); + po = mapper.updateProductOrder(po, prodOrderUpd); + if ( prodOrderUpd.getState()!= null ) { + stateChanged = po.getState() != prodOrderUpd.getState(); + if ( po.getState().equals( ProductOrderStateType.COMPLETED )) { + po.setCompletionDate( OffsetDateTime.now(ZoneOffset.UTC)); + } + } + + if ( prodOrderUpd.getExpectedCompletionDate()!= null ) { + expectedCompletionDateChanged = true; + } + + + po = this.productOrderRepo.save(po); + + return po; + + } + + + private ProductOrder findByUuid(String id) { + Optional optionalCat = this.productOrderRepo.findByUuid(id); + return optionalCat.orElse(null); + } + + + @Transactional + private void raisePOCreateNotification(ProductOrder so) { + + + + } + + + + +} diff --git a/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java b/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java new file mode 100644 index 0000000..ac1b1db --- /dev/null +++ b/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java @@ -0,0 +1,365 @@ +package org.etsi.osl.services.api.po622; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.CoreMatchers.is; +import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.commons.io.IOUtils; +import org.etsi.osl.tmf.JsonUtils; +import org.etsi.osl.tmf.OpenAPISpringBoot; +import org.etsi.osl.tmf.common.model.service.Note; +import org.etsi.osl.tmf.pcm620.model.ProductOffering; +import org.etsi.osl.tmf.pcm620.model.ProductOfferingCreate; +import org.etsi.osl.tmf.pcm620.model.ProductOfferingRef; +import org.etsi.osl.tmf.pcm620.model.ProductSpecification; +import org.etsi.osl.tmf.pcm620.model.ProductSpecificationCreate; +import org.etsi.osl.tmf.pcm620.model.ProductSpecificationRef; +import org.etsi.osl.tmf.pcm620.reposervices.ProductCatalogRepoService; +import org.etsi.osl.tmf.pcm620.reposervices.ProductCategoryRepoService; +import org.etsi.osl.tmf.pcm620.reposervices.ProductOfferingPriceRepoService; +import org.etsi.osl.tmf.pcm620.reposervices.ProductOfferingRepoService; +import org.etsi.osl.tmf.pcm620.reposervices.ProductSpecificationRepoService; +import org.etsi.osl.tmf.po622.model.OrderItemActionType; +import org.etsi.osl.tmf.po622.model.ProductOrder; +import org.etsi.osl.tmf.po622.model.ProductOrderCreate; +import org.etsi.osl.tmf.po622.model.ProductOrderItem; +import org.etsi.osl.tmf.po622.model.ProductOrderItemStateType; +import org.etsi.osl.tmf.po622.model.ProductOrderStateType; +import org.etsi.osl.tmf.po622.model.ProductOrderUpdate; +import org.etsi.osl.tmf.po622.reposervices.ProductOrderRepoService; +import org.etsi.osl.tmf.prm669.model.RelatedParty; +import org.etsi.osl.tmf.scm633.model.ServiceSpecification; +import org.etsi.osl.tmf.scm633.model.ServiceSpecificationCreate; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.WebApplicationContext; +import jakarta.validation.Valid; + +@RunWith(SpringRunner.class) +@Transactional +@SpringBootTest( + webEnvironment = SpringBootTest.WebEnvironment.MOCK, + classes = OpenAPISpringBoot.class +) +//@AutoConfigureTestDatabase //this automatically uses h2 +@AutoConfigureMockMvc +@ActiveProfiles("testing") +public class ProductOrderRepoServiceTest { + + @Autowired + private MockMvc mvc; + + @Autowired + ProductOrderRepoService productOrderRepoService; + + + @Autowired + ProductCatalogRepoService catalogRepoService; + + @Autowired + ProductCategoryRepoService categRepoService; + + @Autowired + ProductOfferingRepoService productOfferingRepoService; + + + @Autowired + ProductOfferingPriceRepoService productOfferingPriceRepoService; + + + @Autowired + ProductSpecificationRepoService productSpecificationRepoService; + + + @Autowired + private WebApplicationContext context; + + @Before + public void setup() throws Exception { + mvc = MockMvcBuilders + .webAppContextSetup(context) + .apply(springSecurity()) + .build(); + } + + + + @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) + @Test + public void testFindAllParams() throws Exception { + + String response = createProductOrder(); + + ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); + String soId = responsesProductOrder.getId(); + String state = responsesProductOrder.getState().toString(); + + // Test with not null params + Map params = new HashMap<>(); + params.put("state", state); + + List productOrderList = productOrderRepoService.findAllParams(params); + + boolean idExists = false; + for (ProductOrder po : productOrderList) { + if ( po.getId().equals( soId ) ) { + idExists= true; + } + } + assertThat( idExists ).isTrue(); + + // Test with null params + Map paramsEmpty = new HashMap<>(); + List productOrderListEmptyParams = productOrderRepoService.findAllParams(paramsEmpty); + + boolean idExistsEmptyParams = false; + for (ProductOrder so : productOrderListEmptyParams) { + if ( so.getId().equals( soId ) ) { + idExistsEmptyParams= true; + } + } + assertThat( idExistsEmptyParams ).isTrue(); + assertThat(productOrderListEmptyParams.size()).isEqualTo(productOrderRepoService.findAll().size()); + } + + + @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) + @Test + public void testFindAllParamsJsonOrderIDs() throws Exception { + + String response = createProductOrder(); + String response2 = createProductOrder(); + + ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); + String soId = responsesProductOrder.getId(); + + ProductOrder responsesProductOrder2 = JsonUtils.toJsonObj(response2, ProductOrder.class); + String soId2 = responsesProductOrder2.getId(); + + String state = responsesProductOrder.getState().toString(); + Map params = new HashMap<>(); + params.put("state", state); + + String soIds = productOrderRepoService.findAllParamsJsonOrderIDs(params); + assertThat(soIds).contains(soId); + assertThat(soIds).contains(soId2); + } + + + @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) + @Test + public void testUpdateProductOrder() throws Exception { + + assertThat( productOrderRepoService.findAll().size() ).isEqualTo( 0 ); + String response = createProductOrder(); + ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); + String poId = responsesProductOrder.getId(); + + ProductOrderUpdate prodOrderUpd = new ProductOrderUpdate(); + prodOrderUpd.setExpectedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + Note en = new Note(); + en.text("test note2"); + prodOrderUpd.addNoteItem(en); + prodOrderUpd.addProductOrderItemItem((new ArrayList<>(responsesProductOrder.getProductOrderItem())).get(0)); + prodOrderUpd.getProductOrderItem().get(0).setState(ProductOrderItemStateType.INPROGRESS); + prodOrderUpd.setState(ProductOrderStateType.COMPLETED); + prodOrderUpd.setCategory("New Test Category"); + prodOrderUpd.setDescription("New Test Description"); + prodOrderUpd.setRequestedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + prodOrderUpd.setRequestedStartDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + + ProductOrder responseSOUpd = productOrderRepoService.updateProductOrder(poId, prodOrderUpd); + assertThat(responseSOUpd.getState().toString()).isEqualTo("COMPLETED"); + assertThat(responseSOUpd.getDescription()).isEqualTo("New Test Description"); + assertThat(productOrderRepoService.findAll().size()).isEqualTo(1); + assertThat( responseSOUpd.getNote().size() ).isEqualTo(2); + assertThat( responseSOUpd.getRelatedParty().size() ).isEqualTo(1); + assertThat( responseSOUpd.getProductOrderItem().size() ).isEqualTo(1); + + prodOrderUpd = new ProductOrderUpdate(); + en = new Note(); + en.text("test note3"); + prodOrderUpd.addNoteItem(en); + prodOrderUpd.addRelatedPartyItem(new RelatedParty()); + responseSOUpd = productOrderRepoService.updateProductOrder(poId, prodOrderUpd); + assertThat(productOrderRepoService.findAll().size()).isEqualTo(1); + assertThat( responseSOUpd.getNote().size() ).isEqualTo(3); + assertThat( responseSOUpd.getRelatedParty().size() ).isEqualTo(2); + + + } + + +// @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) +// @Test +// public void testGetProductOrderEagerAsString() throws Exception { +// +// String response = createProductOrder(); +// ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); +// String soId = responsesProductOrder.getId(); +// +// String eager = productOrderRepoService.getProductOrderEagerAsString(soId); +// ProductOrder eagerProductOrder = JsonUtils.toJsonObj(eager, ProductOrder.class); +// assertThat(eagerProductOrder.getDescription()).isEqualTo("A Test Service Order"); +// assertThat(eagerProductOrder.getCategory()).isEqualTo("Test Category"); +// assertThat(eagerProductOrder.getId()).isEqualTo(soId); +// } +// +// +//// // This test causes "HikariPool-1 - Connection is not available, request timed out after 30000ms" error for other tests +//// @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) +//// @Test +//// public void testAddProductOrderReturnEager() throws Exception { +//// +//// ProductOrderCreate productOrder = new ProductOrderCreate(); +//// productOrder.setCategory("Test Category"); +//// productOrder.setDescription("A Test Service Order"); +//// productOrder.setRequestedStartDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); +//// productOrder.setRequestedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); +//// +//// Note noteItem = new Note(); +//// noteItem.text("Test note"); +//// productOrder.addNoteItem(noteItem); +//// +//// ProductOrderItem soi = new ProductOrderItem(); +//// productOrder.getOrderItem().add(soi); +//// soi.setState(ProductOrderStateType.ACKNOWLEDGED); +//// +//// +//// String eager = productOrderRepoService.addProductOrderReturnEager(productOrder); +//// ProductOrder eagerProductOrder = JsonUtils.toJsonObj(eager, ProductOrder.class); +//// assertThat(eagerProductOrder.getDescription()).isEqualTo("A Test Service Order"); +//// assertThat(eagerProductOrder.getCategory()).isEqualTo("Test Category"); +//// } +// +// +// @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) +// @Test +// public void testGetImageProductOrderItemRelationshipGraph() throws Exception { +// +// String response = createProductOrder(); +// ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); +// String soId = responsesProductOrder.getId(); +// Set productOrderItemSet = responsesProductOrder.getOrderItem(); +// +// for (ProductOrderItem soi: productOrderItemSet) { +// String responseGraph = productOrderRepoService.getImageProductOrderItemRelationshipGraph(soId, soi.getId()); +// assertThat( responseGraph ).isNotNull(); +// } +// } + + + private String createProductOrder() throws Exception { + + int currSize = productOrderRepoService.findAll().size(); + + File sspec = new File("src/test/resources/testProductSpec.json"); + InputStream in = new FileInputStream(sspec); + String sspectext = IOUtils.toString(in, "UTF-8"); + + ProductSpecificationCreate psc = JsonUtils.toJsonObj(sspectext, ProductSpecificationCreate.class); + psc.setVersion("1.1"); + ProductSpecification responseProdSpec = createProductSpec(psc); + + + assertThat( productSpecificationRepoService.findAll().size() ).isEqualTo( currSize + 1 ); + + + + + ProductSpecificationRef prodSpecRef = new ProductSpecificationRef(); + prodSpecRef.setId(responseProdSpec.getId()); + @Valid + ProductOfferingCreate pefCre = new ProductOfferingCreate(); + pefCre.productSpecification(prodSpecRef); + + + ProductOffering pOffer = productOfferingRepoService.addProductOffering(pefCre); + + ProductOfferingRef prodOffRef = new ProductOfferingRef(); + prodOffRef.setId( pOffer.getId()); + + + + ProductOrderCreate productOrder = new ProductOrderCreate(); + productOrder.setCategory("Test Category"); + productOrder.setDescription("A Test Product Order"); + productOrder.setRequestedStartDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + productOrder.setRequestedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + + + + + ProductOrderItem poi = new ProductOrderItem(); + poi + .action(OrderItemActionType.ADD) + .productOffering(prodOffRef); + + productOrder.getProductOrderItem().add(poi); + + + byte[] req = JsonUtils.toJson(productOrder); + String response = mvc + .perform(MockMvcRequestBuilders.post("/productOrderingManagement/v4/productOrder") + .with( SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON).content( req )) + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + + System.out.println(" ====================> " + response); + ProductOrder responsePO = JsonUtils.toJsonObj(response, ProductOrder.class); + + assertThat( productOrderRepoService.findAll().size() ).isEqualTo( currSize + 1 ); + assertThat(responsePO.getId()).isNotNull(); + assertThat(responsePO.getCategory()).isEqualTo("Test Category"); + assertThat(responsePO.getDescription()).isEqualTo("A Test Product Order"); + assertThat( responsePO.getRelatedParty().size() ).isEqualTo(1); + + assertThat( responsePO.getRelatedParty().stream().findFirst().get().getName() ).isEqualTo("osadmin"); + + return response; + + } + + + private ProductSpecification createProductSpec( ProductSpecificationCreate prodSpecificationCreate) throws Exception { + + String response = mvc.perform(MockMvcRequestBuilders.post("/productCatalogManagement/v4/productSpecification") + .with( SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON).content(JsonUtils.toJson(prodSpecificationCreate))) + .andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); + ProductSpecification responsesSpec = JsonUtils.toJsonObj(response, ProductSpecification.class); + + return responsesSpec; + } +} -- GitLab From 6d270139140966aef654c13531f27c44513a1994 Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Fri, 9 Aug 2024 13:12:11 +0300 Subject: [PATCH 2/8] fixing tests --- .../osl/tmf/po622/api/ProductOrderApi.java | 55 +- .../po622/api/ProductOrderApiController.java | 249 +++++--- .../api/ProductOrderApiRouteBuilder.java | 101 ++++ .../ProductOrderApiRouteBuilderEvents.java | 108 ++++ .../po622/repo/ProductOrderRepository.java | 1 + .../reposervices/ProductOrderRepoService.java | 454 +++++++++++++- .../so641/api/ServiceOrderApiController.java | 2 +- .../reposervices/ServiceOrderRepoService.java | 20 +- src/main/resources/application-testing.yml | 12 + src/main/resources/application.yml | 13 + .../po622/ProductOrderRepoServiceTest.java | 553 ++++++++++-------- src/test/resources/productorder.json | 235 ++++++++ 12 files changed, 1441 insertions(+), 362 deletions(-) create mode 100644 src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiRouteBuilder.java create mode 100644 src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiRouteBuilderEvents.java create mode 100644 src/test/resources/productorder.json diff --git a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApi.java b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApi.java index 10da8d5..bd68031 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApi.java +++ b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApi.java @@ -26,6 +26,7 @@ package org.etsi.osl.tmf.po622.api; import java.io.IOException; import java.security.Principal; +import java.util.Date; import java.util.List; import java.util.Optional; @@ -36,6 +37,7 @@ import org.etsi.osl.tmf.po622.model.ProductOrderUpdate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; @@ -111,7 +113,7 @@ public interface ProductOrderApi { @RequestMapping(value = "/productOrder/{id}", produces = { "application/json;charset=utf-8" }, method = RequestMethod.DELETE) - default ResponseEntity deleteProductOrder(@Parameter(description = "Identifier of the ProductOrder",required=true) @PathVariable("id") String id + default ResponseEntity deleteProductOrder(Principal principal,@Parameter(description = "Identifier of the ProductOrder",required=true) @PathVariable("id") String id ) { if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { } else { @@ -134,9 +136,11 @@ public interface ProductOrderApi { @RequestMapping(value = "/productOrder", produces = { "application/json;charset=utf-8" }, method = RequestMethod.GET) - default ResponseEntity> listProductOrder(@Parameter(description = "Comma-separated properties to be provided in response") @Valid @RequestParam(value = "fields", required = false) String fields + default ResponseEntity> listProductOrder(Principal principal,@Parameter(description = "Comma-separated properties to be provided in response") @Valid @RequestParam(value = "fields", required = false) String fields ,@Parameter(description = "Requested index for start of resources to be provided in response") @Valid @RequestParam(value = "offset", required = false) Integer offset -,@Parameter(description = "Requested number of resources to be provided in response") @Valid @RequestParam(value = "limit", required = false) Integer limit +,@Parameter(description = "Requested number of resources to be provided in response") @Valid @RequestParam(value = "limit", required = false) Integer limit, +@Parameter(description = "Requested starttime for start of resources to be provided in response") @Valid @RequestParam(value = "starttime", required = false) Date starttime, +@Parameter(description = "Requested endtime for start of resources to be provided in response") @Valid @RequestParam(value = "endtime", required = false) Date endtime ) { if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { if (getAcceptHeader().get().contains("application/json")) { @@ -168,7 +172,7 @@ public interface ProductOrderApi { produces = { "application/json;charset=utf-8" }, consumes = { "application/json;charset=utf-8" }, method = RequestMethod.PATCH) - default ResponseEntity patchProductOrder(@Parameter(description = "The ProductOrder to be updated" ,required=true ) @Valid @RequestBody ProductOrderUpdate body + default ResponseEntity patchProductOrder(Principal principal,@Parameter(description = "The ProductOrder to be updated" ,required=true ) @Valid @RequestBody ProductOrderUpdate body ,@Parameter(description = "Identifier of the ProductOrder",required=true) @PathVariable("id") String id ) { if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { @@ -200,7 +204,7 @@ public interface ProductOrderApi { @RequestMapping(value = "/productOrder/{id}", produces = { "application/json;charset=utf-8" }, method = RequestMethod.GET) - default ResponseEntity retrieveProductOrder(@Parameter(description = "Identifier of the ProductOrder",required=true) @PathVariable("id") String id + default ResponseEntity retrieveProductOrder(Principal principal, @Parameter(description = "Identifier of the ProductOrder",required=true) @PathVariable("id") String id ,@Parameter(description = "Comma-separated properties to provide in response") @Valid @RequestParam(value = "fields", required = false) String fields ) { if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { @@ -217,5 +221,46 @@ public interface ProductOrderApi { } return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + + @Operation(summary = "Get a SVG image with product order item services relationship graph", operationId = "getImageProductOrderItemRelationshipGraph", + description = "This operation returns a SVG image with Product order item services relationship graph", tags={ "productOrder", }) +@ApiResponses(value = { + + @ApiResponse(responseCode = "302", description = "Success" ), + //@ApiResponse(responseCode ="200", description = "Success" ), + @ApiResponse(responseCode = "400", description = "Bad Request" ), + @ApiResponse(responseCode = "401", description = "Unauthorized" ), + @ApiResponse(responseCode = "403", description = "Forbidden" ), + @ApiResponse(responseCode = "404", description = "Not Found" ), + @ApiResponse(responseCode = "405", description = "Method Not allowed" ), + @ApiResponse(responseCode = "409", description = "Conflict" ), + @ApiResponse(responseCode = "500", description = "Internal Server Error" ) }) +@RequestMapping(value ="/productOrder/{id}/item/{itemid}/relationship_graph", + produces = MediaType.ALL_VALUE , + method = RequestMethod.GET) +ResponseEntity getImageProductOrderItemRelationshipGraph( + @Parameter(description = "Identifier of the ProductOrder",required=true) @PathVariable("id") String id, + @Parameter(description = "Identifier of the ProductOrderItem",required=true) @PathVariable("itemid") String itemid); + + +@Operation(summary = "Get a SVG image with Product order notes activity graph", operationId = "getImageProductOrderNotesGraph", + description = "This operation returns a SVG image with Product order notes activity graph", tags={ "productOrder", }) +@ApiResponses(value = { + + @ApiResponse(responseCode = "302", description = "Success" ), + //@ApiResponse(responseCode ="200", description = "Success" ), + @ApiResponse(responseCode = "400", description = "Bad Request" ), + @ApiResponse(responseCode = "401", description = "Unauthorized" ), + @ApiResponse(responseCode = "403", description = "Forbidden" ), + @ApiResponse(responseCode = "404", description = "Not Found" ), + @ApiResponse(responseCode = "405", description = "Method Not allowed" ), + @ApiResponse(responseCode = "409", description = "Conflict" ), + @ApiResponse(responseCode = "500", description = "Internal Server Error" ) }) +@RequestMapping(value ="/productOrder/{id}/notes_graph", + produces = MediaType.ALL_VALUE , + method = RequestMethod.GET) +ResponseEntity getImageProductOrderNotesGraph( + @Parameter(description = "Identifier of the ProductOrder",required=true) @PathVariable("id") String id); + } diff --git a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java index 4414d2f..e051726 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java +++ b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java @@ -19,21 +19,32 @@ */ package org.etsi.osl.tmf.po622.api; +import java.net.URI; import java.security.Principal; +import java.util.Date; +import java.util.HashMap; +import java.util.List; import java.util.Optional; import com.fasterxml.jackson.databind.ObjectMapper; +import org.etsi.osl.model.nfv.UserRoleType; import org.etsi.osl.tmf.common.model.UserPartRoleType; import org.etsi.osl.tmf.po622.model.ProductOrder; import org.etsi.osl.tmf.po622.model.ProductOrderCreate; +import org.etsi.osl.tmf.po622.model.ProductOrderUpdate; import org.etsi.osl.tmf.po622.reposervices.ProductOrderRepoService; import org.etsi.osl.tmf.so641.api.NotFoundException; +import org.etsi.osl.tmf.so641.model.ServiceOrder; import org.etsi.osl.tmf.util.AddUserAsOwnerToRelatedParties; 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.security.access.prepost.PreAuthorize; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.oauth2.jwt.Jwt; import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken; import org.springframework.stereotype.Controller; @@ -42,91 +53,177 @@ import org.springframework.web.bind.annotation.RequestMapping; import io.swagger.v3.oas.annotations.Parameter; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.Valid; -@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-10-30T10:29:21.184964400+02:00[Europe/Athens]") + +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", + date = "2020-10-30T10:29:21.184964400+02:00[Europe/Athens]") @Controller("ProductOrderApiController622") @RequestMapping("/productOrderingManagement/v4/") public class ProductOrderApiController implements ProductOrderApi { - private final ObjectMapper objectMapper; + private final ObjectMapper objectMapper; - private final HttpServletRequest request; - + private final HttpServletRequest request; - - @Autowired - ProductOrderRepoService productOrderRepoService; - @org.springframework.beans.factory.annotation.Autowired - public ProductOrderApiController(ObjectMapper objectMapper, HttpServletRequest request) { - this.objectMapper = objectMapper; - this.request = request; - } + @Value("${kroki.serverurl}") + private String KROKI_SERVERURL = ""; + + @Autowired + ProductOrderRepoService productOrderRepoService; + + @org.springframework.beans.factory.annotation.Autowired + public ProductOrderApiController(ObjectMapper objectMapper, HttpServletRequest request) { + this.objectMapper = objectMapper; + this.request = request; + } + + + @PreAuthorize("hasAnyAuthority('ROLE_USER')") + @Override + public ResponseEntity createProductOrder(Principal principal, + @Parameter(description = "The ProductOrder to be created", + required = true) @Valid @RequestBody ProductOrderCreate productOrder) { + + try { + // Object attr = request.getSession().getAttribute("SPRING_SECURITY_CONTEXT"); + // SecurityContextHolder.setContext( (SecurityContext) attr ); - @PreAuthorize("hasAnyAuthority('ROLE_USER')" ) - @Override - public ResponseEntity createProductOrder( - Principal principal, - @Parameter(description = "The ProductOrder to be created", required = true) @Valid @RequestBody ProductOrderCreate productOrder - ) { - - try { - //Object attr = request.getSession().getAttribute("SPRING_SECURITY_CONTEXT"); - //SecurityContextHolder.setContext( (SecurityContext) attr ); - - - log.info("authentication= " + principal.toString()); - String extInfo = null; - try { - - - if ( principal instanceof JwtAuthenticationToken) { - - JwtAuthenticationToken pr = ( JwtAuthenticationToken ) principal; - - Jwt lp = (Jwt) pr.getPrincipal(); - extInfo = lp.getClaimAsString("email"); - log.debug("extInfo= " + extInfo); - - productOrder.setRelatedParty(AddUserAsOwnerToRelatedParties.addUser( - principal.getName(), - //user.getId()+"", - principal.getName(), - UserPartRoleType.REQUESTER, - extInfo, - productOrder.getRelatedParty())); - } - else if ( principal instanceof UsernamePasswordAuthenticationToken ) { - productOrder.setRelatedParty(AddUserAsOwnerToRelatedParties.addUser( - principal.getName(), - //user.getId()+"", - principal.getName(), - UserPartRoleType.REQUESTER, - extInfo, - productOrder.getRelatedParty())); - } - - - }finally { - - } - - - - - - - ProductOrder c = productOrderRepoService.addProductOrder(productOrder); - - return new ResponseEntity(c, HttpStatus.OK); - - - } catch (NotFoundException e) { - log.error("Couldn't create Service Order. ", e); - return new ResponseEntity(HttpStatus.BAD_REQUEST); - } catch (Exception e) { - log.error("Couldn't serialize response for content type application/json", e); - return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + log.info("authentication= " + principal.toString()); + String extInfo = null; + try { + + + if (principal instanceof JwtAuthenticationToken) { + + JwtAuthenticationToken pr = (JwtAuthenticationToken) principal; + + Jwt lp = (Jwt) pr.getPrincipal(); + extInfo = lp.getClaimAsString("email"); + log.debug("extInfo= " + extInfo); + + productOrder.setRelatedParty(AddUserAsOwnerToRelatedParties.addUser(principal.getName(), + // user.getId()+"", + principal.getName(), UserPartRoleType.REQUESTER, extInfo, + productOrder.getRelatedParty())); + } else if (principal instanceof UsernamePasswordAuthenticationToken) { + productOrder.setRelatedParty(AddUserAsOwnerToRelatedParties.addUser(principal.getName(), + // user.getId()+"", + principal.getName(), UserPartRoleType.REQUESTER, extInfo, + productOrder.getRelatedParty())); } + + + } finally { + + } + + + + ProductOrder c = productOrderRepoService.addProductOrder(productOrder); + + return new ResponseEntity(c, HttpStatus.OK); + + + } catch (NotFoundException e) { + log.error("Couldn't create Service Order. ", e); + return new ResponseEntity(HttpStatus.BAD_REQUEST); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @Override + @PreAuthorize("hasAnyAuthority('ROLE_ADMIN')") + public ResponseEntity deleteProductOrder(Principal principal, String id) { + + try { + return new ResponseEntity(productOrderRepoService.deleteByUuid(id), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @Override + public ResponseEntity> listProductOrder(Principal principal, + @Valid String fields, @Valid Integer offset, @Valid Integer limit, @Valid Date starttime, + @Valid Date endtime) { + try { + + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + log.debug("principal= " + principal.toString()); + + log.debug("principal ROLE_ADMIN = " + authentication.getAuthorities() + .contains(new SimpleGrantedAuthority(UserRoleType.ROLE_ADMIN.getValue()))); + log.debug("principal ROLE_NFV_DEVELOPER = " + authentication.getAuthorities() + .contains(new SimpleGrantedAuthority(UserRoleType.ROLE_NFV_DEVELOPER.getValue()))); + log.debug("principal ROLE_EXPERIMENTER = " + authentication.getAuthorities() + .contains(new SimpleGrantedAuthority(UserRoleType.ROLE_EXPERIMENTER.getValue()))); + + if (authentication.getAuthorities() + .contains(new SimpleGrantedAuthority(UserRoleType.ROLE_ADMIN.getValue()))) { + + return new ResponseEntity>( + productOrderRepoService.findAll(fields, new HashMap<>(), starttime, endtime), + HttpStatus.OK); + } else { + return new ResponseEntity>( + productOrderRepoService.findAll(principal.getName(), UserPartRoleType.REQUESTER), + HttpStatus.OK); + } + + + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity>(HttpStatus.INTERNAL_SERVER_ERROR); } + } + + + @Override + @PreAuthorize("hasAnyAuthority('ROLE_USER')") + public ResponseEntity patchProductOrder(Principal principal, + @Valid ProductOrderUpdate body, String id) { + ProductOrder c = productOrderRepoService.updateProductOrder(id, body); + + return new ResponseEntity(c, HttpStatus.OK); + } + + + @Override + @PreAuthorize("hasAnyAuthority('ROLE_USER')") + public ResponseEntity retrieveProductOrder(Principal principal, String id, + @Valid String fields) { + try { + + return new ResponseEntity( productOrderRepoService.findByUuid( id ), HttpStatus.OK); + } catch ( Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @Override + @PreAuthorize("hasAnyAuthority('ROLE_USER')") + public ResponseEntity getImageProductOrderItemRelationshipGraph(String id, String itemid) { + String encodedDiagram = + productOrderRepoService.getImageProductOrderItemRelationshipGraph(id, itemid); + + // consider redirect to kroki..id + return ResponseEntity.status(HttpStatus.FOUND) + .location(URI.create(KROKI_SERVERURL + "/blockdiag/svg/" + encodedDiagram)).build(); + // return null; + } + + @Override + @PreAuthorize("hasAnyAuthority('ROLE_USER')") + public ResponseEntity getImageProductOrderNotesGraph(String id) { + String encodedDiagram = productOrderRepoService.getImageProductOrderNotesGraph(id); + + // consider redirect to kroki..id + return ResponseEntity.status(HttpStatus.FOUND) + .location(URI.create(KROKI_SERVERURL + "/actdiag/svg/" + encodedDiagram)).build(); + } } diff --git a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiRouteBuilder.java b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiRouteBuilder.java new file mode 100644 index 0000000..23dbc57 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiRouteBuilder.java @@ -0,0 +1,101 @@ +package org.etsi.osl.tmf.po622.api; + +import java.util.Map; +import org.apache.camel.LoggingLevel; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.model.dataformat.JsonLibrary; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.etsi.osl.centrallog.client.CentralLogger; +import org.etsi.osl.tmf.po622.model.ProductOrderCreate; +import org.etsi.osl.tmf.po622.model.ProductOrderUpdate; +import org.etsi.osl.tmf.po622.reposervices.ProductOrderRepoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; + +@Configuration +//@RefreshScope +@Component +public class ProductOrderApiRouteBuilder extends RouteBuilder { + + private static final transient Log logger = LogFactory.getLog(ProductOrderApiRouteBuilder.class.getName()); + + @Value("${CATALOG_GET_PRODUCTORDER_BY_ID}") + private String CATALOG_GET_PRODUCTORDER_BY_ID = ""; + + @Value("${CATALOG_GET_PRODUCTORDERS}") + private String CATALOG_GET_PRODUCTORDERS = ""; + + @Value("${CATALOG_GET_INITIAL_PRODUCTORDERS_IDS}") + private String CATALOG_GET_INITIAL_PRODUCTORDERS_IDS = ""; + + @Value("${CATALOG_GET_PRODUCTORDER_IDS_BY_STATE}") + private String CATALOG_GET_PRODUCTORDER_IDS_BY_STATE = ""; + + @Value("${CATALOG_UPD_PRODUCTORDER_BY_ID}") + private String CATALOG_UPD_PRODUCTORDER_BY_ID = ""; + + @Value("${CATALOG_ADD_PRODUCTORDER}") + private String CATALOG_ADD_PRODUCTORDER = ""; + + + @Value("${GET_USER_BY_USERNAME}") + private String GET_USER_BY_USERNAME = ""; + + @Value("${spring.application.name}") + private String compname; + + @Autowired + private ProducerTemplate template; + + @Autowired + ProductOrderRepoService productOrderRepoService; + + @Autowired + private CentralLogger centralLogger; + + + @Override + public void configure() throws Exception { + from(CATALOG_GET_PRODUCTORDERS).log(LoggingLevel.INFO, log, CATALOG_GET_PRODUCTORDERS + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true") + .bean(productOrderRepoService, "findAllParamsJsonOrderIDs").convertBodyTo(String.class); + + +from(CATALOG_GET_INITIAL_PRODUCTORDERS_IDS) + .log(LoggingLevel.INFO, log, CATALOG_GET_INITIAL_PRODUCTORDERS_IDS + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true").setBody(constant("{\"state\":\"INITIAL\"}")).unmarshal() + .json(JsonLibrary.Jackson, Map.class, true).bean(productOrderRepoService, "findAllParamsJsonOrderIDs") + .convertBodyTo(String.class); + +from(CATALOG_GET_PRODUCTORDER_IDS_BY_STATE) + .log(LoggingLevel.INFO, log, CATALOG_GET_PRODUCTORDER_IDS_BY_STATE + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true").setBody(simple("{\"state\":\"${header.orderstate}\"}")) + .unmarshal().json(JsonLibrary.Jackson, Map.class, true) + .bean(productOrderRepoService, "findAllParamsJsonOrderIDs").convertBodyTo(String.class); + +from(CATALOG_GET_PRODUCTORDER_BY_ID) + .log(LoggingLevel.INFO, log, CATALOG_GET_PRODUCTORDER_BY_ID + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true") + .bean(productOrderRepoService, "getProductOrderEagerAsString").convertBodyTo(String.class); + +from(CATALOG_UPD_PRODUCTORDER_BY_ID) + .log(LoggingLevel.INFO, log, CATALOG_UPD_PRODUCTORDER_BY_ID + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true").unmarshal() + .json(JsonLibrary.Jackson, ProductOrderUpdate.class, true) + .bean(productOrderRepoService, "updateProductOrder(${header.orderid}, ${body})"); + + +from(CATALOG_ADD_PRODUCTORDER) + .log(LoggingLevel.INFO, log, CATALOG_ADD_PRODUCTORDER + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true").unmarshal() + .json(JsonLibrary.Jackson, ProductOrderCreate.class, true) + .bean(productOrderRepoService, "addProductOrderReturnEager(${body})") + .convertBodyTo(String.class); //creates back a response + } + + +} diff --git a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiRouteBuilderEvents.java b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiRouteBuilderEvents.java new file mode 100644 index 0000000..8343d3d --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiRouteBuilderEvents.java @@ -0,0 +1,108 @@ +package org.etsi.osl.tmf.po622.api; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.builder.RouteBuilder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.etsi.osl.centrallog.client.CLevel; +import org.etsi.osl.centrallog.client.CentralLogger; +import org.etsi.osl.tmf.common.model.Notification; +import org.etsi.osl.tmf.po622.model.ProductOrderAttributeValueChangeNotification; +import org.etsi.osl.tmf.po622.model.ProductOrderCreateNotification; +import org.etsi.osl.tmf.po622.model.ProductOrderDeleteNotification; +import org.etsi.osl.tmf.po622.model.ProductOrderStateChangeNotification; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +@Configuration +// @RefreshScope +@Component +public class ProductOrderApiRouteBuilderEvents extends RouteBuilder { + + private static final transient Log logger = + LogFactory.getLog(ProductOrderApiRouteBuilderEvents.class.getName()); + + + + @Value("${EVENT_PRODUCT_ORDER_CREATE}") + private String EVENT_PRODUCT_ORDER_CREATE = ""; + + @Value("${EVENT_PRODUCT_ORDER_STATE_CHANGED}") + private String EVENT_PRODUCT_ORDER_STATE_CHANGED = ""; + + @Value("${EVENT_PRODUCT_ORDER_DELETE}") + private String EVENT_PRODUCT_ORDER_DELETE = ""; + + @Value("${EVENT_PRODUCT_ORDER_ATTRIBUTE_VALUE_CHANGED}") + private String EVENT_PRODUCT_ORDER_ATTRIBUTE_VALUE_CHANGED = ""; + + + + @Value("${spring.application.name}") + private String compname; + + @Autowired + private ProducerTemplate template; + + + @Autowired + private CentralLogger centralLogger; + + @Override + public void configure() throws Exception { + + + + } + + /** + * @param n + */ + @Transactional + public void publishEvent(final Notification n, final String objId) { + n.setEventType(n.getClass().getName()); + logger.info("will send Event for type " + n.getEventType()); + try { + String msgtopic = ""; + + if (n instanceof ProductOrderCreateNotification) { + msgtopic = EVENT_PRODUCT_ORDER_CREATE; + } else if (n instanceof ProductOrderStateChangeNotification) { + msgtopic = EVENT_PRODUCT_ORDER_STATE_CHANGED; + } else if (n instanceof ProductOrderDeleteNotification) { + msgtopic = EVENT_PRODUCT_ORDER_DELETE; + } else if (n instanceof ProductOrderAttributeValueChangeNotification) { + msgtopic = EVENT_PRODUCT_ORDER_ATTRIBUTE_VALUE_CHANGED; + } + Map map = new HashMap<>(); + map.put("eventid", n.getEventId()); + map.put("objId", objId); + + String apayload = toJsonString(n); + template.sendBodyAndHeaders(msgtopic, apayload, map); + + + centralLogger.log(CLevel.INFO, apayload, compname); + + } catch (Exception e) { + e.printStackTrace(); + logger.error("Cannot send Event . " + e.getMessage()); + } + } + + + static String toJsonString(Object object) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + return mapper.writeValueAsString(object); + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/po622/repo/ProductOrderRepository.java b/src/main/java/org/etsi/osl/tmf/po622/repo/ProductOrderRepository.java index 0569c0c..ae19cea 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/repo/ProductOrderRepository.java +++ b/src/main/java/org/etsi/osl/tmf/po622/repo/ProductOrderRepository.java @@ -35,6 +35,7 @@ public interface ProductOrderRepository extends CrudRepository findByUuid(String id); + Iterable findByState( ProductOrderStateType state); @Query("SELECT por FROM ProductOrder por JOIN FETCH por.relatedParty rp WHERE rp.name = ?1 AND rp.role = ?2 ORDER BY por.orderDate DESC") Iterable findByRolenameAndRoleType(String rolename, UserPartRoleType requester); diff --git a/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java b/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java index bc21350..b405f63 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java +++ b/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java @@ -19,43 +19,71 @@ */ package org.etsi.osl.tmf.po622.reposervices; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.stream.Collectors; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.hibernate5.jakarta.Hibernate5JakartaModule; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.etsi.osl.tmf.common.model.UserPartRoleType; import org.etsi.osl.tmf.common.model.service.Note; +import org.etsi.osl.tmf.common.model.service.ResourceRef; +import org.etsi.osl.tmf.common.model.service.ServiceRef; import org.etsi.osl.tmf.pcm620.model.ProductOffering; import org.etsi.osl.tmf.pcm620.model.ProductOfferingRef; import org.etsi.osl.tmf.pcm620.model.ProductSpecification; import org.etsi.osl.tmf.pcm620.model.ProductSpecificationRef; import org.etsi.osl.tmf.pcm620.reposervices.ProductOfferingRepoService; import org.etsi.osl.tmf.pcm620.reposervices.ProductSpecificationRepoService; +import org.etsi.osl.tmf.po622.api.ProductOrderApiRouteBuilderEvents; +import org.etsi.osl.tmf.po622.model.OrderItemActionType; import org.etsi.osl.tmf.po622.model.ProductOrder; +import org.etsi.osl.tmf.po622.model.ProductOrderAttributeValueChangeEvent; +import org.etsi.osl.tmf.po622.model.ProductOrderAttributeValueChangeNotification; import org.etsi.osl.tmf.po622.model.ProductOrderCreate; +import org.etsi.osl.tmf.po622.model.ProductOrderCreateEvent; +import org.etsi.osl.tmf.po622.model.ProductOrderCreateNotification; import org.etsi.osl.tmf.po622.model.ProductOrderItem; import org.etsi.osl.tmf.po622.model.ProductOrderItemStateType; import org.etsi.osl.tmf.po622.model.ProductOrderMapper; +import org.etsi.osl.tmf.po622.model.ProductOrderStateChangeEvent; +import org.etsi.osl.tmf.po622.model.ProductOrderStateChangeNotification; import org.etsi.osl.tmf.po622.model.ProductOrderStateType; import org.etsi.osl.tmf.po622.model.ProductOrderUpdate; import org.etsi.osl.tmf.po622.repo.ProductOrderRepository; -import org.etsi.osl.tmf.rpm685.model.ResourcePoolMapper; +import org.etsi.osl.tmf.prm669.model.RelatedParty; +import org.etsi.osl.tmf.sim638.model.ServiceUpdate; +import org.etsi.osl.tmf.sim638.service.ServiceRepoService; import org.etsi.osl.tmf.so641.api.NotFoundException; -import org.etsi.osl.tmf.so641.model.ServiceOrder; -import org.etsi.osl.tmf.so641.model.ServiceOrderStateType; +import org.etsi.osl.tmf.util.KrokiClient; +import org.hibernate.Hibernate; +import org.hibernate.Session; import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.hibernate.query.Query; +import org.hibernate.transform.ResultTransformer; import org.mapstruct.factory.Mappers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManagerFactory; +import jakarta.persistence.PersistenceContext; import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import lombok.Data; @Service public class ProductOrderRepoService { @@ -75,10 +103,18 @@ public class ProductOrderRepoService { @Autowired ProductOfferingRepoService productOfferingRepoService; + + + @Autowired + ProductOrderApiRouteBuilderEvents productOrderApiRouteBuilder; + + @Autowired + ServiceRepoService serviceRepoService; private SessionFactory sessionFactory; + @PersistenceContext EntityManager entityManager; @Autowired public ProductOrderRepoService(EntityManagerFactory factory) { @@ -89,12 +125,25 @@ public class ProductOrderRepoService { } + @Transactional public List findAll() { // return (List) this.productOrderRepo.findAll(); // return (List) this.productOrderRepo.findByOrderByOrderDateDesc(); return (List) this.productOrderRepo.findAllOptimized(); } + + public Void deleteByUuid(String id) { + + Optional optso = this.productOrderRepo.findByUuid(id); + ProductOrder so = optso.get(); + if ( so == null ) { + return null; + } + + this.productOrderRepo.delete(so); + return null; +} public List findAllParams(Map allParams) { @@ -110,6 +159,7 @@ public class ProductOrderRepoService { public String findAllParamsJsonOrderIDs(Map allParams) throws JsonProcessingException { + List lso = findAllParams(allParams); ArrayList oids = new ArrayList<>(); for (ProductOrder object : lso) { @@ -123,6 +173,144 @@ public class ProductOrderRepoService { return res; } + + public String addProductOrderReturnEager(@Valid ProductOrderCreate pOrderCreate) { + try { + ProductOrder so = this.addProductOrder(pOrderCreate); + return this.getProductOrderEagerAsString( so.getUuid()); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (NotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; +} + + /** + * + * This findAll is optimized on fields. + * @param fields + * @param allParams + * @return + * @throws UnsupportedEncodingException + */ + @Transactional + public List findAll(@Valid String fields, Map allParams, @Valid Date starttime, @Valid Date endtime) + throws UnsupportedEncodingException { + + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + List alist = null; + try { + String sql = "SELECT " + + "por.uuid as uuid," + + "por.orderDate as orderDate," + + "por.requestedStartDate as requestedStartDate," + + "por.requestedCompletionDate as requestedCompletionDate," + + "por.expectedCompletionDate as expectedCompletionDate," + + "por.state as state," + + "por.type as type," + + "rp.uuid as relatedParty_uuid," + + "rp.name as relatedParty_name"; + + if (fields != null && fields.length()>0 ) { + String[] field = fields.split(","); + for (String f : field) { + sql += ", sor." + f + " as " + f ; + } + + } + sql += " FROM ProductOrder sor " + + "JOIN sor.relatedParty rp "; + + if (allParams.size() > 0) { + sql += " WHERE rp.role = 'REQUESTER' AND "; + for (String pname : allParams.keySet()) { + sql += " " + pname + " LIKE "; + String pval = URLDecoder.decode(allParams.get(pname), StandardCharsets.UTF_8.toString()); + sql += "'" + pval + "'"; + } + } else { + sql += " WHERE rp.role = 'REQUESTER' "; + } + + if ( starttime != null ) { + sql += " AND por.orderDate >= :param1"; + + } + if ( endtime != null ) { + sql += " AND por.expectedCompletionDate <= :param2"; + } + + sql += " ORDER BY por.orderDate DESC"; + + Query query = session.createQuery( sql ); + if ( starttime != null ) { + query.setParameter("param1", starttime.toInstant().atOffset(ZoneOffset.UTC) ); + } + if ( endtime != null ) { + query.setParameter("param2", endtime.toInstant().atOffset(ZoneOffset.UTC) ); + } + + List mapaEntity = query + .setResultTransformer( new ResultTransformer() { + + @Override + public Object transformTuple(Object[] tuple, String[] aliases) { + Map result = new LinkedHashMap(tuple.length); + for (int i = 0; i < tuple.length; i++) { + String alias = aliases[i]; + if (alias.equals("uuid")) { + result.put("id", tuple[i]); + } + if (alias.equals("type")) { + alias = "@type"; + } + if (alias.equals("relatedParty_name")) { + if ( result.get( "relatedParty" ) == null ) { + result.put("relatedParty", new ArrayList() ) ; + } + ArrayList< Object> rpList = (ArrayList< Object>) result.get( "relatedParty" ); + LinkedHashMap rp = new LinkedHashMap(); + rp.put("name", tuple[i]); + rp.put("role", "REQUESTER" ); + rpList.add(rp); + } + if (alias != null) { + result.put(alias, tuple[i]); + } + } + + return result; + } + + @Override + public List transformList(List collection) { + return collection; + } + } ) + .list(); + + + + + return mapaEntity; + + + + + } finally { + tx.commit(); + session.close(); + } + + } + + public List findAll(String rolename, UserPartRoleType requester) { + return (List) this.productOrderRepo.findByRolename(rolename); + } @Transactional @@ -201,8 +389,11 @@ public class ProductOrderRepoService { so.addNoteItem(noteItem); so = this.productOrderRepo.save(so); + } + + raisePOCreateNotification(so); return so; @@ -214,31 +405,73 @@ public class ProductOrderRepoService { logger.info("Will updateProductOrder:" + id); ProductOrder po = this.findByUuid(id); + boolean stateChanged = false; + if ( prodOrderUpd.getState()!= null ) { + stateChanged = po.getState() != prodOrderUpd.getState(); + } boolean expectedCompletionDateChanged = false; ProductOrderMapper mapper = Mappers.getMapper( ProductOrderMapper.class ); po = mapper.updateProductOrder(po, prodOrderUpd); - if ( prodOrderUpd.getState()!= null ) { - stateChanged = po.getState() != prodOrderUpd.getState(); - if ( po.getState().equals( ProductOrderStateType.COMPLETED )) { - po.setCompletionDate( OffsetDateTime.now(ZoneOffset.UTC)); - } + + + if ( prodOrderUpd.getState() != null ) { + po.state( prodOrderUpd.getState() ); + } + + if ( prodOrderUpd.getDescription() != null ) { + po.setDescription( prodOrderUpd.getDescription() ); } + + + if ( po.getState().equals( ProductOrderStateType.COMPLETED )) { + po.setCompletionDate( OffsetDateTime.now(ZoneOffset.UTC)); + } + + if ( prodOrderUpd.getExpectedCompletionDate()!= null ) { expectedCompletionDateChanged = true; } + if ( stateChanged ) { + Note noteItem = new Note(); + noteItem.setText("Product Order " + po.getState() ); + noteItem.setAuthor("PO622API-stateChanged"); + noteItem.setDate(OffsetDateTime.now(ZoneOffset.UTC) ); + po.addNoteItem(noteItem); + } + + // Update each Service's end date to the updated Service Order's expected completion date + if (expectedCompletionDateChanged) { + List services = serviceRepoService.getServicesFromOrderID(id); + + for (String serviceId : services) { + logger.debug("Will delegate updated Product Order expected completion date " + + po.getExpectedCompletionDate() + " to service with id = " + serviceId); + + @Valid + ServiceUpdate servUpd = new ServiceUpdate(); + servUpd.setEndDate(po.getExpectedCompletionDate()); + serviceRepoService.updateService(serviceId, servUpd, false, null, null); + } + } po = this.productOrderRepo.save(po); + if (stateChanged) { + raisePOStateChangedNotification(po); + } else { + raisePOAttributeValueChangedNotification(po); + } return po; } - - private ProductOrder findByUuid(String id) { + + @Transactional + public ProductOrder findByUuid(String id) { Optional optionalCat = this.productOrderRepo.findByUuid(id); return optionalCat.orElse(null); } @@ -247,10 +480,211 @@ public class ProductOrderRepoService { @Transactional private void raisePOCreateNotification(ProductOrder so) { + ProductOrderCreateNotification n = new ProductOrderCreateNotification(); + ProductOrderCreateEvent event = new ProductOrderCreateEvent(); + event.getEvent().productOrder( so ); + n.setEvent(event ); + productOrderApiRouteBuilder.publishEvent(n, so.getId()); } + + @Transactional + private void raisePOStateChangedNotification(ProductOrder so) { + ProductOrderStateChangeNotification n = new ProductOrderStateChangeNotification(); + ProductOrderStateChangeEvent event = new ProductOrderStateChangeEvent(); + //event.serviceOrder( getServiceORderEager( so.getId()) ); + event.getEvent().productOrder( so ); + n.setEvent(event ); + productOrderApiRouteBuilder.publishEvent(n, so.getId()); + + } + + @Transactional + private void raisePOAttributeValueChangedNotification(ProductOrder so) { + ProductOrderAttributeValueChangeNotification n = new ProductOrderAttributeValueChangeNotification(); + ProductOrderAttributeValueChangeEvent event = new ProductOrderAttributeValueChangeEvent(); + event.getEvent().productOrder( so ); + n.setEvent(event ); + productOrderApiRouteBuilder.publishEvent(n, so.getId()); + + } + + + public ProductOrder getProductOrderEager(String id) { + + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + + try { + ProductOrder s = null; + try { + s = (ProductOrder) session.get(ProductOrder.class, id); + if (s == null) { + return this.findByUuid(id);// last resort + } + Hibernate.initialize(s.getRelatedParty()); + Hibernate.initialize(s.getProductOrderItem() ); + Hibernate.initialize(s.getNote() ); + for (ProductOrderItem soi : s.getProductOrderItem()) { + Hibernate.initialize( soi.getProduct().getProductCharacteristic() ); + Hibernate.initialize( soi.getProductOffering() ); + } + + tx.commit(); + } finally { + session.close(); + } + + return s; + } catch (Exception e) { + // TODO: handle exception + } + + session.close(); + return null; + + +} + + public String getProductOrderEagerAsString(String id) throws JsonProcessingException { + ProductOrder s = this.getProductOrderEager(id); + ObjectMapper mapper = new ObjectMapper(); + mapper.registerModule(new Hibernate5JakartaModule()); + String res = mapper.writeValueAsString(s); + + return res; + } + + + public String getImageProductOrderItemRelationshipGraph(String id, @NotNull String itemid) { + ProductOrder so = this.findByUuid(id); + String charvalue = null; + if ( so!=null) { + for (ProductOrderItem soiOrigin : so.getProductOrderItem()) { + if ( soiOrigin.getId().equals(itemid)) { + charvalue = createItemRelationshipGraphNotation( soiOrigin ); + + } + + } + } + + return KrokiClient.encodedGraph( charvalue ); + } + + + private String createItemRelationshipGraphNotation(ProductOrderItem soiOrigin) { + String result = getPOItemGraphNotation(soiOrigin, 0 ); + result = "blockdiag {" + + "default_textcolor = white;\r\n" + + "default_fontsize = 12;\r\n" + + "\r\n" + result + "}"; + return result; + } + + + private String getPOItemGraphNotation(ProductOrderItem soiOrigin, int depth) { + String result = ""; + if (depth>10 || soiOrigin.getProduct()==null) { + return result; + } + for (ServiceRef specRel : soiOrigin.getProduct().getRealizingService() ) { + if ( !soiOrigin.getProduct().getName().equals( specRel.getName()) ) { + result += "\""+ soiOrigin.getProduct().getId() + "\""+ " -> " + "\""+ specRel.getId() +"\" "+";\r\n"; + result += "\""+ specRel.getId() + "\""+ " [label =\""+ specRel.getName() +"\", color = \"#2596be\"]; \r\n"; + org.etsi.osl.tmf.sim638.model.Service aService= serviceRepoService.findByUuid( specRel.getId() ); + if ( aService!= null) { + result += getServiceGraphNotation( aService,0 ); + } + } + + } + + + result += "\""+ soiOrigin.getProduct().getId() + "\""+ " [label = \""+ soiOrigin.getProduct().getName() +"\", color = \"#2596be\"]; \r\n"; + return result; + } + + + private String getServiceGraphNotation(org.etsi.osl.tmf.sim638.model.Service aService, int depth) { + String result = ""; + if (depth>10) { + return result; + } + for (ServiceRef specRel : aService.getSupportingService() ) { + result += "\""+ aService.getId() + "\""+ " -> " + "\""+ specRel.getId() +"\" "+";\r\n"; + result += "\""+ specRel.getId() + "\""+ " [label = \"" + specRel.getName() + "\", color = \"#2596be\"];\r\n"; + + for (ResourceRef resRel : aService.getSupportingResource()) { + + result += "\""+ aService.getId() + "\""+ " -> " + "\""+ resRel.getId() + "\""+ ";\r\n"; + result += "\""+ resRel.getId() + "\""+ " [ label = \"" + resRel.getName() +"\", shape = roundedbox, color = \"#e28743\"]; \r\n"; + + } + + } + + + return result; + } + + + public String getImageProductOrderNotesGraph(String id) { + + @Data + class ALane{ + public ALane(String author) { + this.name =author; + } + String name = ""; + List boxes = new ArrayList(); + } + + Map lanes = new HashMap<>(); + String charvalue = ""; + Optional optionalCat = this.productOrderRepo.findNotesOfProdOrder(id); + if ( optionalCat.isPresent() ) { + + ProductOrder so = optionalCat.get(); + List notes = so.getNote() + .stream() + .sorted( (a, b) -> a.getDate().compareTo(b.getDate()) ) + .collect(Collectors.toList()); + + for (Note anote : notes ) { + if ( charvalue.length() > 0 ) { + charvalue += " -> "; + } + charvalue += "\""+ anote.getUuid() + "\"" ; + + if ( lanes.get( anote.getAuthor()) == null) { + lanes.put( anote.getAuthor() , new ALane( anote.getAuthor() )); + } + + lanes.get( anote.getAuthor()).boxes.add( anote); + + } + + } + + for (String lane : lanes.keySet()) { + charvalue += "lane " + lanes.get(lane).name + " {\r\n"; + for ( Note aNote : lanes.get(lane).boxes) { + charvalue += aNote.getUuid() +" [label = \"" + aNote.getDateString() + "\r\n "+ aNote.getText() +"\", color = \"#2596be\"]\r\n"; + } + charvalue += "}\r\n"; + } + + charvalue = "actdiag {" + + "default_textcolor = white;\r\n" + + "default_fontsize = 9;\r\n" + + "\r\n" + charvalue + "}\r\n"; + return KrokiClient.encodedGraph( charvalue ); + + +} diff --git a/src/main/java/org/etsi/osl/tmf/so641/api/ServiceOrderApiController.java b/src/main/java/org/etsi/osl/tmf/so641/api/ServiceOrderApiController.java index 60b5182..a83e78c 100644 --- a/src/main/java/org/etsi/osl/tmf/so641/api/ServiceOrderApiController.java +++ b/src/main/java/org/etsi/osl/tmf/so641/api/ServiceOrderApiController.java @@ -152,7 +152,7 @@ public class ServiceOrderApiController implements ServiceOrderApi { } } - @PreAuthorize("hasAnyAuthority('ROLE_USER')" ) + @PreAuthorize("hasAnyAuthority('ROLE_ADMIN')" ) @Override public ResponseEntity deleteServiceOrder( Principal principal, diff --git a/src/main/java/org/etsi/osl/tmf/so641/reposervices/ServiceOrderRepoService.java b/src/main/java/org/etsi/osl/tmf/so641/reposervices/ServiceOrderRepoService.java index 06864b4..c761b52 100644 --- a/src/main/java/org/etsi/osl/tmf/so641/reposervices/ServiceOrderRepoService.java +++ b/src/main/java/org/etsi/osl/tmf/so641/reposervices/ServiceOrderRepoService.java @@ -44,6 +44,7 @@ import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic; import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristicValue; import org.etsi.osl.tmf.scm633.model.ServiceSpecification; import org.etsi.osl.tmf.scm633.reposervices.ServiceSpecificationRepoService; +import org.etsi.osl.tmf.sim638.model.ServiceUpdate; import org.etsi.osl.tmf.sim638.service.ServiceRepoService; import org.etsi.osl.tmf.so641.api.NotFoundException; import org.etsi.osl.tmf.so641.api.ServiceOrderApiRouteBuilderEvents; @@ -538,9 +539,7 @@ public class ServiceOrderRepoService { logger.debug( "(oi.getId() = "+oi.getId() ); } - if ( serviceOrderUpd.getState()!= null ) { - - + if ( serviceOrderUpd.getState()!= null ) { stateChanged = so.getState() != serviceOrderUpd.getState(); so.setState( serviceOrderUpd.getState() ); @@ -549,12 +548,6 @@ public class ServiceOrderRepoService { so.setCompletionDate( OffsetDateTime.now(ZoneOffset.UTC)); } - - - - - - } if ( serviceOrderUpd.getCategory()!= null ) { so.setCategory(serviceOrderUpd.getCategory()); @@ -654,9 +647,12 @@ public class ServiceOrderRepoService { for (String serviceId : services) { logger.debug("Will delegate updated SO expected completion date " + so.getExpectedCompletionDate() + " to service with id = " + serviceId); - - org.etsi.osl.tmf.sim638.model.Service service = serviceRepoService.findByUuid(serviceId); - service.setEndDate(so.getExpectedCompletionDate()); + + + @Valid + ServiceUpdate servUpd = new ServiceUpdate(); + servUpd.setEndDate(so.getExpectedCompletionDate()); + serviceRepoService.updateService(serviceId, servUpd, false, null, null); } } diff --git a/src/main/resources/application-testing.yml b/src/main/resources/application-testing.yml index b9e89cc..2efb62e 100644 --- a/src/main/resources/application-testing.yml +++ b/src/main/resources/application-testing.yml @@ -105,6 +105,13 @@ CATALOG_SERVICES_OF_PARTNERS: "jms:queue:CATALOG.GET.SERVICESOFPARTNERS" CATALOG_GET_EXTERNAL_SERVICE_PARTNERS: "jms:queue:CATALOG.GET.EXTERNALSERVICEPARTNERS" CATALOG_UPD_EXTERNAL_SERVICESPEC: "jms:queue:CATALOG.UPD.EXTERNAL_SERVICESPEC" +CATALOG_GET_PRODUCTORDERS: "jms:queue:CATALOG.GET.PRODUCTORDERS" +CATALOG_GET_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.GET.PRODUCTORDER_BY_ID" +CATALOG_ADD_PRODUCTORDER: "jms:queue:CATALOG.ADD.PRODUCTORDER" +CATALOG_UPD_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.UPD.PRODUCTORDER_BY_ID" +CATALOG_GET_INITIAL_PRODUCTORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_PRODUCTORDERS" +CATALOG_GET_PRODUCTORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_PRODUCTORDERS" + #ALARMS ALARMS_ADD_ALARM: "jms:queue:ALARMS.ADD.ALARM" ALARMS_UPDATE_ALARM: "jms:queue:ALARMS.UPDATE.ALARM" @@ -127,6 +134,11 @@ EVENT_ORGANIZATION_CREATE: "jms:topic:EVENT.ORGANIZATION.CREATE" EVENT_ORGANIZATION_CHANGED: "jms:topic:EVENT.ORGANIZATION.CHANGE" EVENT_ALARM_CREATE: "jms:topic:EVENT.ALARM.CREATE" +EVENT_PRODUCT_ORDER_CREATE: "jms:topic:EVENT.PRODUCTORDER.CREATE" +EVENT_PRODUCT_ORDER_STATE_CHANGED: "jms:topic:EVENT.PRODUCTORDER.STATECHANGED" +EVENT_PRODUCT_ORDER_DELETE: "jms:topic:EVENT.PRODUCTORDER.DELETE" +EVENT_PRODUCT_ORDER_ATTRIBUTE_VALUE_CHANGED: "jms:topic:EVENT.PRODUCTORDER.ATTRCHANGED" + #QUEUE MESSSAGES WITH VNFNSD CATALOG NFV_CATALOG_GET_NSD_BY_ID: "jms:queue:NFVCATALOG.GET.NSD_BY_ID" GET_USER_BY_USERNAME: "direct:get_user_byusername" diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index fb8fddc..4a71727 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -135,6 +135,14 @@ CATALOG_SERVICES_OF_PARTNERS: "jms:queue:CATALOG.GET.SERVICESOFPARTNERS" CATALOG_GET_EXTERNAL_SERVICE_PARTNERS: "jms:queue:CATALOG.GET.EXTERNALSERVICEPARTNERS" CATALOG_UPD_EXTERNAL_SERVICESPEC: "jms:queue:CATALOG.UPD.EXTERNAL_SERVICESPEC" +CATALOG_GET_PRODUCTORDERS: "jms:queue:CATALOG.GET.PRODUCTORDERS" +CATALOG_GET_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.GET.PRODUCTORDER_BY_ID" +CATALOG_ADD_PRODUCTORDER: "jms:queue:CATALOG.ADD.PRODUCTORDER" +CATALOG_UPD_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.UPD.PRODUCTORDER_BY_ID" +CATALOG_GET_INITIAL_PRODUCTORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_PRODUCTORDERS" +CATALOG_GET_PRODUCTORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_PRODUCTORDERS" + + #ALARMS ALARMS_ADD_ALARM: "jms:queue:ALARMS.ADD.ALARM" ALARMS_UPDATE_ALARM: "jms:queue:ALARMS.UPDATE.ALARM" @@ -157,6 +165,11 @@ EVENT_ORGANIZATION_CREATE: "jms:topic:EVENT.ORGANIZATION.CREATE" EVENT_ORGANIZATION_CHANGED: "jms:topic:EVENT.ORGANIZATION.CHANGE" EVENT_ALARM_CREATE: "jms:topic:EVENT.ALARM.CREATE" +EVENT_PRODUCT_ORDER_CREATE: "jms:topic:EVENT.PRODUCTORDER.CREATE" +EVENT_PRODUCT_ORDER_STATE_CHANGED: "jms:topic:EVENT.PRODUCTORDER.STATECHANGED" +EVENT_PRODUCT_ORDER_DELETE: "jms:topic:EVENT.PRODUCTORDER.DELETE" +EVENT_PRODUCT_ORDER_ATTRIBUTE_VALUE_CHANGED: "jms:topic:EVENT.PRODUCTORDER.ATTRCHANGED" + #QUEUE MESSSAGES WITH VNFNSD CATALOG NFV_CATALOG_GET_NSD_BY_ID: "jms:queue:NFVCATALOG.GET.NSD_BY_ID" diff --git a/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java b/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java index ac1b1db..f8ea9bf 100644 --- a/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java +++ b/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java @@ -8,6 +8,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStream; import java.time.OffsetDateTime; import java.time.ZoneOffset; @@ -15,6 +16,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.commons.io.IOUtils; import org.etsi.osl.tmf.JsonUtils; import org.etsi.osl.tmf.OpenAPISpringBoot; @@ -45,6 +47,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; @@ -55,311 +58,345 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.support.TransactionCallbackWithoutResult; +import org.springframework.transaction.support.TransactionTemplate; import org.springframework.web.context.WebApplicationContext; import jakarta.validation.Valid; @RunWith(SpringRunner.class) @Transactional -@SpringBootTest( - webEnvironment = SpringBootTest.WebEnvironment.MOCK, - classes = OpenAPISpringBoot.class -) -//@AutoConfigureTestDatabase //this automatically uses h2 +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, + classes = OpenAPISpringBoot.class) +@AutoConfigureTestDatabase //this automatically uses h2 @AutoConfigureMockMvc @ActiveProfiles("testing") public class ProductOrderRepoServiceTest { - @Autowired - private MockMvc mvc; + @Autowired + private MockMvc mvc; - @Autowired - ProductOrderRepoService productOrderRepoService; + @Autowired + ProductOrderRepoService productOrderRepoService; - @Autowired - ProductCatalogRepoService catalogRepoService; + @Autowired + ProductCatalogRepoService catalogRepoService; - @Autowired - ProductCategoryRepoService categRepoService; + @Autowired + ProductCategoryRepoService categRepoService; - @Autowired - ProductOfferingRepoService productOfferingRepoService; - + @Autowired + ProductOfferingRepoService productOfferingRepoService; - @Autowired - ProductOfferingPriceRepoService productOfferingPriceRepoService; + @Autowired + ProductOfferingPriceRepoService productOfferingPriceRepoService; - @Autowired - ProductSpecificationRepoService productSpecificationRepoService; - - @Autowired - private WebApplicationContext context; + @Autowired + ProductSpecificationRepoService productSpecificationRepoService; - @Before - public void setup() throws Exception { - mvc = MockMvcBuilders - .webAppContextSetup(context) - .apply(springSecurity()) - .build(); - } - + @Autowired + private WebApplicationContext context; + - @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) - @Test - public void testFindAllParams() throws Exception { - - String response = createProductOrder(); - - ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); - String soId = responsesProductOrder.getId(); - String state = responsesProductOrder.getState().toString(); - - // Test with not null params - Map params = new HashMap<>(); - params.put("state", state); - - List productOrderList = productOrderRepoService.findAllParams(params); - - boolean idExists = false; - for (ProductOrder po : productOrderList) { - if ( po.getId().equals( soId ) ) { - idExists= true; - } - } - assertThat( idExists ).isTrue(); - - // Test with null params - Map paramsEmpty = new HashMap<>(); - List productOrderListEmptyParams = productOrderRepoService.findAllParams(paramsEmpty); - - boolean idExistsEmptyParams = false; - for (ProductOrder so : productOrderListEmptyParams) { - if ( so.getId().equals( soId ) ) { - idExistsEmptyParams= true; - } - } - assertThat( idExistsEmptyParams ).isTrue(); - assertThat(productOrderListEmptyParams.size()).isEqualTo(productOrderRepoService.findAll().size()); - } + @Autowired + TransactionTemplate txTemplate; - @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) - @Test - public void testFindAllParamsJsonOrderIDs() throws Exception { + @Before + public void setup() throws Exception { + mvc = MockMvcBuilders.webAppContextSetup(context).apply(springSecurity()).build(); + } - String response = createProductOrder(); - String response2 = createProductOrder(); - ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); - String soId = responsesProductOrder.getId(); - ProductOrder responsesProductOrder2 = JsonUtils.toJsonObj(response2, ProductOrder.class); - String soId2 = responsesProductOrder2.getId(); + @WithMockUser(username = "osadmin", roles = {"ADMIN", "USER"}) + @Test + public void testFindAllParams() throws Exception { - String state = responsesProductOrder.getState().toString(); - Map params = new HashMap<>(); - params.put("state", state); + String response = createProductOrder(); - String soIds = productOrderRepoService.findAllParamsJsonOrderIDs(params); - assertThat(soIds).contains(soId); - assertThat(soIds).contains(soId2); - } + ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); + String soId = responsesProductOrder.getId(); + String state = responsesProductOrder.getState().toString(); + // Test with not null params + Map params = new HashMap<>(); + params.put("state", state); - @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) - @Test - public void testUpdateProductOrder() throws Exception { - - assertThat( productOrderRepoService.findAll().size() ).isEqualTo( 0 ); - String response = createProductOrder(); - ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); - String poId = responsesProductOrder.getId(); - - ProductOrderUpdate prodOrderUpd = new ProductOrderUpdate(); - prodOrderUpd.setExpectedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); - Note en = new Note(); - en.text("test note2"); - prodOrderUpd.addNoteItem(en); - prodOrderUpd.addProductOrderItemItem((new ArrayList<>(responsesProductOrder.getProductOrderItem())).get(0)); - prodOrderUpd.getProductOrderItem().get(0).setState(ProductOrderItemStateType.INPROGRESS); - prodOrderUpd.setState(ProductOrderStateType.COMPLETED); - prodOrderUpd.setCategory("New Test Category"); - prodOrderUpd.setDescription("New Test Description"); - prodOrderUpd.setRequestedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); - prodOrderUpd.setRequestedStartDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); - - ProductOrder responseSOUpd = productOrderRepoService.updateProductOrder(poId, prodOrderUpd); - assertThat(responseSOUpd.getState().toString()).isEqualTo("COMPLETED"); - assertThat(responseSOUpd.getDescription()).isEqualTo("New Test Description"); - assertThat(productOrderRepoService.findAll().size()).isEqualTo(1); - assertThat( responseSOUpd.getNote().size() ).isEqualTo(2); - assertThat( responseSOUpd.getRelatedParty().size() ).isEqualTo(1); - assertThat( responseSOUpd.getProductOrderItem().size() ).isEqualTo(1); - - prodOrderUpd = new ProductOrderUpdate(); - en = new Note(); - en.text("test note3"); - prodOrderUpd.addNoteItem(en); - prodOrderUpd.addRelatedPartyItem(new RelatedParty()); - responseSOUpd = productOrderRepoService.updateProductOrder(poId, prodOrderUpd); - assertThat(productOrderRepoService.findAll().size()).isEqualTo(1); - assertThat( responseSOUpd.getNote().size() ).isEqualTo(3); - assertThat( responseSOUpd.getRelatedParty().size() ).isEqualTo(2); - - + List productOrderList = productOrderRepoService.findAllParams(params); + + boolean idExists = false; + for (ProductOrder po : productOrderList) { + if (po.getId().equals(soId)) { + idExists = true; + } + } + assertThat(idExists).isTrue(); + + // Test with null params + Map paramsEmpty = new HashMap<>(); + List productOrderListEmptyParams = + productOrderRepoService.findAllParams(paramsEmpty); + + boolean idExistsEmptyParams = false; + for (ProductOrder so : productOrderListEmptyParams) { + if (so.getId().equals(soId)) { + idExistsEmptyParams = true; + } } + assertThat(idExistsEmptyParams).isTrue(); + assertThat(productOrderListEmptyParams.size()) + .isEqualTo(productOrderRepoService.findAll().size()); + } -// @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) -// @Test -// public void testGetProductOrderEagerAsString() throws Exception { -// -// String response = createProductOrder(); -// ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); -// String soId = responsesProductOrder.getId(); -// -// String eager = productOrderRepoService.getProductOrderEagerAsString(soId); -// ProductOrder eagerProductOrder = JsonUtils.toJsonObj(eager, ProductOrder.class); -// assertThat(eagerProductOrder.getDescription()).isEqualTo("A Test Service Order"); -// assertThat(eagerProductOrder.getCategory()).isEqualTo("Test Category"); -// assertThat(eagerProductOrder.getId()).isEqualTo(soId); -// } -// -// -//// // This test causes "HikariPool-1 - Connection is not available, request timed out after 30000ms" error for other tests -//// @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) -//// @Test -//// public void testAddProductOrderReturnEager() throws Exception { -//// -//// ProductOrderCreate productOrder = new ProductOrderCreate(); -//// productOrder.setCategory("Test Category"); -//// productOrder.setDescription("A Test Service Order"); -//// productOrder.setRequestedStartDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); -//// productOrder.setRequestedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); -//// -//// Note noteItem = new Note(); -//// noteItem.text("Test note"); -//// productOrder.addNoteItem(noteItem); -//// -//// ProductOrderItem soi = new ProductOrderItem(); -//// productOrder.getOrderItem().add(soi); -//// soi.setState(ProductOrderStateType.ACKNOWLEDGED); -//// -//// -//// String eager = productOrderRepoService.addProductOrderReturnEager(productOrder); -//// ProductOrder eagerProductOrder = JsonUtils.toJsonObj(eager, ProductOrder.class); -//// assertThat(eagerProductOrder.getDescription()).isEqualTo("A Test Service Order"); -//// assertThat(eagerProductOrder.getCategory()).isEqualTo("Test Category"); -//// } -// -// -// @WithMockUser(username="osadmin", roles = {"ADMIN","USER"}) -// @Test -// public void testGetImageProductOrderItemRelationshipGraph() throws Exception { -// -// String response = createProductOrder(); -// ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); -// String soId = responsesProductOrder.getId(); -// Set productOrderItemSet = responsesProductOrder.getOrderItem(); -// -// for (ProductOrderItem soi: productOrderItemSet) { -// String responseGraph = productOrderRepoService.getImageProductOrderItemRelationshipGraph(soId, soi.getId()); -// assertThat( responseGraph ).isNotNull(); -// } -// } - - - private String createProductOrder() throws Exception { - - int currSize = productOrderRepoService.findAll().size(); - - File sspec = new File("src/test/resources/testProductSpec.json"); - InputStream in = new FileInputStream(sspec); - String sspectext = IOUtils.toString(in, "UTF-8"); - - ProductSpecificationCreate psc = JsonUtils.toJsonObj(sspectext, ProductSpecificationCreate.class); - psc.setVersion("1.1"); - ProductSpecification responseProdSpec = createProductSpec(psc); - - - assertThat( productSpecificationRepoService.findAll().size() ).isEqualTo( currSize + 1 ); - - + @WithMockUser(username = "osadmin", roles = {"ADMIN", "USER"}) + @Test + public void testFindAllParamsJsonOrderIDs() throws Exception { + String response = createProductOrder(); + String response2 = createProductOrder(); - ProductSpecificationRef prodSpecRef = new ProductSpecificationRef(); - prodSpecRef.setId(responseProdSpec.getId()); - @Valid - ProductOfferingCreate pefCre = new ProductOfferingCreate(); - pefCre.productSpecification(prodSpecRef); - - - ProductOffering pOffer = productOfferingRepoService.addProductOffering(pefCre); - - ProductOfferingRef prodOffRef = new ProductOfferingRef(); - prodOffRef.setId( pOffer.getId()); - + ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); + String soId = responsesProductOrder.getId(); + + ProductOrder responsesProductOrder2 = JsonUtils.toJsonObj(response2, ProductOrder.class); + String soId2 = responsesProductOrder2.getId(); + + String state = responsesProductOrder.getState().toString(); + Map params = new HashMap<>(); + params.put("state", state); + + String soIds = productOrderRepoService.findAllParamsJsonOrderIDs(params); + assertThat(soIds).contains(soId); + assertThat(soIds).contains(soId2); + } + + + @WithMockUser(username = "osadmin", roles = {"ADMIN", "USER"}) + @Test + public void testUpdateProductOrder() throws Exception { + + + assertThat(productOrderRepoService.findAll().size()).isEqualTo(0); + String response = txTemplate.execute(status -> { + try { + return createProductOrder(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + }); + + + ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); + String poId = responsesProductOrder.getId(); + assertThat(productOrderRepoService.findAll().size()).isEqualTo(1); + + + + ProductOrder responseSOUpd = txTemplate.execute(status -> { + + ProductOrderUpdate prodOrderUpd = new ProductOrderUpdate(); + prodOrderUpd.setExpectedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + Note en = new Note(); + en.text("test note2"); + prodOrderUpd.addNoteItem(en); + + //ProductOrderItem its = responsesProductOrder.getProductOrderItem().stream().findFirst().get(); + ProductOrderItem its = new ProductOrderItem(); + prodOrderUpd.addProductOrderItemItem( its ); + + prodOrderUpd.getProductOrderItem().get(0).setState(ProductOrderItemStateType.INPROGRESS); + prodOrderUpd.setState(ProductOrderStateType.COMPLETED); + prodOrderUpd.setCategory("New Test Category"); + prodOrderUpd.setDescription("New Test Description"); + prodOrderUpd.setRequestedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + prodOrderUpd.setRequestedStartDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + //return productOrderRepoService.updateProductOrder(poId, prodOrderUpd); + + byte[] req; + try { + req = JsonUtils.toJson(prodOrderUpd); + String responseP = mvc + .perform(MockMvcRequestBuilders.patch("/productOrderingManagement/v4/productOrder/" + poId) + .with(SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON).content(req)) + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); + + System.out.println(" ====================> " + responseP); + ProductOrder responsePO = JsonUtils.toJsonObj( responseP, ProductOrder.class); + return responsePO; - ProductOrderCreate productOrder = new ProductOrderCreate(); - productOrder.setCategory("Test Category"); - productOrder.setDescription("A Test Product Order"); - productOrder.setRequestedStartDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); - productOrder.setRequestedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + + return null; + + + + }); + + int i = txTemplate.execute(status -> { + return productOrderRepoService.findAll().size(); + }); + + + assertThat(responseSOUpd.getState().toString()).isEqualTo("COMPLETED"); + assertThat(responseSOUpd.getDescription()).isEqualTo("New Test Description"); + + assertThat(productOrderRepoService.findAll().size()).isEqualTo(1); + + assertThat(responseSOUpd.getNote().size()).isEqualTo(3); + assertThat(responseSOUpd.getRelatedParty().size()).isEqualTo(1); + assertThat(responseSOUpd.getProductOrderItem().size()).isEqualTo(2); - - - - ProductOrderItem poi = new ProductOrderItem(); - poi - .action(OrderItemActionType.ADD) - .productOffering(prodOffRef); - - productOrder.getProductOrderItem().add(poi); - - - byte[] req = JsonUtils.toJson(productOrder); - String response = mvc - .perform(MockMvcRequestBuilders.post("/productOrderingManagement/v4/productOrder") - .with( SecurityMockMvcRequestPostProcessors.csrf()) - .contentType(MediaType.APPLICATION_JSON).content( req )) - .andExpect(status().isOk()) - .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andReturn() - .getResponse() - .getContentAsString(); + ProductOrderUpdate prodOrderUpd = new ProductOrderUpdate(); + Note en = new Note(); + en.text("test note3"); + prodOrderUpd.addNoteItem(en); + prodOrderUpd.addRelatedPartyItem(new RelatedParty()); + responseSOUpd = productOrderRepoService.updateProductOrder(poId, prodOrderUpd); + assertThat(productOrderRepoService.findAll().size()).isEqualTo(1); + assertThat(responseSOUpd.getNote().size()).isEqualTo(4); + assertThat(responseSOUpd.getRelatedParty().size()).isEqualTo(2); - - System.out.println(" ====================> " + response); - ProductOrder responsePO = JsonUtils.toJsonObj(response, ProductOrder.class); - assertThat( productOrderRepoService.findAll().size() ).isEqualTo( currSize + 1 ); - assertThat(responsePO.getId()).isNotNull(); - assertThat(responsePO.getCategory()).isEqualTo("Test Category"); - assertThat(responsePO.getDescription()).isEqualTo("A Test Product Order"); - assertThat( responsePO.getRelatedParty().size() ).isEqualTo(1); + } - assertThat( responsePO.getRelatedParty().stream().findFirst().get().getName() ).isEqualTo("osadmin"); - return response; + @WithMockUser(username = "osadmin", roles = {"ADMIN", "USER"}) + @Test + public void testGetProductOrderEagerAsString() throws Exception { - } + String response = createProductOrder(); + ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); + String soId = responsesProductOrder.getId(); + String eager = productOrderRepoService.getProductOrderEagerAsString(soId); + ProductOrder eagerProductOrder = JsonUtils.toJsonObj(eager, ProductOrder.class); + assertThat(eagerProductOrder.getDescription()).isEqualTo("A Test Product Order"); + assertThat(eagerProductOrder.getCategory()).isEqualTo("Test Category"); + assertThat(eagerProductOrder.getId()).isEqualTo(soId); + } - private ProductSpecification createProductSpec( ProductSpecificationCreate prodSpecificationCreate) throws Exception { - String response = mvc.perform(MockMvcRequestBuilders.post("/productCatalogManagement/v4/productSpecification") - .with( SecurityMockMvcRequestPostProcessors.csrf()) - .contentType(MediaType.APPLICATION_JSON).content(JsonUtils.toJson(prodSpecificationCreate))) - .andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); - ProductSpecification responsesSpec = JsonUtils.toJsonObj(response, ProductSpecification.class); - return responsesSpec; + @WithMockUser(username = "osadmin", roles = {"ADMIN", "USER"}) + @Test + public void testGetImageProductOrderItemRelationshipGraph() throws Exception { + + String response = createProductOrder(); + ProductOrder responsesProductOrder = JsonUtils.toJsonObj(response, ProductOrder.class); + String soId = responsesProductOrder.getId(); + Set productOrderItemSet = responsesProductOrder.getProductOrderItem(); + + for (ProductOrderItem soi : productOrderItemSet) { + String responseGraph = + productOrderRepoService.getImageProductOrderItemRelationshipGraph(soId, soi.getId()); + assertThat(responseGraph).isNotNull(); } + } + + + private String createProductOrder() throws Exception { + + int currSize = productOrderRepoService.findAll().size(); + + File sspec = new File("src/test/resources/testProductSpec.json"); + InputStream in = new FileInputStream(sspec); + String sspectext = IOUtils.toString(in, "UTF-8"); + + ProductSpecificationCreate psc = + JsonUtils.toJsonObj(sspectext, ProductSpecificationCreate.class); + psc.setVersion("1.1"); + ProductSpecification responseProdSpec = createProductSpec(psc); + + + assertThat(productSpecificationRepoService.findAll().size()).isEqualTo(currSize + 1); + + + + ProductSpecificationRef prodSpecRef = new ProductSpecificationRef(); + prodSpecRef.setId(responseProdSpec.getId()); + @Valid + ProductOfferingCreate pefCre = new ProductOfferingCreate(); + pefCre.productSpecification(prodSpecRef); + + + ProductOffering pOffer = productOfferingRepoService.addProductOffering(pefCre); + + ProductOfferingRef prodOffRef = new ProductOfferingRef(); + prodOffRef.setId(pOffer.getId()); + + + + ProductOrderCreate productOrder = new ProductOrderCreate(); + productOrder.setCategory("Test Category"); + productOrder.setDescription("A Test Product Order"); + productOrder.setRequestedStartDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + productOrder.setRequestedCompletionDate(OffsetDateTime.now(ZoneOffset.UTC).toString()); + + + + ProductOrderItem poi = new ProductOrderItem(); + poi.action(OrderItemActionType.ADD).productOffering(prodOffRef); + + productOrder.getProductOrderItem().add(poi); + + + byte[] req = JsonUtils.toJson(productOrder); + String response = mvc + .perform(MockMvcRequestBuilders.post("/productOrderingManagement/v4/productOrder") + .with(SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON).content(req)) + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); + + + System.out.println(" ====================> " + response); + ProductOrder responsePO = JsonUtils.toJsonObj(response, ProductOrder.class); + + assertThat(productOrderRepoService.findAll().size()).isEqualTo(currSize + 1); + assertThat(responsePO.getId()).isNotNull(); + assertThat(responsePO.getCategory()).isEqualTo("Test Category"); + assertThat(responsePO.getDescription()).isEqualTo("A Test Product Order"); + assertThat(responsePO.getRelatedParty().size()).isEqualTo(1); + + assertThat(responsePO.getRelatedParty().stream().findFirst().get().getName()) + .isEqualTo("osadmin"); + + return response; + + } + + + private ProductSpecification createProductSpec(ProductSpecificationCreate prodSpecificationCreate) + throws Exception { + + String response = mvc + .perform(MockMvcRequestBuilders.post("/productCatalogManagement/v4/productSpecification") + .with(SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON) + .content(JsonUtils.toJson(prodSpecificationCreate))) + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); + ProductSpecification responsesSpec = JsonUtils.toJsonObj(response, ProductSpecification.class); + + return responsesSpec; + } } diff --git a/src/test/resources/productorder.json b/src/test/resources/productorder.json new file mode 100644 index 0000000..c4d24ce --- /dev/null +++ b/src/test/resources/productorder.json @@ -0,0 +1,235 @@ +{ +"category": "B2C product order", +"description": "Product Order illustration sample", +"externalId": "PO-456", +"priority": "1", +"requestedCompletionDate": "2019-05-02T08:13:59.506Z", +"requestedStartDate": "2019-05-03T08:13:59.506Z", +"channel": [ +{ +"id": "1", +"role": "Used channel for order capture", +"name": "Online chanel" +} +], +"note": [ +{ +"id": "1", +"author": "Jean Pontus", +"date": "2019-04-30T08:13:59.509Z", +"text": "This is a TMF product order illustration" +} +], +"productOrderItem": [ +{ +"id": "100", +"quantity": 1, +"action": "add", +"productOffering": { +"id": "14277", +"href": "https://host:port/productCatalogManagement/v4/productOffering/14277", +"name": "TMF25" +}, +"productOrderItemRelationship": [ +{ +"id": "110", +"relationshipType": "bundles" +}, +{ +"id": "120", +"relationshipType": "bundles" +}, +{ +"id": "130", +"relationshipType": "bundles" +} +], +"@type": "ProductOrderItem" +}, +{ +"id": "110", +"quantity": 1, +"action": "add", +"itemPrice": [ +{ +"description": "Access Fee", +"name": "Access Fee", +"priceType": "nonRecurring", +"price": { +"taxRate": 0, +"dutyFreeAmount": { +"unit": "EUR", +"value": 0.99 +}, +"taxIncludedAmount": { +"unit": "EUT", +"value": 0.99 +} +} +} +], +"payment": [ +{ +"id": "2365", +"href": "https://host:port/paymentManagement/v4/cashPayment/2365", +"name": "Cash payment for access fee", +"@type": "CashPayment", +"@referredType": "Payment" +} +], +"product": { +"isBundle": false, +"@type": "Product", +"productCharacteristic": [ +{ +"name": "TEL_MSISDN", +"valueType": "string", +"value": "415 279 7439" +} +], +"productSpecification": { +"id": "14307", +"href": "https://host:port/productCatalogManagement/v4/productSpecification/14307", +"name": "Mobile Telephony", +"version": "1", +"@type": "ProductSpecificationRef" +} +}, +"productOffering": { +"id": "14305", +"href": "https://host:port/productCatalogManagement/v4/productOffering/14305", +"name": "TMF Mobile Telephony" +}, +"@type": "ProductOrderItem" +}, +{ +"id": "120", +"quantity": 1, +"action": "add", +"billingAccount": { +"id": "1513", +"href": "https://host:port/billingAccountManagement/v4/billingAccount/1513", +"@type": "BillingAccount" +}, +"itemPrice": [ +{ +"description": "Tariff plan monthly fee", +"name": "MonthlyFee", +"priceType": "recurring", +"recurringChargePeriod": "month", +"price": { +"taxRate": 0, +"dutyFreeAmount": { +"unit": "EUR", +"value": 20 +}, +"taxIncludedAmount": { +"unit": "EUR", +"value": 20 +} +}, +"priceAlteration": [ +{ +"applicationDuration": 3, +"description": "20% for first 3 months", +"name": "WelcomeDiscount", +"priceType": "recurring", +"priority": 1, +"recurringChargePeriod": "month", +"price": { +"percentage": 20, +"taxRate": 0, +"@type": "price" +} +} +] +} +], +"itemTerm": [ +{ +"description": "Tariff plan 12 Months commitment", +"name": "12Months", +"duration": { +"amount": 12, +"units": "month" +} +} +], +"product": { +"isBundle": false, +"@type": "Product", +"productSpecification": { +"id": "14395", +"href": "https://host:port/productCatalogManagement/v4/productSpecification/14395", +"name": "TMF Tariff plan", +"version": "1", +"@type": "ProductSpecificationRef" +} +}, +"productOffering": { +"id": "14344", +"href": "https://host:port/productCatalogManagement/v4/productOffering/14344" +}, +"productOrderItemRelationship": [ +{ +"id": "110", +"relationshipType": "reliesOn" +} +], +"@type": "ProductOrderItem" +}, +{ +"id": "130", +"quantity": 1, +"action": "add", +"product": { +"isBundle": false, +"@type": "Product", +"productCharacteristic": [ +{ +"name": "CoverageOptions", +"valueType": "string", +"value": "National" +} +], +"productSpecification": { +"id": "14353", +"href": "https://host:port/productCatalogManagement/v4/productSpecification/14353", +"name": "Coverage", +"version": "1", +"@type": "ProductSpecificationRef" +} +}, +"productOffering": { +"id": "14354", +"href": "https://host:port/productCatalogManagement/v4/productOffering/14354", +"name": "Coverage Options" +}, +"productOrderItemRelationship": [ +{ +"id": "110", +"relationshipType": "reliesOn" +} +], +"@type": "ProductOrderItem" +} +], +"relatedParty": [ +{ +"id": "456-dd-df45", +"href": "https://host:port/partyManagement/v4/individual/456-dd-df45", +"name": "Joe Doe", +"role": "Seller", +"@type": "RelatedParty", +"@referredType": "Individual" +}, +{ +"id": "ff55-hjy4", +"href": "https://host:port/partyRoleManagement/v4/customer/ff55-hjy4", +"name": "Jean Pontus", +"@type": "RelatedParty", +"@referredType": "Customer" +} +], +"@type": "ProductOrder" +} \ No newline at end of file -- GitLab From a7917289e4ba863355e9658ce11ed710b6e8b83c Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Fri, 9 Aug 2024 20:14:33 +0300 Subject: [PATCH 3/8] adding api to create prod offer from spec --- .../tmf/pcm620/api/ProductOfferingApi.java | 20 ++++ .../api/ProductOfferingApiController.java | 16 ++++ .../ProductOfferingRepoService.java | 91 ++++++++++++++++++- .../ProductSpecificationRepoService.java | 75 ++++++++++++++- .../po622/ProductOrderRepoServiceTest.java | 53 +++++++++++ src/test/resources/testServiceSpec2.json | 29 ++++++ 6 files changed, 279 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductOfferingApi.java b/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductOfferingApi.java index 3b0eacf..181bde0 100644 --- a/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductOfferingApi.java +++ b/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductOfferingApi.java @@ -223,5 +223,25 @@ public interface ProductOfferingApi { } return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } + + @Operation(summary = "Creates and Retrieves a ProductOffering by ID", operationId = "retrieveProductOffering", description = "This operation retrieves a ProductOffering entity. Attribute selection is enabled for all first level attributes." , tags = { + "productOffering", }) + @ApiResponses(value = { @ApiResponse(responseCode ="200", description = "Success" ), + @ApiResponse(responseCode = "400", description = "Bad Request" ), + @ApiResponse(responseCode = "401", description = "Unauthorized" ), + @ApiResponse(responseCode = "403", description = "Forbidden" ), + @ApiResponse(responseCode = "404", description = "Not Found" ), + @ApiResponse(responseCode = "405", description = "Method Not allowed" ), + @ApiResponse(responseCode = "409", description = "Conflict" ), + @ApiResponse(responseCode = "500", description = "Internal Server Error" ) }) + @RequestMapping(value = "/productOffering/fromServiceSpecId/{id}", produces = { + "application/json;charset=utf-8" }, method = RequestMethod.POST) + default ResponseEntity createRetrieveProductOfferingBasedOnServiceSpec( + @Parameter(description = "Identifier of the ProductOffering", required = true) @PathVariable("id") String id) { + + + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + } + } diff --git a/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductOfferingApiController.java b/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductOfferingApiController.java index c22b53e..b131825 100644 --- a/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductOfferingApiController.java +++ b/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductOfferingApiController.java @@ -166,6 +166,22 @@ public class ProductOfferingApiController implements ProductOfferingApi { return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); } } + + @Override + @PreAuthorize("hasAnyAuthority('ROLE_ADMIN')" ) + public ResponseEntity createRetrieveProductOfferingBasedOnServiceSpec( + String id) { + try { + + + return new ResponseEntity(productOfferingRepoService.createRetrieveProductOfferingBasedOnServiceSpec(id), + HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); + } + + } } diff --git a/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductOfferingRepoService.java b/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductOfferingRepoService.java index b53dd5b..422d8f2 100644 --- a/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductOfferingRepoService.java +++ b/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductOfferingRepoService.java @@ -26,21 +26,34 @@ import java.time.OffsetDateTime; import java.time.ZoneOffset; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import org.etsi.osl.tmf.JsonUtils; import org.etsi.osl.tmf.am651.model.AgreementRef; +import org.etsi.osl.tmf.common.model.Any; import org.etsi.osl.tmf.common.model.AttachmentRefOrValue; import org.etsi.osl.tmf.common.model.ELifecycle; import org.etsi.osl.tmf.common.model.TimePeriod; +import org.etsi.osl.tmf.common.model.service.ServiceSpecificationRef; import org.etsi.osl.tmf.pcm620.model.BundledProductOffering; import org.etsi.osl.tmf.pcm620.model.ProductOffering; import org.etsi.osl.tmf.pcm620.model.ProductOfferingCreate; import org.etsi.osl.tmf.pcm620.model.ProductOfferingPriceRef; import org.etsi.osl.tmf.pcm620.model.ProductOfferingUpdate; +import org.etsi.osl.tmf.pcm620.model.ProductSpecification; +import org.etsi.osl.tmf.pcm620.model.ProductSpecificationCharacteristic; +import org.etsi.osl.tmf.pcm620.model.ProductSpecificationCharacteristicValue; import org.etsi.osl.tmf.pcm620.model.ProductSpecificationCharacteristicValueUse; +import org.etsi.osl.tmf.pcm620.model.ProductSpecificationCreate; +import org.etsi.osl.tmf.pcm620.model.ProductSpecificationRef; import org.etsi.osl.tmf.pcm620.repo.ProductOfferingRepository; +import org.etsi.osl.tmf.pcm620.repo.ProductSpecificationRepository; +import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristicValue; +import org.etsi.osl.tmf.scm633.model.ServiceSpecification; +import org.etsi.osl.tmf.scm633.reposervices.ServiceSpecificationRepoService; import org.hibernate.Hibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; @@ -58,8 +71,12 @@ public class ProductOfferingRepoService { @Autowired ProductOfferingRepository prodsOfferingRepo; - - + + @Autowired + ProductSpecificationRepoService prodSpecRepoService; + + @Autowired + ServiceSpecificationRepoService serviceSpecificationRepoService; private SessionFactory sessionFactory; @@ -320,6 +337,7 @@ public class ProductOfferingRepoService { if ( prodOfferingUpd.getProductSpecification() != null ) { prodOffering.setProductSpecification( prodOfferingUpd.getProductSpecification() ); + prodOffering = copyCharacteristicsFromProdSpec( prodOffering, prodOfferingUpd.getProductSpecification() ); } @@ -542,5 +560,74 @@ public class ProductOfferingRepoService { return prodOffering; } + + private ProductOffering copyCharacteristicsFromProdSpec(ProductOffering prodOffering, + @Valid ProductSpecificationRef productSpecRef) { + + ProductSpecification prodSpec = prodSpecRepoService.findByUuid( productSpecRef.getId() ); + + if (prodSpec!= null ) { + for (ProductSpecificationCharacteristic prodSpecChar : prodSpec.getProductSpecCharacteristic()) { + if ( prodOffering.findCharacteristicByName( prodSpecChar.getName() ) == null ) { + ProductSpecificationCharacteristicValueUse pcitem = new ProductSpecificationCharacteristicValueUse(); + pcitem.name( prodSpecChar.getName() ); + pcitem.setDescription(prodSpecChar.getDescription()); + pcitem + .maxCardinality(prodSpecChar.getMaxCardinality()) + .minCardinality(prodSpecChar.getMinCardinality()) + .valueType(prodSpecChar.getValueType()); + + for (ProductSpecificationCharacteristicValue r : prodSpecChar.getProductSpecCharacteristicValue()) { + ProductSpecificationCharacteristicValue pcval = new ProductSpecificationCharacteristicValue(); + pcval.isDefault(r.isIsDefault()) + .rangeInterval(r.getRangeInterval()) + .regex(r.getRegex()) + .unitOfMeasure(r.getUnitOfMeasure()) + .valueFrom(r.getValueFrom()+"") + .valueTo(r.getValueTo()+"") + .valueType(r.getValueType()) + .value( new Any( r.getValue() ) ); + pcitem.addProductSpecCharacteristicValueItem( pcval ); + + } + + + prodOffering.addProdSpecCharValueUseItem(pcitem ); + } + } + } + + return prodOffering; + } + + public ProductOffering createRetrieveProductOfferingBasedOnServiceSpec(String id) { + + ServiceSpecification serviceSpec = serviceSpecificationRepoService.findByUuid(id); + ProductSpecificationCreate psc = new ProductSpecificationCreate(); + psc.setName(serviceSpec.getName()); + psc.setDescription(serviceSpec.getDescription()); + + ProductSpecification responseProdSpec = prodSpecRepoService.addProductSpecification(psc); + + responseProdSpec = prodSpecRepoService.addServiceSpecToProductSpec( responseProdSpec, serviceSpec ); + + ProductOffering pOffer = this.prodOfferingFromPrdSpec( responseProdSpec ); + + return pOffer; + } + + private ProductOffering prodOfferingFromPrdSpec(ProductSpecification responseProdSpec) { + ProductSpecificationRef prodSpecRef = new ProductSpecificationRef(); + prodSpecRef.setId(responseProdSpec.getId()); + prodSpecRef.setName(responseProdSpec.getName()); + + ProductOfferingCreate pefCre = new ProductOfferingCreate(); + pefCre.setName( responseProdSpec.getName()); + pefCre.productSpecification(prodSpecRef); + + ProductOffering pOffer = this.addProductOffering(pefCre); + + return pOffer; + } } diff --git a/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductSpecificationRepoService.java b/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductSpecificationRepoService.java index 2994b2a..b7bb5ee 100644 --- a/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductSpecificationRepoService.java +++ b/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductSpecificationRepoService.java @@ -30,6 +30,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import org.etsi.osl.tmf.common.model.Any; import org.etsi.osl.tmf.common.model.AttachmentRefOrValue; import org.etsi.osl.tmf.common.model.ELifecycle; import org.etsi.osl.tmf.common.model.TimePeriod; @@ -37,12 +38,17 @@ import org.etsi.osl.tmf.common.model.service.ServiceSpecificationRef; import org.etsi.osl.tmf.pcm620.model.BundledProductSpecification; import org.etsi.osl.tmf.pcm620.model.ProductSpecification; import org.etsi.osl.tmf.pcm620.model.ProductSpecificationCharacteristic; +import org.etsi.osl.tmf.pcm620.model.ProductSpecificationCharacteristicValue; import org.etsi.osl.tmf.pcm620.model.ProductSpecificationCreate; import org.etsi.osl.tmf.pcm620.model.ProductSpecificationRelationship; import org.etsi.osl.tmf.pcm620.model.ProductSpecificationUpdate; import org.etsi.osl.tmf.pcm620.repo.ProductSpecificationRepository; import org.etsi.osl.tmf.prm669.model.RelatedParty; import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; +import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristic; +import org.etsi.osl.tmf.scm633.model.ServiceSpecCharacteristicValue; +import org.etsi.osl.tmf.scm633.model.ServiceSpecification; +import org.etsi.osl.tmf.scm633.reposervices.ServiceSpecificationRepoService; import org.hibernate.Hibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; @@ -61,7 +67,9 @@ public class ProductSpecificationRepoService { @Autowired ProductSpecificationRepository prodsOfferingRepo; - + + @Autowired + ServiceSpecificationRepoService serviceSpecificationRepoService; private SessionFactory sessionFactory; @@ -428,7 +436,7 @@ public class ProductSpecificationRepoService { } - + /** * Update ProductSpecificationRelationship list @@ -548,7 +556,7 @@ public class ProductSpecificationRepoService { } /** - * Update ResourceSpecificationRef list + * Update ServiceSpecificationRef list */ if (prodSpecUpd.getServiceSpecification() != null) { @@ -569,6 +577,7 @@ public class ProductSpecificationRepoService { if (!idexists) { prodSpec.getServiceSpecification().add(ar); + prodSpec = copyConfigurableCharacteristics( prodSpec, ar ); idAddedUpdated.put(ar.getUuid(), true); } } @@ -597,5 +606,65 @@ public class ProductSpecificationRepoService { return prodSpec; } + + private ProductSpecification copyConfigurableCharacteristics(ProductSpecification prodSpec, + ServiceSpecificationRef ar) { + + ServiceSpecification sourceSpec = serviceSpecificationRepoService.findByUuid(ar.getId()); + + if ( sourceSpec != null ) { + for (ServiceSpecCharacteristic ssc : sourceSpec.getServiceSpecCharacteristic()) { + if (ssc.isConfigurable()!= null && ssc.isConfigurable()) { + if ( prodSpec.findProdCharacteristicByName( ssc.getName() ) == null ) { + + ProductSpecificationCharacteristic cnew = new ProductSpecificationCharacteristic(); + cnew.setName( cnew.getName() ); + cnew.setDescription( cnew.getDescription()); + cnew.isUnique(cnew.isIsUnique()) + .extensible(cnew.isExtensible()) + .maxCardinality(cnew.getMaxCardinality()) + .minCardinality(cnew.getMinCardinality()) + .valueType(cnew.getValueType()); + for (ServiceSpecCharacteristicValue r : ssc.getServiceSpecCharacteristicValue()) { + ProductSpecificationCharacteristicValue pcval = new ProductSpecificationCharacteristicValue(); + pcval.isDefault(r.isIsDefault()) + .rangeInterval(r.getRangeInterval()) + .regex(r.getRegex()) + .unitOfMeasure(r.getUnitOfMeasure()) + .valueFrom(r.getValueFrom()+"") + .valueTo(r.getValueTo()+"") + .valueType(r.getValueType()) + .value( new Any( r.getValue() ) ); + + cnew.addProductSpecCharacteristicValueItem( pcval ); + } + + prodSpec.getProductSpecCharacteristic().add( cnew ); + + } + } + } + } + + return prodSpec; + } + + public ProductSpecification addServiceSpecToProductSpec(ProductSpecification responseProdSpec, ServiceSpecification serviceSpec) { + + ServiceSpecificationRef serviceSpecRef = new ServiceSpecificationRef(); + serviceSpecRef.setId( serviceSpec.getId() ); + serviceSpecRef.setName( serviceSpec.getName()); + serviceSpecRef.setVersion(serviceSpec.getVersion()); + serviceSpecRef.setReferredType(serviceSpec.getType()); + + ProductSpecificationUpdate pSpecUpd = new ProductSpecificationUpdate(); + pSpecUpd.addServiceSpecificationItem(serviceSpecRef); + if (responseProdSpec.getServiceSpecification()!=null) { + pSpecUpd.getServiceSpecification().addAll( responseProdSpec.getServiceSpecification() ); + } + responseProdSpec = updateProductSpecificationDataFromAPIcall(responseProdSpec, pSpecUpd); + + return responseProdSpec; + } } diff --git a/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java b/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java index f8ea9bf..f196c06 100644 --- a/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java +++ b/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java @@ -309,6 +309,36 @@ public class ProductOrderRepoServiceTest { assertThat(responseGraph).isNotNull(); } } + + + @WithMockUser(username = "osadmin", roles = {"ADMIN", "USER"}) + @Test + public void testCreateProductOfferingFromServiceSpec() throws Exception { + ServiceSpecification serviceSpec = createServiceSpecification(); + + String response = mvc + .perform(MockMvcRequestBuilders.post("/productCatalogManagement/v4/productOffering/fromServiceSpecId/" + serviceSpec.getId()) + .with(SecurityMockMvcRequestPostProcessors.csrf())) + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); + + ProductOffering respOff = JsonUtils.toJsonObj(response, ProductOffering.class); + + assertThat(respOff).isNotNull(); + assertThat( respOff.getName() ).isEqualTo( "Test Spec2" ); + assertThat( respOff.getProductSpecification() ).isNotNull(); + assertThat( respOff.getProductSpecification().getName() ).isEqualTo( "Test Spec2" ); + + ProductSpecification prodSpec = productSpecificationRepoService.findByUuid( respOff.getProductSpecification().getId() ); + assertThat( prodSpec.getName() ).isEqualTo( "Test Spec2" ); + assertThat( prodSpec.getServiceSpecification().size() ).isEqualTo( 1 ); + assertThat( prodSpec.getProductSpecCharacteristic().size() ).isEqualTo( 2 ); + + assertThat( respOff.getProdSpecCharValueUse().size() ).isEqualTo( 2 ); + + + } private String createProductOrder() throws Exception { @@ -399,4 +429,27 @@ public class ProductOrderRepoServiceTest { return responsesSpec; } + + private ServiceSpecification createServiceSpecification() throws Exception{ + + File sspec = new File( "src/test/resources/testServiceSpec2.json" ); + InputStream in = new FileInputStream( sspec ); + String sspectext = IOUtils.toString(in, "UTF-8"); + ServiceSpecificationCreate serviceSpecificationCreate = JsonUtils.toJsonObj( sspectext, ServiceSpecificationCreate.class); + + String response = mvc.perform(MockMvcRequestBuilders.post("/serviceCatalogManagement/v4/serviceSpecification") + .with( SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON) + .content( JsonUtils.toJson( serviceSpecificationCreate ) )) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andReturn().getResponse().getContentAsString(); + + + ServiceSpecification responsesSpec = JsonUtils.toJsonObj(response, ServiceSpecification.class); + assertThat( responsesSpec.getName() ).isEqualTo( "Test Spec2" ); + + + return responsesSpec; +} } diff --git a/src/test/resources/testServiceSpec2.json b/src/test/resources/testServiceSpec2.json index 13e648d..987a2cc 100644 --- a/src/test/resources/testServiceSpec2.json +++ b/src/test/resources/testServiceSpec2.json @@ -73,6 +73,35 @@ } } ] + }, + { + "name": "Spec2Attribute3", + "configurable": false, + "description": "This attribute specifies the zzzxxx", + "extensible": null, + "isUnique": true, + "maxCardinality": 1, + "minCardinality": 10, + "regex": null, + "valueType": "ENUM", + "serviceSpecCharRelationship": [ + ], + "serviceSpecCharacteristicValue": [ + { + "isDefault": true, + "rangeInterval": null, + "regex": null, + "unitOfMeasure": "N/A", + "valueFrom": null, + "valueTo": null, + "valueType": "SMALLINT", + "validFor": null, + "value": { + "value": "2", + "alias": "xxx" + } + } + ] } ] } -- GitLab From ef36e67ccf5e4edecbfbadd24e0cd8361aba0425 Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Sat, 17 Aug 2024 01:09:12 +0300 Subject: [PATCH 4/8] update product order api --- .../ProductSpecificationApiRouteBuilder.java | 95 +++++++++++++++++++ .../ProductOfferingRepoService.java | 3 + .../ProductSpecificationRepoService.java | 31 ++++-- .../po622/api/ProductOrderApiController.java | 1 + .../reposervices/ProductOrderRepoService.java | 24 +++-- src/main/resources/application-testing.yml | 7 ++ src/main/resources/application.yml | 6 ++ .../api/ServiceOrderIntegrationTest.java | 4 +- 8 files changed, 154 insertions(+), 17 deletions(-) create mode 100644 src/main/java/org/etsi/osl/tmf/pcm620/api/ProductSpecificationApiRouteBuilder.java diff --git a/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductSpecificationApiRouteBuilder.java b/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductSpecificationApiRouteBuilder.java new file mode 100644 index 0000000..07fe723 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductSpecificationApiRouteBuilder.java @@ -0,0 +1,95 @@ +package org.etsi.osl.tmf.pcm620.api; + +import org.apache.camel.LoggingLevel; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.model.dataformat.JsonLibrary; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.etsi.osl.tmf.pcm620.model.ProductSpecificationCreate; +import org.etsi.osl.tmf.pcm620.model.ProductSpecificationUpdate; +import org.etsi.osl.tmf.pcm620.reposervices.ProductOfferingRepoService; +import org.etsi.osl.tmf.pcm620.reposervices.ProductSpecificationRepoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; + +@Configuration +//@RefreshScope +@Component +public class ProductSpecificationApiRouteBuilder extends RouteBuilder { + + private static final transient Log logger = LogFactory.getLog(ProductSpecificationApiRouteBuilder.class.getName()); + + @Value("${CATALOG_GET_PRODUCTSPEC_BY_ID}") + private String CATALOG_GET_PRODUCTSPEC_BY_ID = ""; + + + @Value("${CATALOG_ADD_PRODUCTSPEC}") + private String CATALOG_ADD_PRODUCTSPEC = ""; + + + @Value("${CATALOG_UPD_PRODUCTSPEC}") + private String CATALOG_UPD_PRODUCTSPEC = ""; + + @Value("${CATALOG_UPDADD_PRODUCTSPEC}") + private String CATALOG_UPDADD_PRODUCTSPEC = ""; + + + @Value("${CATALOG_GET_PRODUCTOFFERING_BY_ID}") + private String CATALOG_GET_PRODUCTOFFERING_BY_ID = ""; + + + + @Autowired + ProductSpecificationRepoService productSpecificationRepoService; + + @Autowired + ProductOfferingRepoService productOfferingRepoService; + + + @Override + public void configure() throws Exception { + from( CATALOG_GET_PRODUCTSPEC_BY_ID ) + .log(LoggingLevel.INFO, log, CATALOG_GET_PRODUCTSPEC_BY_ID + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true") + .bean( productSpecificationRepoService, "findByUuidEager") + .marshal().json( JsonLibrary.Jackson, String.class) + .convertBodyTo( String.class ); + + + from( CATALOG_ADD_PRODUCTSPEC ) + .log(LoggingLevel.INFO, log, CATALOG_ADD_PRODUCTSPEC + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true") + .unmarshal().json( JsonLibrary.Jackson, ProductSpecificationCreate .class, true) + .bean( productSpecificationRepoService, "addProductSpecification(${body})") + .marshal().json( JsonLibrary.Jackson) + .convertBodyTo( String.class ); + + from( CATALOG_UPD_PRODUCTSPEC ) + .log(LoggingLevel.INFO, log, CATALOG_UPD_PRODUCTSPEC + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true") + .unmarshal().json( JsonLibrary.Jackson, ProductSpecificationUpdate.class, true) + .bean( productSpecificationRepoService, "updateProductSpecification(${header.serviceSpecId}, ${body} )") + .marshal().json( JsonLibrary.Jackson) + .convertBodyTo( String.class ); + + from( CATALOG_UPDADD_PRODUCTSPEC ) + .log(LoggingLevel.INFO, log, CATALOG_UPD_PRODUCTSPEC + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true") + .unmarshal().json( JsonLibrary.Jackson, ProductSpecificationUpdate.class, true) + .bean( productSpecificationRepoService, "updateOrAddProductSpecification(${header.serviceSpecId}, ${header.forceId}, ${body} )") + .marshal().json( JsonLibrary.Jackson) + .convertBodyTo( String.class ); + + + from( CATALOG_GET_PRODUCTOFFERING_BY_ID ) + .log(LoggingLevel.INFO, log, CATALOG_GET_PRODUCTOFFERING_BY_ID + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true") + .bean( productOfferingRepoService, "findByUuidEager") + .marshal().json( JsonLibrary.Jackson, String.class) + .convertBodyTo( String.class ); + + + } +} diff --git a/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductOfferingRepoService.java b/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductOfferingRepoService.java index 422d8f2..40176d7 100644 --- a/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductOfferingRepoService.java +++ b/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductOfferingRepoService.java @@ -222,6 +222,8 @@ public class ProductOfferingRepoService { try { dd = session.get(ProductOffering.class, id); if (dd == null) { + tx.rollback(); + session.close(); return this.findByUuid(id);// last resort } Hibernate.initialize(dd.getAttachment()); @@ -238,6 +240,7 @@ public class ProductOfferingRepoService { Hibernate.initialize(dd.getProductOfferingTerm() ); Hibernate.initialize(dd.getServiceCandidate() ); Hibernate.initialize(dd.getResourceCandidate() ); + Hibernate.initialize(dd.getChannel()); tx.commit(); } finally { diff --git a/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductSpecificationRepoService.java b/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductSpecificationRepoService.java index b7bb5ee..deec0a6 100644 --- a/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductSpecificationRepoService.java +++ b/src/main/java/org/etsi/osl/tmf/pcm620/reposervices/ProductSpecificationRepoService.java @@ -208,6 +208,8 @@ public class ProductSpecificationRepoService { return optionalCat.orElse(null); } + + @Transactional public ProductSpecification findByUuidEager(String id) { Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); // instead of begin transaction, is it possible to continue? @@ -215,16 +217,18 @@ public class ProductSpecificationRepoService { try { dd = session.get(ProductSpecification.class, id); if (dd == null) { + session.close(); return this.findByUuid(id);// last resort } Hibernate.initialize(dd.getAttachment()); Hibernate.initialize(dd.getRelatedParty() ); Hibernate.initialize(dd.getBundledProductSpecification() ); Hibernate.initialize(dd.getResourceSpecification() ); - Hibernate.initialize(dd.getServiceSpecification() ); + Hibernate.initialize(dd.getServiceSpecification() ); + Hibernate.initialize(dd.getProductSpecificationRelationship() ); for (ProductSpecificationCharacteristic schar : dd.getProductSpecCharacteristic() ) { Hibernate.initialize(schar.getProductSpecCharacteristicValue() ); - + Hibernate.initialize(schar.getProductSpecCharRelationship() ); } @@ -618,13 +622,13 @@ public class ProductSpecificationRepoService { if ( prodSpec.findProdCharacteristicByName( ssc.getName() ) == null ) { ProductSpecificationCharacteristic cnew = new ProductSpecificationCharacteristic(); - cnew.setName( cnew.getName() ); - cnew.setDescription( cnew.getDescription()); - cnew.isUnique(cnew.isIsUnique()) - .extensible(cnew.isExtensible()) - .maxCardinality(cnew.getMaxCardinality()) - .minCardinality(cnew.getMinCardinality()) - .valueType(cnew.getValueType()); + cnew.setName( ssc.getName() ); + cnew.setDescription( ssc.getDescription()); + cnew.isUnique(ssc.isIsUnique()) + .extensible(ssc.isExtensible()) + .maxCardinality(ssc.getMaxCardinality()) + .minCardinality(ssc.getMinCardinality()) + .valueType(ssc.getValueType()); for (ServiceSpecCharacteristicValue r : ssc.getServiceSpecCharacteristicValue()) { ProductSpecificationCharacteristicValue pcval = new ProductSpecificationCharacteristicValue(); pcval.isDefault(r.isIsDefault()) @@ -666,5 +670,14 @@ public class ProductSpecificationRepoService { return responseProdSpec; } + + public ProductSpecification updateOrAddProductSpecification(String id, ProductSpecificationCreate productSpecificatioCreate) { + ProductSpecification serviceSpec = updateProductSpecification(id, productSpecificatioCreate ); + if ( serviceSpec == null ) { + serviceSpec = addProductSpecification( productSpecificatioCreate ); + } + + return serviceSpec; + } } diff --git a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java index e051726..ab307dd 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java +++ b/src/main/java/org/etsi/osl/tmf/po622/api/ProductOrderApiController.java @@ -147,6 +147,7 @@ public class ProductOrderApiController implements ProductOrderApi { } @Override + @PreAuthorize("hasAnyAuthority('ROLE_ADMIN')") public ResponseEntity> listProductOrder(Principal principal, @Valid String fields, @Valid Integer offset, @Valid Integer limit, @Valid Date starttime, @Valid Date endtime) { diff --git a/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java b/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java index b405f63..c572a65 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java +++ b/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java @@ -67,6 +67,7 @@ import org.etsi.osl.tmf.prm669.model.RelatedParty; import org.etsi.osl.tmf.sim638.model.ServiceUpdate; import org.etsi.osl.tmf.sim638.service.ServiceRepoService; import org.etsi.osl.tmf.so641.api.NotFoundException; +import org.etsi.osl.tmf.so641.reposervices.ServiceOrderRepoService; import org.etsi.osl.tmf.util.KrokiClient; import org.hibernate.Hibernate; import org.hibernate.Session; @@ -112,6 +113,9 @@ public class ProductOrderRepoService { @Autowired ServiceRepoService serviceRepoService; + @Autowired + ServiceOrderRepoService serviceOrderRepoService; + private SessionFactory sessionFactory; @PersistenceContext EntityManager entityManager; @@ -222,8 +226,8 @@ public class ProductOrderRepoService { } } - sql += " FROM ProductOrder sor " - + "JOIN sor.relatedParty rp "; + sql += " FROM ProductOrder por " + + "JOIN por.relatedParty rp "; if (allParams.size() > 0) { sql += " WHERE rp.role = 'REQUESTER' AND "; @@ -353,6 +357,10 @@ public class ProductOrderRepoService { so.getNote().addAll(productOrderCreate.getNote()); } + so.setState( productOrderCreate.getState() ); + + + @@ -510,7 +518,7 @@ public class ProductOrderRepoService { } - + @Transactional public ProductOrder getProductOrderEager(String id) { Session session = sessionFactory.openSession(); @@ -527,9 +535,12 @@ public class ProductOrderRepoService { Hibernate.initialize(s.getRelatedParty()); Hibernate.initialize(s.getProductOrderItem() ); Hibernate.initialize(s.getNote() ); + Hibernate.initialize(s.getChannel()); for (ProductOrderItem soi : s.getProductOrderItem()) { - Hibernate.initialize( soi.getProduct().getProductCharacteristic() ); - Hibernate.initialize( soi.getProductOffering() ); + if ( soi.getProduct() != null ) { + Hibernate.initialize( soi.getProduct().getProductCharacteristic() ); + } + Hibernate.initialize( soi.getProductOffering() ); } tx.commit(); @@ -539,7 +550,7 @@ public class ProductOrderRepoService { return s; } catch (Exception e) { - // TODO: handle exception + e.printStackTrace(); } session.close(); @@ -548,6 +559,7 @@ public class ProductOrderRepoService { } + @Transactional public String getProductOrderEagerAsString(String id) throws JsonProcessingException { ProductOrder s = this.getProductOrderEager(id); ObjectMapper mapper = new ObjectMapper(); diff --git a/src/main/resources/application-testing.yml b/src/main/resources/application-testing.yml index 2efb62e..4e908f4 100644 --- a/src/main/resources/application-testing.yml +++ b/src/main/resources/application-testing.yml @@ -88,6 +88,13 @@ CATALOG_GET_SERVICESPEC_BY_ID: "jms:queue:CATALOG.GET.SERVICESPEC_BY_ID" CATALOG_ADD_SERVICESPEC: "jms:queue:CATALOG.ADD.SERVICESPEC" CATALOG_UPD_SERVICESPEC: "jms:queue:CATALOG.UPD.SERVICESPEC" CATALOG_UPDADD_SERVICESPEC: "jms:queue:CATALOG.UPDADD.SERVICESPEC" + +CATALOG_GET_PRODUCTSPEC_BY_ID: "jms:queue:CATALOG.GET.PRODUCTSPEC_BY_ID" +CATALOG_ADD_PRODUCTSPEC: "jms:queue:CATALOG.ADD.PRODUCTSPEC" +CATALOG_UPD_PRODUCTSPEC: "jms:queue:CATALOG.UPD.PRODUCTSPEC" +CATALOG_UPDADD_PRODUCTSPEC: "jms:queue:CATALOG.UPDADD.PRODUCTSPEC" +CATALOG_GET_PRODUCTOFFERING_BY_ID: "jms:queue:CATALOG.GET.PRODUCTOFFERING_BY_ID" + CATALOG_GET_INITIAL_SERVICEORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_SERVICEORDERS" CATALOG_GET_SERVICEORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_SERVICEORDERS" CATALOG_ADD_SERVICE: "jms:queue:CATALOG.ADD.SERVICE" diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 4a71727..db294fe 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -117,6 +117,12 @@ CATALOG_ADD_SERVICESPEC: "jms:queue:CATALOG.ADD.SERVICESPEC" CATALOG_UPD_SERVICESPEC: "jms:queue:CATALOG.UPD.SERVICESPEC" CATALOG_UPDADD_SERVICESPEC: "jms:queue:CATALOG.UPDADD.SERVICESPEC" +CATALOG_GET_PRODUCTSPEC_BY_ID: "jms:queue:CATALOG.GET.PRODUCTSPEC_BY_ID" +CATALOG_ADD_PRODUCTSPEC: "jms:queue:CATALOG.ADD.PRODUCTSPEC" +CATALOG_UPD_PRODUCTSPEC: "jms:queue:CATALOG.UPD.PRODUCTSPEC" +CATALOG_UPDADD_PRODUCTSPEC: "jms:queue:CATALOG.UPDADD.PRODUCTSPEC" +CATALOG_GET_PRODUCTOFFERING_BY_ID: "jms:queue:CATALOG.GET.PRODUCTOFFERING_BY_ID" + CATALOG_GET_INITIAL_SERVICEORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_SERVICEORDERS" CATALOG_GET_SERVICEORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_SERVICEORDERS" diff --git a/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java index 017804b..142c2fa 100644 --- a/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java @@ -208,7 +208,7 @@ public class ServiceOrderIntegrationTest { * here 1+2 + the 2 characteristics of the service itself total 5 */ - assertThat( responsesSpec3.getServiceSpecCharacteristic().size() ).isEqualTo( 3 ); + assertThat( responsesSpec3.getServiceSpecCharacteristic().size() ).isEqualTo( 4 ); ServiceOrderCreate servOrder = new ServiceOrderCreate(); servOrder.setCategory("Experimentation"); @@ -261,7 +261,7 @@ public class ServiceOrderIntegrationTest { assertThat( responsesSpec1.getServiceSpecCharacteristic().size() ).isEqualTo( 2 ); - assertThat( responsesSpec2.getServiceSpecCharacteristic().size() ).isEqualTo( 3 ); + assertThat( responsesSpec2.getServiceSpecCharacteristic().size() ).isEqualTo( 4 ); assertThat( responsesSpec3.getServiceSpecCharacteristic().size() ).isEqualTo( 3 ); -- GitLab From 4ebbc223e5aa3144a9a46f82d1e321cf584cafce Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Sat, 17 Aug 2024 01:27:24 +0300 Subject: [PATCH 5/8] update tests --- .../osl/tmf/po622/reposervices/ProductOrderRepoService.java | 6 +++++- .../etsi/osl/services/api/ServiceOrderIntegrationTest.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java b/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java index c572a65..2ae7aa0 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java +++ b/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java @@ -357,7 +357,11 @@ public class ProductOrderRepoService { so.getNote().addAll(productOrderCreate.getNote()); } - so.setState( productOrderCreate.getState() ); + if ( productOrderCreate.getState() != null ) { + so.setState( productOrderCreate.getState() ); + } else { + so.setState( ProductOrderStateType.INITIAL ); + } diff --git a/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java index 142c2fa..b05c6e7 100644 --- a/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java +++ b/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java @@ -262,7 +262,7 @@ public class ServiceOrderIntegrationTest { assertThat( responsesSpec1.getServiceSpecCharacteristic().size() ).isEqualTo( 2 ); assertThat( responsesSpec2.getServiceSpecCharacteristic().size() ).isEqualTo( 4 ); - assertThat( responsesSpec3.getServiceSpecCharacteristic().size() ).isEqualTo( 3 ); + assertThat( responsesSpec3.getServiceSpecCharacteristic().size() ).isEqualTo( 4 ); responseSO.getOrderItem().stream().forEach(soiElement -> { -- GitLab From ddc4105e9bd00c6219874f35bdad131c0226ff5a Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Wed, 27 Nov 2024 17:56:57 +0200 Subject: [PATCH 6/8] fix for merge --- pom.xml | 2 +- src/main/resources/application-testing.yml | 13 ++++++------- src/main/resources/application.yml | 14 ++++++-------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index cd2166e..53e828a 100644 --- a/pom.xml +++ b/pom.xml @@ -9,11 +9,11 @@ ../org.etsi.osl.main + ${org.etsi.osl.tmf.api.version>} org.etsi.osl.tmf.api org.etsi.osl.tmf.api - ${org.etsi.osl.tmf.api.version>} diff --git a/src/main/resources/application-testing.yml b/src/main/resources/application-testing.yml index 4e908f4..1c966ea 100644 --- a/src/main/resources/application-testing.yml +++ b/src/main/resources/application-testing.yml @@ -94,7 +94,12 @@ CATALOG_ADD_PRODUCTSPEC: "jms:queue:CATALOG.ADD.PRODUCTSPEC" CATALOG_UPD_PRODUCTSPEC: "jms:queue:CATALOG.UPD.PRODUCTSPEC" CATALOG_UPDADD_PRODUCTSPEC: "jms:queue:CATALOG.UPDADD.PRODUCTSPEC" CATALOG_GET_PRODUCTOFFERING_BY_ID: "jms:queue:CATALOG.GET.PRODUCTOFFERING_BY_ID" - +CATALOG_GET_PRODUCTORDERS: "jms:queue:CATALOG.GET.PRODUCTORDERS" +CATALOG_GET_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.GET.PRODUCTORDER_BY_ID" +CATALOG_ADD_PRODUCTORDER: "jms:queue:CATALOG.ADD.PRODUCTORDER" +CATALOG_UPD_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.UPD.PRODUCTORDER_BY_ID" +CATALOG_GET_INITIAL_PRODUCTORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_PRODUCTORDERS" +CATALOG_GET_PRODUCTORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_PRODUCTORDERS" CATALOG_GET_INITIAL_SERVICEORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_SERVICEORDERS" CATALOG_GET_SERVICEORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_SERVICEORDERS" CATALOG_ADD_SERVICE: "jms:queue:CATALOG.ADD.SERVICE" @@ -112,12 +117,6 @@ CATALOG_SERVICES_OF_PARTNERS: "jms:queue:CATALOG.GET.SERVICESOFPARTNERS" CATALOG_GET_EXTERNAL_SERVICE_PARTNERS: "jms:queue:CATALOG.GET.EXTERNALSERVICEPARTNERS" CATALOG_UPD_EXTERNAL_SERVICESPEC: "jms:queue:CATALOG.UPD.EXTERNAL_SERVICESPEC" -CATALOG_GET_PRODUCTORDERS: "jms:queue:CATALOG.GET.PRODUCTORDERS" -CATALOG_GET_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.GET.PRODUCTORDER_BY_ID" -CATALOG_ADD_PRODUCTORDER: "jms:queue:CATALOG.ADD.PRODUCTORDER" -CATALOG_UPD_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.UPD.PRODUCTORDER_BY_ID" -CATALOG_GET_INITIAL_PRODUCTORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_PRODUCTORDERS" -CATALOG_GET_PRODUCTORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_PRODUCTORDERS" #ALARMS ALARMS_ADD_ALARM: "jms:queue:ALARMS.ADD.ALARM" diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index db294fe..33b6f60 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -122,8 +122,12 @@ CATALOG_ADD_PRODUCTSPEC: "jms:queue:CATALOG.ADD.PRODUCTSPEC" CATALOG_UPD_PRODUCTSPEC: "jms:queue:CATALOG.UPD.PRODUCTSPEC" CATALOG_UPDADD_PRODUCTSPEC: "jms:queue:CATALOG.UPDADD.PRODUCTSPEC" CATALOG_GET_PRODUCTOFFERING_BY_ID: "jms:queue:CATALOG.GET.PRODUCTOFFERING_BY_ID" - - +CATALOG_GET_PRODUCTORDERS: "jms:queue:CATALOG.GET.PRODUCTORDERS" +CATALOG_GET_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.GET.PRODUCTORDER_BY_ID" +CATALOG_ADD_PRODUCTORDER: "jms:queue:CATALOG.ADD.PRODUCTORDER" +CATALOG_UPD_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.UPD.PRODUCTORDER_BY_ID" +CATALOG_GET_INITIAL_PRODUCTORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_PRODUCTORDERS" +CATALOG_GET_PRODUCTORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_PRODUCTORDERS" CATALOG_GET_INITIAL_SERVICEORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_SERVICEORDERS" CATALOG_GET_SERVICEORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_SERVICEORDERS" CATALOG_ADD_SERVICE: "jms:queue:CATALOG.ADD.SERVICE" @@ -141,12 +145,6 @@ CATALOG_SERVICES_OF_PARTNERS: "jms:queue:CATALOG.GET.SERVICESOFPARTNERS" CATALOG_GET_EXTERNAL_SERVICE_PARTNERS: "jms:queue:CATALOG.GET.EXTERNALSERVICEPARTNERS" CATALOG_UPD_EXTERNAL_SERVICESPEC: "jms:queue:CATALOG.UPD.EXTERNAL_SERVICESPEC" -CATALOG_GET_PRODUCTORDERS: "jms:queue:CATALOG.GET.PRODUCTORDERS" -CATALOG_GET_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.GET.PRODUCTORDER_BY_ID" -CATALOG_ADD_PRODUCTORDER: "jms:queue:CATALOG.ADD.PRODUCTORDER" -CATALOG_UPD_PRODUCTORDER_BY_ID: "jms:queue:CATALOG.UPD.PRODUCTORDER_BY_ID" -CATALOG_GET_INITIAL_PRODUCTORDERS_IDS: "jms:queue:CATALOG.GET.INITIAL_PRODUCTORDERS" -CATALOG_GET_PRODUCTORDER_IDS_BY_STATE: "jms:queue:CATALOG.GET.ACKNOWLEDGED_PRODUCTORDERS" #ALARMS -- GitLab From d6bfc02d33f5d6c2eb888461753894eae38bc290 Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Wed, 27 Nov 2024 18:09:57 +0200 Subject: [PATCH 7/8] fix pom.xml --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 14e3f3e..56e5a62 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,6 @@ org.etsi.osl.tmf.api org.etsi.osl.tmf.api - ${org.etsi.osl.tmf.api.version} OpenSlice by ETSI -- GitLab From ed313f01a4afddb48a13576e12f9402b31966e10 Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Wed, 27 Nov 2024 18:10:07 +0200 Subject: [PATCH 8/8] fix hubapi controllers --- src/main/java/org/etsi/osl/tmf/pim637/api/HubApiController.java | 2 +- src/main/java/org/etsi/osl/tmf/pm628/api/HubApiController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/etsi/osl/tmf/pim637/api/HubApiController.java b/src/main/java/org/etsi/osl/tmf/pim637/api/HubApiController.java index 19e6954..96129c8 100644 --- a/src/main/java/org/etsi/osl/tmf/pim637/api/HubApiController.java +++ b/src/main/java/org/etsi/osl/tmf/pim637/api/HubApiController.java @@ -18,7 +18,7 @@ import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.Valid; @jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") -@RestController +@RestController("HubApiController637") public class HubApiController implements HubApi { private static final Logger log = LoggerFactory.getLogger(HubApiController.class); diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/HubApiController.java b/src/main/java/org/etsi/osl/tmf/pm628/api/HubApiController.java index 77be4ef..c3bf28d 100644 --- a/src/main/java/org/etsi/osl/tmf/pm628/api/HubApiController.java +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/HubApiController.java @@ -9,7 +9,7 @@ import javax.annotation.Generated; import java.util.Optional; @Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2024-05-15T07:30:16.936523289Z[Etc/UTC]", comments = "Generator version: 7.6.0-SNAPSHOT") -@Controller +@Controller("HubApiController628") @RequestMapping("/performance/v5") public class HubApiController implements HubApi { -- GitLab