diff --git a/pom.xml b/pom.xml index 05a3dd019ba2fa4ac10cfe4603e535ce5e28010f..56e5a62eca27c9d0cefd8be90e35d01ba0e79941 100644 --- a/pom.xml +++ b/pom.xml @@ -9,10 +9,10 @@ ../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} OpenSlice by ETSI @@ -20,6 +20,7 @@ + UTF-8 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 ac55f12d80bea74fa75b571c4fb1a0f4b261ff8b..b8e5b11ab5d362a73dc607ebe8a56453a7d04132 100644 --- a/src/main/java/org/etsi/osl/tmf/configuration/SwaggerDocumentationConfig.java +++ b/src/main/java/org/etsi/osl/tmf/configuration/SwaggerDocumentationConfig.java @@ -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") @@ -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 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 3b0eacf57af62f8a30f4838f1fd8dd1f82d73742..181bde0b3086d73d27d6b74e7445740589dbbc74 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 c22b53ea188f9f749058ba2d145b53ed8582501c..b13182529d12bee5dceadefb1d9ea62ae43a2a92 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/api/ProductSpecificationApiRouteBuilder.java b/src/main/java/org/etsi/osl/tmf/pcm620/api/ProductSpecificationApiRouteBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..07fe723d0e242df176992fc1729001098dd3427e --- /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 b53dd5b0be6b91e419e748ff62d1583c3582dc58..40176d7b632d3795da8fa4b598a4fdfd4d25ea4c 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; @@ -205,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()); @@ -221,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 { @@ -320,6 +340,7 @@ public class ProductOfferingRepoService { if ( prodOfferingUpd.getProductSpecification() != null ) { prodOffering.setProductSpecification( prodOfferingUpd.getProductSpecification() ); + prodOffering = copyCharacteristicsFromProdSpec( prodOffering, prodOfferingUpd.getProductSpecification() ); } @@ -542,5 +563,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 2994b2aea69a05b52b4309ccf9da950156f8cdd2..deec0a663436f017e7d66f89389fb22bd6cd8ea6 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; @@ -200,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? @@ -207,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() ); } @@ -428,7 +440,7 @@ public class ProductSpecificationRepoService { } - + /** * Update ProductSpecificationRelationship list @@ -548,7 +560,7 @@ public class ProductSpecificationRepoService { } /** - * Update ResourceSpecificationRef list + * Update ServiceSpecificationRef list */ if (prodSpecUpd.getServiceSpecification() != null) { @@ -569,6 +581,7 @@ public class ProductSpecificationRepoService { if (!idexists) { prodSpec.getServiceSpecification().add(ar); + prodSpec = copyConfigurableCharacteristics( prodSpec, ar ); idAddedUpdated.put(ar.getUuid(), true); } } @@ -597,5 +610,74 @@ 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( 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()) + .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; + } + + 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/pim637/api/ApiException.java b/src/main/java/org/etsi/osl/tmf/pim637/api/ApiException.java new file mode 100644 index 0000000000000000000000000000000000000000..dee19e45a7d626efd22887db321cb5555cd9171d --- /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 0000000000000000000000000000000000000000..653abc4129136c306030c9b2be54c6034155496c --- /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 0000000000000000000000000000000000000000..8bf7d4c83b4b574be35b1356da5e528e47354956 --- /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 0000000000000000000000000000000000000000..7dc3b86aea3df45469e25725451605e52133e6c8 --- /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 0000000000000000000000000000000000000000..96129c8d13131e6c601ca1a826feaff0434177e2 --- /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("HubApiController637") +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 0000000000000000000000000000000000000000..8ea75df1e1c1685af62bef92deb90df4eee25ce9 --- /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 0000000000000000000000000000000000000000..475d90f202574fa8d31ad7501d7cffd439007ba4 --- /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 0000000000000000000000000000000000000000..37767fee4433b2d43cb050541511b68b07971f28 --- /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 0000000000000000000000000000000000000000..c4f9f782563f7131a31f0a781f030f7310203880 --- /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 0000000000000000000000000000000000000000..f53ce22c4fc59e9cdaed8f3c80768cbf5be5f626 --- /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/pm628/api/HubApiController.java b/src/main/java/org/etsi/osl/tmf/pm628/api/HubApiController.java index 77be4ef6598d3af3511264db92135868c0f80da1..c3bf28d4f446c20dbb3f7860792c146e14fae6d4 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 { 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 540440c66b276040ec915d53f8e9f4c8c6d96198..0a183b76ef9e14ee1c8b2780a5eda15f69c4455f 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 b3851c5e55909c7ffb1388ce61e4d191ddbe455d..bd68031c98d66034047611612f2feb58cfb70ec1 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,8 @@ 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; @@ -35,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; @@ -79,7 +82,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")) { @@ -110,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 { @@ -133,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")) { @@ -167,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()) { @@ -199,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()) { @@ -216,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 bf80e2db4a7d9f04b08a42f44f00cd8854490ec4..ab307dda35bffd5b26b4632d250536437cc7dd72 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,37 +19,212 @@ */ 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; +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; -@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-10-30T10:29:21.184964400+02:00[Europe/Athens]") -@Controller +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("ProductOrderApiController622") @RequestMapping("/productOrderingManagement/v4/") public class ProductOrderApiController implements ProductOrderApi { - private final ObjectMapper objectMapper; + private final ObjectMapper objectMapper; + + private final HttpServletRequest 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 ); + + + 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 { + + } - private final HttpServletRequest request; - @org.springframework.beans.factory.annotation.Autowired - public ProductOrderApiController(ObjectMapper objectMapper, HttpServletRequest request) { - this.objectMapper = objectMapper; - this.request = request; + + 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) { - @Override - public Optional getObjectMapper() { - return Optional.ofNullable(objectMapper); + 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 + @PreAuthorize("hasAnyAuthority('ROLE_ADMIN')") + 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); + } - @Override - public Optional getRequest() { - return Optional.ofNullable(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_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 0000000000000000000000000000000000000000..23dbc57a33d948b7bc9ae6d01f0da12a7bbafb3c --- /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 0000000000000000000000000000000000000000..8343d3da1c62d37fbc0cd518416aeadc38e2fc83 --- /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 new file mode 100644 index 0000000000000000000000000000000000000000..ae19cea2051edbc0248c9e6b581789e43c765714 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/po622/repo/ProductOrderRepository.java @@ -0,0 +1,56 @@ +/*- + * ========================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 0000000000000000000000000000000000000000..2ae7aa07aac5b7440c131f256216f9fddbb52666 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/po622/reposervices/ProductOrderRepoService.java @@ -0,0 +1,707 @@ +/*- + * ========================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.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.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; +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 { + + private static final transient Log logger = + LogFactory.getLog(ProductOrderRepoService.class.getName()); + + @Autowired + ObjectMapper objectMapper; + + @Autowired + ProductOrderRepository productOrderRepo; + + + @Autowired + ProductSpecificationRepoService productSpecificationRepoService; + + @Autowired + ProductOfferingRepoService productOfferingRepoService; + + + @Autowired + ProductOrderApiRouteBuilderEvents productOrderApiRouteBuilder; + + + @Autowired + ServiceRepoService serviceRepoService; + + @Autowired + ServiceOrderRepoService serviceOrderRepoService; + + private SessionFactory sessionFactory; + + @PersistenceContext EntityManager entityManager; + + @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); + } + + + @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) { + 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; + } + + 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 por " + + "JOIN por.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 + 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()); + } + + if ( productOrderCreate.getState() != null ) { + so.setState( productOrderCreate.getState() ); + } else { + so.setState( ProductOrderStateType.INITIAL ); + } + + + + + + + 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; + 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 ) { + 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; + + } + + + @Transactional + public ProductOrder findByUuid(String id) { + Optional optionalCat = this.productOrderRepo.findByUuid(id); + return optionalCat.orElse(null); + } + + + @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()); + + } + + @Transactional + 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() ); + Hibernate.initialize(s.getChannel()); + for (ProductOrderItem soi : s.getProductOrderItem()) { + if ( soi.getProduct() != null ) { + Hibernate.initialize( soi.getProduct().getProductCharacteristic() ); + } + Hibernate.initialize( soi.getProductOffering() ); + } + + tx.commit(); + } finally { + session.close(); + } + + return s; + } catch (Exception e) { + e.printStackTrace(); + } + + session.close(); + return null; + + +} + + @Transactional + 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 60b5182926540c7de0c3101d617ce2f6c23e3a33..a83e78cb2ae5f9c06e69da4af97725636814bfcf 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 06864b4a940910bb7441faafc1281b96754588b8..c761b52df8705fa5605101c8becb045a0b5b964d 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 719f8c57fedd3186a081820e20377eedd6965e36..de3f168bbb8b053aadc7420482586b351756b7a5 100644 --- a/src/main/resources/application-testing.yml +++ b/src/main/resources/application-testing.yml @@ -88,6 +88,18 @@ 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_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" @@ -111,6 +123,7 @@ PM_MEASUREMENT_COLLECTION_JOB_ADD: "jms:queue:PM.MEASUREMENTCOLLECTIONJOB. PM_MEASUREMENT_COLLECTION_JOB_CREATED: "jms:queue:PM.MEASUREMENTCOLLECTIONJOB.CREATED" PM_MEASUREMENT_COLLECTION_JOB_UPDATE: "jms:queue:PM.MEASUREMENTCOLLECTIONJOB.UPDATE" + #ALARMS ALARMS_ADD_ALARM: "jms:queue:ALARMS.ADD.ALARM" ALARMS_UPDATE_ALARM: "jms:queue:ALARMS.UPDATE.ALARM" @@ -137,6 +150,11 @@ EVENT_MEASUREMENT_COLLECTION_JOB_EXECUTION_STATE_CHANGED: "jms:topic:EVENT.MEASU EVENT_MEASUREMENT_COLLECTION_JOB_DELETE: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.DELETE" EVENT_MEASUREMENT_COLLECTION_JOB_ATTRIBUTE_VALUE_CHANGED: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.ATTRCHANGED" +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 163f1d379831b166225b0ac421eb8a1998ed8993..0d50413cb4ee732133c5f6830956036f21f2765d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -117,7 +117,17 @@ 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_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" @@ -135,6 +145,8 @@ 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" + + PM_MEASUREMENT_COLLECTION_GET_JOB_BY_ID: "jms:queue:PM.MEASUREMENTCOLLECTIONJOB.GET_BY_ID" PM_MEASUREMENT_COLLECTION_JOBS_GET: "jms:queue:PM.MEASUREMENTCOLLECTIONJOBS.GET" PM_MEASUREMENT_COLLECTION_JOB_ADD: "jms:queue:PM.MEASUREMENTCOLLECTIONJOB.ADD" @@ -167,6 +179,11 @@ EVENT_MEASUREMENT_COLLECTION_JOB_EXECUTION_STATE_CHANGED: "jms:topic:EVENT.MEASU EVENT_MEASUREMENT_COLLECTION_JOB_DELETE: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.DELETE" EVENT_MEASUREMENT_COLLECTION_JOB_ATTRIBUTE_VALUE_CHANGED: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.ATTRCHANGED" +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/ServiceOrderIntegrationTest.java b/src/test/java/org/etsi/osl/services/api/ServiceOrderIntegrationTest.java index 017804bfc044adbd710d2f7999d0fc1dc7696406..b05c6e78ece77399cddcc319f4ea64a7d57b7bd6 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,8 +261,8 @@ public class ServiceOrderIntegrationTest { assertThat( responsesSpec1.getServiceSpecCharacteristic().size() ).isEqualTo( 2 ); - assertThat( responsesSpec2.getServiceSpecCharacteristic().size() ).isEqualTo( 3 ); - assertThat( responsesSpec3.getServiceSpecCharacteristic().size() ).isEqualTo( 3 ); + assertThat( responsesSpec2.getServiceSpecCharacteristic().size() ).isEqualTo( 4 ); + assertThat( responsesSpec3.getServiceSpecCharacteristic().size() ).isEqualTo( 4 ); responseSO.getOrderItem().stream().forEach(soiElement -> { 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 0000000000000000000000000000000000000000..f196c06eb7da5cbd6493adf7dcde8c4692edee40 --- /dev/null +++ b/src/test/java/org/etsi/osl/services/api/po622/ProductOrderRepoServiceTest.java @@ -0,0 +1,455 @@ +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.IOException; +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 java.util.Set; +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.jdbc.AutoConfigureTestDatabase; +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.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 +@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; + + + + @Autowired + TransactionTemplate txTemplate; + + @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 = 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; + + } 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); + + 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); + + + } + + + @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); + } + + + + @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(); + } + } + + + @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 { + + 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; + } + + 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/productorder.json b/src/test/resources/productorder.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d24ce8a5a4b2373c833b6b1bd7f95e609bb9a8 --- /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 diff --git a/src/test/resources/testServiceSpec2.json b/src/test/resources/testServiceSpec2.json index 13e648d6256c026bc134c9418cb6deccbadbb96e..987a2cc155634ec91b4b83b1e7da970df2d9ce38 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" + } + } + ] } ] }