diff --git a/.factorypath b/.factorypath index 64aa78395684cdf667988ff5f0a9d23a40f8ff19..d2a264809b58dcdc44078350cbb1f15fa76deac4 100644 --- a/.factorypath +++ b/.factorypath @@ -1,4 +1,4 @@ <factorypath> - <factorypathentry kind="PLUGIN" id="org.eclipse.jst.ws.annotations.core" enabled="true" runInBatchMode="false"/> - <factorypathentry kind="EXTJAR" id="C:\Users\ctranoris\.m2\repository\org\mapstruct\mapstruct-processor\1.5.3.Final\mapstruct-processor-1.5.3.Final.jar" enabled="true" runInBatchMode="false"/> + <factorypathentry kind="VARJAR" id="M2_REPO/org/mapstruct/mapstruct-processor/1.5.3.Final/mapstruct-processor-1.5.3.Final.jar" enabled="true" runInBatchMode="false"/> + <factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok/1.18.28/lombok-1.18.28.jar" enabled="true" runInBatchMode="false"/> </factorypath> 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 239be290194fb3da0c4bd4c908d742c492c08ef9..d9433a34e3811586c06161eed081136499f7a12b 100644 --- a/src/main/java/org/etsi/osl/tmf/configuration/SwaggerDocumentationConfig.java +++ b/src/main/java/org/etsi/osl/tmf/configuration/SwaggerDocumentationConfig.java @@ -73,7 +73,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -109,7 +109,7 @@ public class SwaggerDocumentationConfig { .description("## TMF API Reference: TMF620 - Product Catalog Management ### Release : 19.0 - June 2019 Product Catalog API is one of Catalog Management API Family. Product Catalog API goal is to provide a catalog of products. ### Operations Product Catalog API performs the following operations on the resources : - Retrieve an entity or a collection of entities depending on filter criteria - Partial update of an entity (including updating rules) - Create an entity (including default values and creation rules) - Delete an entity - Manage notification of events") .version("4.0.0") - .license(new License().name("Apache 2.0").url("http://openslice.io"))) + .license(new License().name("Apache 2.0").url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -148,7 +148,7 @@ public class SwaggerDocumentationConfig { .version("1.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -183,7 +183,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -217,7 +217,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -255,7 +255,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -291,7 +291,7 @@ public class SwaggerDocumentationConfig { .version("2.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -328,7 +328,7 @@ public class SwaggerDocumentationConfig { .version("2.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -366,7 +366,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -403,7 +403,7 @@ public class SwaggerDocumentationConfig { .version("2.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -442,7 +442,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -479,7 +479,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -516,7 +516,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -555,7 +555,7 @@ public class SwaggerDocumentationConfig { // .version("3.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -594,7 +594,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -633,7 +633,7 @@ public class SwaggerDocumentationConfig { .version("1.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -671,7 +671,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -709,7 +709,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -744,7 +744,7 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("TMF API Tables") .url("https://www.tmforum.org/oda/open-apis/table")); @@ -781,10 +781,10 @@ public class SwaggerDocumentationConfig { .version("4.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("Openslice") - .url("http://openslice.io")); + .url("https://osl.etsi.org")); } @Bean @@ -826,10 +826,10 @@ public class SwaggerDocumentationConfig { .version("1.0.0") .license(new License() .name("Apache 2.0") - .url("http://openslice.io"))) + .url("https://osl.etsi.org"))) .externalDocs(new ExternalDocumentation() .description("Openslice") - .url("http://openslice.io")); + .url("https://osl.etsi.org")); } @Bean @@ -845,6 +845,38 @@ public class SwaggerDocumentationConfig { .build(); } + + /** + * TMF 628 Performance Management + * @return + */ + @Bean + public OpenApiCustomizer pm628OpenAPI() { + return openApi -> openApi + .specVersion( SpecVersion.V30 ).addSecurityItem(new SecurityRequirement().addList("security_auth")) + .info(new Info().title("TMF628 Performance Management API") + .description("TMF628 Performance Management API") + .version("5.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 pm628(){ + + 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-628-PerformanceManagement-v5.0.0") + .addOpenApiCustomizer( this.pm628OpenAPI() ) + .packagesToScan("org.etsi.osl.tmf.pm628.api") + .build(); + + } // @Bean diff --git a/src/main/java/org/etsi/osl/tmf/pm628/README.md b/src/main/java/org/etsi/osl/tmf/pm628/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5cd22b6081a211257f7ea2e6b0bef98c47926b4f --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/README.md @@ -0,0 +1,21 @@ +# OpenAPI generated server + +Spring Boot Server + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. + + +The underlying library integrating OpenAPI to Spring Boot is [springdoc](https://springdoc.org). +Springdoc will generate an OpenAPI v3 specification based on the generated Controller and Model classes. +The specification is available to download using the following url: +http://localhost:8080/v3/api-docs/ + +Start your server as a simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:8080/swagger-ui.html + +Change default port value in application.properties \ No newline at end of file diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/ApiUtil.java b/src/main/java/org/etsi/osl/tmf/pm628/api/ApiUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..0ad52b68062b71420fadbdf6c7400f4c7d9e1c51 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/ApiUtil.java @@ -0,0 +1,19 @@ +package org.etsi.osl.tmf.pm628.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/DataAccessEndpointApi.java b/src/main/java/org/etsi/osl/tmf/pm628/api/DataAccessEndpointApi.java new file mode 100644 index 0000000000000000000000000000000000000000..147ee55d5070f6e526f3a20f4a3c4c4c6df68cef --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/DataAccessEndpointApi.java @@ -0,0 +1,273 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.6.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pm628.api; + +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.tags.Tag; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.pm628.model.DataAccessEndpoint; +import org.etsi.osl.tmf.common.model.Error; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.annotation.Generated; +import java.util.List; +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") +@Validated +@Tag(name = "dataAccessEndpoint", description = "Operations for DataAccessEndpoint Resource") +public interface DataAccessEndpointApi { + + default Optional<NativeWebRequest> getRequest() { + return Optional.empty(); + } + + /** + * GET /dataAccessEndpoint : List or find DataAccessEndpoint objects + * List or find DataAccessEndpoint objects + * + * @param fields Comma-separated properties to be provided in response (optional) + * @param offset Requested index for start of resources to be provided in response (optional) + * @param limit Requested number of resources to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "listDataAccessEndpoint", + summary = "List or find DataAccessEndpoint objects", + description = "List or find DataAccessEndpoint objects", + tags = { "dataAccessEndpoint" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = DataAccessEndpoint.class))) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/dataAccessEndpoint", + produces = { "application/json" } + ) + + default ResponseEntity<List<DataAccessEndpoint>> listDataAccessEndpoint( + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields, + @Parameter(name = "offset", description = "Requested index for start of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "offset", required = false) Integer offset, + @Parameter(name = "limit", description = "Requested number of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false) Integer limit + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"uriQueryFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"uri\" : \"https://openapi-generator.tech\", \"apiType\" : \"apiType\" }, { \"uriQueryFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"uri\" : \"https://openapi-generator.tech\", \"apiType\" : \"apiType\" } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /dataAccessEndpoint/{id} : Retrieves a DataAccessEndpoint by ID + * This operation retrieves a DataAccessEndpoint entity. Attribute selection enabled for all first level attributes. + * + * @param id Identifier of the Resource (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "retrieveDataAccessEndpoint", + summary = "Retrieves a DataAccessEndpoint by ID", + description = "This operation retrieves a DataAccessEndpoint entity. Attribute selection enabled for all first level attributes.", + tags = { "dataAccessEndpoint" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = DataAccessEndpoint.class)) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/dataAccessEndpoint/{id}", + produces = { "application/json" } + ) + + default ResponseEntity<DataAccessEndpoint> retrieveDataAccessEndpoint( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"uriQueryFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"uri\" : \"https://openapi-generator.tech\", \"apiType\" : \"apiType\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/DataAccessEndpointApiController.java b/src/main/java/org/etsi/osl/tmf/pm628/api/DataAccessEndpointApiController.java new file mode 100644 index 0000000000000000000000000000000000000000..13598a5e50a7bcda639b85536eaac6ebac0f80b0 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/DataAccessEndpointApiController.java @@ -0,0 +1,75 @@ +package org.etsi.osl.tmf.pm628.api; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.pm628.model.DataAccessEndpoint; +import org.etsi.osl.tmf.pm628.reposervices.DataAccessEndpointService; +import org.etsi.osl.tmf.pm628.api.DataAccessEndpointApiController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.annotation.Generated; +import java.util.List; +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 +@RequestMapping("/performance/v5") +public class DataAccessEndpointApiController implements DataAccessEndpointApi { + + private static final Logger log = LoggerFactory.getLogger(DataAccessEndpointApiController.class); + + private final NativeWebRequest request; + + @Autowired + DataAccessEndpointService dataAccessEndpointService; + + @Autowired + public DataAccessEndpointApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional<NativeWebRequest> getRequest() { + return Optional.ofNullable(request); + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<List<DataAccessEndpoint>> listDataAccessEndpoint( + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields, + @Parameter(name = "offset", description = "Requested index for start of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "offset", required = false) Integer offset, + @Parameter(name = "limit", description = "Requested number of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false) Integer limit + ) { + try { + return new ResponseEntity<List<DataAccessEndpoint>>(dataAccessEndpointService.findAllDataAccessEndpoints(), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<List<DataAccessEndpoint>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<DataAccessEndpoint> retrieveDataAccessEndpoint( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + try { + return new ResponseEntity<DataAccessEndpoint>(dataAccessEndpointService.findDataAccessEndpointByUuid(id), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<DataAccessEndpoint>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } +} \ No newline at end of file diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/HubApi.java b/src/main/java/org/etsi/osl/tmf/pm628/api/HubApi.java new file mode 100644 index 0000000000000000000000000000000000000000..c9c67a58a25d0bbebd25b8f134dab66036b4ff98 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/HubApi.java @@ -0,0 +1,134 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.6.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pm628.api; + +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.tags.Tag; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.common.model.Error; +import org.etsi.osl.tmf.pm628.model.Hub; +import org.etsi.osl.tmf.pm628.model.HubFVO; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +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.context.request.NativeWebRequest; + +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") +@Validated +@Tag(name = "events subscription", description = "Endpoints to register and terminate an Event Listener") +public interface HubApi { + + default Optional<NativeWebRequest> getRequest() { + return Optional.empty(); + } + + /** + * POST /hub : Create a subscription (hub) to receive Events + * Sets the communication endpoint to receive Events. + * + * @param hubFVO Data containing the callback endpoint to deliver the information (required) + * @return Notified (status code 201) + * or Error (status code 200) + */ + @Operation( + operationId = "createHub", + summary = "Create a subscription (hub) to receive Events", + description = "Sets the communication endpoint to receive Events.", + tags = { "events subscription" }, + responses = { + @ApiResponse(responseCode = "201", description = "Notified", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Hub.class)) + }), + @ApiResponse(responseCode = "default", description = "Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/hub", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<Hub> createHub( + @Parameter(name = "HubFVO", description = "Data containing the callback endpoint to deliver the information", required = true) @Valid @RequestBody HubFVO hubFVO + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"query\" : \"query\", \"callback\" : \"callback\", \"id\" : \"id\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * DELETE /hub/{id} : Remove a subscription (hub) to receive Events + * + * + * @param id Identifier of the Resource (required) + * @return Deleted (status code 204) + * or Error (status code 200) + */ + @Operation( + operationId = "hubDelete", + summary = "Remove a subscription (hub) to receive Events", + description = "", + tags = { "events subscription" }, + responses = { + @ApiResponse(responseCode = "204", description = "Deleted"), + @ApiResponse(responseCode = "default", description = "Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.DELETE, + value = "/hub/{id}", + produces = { "application/json" } + ) + + default ResponseEntity<Void> hubDelete( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + 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 new file mode 100644 index 0000000000000000000000000000000000000000..77be4ef6598d3af3511264db92135868c0f80da1 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/HubApiController.java @@ -0,0 +1,28 @@ +package org.etsi.osl.tmf.pm628.api; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; + +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 +@RequestMapping("/performance/v5") +public class HubApiController implements HubApi { + + private final NativeWebRequest request; + + @Autowired + public HubApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional<NativeWebRequest> getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/ListenerApi.java b/src/main/java/org/etsi/osl/tmf/pm628/api/ListenerApi.java new file mode 100644 index 0000000000000000000000000000000000000000..3ead3a97687ff776d7fc9208cda9b20477500cb7 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/ListenerApi.java @@ -0,0 +1,389 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.6.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pm628.api; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +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.tags.Tag; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.common.model.Error; +import org.etsi.osl.tmf.pm628.model.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +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 org.springframework.web.context.request.NativeWebRequest; + +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") +@Validated +@Tag(name = "notification listener", description = "Notifications for Resource Lifecycle and event notifications") +public interface ListenerApi { + + default Optional<NativeWebRequest> getRequest() { + return Optional.empty(); + } + + /** + * POST /listener/measurementCollectionJobAttributeValueChangeEvent : Client listener for entity MeasurementCollectionJobAttributeValueChangeEvent + * Example of a client listener for receiving the notification MeasurementCollectionJobAttributeValueChangeEvent + * + * @param measurementCollectionJobAttributeValueChangeEvent MeasurementCollectionJob attributeValueChange Event payload (required) + * @return Notified (status code 204) + * or Error (status code 200) + */ + @Operation( + operationId = "measurementCollectionJobAttributeValueChangeEvent", + summary = "Client listener for entity MeasurementCollectionJobAttributeValueChangeEvent", + description = "Example of a client listener for receiving the notification MeasurementCollectionJobAttributeValueChangeEvent", + tags = { "notification listener" }, + responses = { + @ApiResponse(responseCode = "204", description = "Notified"), + @ApiResponse(responseCode = "default", description = "Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/listener/measurementCollectionJobAttributeValueChangeEvent", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<Void> measurementCollectionJobAttributeValueChangeEvent( + @Parameter(name = "MeasurementCollectionJobAttributeValueChangeEvent", description = "MeasurementCollectionJob attributeValueChange Event payload", required = true) @Valid @RequestBody MeasurementCollectionJobAttributeValueChangeEvent measurementCollectionJobAttributeValueChangeEvent + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * POST /listener/measurementCollectionJobCreateEvent : Client listener for entity MeasurementCollectionJobCreateEvent + * Example of a client listener for receiving the notification MeasurementCollectionJobCreateEvent + * + * @param measurementCollectionJobCreateEvent MeasurementCollectionJob create Event payload (required) + * @return Notified (status code 204) + * or Error (status code 200) + */ + @Operation( + operationId = "measurementCollectionJobCreateEvent", + summary = "Client listener for entity MeasurementCollectionJobCreateEvent", + description = "Example of a client listener for receiving the notification MeasurementCollectionJobCreateEvent", + tags = { "notification listener" }, + responses = { + @ApiResponse(responseCode = "204", description = "Notified"), + @ApiResponse(responseCode = "default", description = "Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/listener/measurementCollectionJobCreateEvent", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<Void> measurementCollectionJobCreateEvent( + @Parameter(name = "MeasurementCollectionJobCreateEvent", description = "MeasurementCollectionJob create Event payload", required = true) @Valid @RequestBody MeasurementCollectionJobCreateEvent measurementCollectionJobCreateEvent + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * POST /listener/measurementCollectionJobDeleteEvent : Client listener for entity MeasurementCollectionJobDeleteEvent + * Example of a client listener for receiving the notification MeasurementCollectionJobDeleteEvent + * + * @param measurementCollectionJobDeleteEvent MeasurementCollectionJob delete Event payload (required) + * @return Notified (status code 204) + * or Error (status code 200) + */ + @Operation( + operationId = "measurementCollectionJobDeleteEvent", + summary = "Client listener for entity MeasurementCollectionJobDeleteEvent", + description = "Example of a client listener for receiving the notification MeasurementCollectionJobDeleteEvent", + tags = { "notification listener" }, + responses = { + @ApiResponse(responseCode = "204", description = "Notified"), + @ApiResponse(responseCode = "default", description = "Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/listener/measurementCollectionJobDeleteEvent", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<Void> measurementCollectionJobDeleteEvent( + @Parameter(name = "MeasurementCollectionJobDeleteEvent", description = "MeasurementCollectionJob delete Event payload", required = true) @Valid @RequestBody MeasurementCollectionJobDeleteEvent measurementCollectionJobDeleteEvent + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * POST /listener/measurementCollectionJobExecutionStateChangeEvent : Client listener for entity MeasurementCollectionJobExecutionStateChangeEvent + * Example of a client listener for receiving the notification MeasurementCollectionJobExecutionStateChangeEvent + * + * @param measurementCollectionJobExecutionStateChangeEvent MeasurementCollectionJob executionStateChange Event payload (required) + * @return Notified (status code 204) + * or Error (status code 200) + */ + @Operation( + operationId = "measurementCollectionJobExecutionStateChangeEvent", + summary = "Client listener for entity MeasurementCollectionJobExecutionStateChangeEvent", + description = "Example of a client listener for receiving the notification MeasurementCollectionJobExecutionStateChangeEvent", + tags = { "notification listener" }, + responses = { + @ApiResponse(responseCode = "204", description = "Notified"), + @ApiResponse(responseCode = "default", description = "Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/listener/measurementCollectionJobExecutionStateChangeEvent", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<Void> measurementCollectionJobExecutionStateChangeEvent( + @Parameter(name = "MeasurementCollectionJobExecutionStateChangeEvent", description = "MeasurementCollectionJob executionStateChange Event payload", required = true) @Valid @RequestBody MeasurementCollectionJobExecutionStateChangeEvent measurementCollectionJobExecutionStateChangeEvent + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * POST /listener/measurementCollectionJobFilesPreparationErrorEvent : Client listener for entity MeasurementCollectionJobFilesPreparationErrorEvent + * Example of a client listener for receiving the notification MeasurementCollectionJobFilesPreparationErrorEvent + * + * @param measurementCollectionJobFilesPreparationErrorEvent MeasurementCollectionJob filesPreparationError Event payload (required) + * @return Notified (status code 204) + * or Error (status code 200) + */ + @Operation( + operationId = "measurementCollectionJobFilesPreparationErrorEvent", + summary = "Client listener for entity MeasurementCollectionJobFilesPreparationErrorEvent", + description = "Example of a client listener for receiving the notification MeasurementCollectionJobFilesPreparationErrorEvent", + tags = { "notification listener" }, + responses = { + @ApiResponse(responseCode = "204", description = "Notified"), + @ApiResponse(responseCode = "default", description = "Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/listener/measurementCollectionJobFilesPreparationErrorEvent", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<Void> measurementCollectionJobFilesPreparationErrorEvent( + @Parameter(name = "MeasurementCollectionJobFilesPreparationErrorEvent", description = "MeasurementCollectionJob filesPreparationError Event payload", required = true) @Valid @RequestBody MeasurementCollectionJobFilesPreparationErrorEvent measurementCollectionJobFilesPreparationErrorEvent + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * POST /listener/measurementCollectionJobFilesReadyEvent : Client listener for entity MeasurementCollectionJobFilesReadyEvent + * Example of a client listener for receiving the notification MeasurementCollectionJobFilesReadyEvent + * + * @param measurementCollectionJobFilesReadyEvent MeasurementCollectionJob filesReady Event payload (required) + * @return Notified (status code 204) + * or Error (status code 200) + */ + @Operation( + operationId = "measurementCollectionJobFilesReadyEvent", + summary = "Client listener for entity MeasurementCollectionJobFilesReadyEvent", + description = "Example of a client listener for receiving the notification MeasurementCollectionJobFilesReadyEvent", + tags = { "notification listener" }, + responses = { + @ApiResponse(responseCode = "204", description = "Notified"), + @ApiResponse(responseCode = "default", description = "Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/listener/measurementCollectionJobFilesReadyEvent", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<Void> measurementCollectionJobFilesReadyEvent( + @Parameter(name = "MeasurementCollectionJobFilesReadyEvent", description = "MeasurementCollectionJob filesReady Event payload", required = true) @Valid @RequestBody MeasurementCollectionJobFilesReadyEvent measurementCollectionJobFilesReadyEvent + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * POST /listener/performanceMeasurementCollectionReadyEvent : Client listener for entity PerformanceMeasurementCollectionReadyEvent + * Example of a client listener for receiving the notification PerformanceMeasurementCollectionReadyEvent + * + * @param performanceMeasurementCollectionReadyEvent PerformanceMeasurement collectionReady Event payload (required) + * @return Notified (status code 204) + * or Error (status code 200) + */ + @Operation( + operationId = "performanceMeasurementCollectionReadyEvent", + summary = "Client listener for entity PerformanceMeasurementCollectionReadyEvent", + description = "Example of a client listener for receiving the notification PerformanceMeasurementCollectionReadyEvent", + tags = { "notification listener" }, + responses = { + @ApiResponse(responseCode = "204", description = "Notified"), + @ApiResponse(responseCode = "default", description = "Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/listener/performanceMeasurementCollectionReadyEvent", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<Void> performanceMeasurementCollectionReadyEvent( + @Parameter(name = "PerformanceMeasurementCollectionReadyEvent", description = "PerformanceMeasurement collectionReady Event payload", required = true) @Valid @RequestBody PerformanceMeasurementCollectionReadyEvent performanceMeasurementCollectionReadyEvent + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * POST /listener/performanceMeasurementCreateEvent : Client listener for entity PerformanceMeasurementCreateEvent + * Example of a client listener for receiving the notification PerformanceMeasurementCreateEvent + * + * @param performanceMeasurementCreateEvent PerformanceMeasurement create Event payload (required) + * @return Notified (status code 204) + * or Error (status code 200) + */ + @Operation( + operationId = "performanceMeasurementCreateEvent", + summary = "Client listener for entity PerformanceMeasurementCreateEvent", + description = "Example of a client listener for receiving the notification PerformanceMeasurementCreateEvent", + tags = { "notification listener" }, + responses = { + @ApiResponse(responseCode = "204", description = "Notified"), + @ApiResponse(responseCode = "default", description = "Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/listener/performanceMeasurementCreateEvent", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<Void> performanceMeasurementCreateEvent( + @Parameter(name = "PerformanceMeasurementCreateEvent", description = "PerformanceMeasurement create Event payload", required = true) @Valid @RequestBody PerformanceMeasurementCreateEvent performanceMeasurementCreateEvent + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/ListenerApiController.java b/src/main/java/org/etsi/osl/tmf/pm628/api/ListenerApiController.java new file mode 100644 index 0000000000000000000000000000000000000000..aab852d2b8a5ed0e91522911968fc0713e088092 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/ListenerApiController.java @@ -0,0 +1,28 @@ +package org.etsi.osl.tmf.pm628.api; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; + +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("ListenerApiController628") +@RequestMapping("/monitoring/v5") +public class ListenerApiController implements ListenerApi { + + private final NativeWebRequest request; + + @Autowired + public ListenerApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional<NativeWebRequest> getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApi.java b/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApi.java new file mode 100644 index 0000000000000000000000000000000000000000..e49e945b5590725be2958e8158def4abda998c76 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApi.java @@ -0,0 +1,692 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.6.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pm628.api; + +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.tags.Tag; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.common.model.Error; +import org.etsi.osl.tmf.pm628.model.MeasurementCollectionJob; +import org.etsi.osl.tmf.pm628.model.MeasurementCollectionJobFVO; +import org.etsi.osl.tmf.pm628.model.MeasurementCollectionJobMVO; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.annotation.Generated; +import java.util.List; +import java.util.Map; +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") +@Validated +@Tag(name = "measurementCollectionJob", description = "Operations for MeasurementCollectionJob Resource") +public interface MeasurementCollectionJobApi { + + default Optional<NativeWebRequest> getRequest() { + return Optional.empty(); + } + + /** + * POST /measurementCollectionJob : Creates a MeasurementCollectionJob + * This operation creates a MeasurementCollectionJob entity. + * + * @param measurementCollectionJobFVO The MeasurementCollectionJob to be created (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return OK/Created (status code 201) + * or Accepted (status code 202) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Conflict (status code 409) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "createMeasurementCollectionJob", + summary = "Creates a MeasurementCollectionJob", + description = "This operation creates a MeasurementCollectionJob entity.", + tags = { "measurementCollectionJob" }, + responses = { + @ApiResponse(responseCode = "201", description = "OK/Created", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MeasurementCollectionJob.class)) + }), + @ApiResponse(responseCode = "202", description = "Accepted"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/measurementCollectionJob", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<MeasurementCollectionJob> createMeasurementCollectionJob( + @Parameter(name = "MeasurementCollectionJobFVO", description = "The MeasurementCollectionJob to be created", required = true) @Valid @RequestBody MeasurementCollectionJobFVO measurementCollectionJobFVO, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"jobOnDemand\" : false, \"jobCollectionFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"searchTaskFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"outputFormat\" : \"outputFormat\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * DELETE /measurementCollectionJob/{id} : Deletes a MeasurementCollectionJob + * This operation deletes a MeasurementCollectionJob entity. + * + * @param id Identifier of the Resource (required) + * @return Accepted (status code 202) + * or Deleted (status code 204) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Conflict (status code 409) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "deleteMeasurementCollectionJob", + summary = "Deletes a MeasurementCollectionJob", + description = "This operation deletes a MeasurementCollectionJob entity.", + tags = { "measurementCollectionJob" }, + responses = { + @ApiResponse(responseCode = "202", description = "Accepted"), + @ApiResponse(responseCode = "204", description = "Deleted"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.DELETE, + value = "/measurementCollectionJob/{id}", + produces = { "application/json" } + ) + + default ResponseEntity<Void> deleteMeasurementCollectionJob( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /measurementCollectionJob : List or find MeasurementCollectionJob objects + * List or find MeasurementCollectionJob objects + * + * @param fields Comma-separated properties to be provided in response (optional) + * @param offset Requested index for start of resources to be provided in response (optional) + * @param limit Requested number of resources to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "listMeasurementCollectionJob", + summary = "List or find MeasurementCollectionJob objects", + description = "List or find MeasurementCollectionJob objects", + tags = { "measurementCollectionJob" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = MeasurementCollectionJob.class))) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/measurementCollectionJob", + produces = { "application/json" } + ) + + default ResponseEntity<List<MeasurementCollectionJob>> listMeasurementCollectionJob( + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields, + @Parameter(name = "allParams", description = "Filters to be applied in the query", in = ParameterIn.QUERY) @Valid @RequestParam(value = "allParams", required = false) Map<String, String> allParams, + @Parameter(name = "offset", description = "Requested index for start of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "offset", required = false) Integer offset, + @Parameter(name = "limit", description = "Requested number of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false) Integer limit + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"jobOnDemand\" : false, \"jobCollectionFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"searchTaskFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"outputFormat\" : \"outputFormat\" }, { \"jobOnDemand\" : false, \"jobCollectionFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"searchTaskFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"outputFormat\" : \"outputFormat\" } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * PATCH /measurementCollectionJob/{id} : Updates partially a MeasurementCollectionJob + * This operation updates partially a MeasurementCollectionJob entity. + * + * @param id Identifier of the Resource (required) + * @param measurementCollectionJobMVO The MeasurementCollectionJob to be patched (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return Success (status code 200) + * or Accepted (status code 202) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Conflict (status code 409) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "patchMeasurementCollectionJob", + summary = "Updates partially a MeasurementCollectionJob", + description = "This operation updates partially a MeasurementCollectionJob entity.", + tags = { "measurementCollectionJob" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MeasurementCollectionJob.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = MeasurementCollectionJob.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = MeasurementCollectionJob.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = MeasurementCollectionJob.class)) + }), + @ApiResponse(responseCode = "202", description = "Accepted"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.PATCH, + value = "/measurementCollectionJob/{id}", + produces = { "application/json", "application/merge-patch+json", "application/json-patch+json", "application/json-patch-query+json" }, + consumes = { "application/json", "application/merge-patch+json", "application/json-patch+json", "application/json-patch-query+json" } + ) + + default ResponseEntity<MeasurementCollectionJob> patchMeasurementCollectionJob( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "MeasurementCollectionJobMVO", description = "The MeasurementCollectionJob to be patched", required = true) @Valid @RequestBody MeasurementCollectionJobMVO measurementCollectionJobMVO, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"jobOnDemand\" : false, \"jobCollectionFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"searchTaskFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"outputFormat\" : \"outputFormat\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json-patch+json"))) { + String exampleString = "{ \"jobOnDemand\" : false, \"jobCollectionFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"searchTaskFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"outputFormat\" : \"outputFormat\" }"; + ApiUtil.setExampleResponse(request, "application/json-patch+json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json-patch-query+json"))) { + String exampleString = "{ \"jobOnDemand\" : false, \"jobCollectionFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"searchTaskFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"outputFormat\" : \"outputFormat\" }"; + ApiUtil.setExampleResponse(request, "application/json-patch-query+json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/merge-patch+json"))) { + String exampleString = "Custom MIME type example not yet supported: application/merge-patch+json"; + ApiUtil.setExampleResponse(request, "application/merge-patch+json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /measurementCollectionJob/{id} : Retrieves a MeasurementCollectionJob by ID + * This operation retrieves a MeasurementCollectionJob entity. Attribute selection enabled for all first level attributes. + * + * @param id Identifier of the Resource (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "retrieveMeasurementCollectionJob", + summary = "Retrieves a MeasurementCollectionJob by ID", + description = "This operation retrieves a MeasurementCollectionJob entity. Attribute selection enabled for all first level attributes.", + tags = { "measurementCollectionJob" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = MeasurementCollectionJob.class)) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/measurementCollectionJob/{id}", + produces = { "application/json" } + ) + + default ResponseEntity<MeasurementCollectionJob> retrieveMeasurementCollectionJob( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"jobOnDemand\" : false, \"jobCollectionFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"searchTaskFilter\" : { \"mappings\" : [ { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } }, { \"filterTemplate\" : { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"name\" : \"name\", \"description\" : \"description\", \"id\" : \"6c088cf7f1bc\", \"href\" : \"https://host/dataFilerTemplate/6c088cf7f1bc\", \"@schemaLocation\" : \"@schemaLocation\" }, \"stringArray\" : { \"valueType\" : \"valueType\", \"value\" : [ \"Dallas\", \"Houston\", \"Paris\" ] } } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\" }, \"outputFormat\" : \"outputFormat\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApiController.java b/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApiController.java new file mode 100644 index 0000000000000000000000000000000000000000..f23964e5bed8bf11da16c34ca98d5c6b4f0a3557 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApiController.java @@ -0,0 +1,126 @@ +package org.etsi.osl.tmf.pm628.api; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.pm628.model.MeasurementCollectionJob; +import org.etsi.osl.tmf.pm628.model.MeasurementCollectionJobFVO; +import org.etsi.osl.tmf.pm628.model.MeasurementCollectionJobMVO; +import org.etsi.osl.tmf.pm628.reposervices.MeasurementCollectionJobService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.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.context.request.NativeWebRequest; + +import javax.annotation.Generated; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +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 +@RequestMapping("/monitoring/v5") +public class MeasurementCollectionJobApiController implements MeasurementCollectionJobApi { + + private static final Logger log = LoggerFactory.getLogger(MeasurementCollectionJobApiController.class); + + private final NativeWebRequest request; + + @Autowired + MeasurementCollectionJobService measurementCollectionJobService; + + @Autowired + public MeasurementCollectionJobApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional<NativeWebRequest> getRequest() { + return Optional.ofNullable(request); + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<MeasurementCollectionJob> createMeasurementCollectionJob( + @Parameter(name = "MeasurementCollectionJobFVO", description = "The MeasurementCollectionJob to be created", required = true) @Valid @RequestBody MeasurementCollectionJobFVO measurementCollectionJobFVO, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + try { + return new ResponseEntity<MeasurementCollectionJob>(measurementCollectionJobService.createMeasurementCollectionJob(measurementCollectionJobFVO), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<MeasurementCollectionJob>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<Void> deleteMeasurementCollectionJob( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id + ) { + try { + return new ResponseEntity<Void>(measurementCollectionJobService.deleteMeasurementCollectionJob(id), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<Void>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<List<MeasurementCollectionJob>> listMeasurementCollectionJob( + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields, + @Parameter(name = "allParams", description = "Filters to be applied in the query", in = ParameterIn.QUERY) @Valid @RequestParam(value = "allParams", required = false) Map<String, String> allParams, + @Parameter(name = "offset", description = "Requested index for start of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "offset", required = false) Integer offset, + @Parameter(name = "limit", description = "Requested number of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false) Integer limit + ) { + try { + if (allParams == null) + allParams = new HashMap<>(); + + return new ResponseEntity<List<MeasurementCollectionJob>>(measurementCollectionJobService.findAll(fields, allParams), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<List<MeasurementCollectionJob>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<MeasurementCollectionJob> patchMeasurementCollectionJob( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "MeasurementCollectionJobMVO", description = "The MeasurementCollectionJob to be patched", required = true) @Valid @RequestBody MeasurementCollectionJobMVO measurementCollectionJobMVO, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + try { + return new ResponseEntity<MeasurementCollectionJob>(measurementCollectionJobService.updateMeasurementCollectionJob(id, measurementCollectionJobMVO), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<MeasurementCollectionJob>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<MeasurementCollectionJob> retrieveMeasurementCollectionJob( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + try { + return new ResponseEntity<MeasurementCollectionJob>(measurementCollectionJobService.findMeasurementCollectionJobByUuid(id), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<MeasurementCollectionJob>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApiRouteBuilder.java b/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApiRouteBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..0e5e1c7d8c6b5588cfdba1fa185b0c3b1bb695fa --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApiRouteBuilder.java @@ -0,0 +1,93 @@ +package org.etsi.osl.tmf.pm628.api; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.ObjectMapper; +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.pm628.model.MeasurementCollectionJobFVO; +import org.etsi.osl.tmf.pm628.model.MeasurementCollectionJobMVO; +import org.etsi.osl.tmf.pm628.reposervices.MeasurementCollectionJobService; +import org.etsi.osl.tmf.pm628.api.MeasurementCollectionJobApiRouteBuilder; +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 java.io.IOException; + +@Configuration +@Component +public class MeasurementCollectionJobApiRouteBuilder extends RouteBuilder { + + private static final transient Log logger = LogFactory.getLog(MeasurementCollectionJobApiRouteBuilder.class.getName()); + + @Value("${PM_MEASUREMENT_COLLECTION_JOBS_GET}") + private String PM_GET_MEASUREMENT_COLLECTION_JOBS; + + @Value("${PM_MEASUREMENT_COLLECTION_GET_JOB_BY_ID}") + private String PM_GET_MEASUREMENT_COLLECTION_JOB_BY_ID; + + @Value("${PM_MEASUREMENT_COLLECTION_JOB_ADD}") + private String PM_ADD_MEASUREMENT_COLLECTION_JOB; + + @Value("${PM_MEASUREMENT_COLLECTION_JOB_CREATED}") + private String PM_CREATED_MEASUREMENT_COLLECTION_JOB; + + @Value("${PM_MEASUREMENT_COLLECTION_JOB_UPDATE}") + private String PM_UPDATE_MEASUREMENT_COLLECTION_JOB; + + @Autowired + private ProducerTemplate template; + + @Autowired + MeasurementCollectionJobService measurementCollectionJobService; + + @Autowired + private CentralLogger centralLogger; + + @Override + public void configure() throws Exception { + from(PM_GET_MEASUREMENT_COLLECTION_JOBS) + .log(LoggingLevel.INFO, log, PM_GET_MEASUREMENT_COLLECTION_JOBS + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true") + .bean(measurementCollectionJobService, "findAllMeasurementCollectionJobs") + .convertBodyTo( String.class ); + + from(PM_GET_MEASUREMENT_COLLECTION_JOB_BY_ID) + .log(LoggingLevel.INFO, log, PM_GET_MEASUREMENT_COLLECTION_JOB_BY_ID + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true") + .bean(measurementCollectionJobService, "findMeasurementCollectionJobByUuid") + .convertBodyTo( String.class ); + + from(PM_ADD_MEASUREMENT_COLLECTION_JOB) + .log(LoggingLevel.INFO, log, PM_ADD_MEASUREMENT_COLLECTION_JOB + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true").unmarshal() + .json(JsonLibrary.Jackson, MeasurementCollectionJobFVO.class, true) + .bean(measurementCollectionJobService, "createMeasurementCollectionJob(${body})") + .convertBodyTo( String.class ); + + from(PM_UPDATE_MEASUREMENT_COLLECTION_JOB) + .log(LoggingLevel.INFO, log, PM_UPDATE_MEASUREMENT_COLLECTION_JOB + " message received!") + .to("log:DEBUG?showBody=true&showHeaders=true").unmarshal() + .json(JsonLibrary.Jackson, MeasurementCollectionJobMVO.class, true) + .bean(measurementCollectionJobService, "updateMeasurementCollectionJob(${header.mcjid}, ${body})") + .convertBodyTo( String.class ); + } + + static String toJsonString(Object object) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + return mapper.writeValueAsString(object); + } + + static <T> T toJsonObj(String content, Class<T> valueType) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + return mapper.readValue( content, valueType); + } +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApiRouteBuilderEvents.java b/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApiRouteBuilderEvents.java new file mode 100644 index 0000000000000000000000000000000000000000..8bbb2fbd8bcea828db4e0083c5db9815870bcceb --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/MeasurementCollectionJobApiRouteBuilderEvents.java @@ -0,0 +1,103 @@ +package org.etsi.osl.tmf.pm628.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.pm628.model.*; +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 MeasurementCollectionJobApiRouteBuilderEvents extends RouteBuilder{ + + private static final transient Log logger = LogFactory.getLog(MeasurementCollectionJobApiRouteBuilderEvents.class.getName()); + + + @Value("${EVENT_MEASUREMENT_COLLECTION_JOB_CREATE}") + private String EVENT_MEASUREMENT_COLLECTION_JOB_CREATE=""; + + @Value("${EVENT_MEASUREMENT_COLLECTION_JOB_DELETE}") + private String EVENT_MEASUREMENT_COLLECTION_JOB_DELETE=""; + + @Value("${EVENT_MEASUREMENT_COLLECTION_JOB_ATTRIBUTE_VALUE_CHANGED}") + private String EVENT_MEASUREMENT_COLLECTION_JOB_ATTRIBUTE_VALUE_CHANGED=""; + + @Value("${EVENT_MEASUREMENT_COLLECTION_JOB_EXECUTION_STATE_CHANGED}") + private String EVENT_MEASUREMENT_COLLECTION_JOB_EXECUTION_STATE_CHANGED=""; + + @Value("${spring.application.name}") + private String compname; + + @Autowired + private ProducerTemplate template; + + + @Autowired + private CentralLogger centralLogger; + + @Override + public void configure() throws Exception { + + } + + @Transactional public void publishEvent(final Event event, final String objId) { + event.setEventType(event.getClass().getName()); + logger.info("will send Event for type " + event.getEventType()); + + try{ + String msgtopic = ""; + + if (event instanceof MeasurementCollectionJobCreateEvent) { + msgtopic = EVENT_MEASUREMENT_COLLECTION_JOB_CREATE; + } else if (event instanceof MeasurementCollectionJobDeleteEvent) { + msgtopic = EVENT_MEASUREMENT_COLLECTION_JOB_DELETE; + } else if (event instanceof MeasurementCollectionJobAttributeValueChangeEvent) { + msgtopic = EVENT_MEASUREMENT_COLLECTION_JOB_ATTRIBUTE_VALUE_CHANGED; + } else if (event instanceof MeasurementCollectionJobExecutionStateChangeEvent) { + msgtopic = EVENT_MEASUREMENT_COLLECTION_JOB_EXECUTION_STATE_CHANGED; + } + + Map<String, Object> map = new HashMap<>(); + map.put("eventid", event.getEventId() ); + map.put("objId", objId ); //measurementcollectionjob id + + String apayload = toJsonString(event); + 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); + } + + static <T> T toJsonObj(String content, Class<T> valueType) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + return mapper.readValue( content, valueType); + } +} + + diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorGroupSpecificationApi.java b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorGroupSpecificationApi.java new file mode 100644 index 0000000000000000000000000000000000000000..e25a866c67752dbe03b4e46b7e393bb6f4e4b6cf --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorGroupSpecificationApi.java @@ -0,0 +1,690 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.6.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pm628.api; + +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.tags.Tag; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.common.model.Error; +import org.etsi.osl.tmf.pm628.model.PerformanceIndicatorGroupSpecification; +import org.etsi.osl.tmf.pm628.model.PerformanceIndicatorGroupSpecificationFVO; +import org.etsi.osl.tmf.pm628.model.PerformanceIndicatorGroupSpecificationMVO; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.annotation.Generated; +import java.util.List; +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") +@Validated +@Tag(name = "performanceIndicatorGroupSpecification", description = "Operations for PerformanceIndicatorGroupSpecification Resource") +public interface PerformanceIndicatorGroupSpecificationApi { + + default Optional<NativeWebRequest> getRequest() { + return Optional.empty(); + } + + /** + * POST /performanceIndicatorGroupSpecification : Creates a PerformanceIndicatorGroupSpecification + * This operation creates a PerformanceIndicatorGroupSpecification entity. + * + * @param performanceIndicatorGroupSpecificationFVO The PerformanceIndicatorGroupSpecification to be created (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return OK/Created (status code 201) + * or Accepted (status code 202) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Conflict (status code 409) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "createPerformanceIndicatorGroupSpecification", + summary = "Creates a PerformanceIndicatorGroupSpecification", + description = "This operation creates a PerformanceIndicatorGroupSpecification entity.", + tags = { "performanceIndicatorGroupSpecification" }, + responses = { + @ApiResponse(responseCode = "201", description = "OK/Created", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PerformanceIndicatorGroupSpecification.class)) + }), + @ApiResponse(responseCode = "202", description = "Accepted"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/performanceIndicatorGroupSpecification", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<PerformanceIndicatorGroupSpecification> createPerformanceIndicatorGroupSpecification( + @Parameter(name = "PerformanceIndicatorGroupSpecificationFVO", description = "The PerformanceIndicatorGroupSpecification to be created", required = true) @Valid @RequestBody PerformanceIndicatorGroupSpecificationFVO performanceIndicatorGroupSpecificationFVO, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"groupCategory\" : \"groupCategory\", \"name\" : \"name\", \"href\" : \"href\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\", \"performanceIndicatorSpecification\" : [ { \"version\" : \"version\" }, { \"version\" : \"version\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * DELETE /performanceIndicatorGroupSpecification/{id} : Deletes a PerformanceIndicatorGroupSpecification + * This operation deletes a PerformanceIndicatorGroupSpecification entity. + * + * @param id Identifier of the Resource (required) + * @return Accepted (status code 202) + * or Deleted (status code 204) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Conflict (status code 409) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "deletePerformanceIndicatorGroupSpecification", + summary = "Deletes a PerformanceIndicatorGroupSpecification", + description = "This operation deletes a PerformanceIndicatorGroupSpecification entity.", + tags = { "performanceIndicatorGroupSpecification" }, + responses = { + @ApiResponse(responseCode = "202", description = "Accepted"), + @ApiResponse(responseCode = "204", description = "Deleted"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.DELETE, + value = "/performanceIndicatorGroupSpecification/{id}", + produces = { "application/json" } + ) + + default ResponseEntity<Void> deletePerformanceIndicatorGroupSpecification( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /performanceIndicatorGroupSpecification : List or find PerformanceIndicatorGroupSpecification objects + * List or find PerformanceIndicatorGroupSpecification objects + * + * @param fields Comma-separated properties to be provided in response (optional) + * @param offset Requested index for start of resources to be provided in response (optional) + * @param limit Requested number of resources to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "listPerformanceIndicatorGroupSpecification", + summary = "List or find PerformanceIndicatorGroupSpecification objects", + description = "List or find PerformanceIndicatorGroupSpecification objects", + tags = { "performanceIndicatorGroupSpecification" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = PerformanceIndicatorGroupSpecification.class))) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/performanceIndicatorGroupSpecification", + produces = { "application/json" } + ) + + default ResponseEntity<List<PerformanceIndicatorGroupSpecification>> listPerformanceIndicatorGroupSpecification( + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields, + @Parameter(name = "offset", description = "Requested index for start of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "offset", required = false) Integer offset, + @Parameter(name = "limit", description = "Requested number of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false) Integer limit + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"groupCategory\" : \"groupCategory\", \"name\" : \"name\", \"href\" : \"href\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\", \"performanceIndicatorSpecification\" : [ { \"version\" : \"version\" }, { \"version\" : \"version\" } ] }, { \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"groupCategory\" : \"groupCategory\", \"name\" : \"name\", \"href\" : \"href\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\", \"performanceIndicatorSpecification\" : [ { \"version\" : \"version\" }, { \"version\" : \"version\" } ] } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * PATCH /performanceIndicatorGroupSpecification/{id} : Updates partially a PerformanceIndicatorGroupSpecification + * This operation updates partially a PerformanceIndicatorGroupSpecification entity. + * + * @param id Identifier of the Resource (required) + * @param performanceIndicatorGroupSpecificationMVO The PerformanceIndicatorGroupSpecification to be patched (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return Success (status code 200) + * or Accepted (status code 202) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Conflict (status code 409) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "patchPerformanceIndicatorGroupSpecification", + summary = "Updates partially a PerformanceIndicatorGroupSpecification", + description = "This operation updates partially a PerformanceIndicatorGroupSpecification entity.", + tags = { "performanceIndicatorGroupSpecification" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PerformanceIndicatorGroupSpecification.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = PerformanceIndicatorGroupSpecification.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = PerformanceIndicatorGroupSpecification.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = PerformanceIndicatorGroupSpecification.class)) + }), + @ApiResponse(responseCode = "202", description = "Accepted"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.PATCH, + value = "/performanceIndicatorGroupSpecification/{id}", + produces = { "application/json", "application/merge-patch+json", "application/json-patch+json", "application/json-patch-query+json" }, + consumes = { "application/json", "application/merge-patch+json", "application/json-patch+json", "application/json-patch-query+json" } + ) + + default ResponseEntity<PerformanceIndicatorGroupSpecification> patchPerformanceIndicatorGroupSpecification( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "PerformanceIndicatorGroupSpecificationMVO", description = "The PerformanceIndicatorGroupSpecification to be patched", required = true) @Valid @RequestBody PerformanceIndicatorGroupSpecificationMVO performanceIndicatorGroupSpecificationMVO, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"groupCategory\" : \"groupCategory\", \"name\" : \"name\", \"href\" : \"href\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\", \"performanceIndicatorSpecification\" : [ { \"version\" : \"version\" }, { \"version\" : \"version\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json-patch+json"))) { + String exampleString = "{ \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"groupCategory\" : \"groupCategory\", \"name\" : \"name\", \"href\" : \"href\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\", \"performanceIndicatorSpecification\" : [ { \"version\" : \"version\" }, { \"version\" : \"version\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json-patch+json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json-patch-query+json"))) { + String exampleString = "{ \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"groupCategory\" : \"groupCategory\", \"name\" : \"name\", \"href\" : \"href\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\", \"performanceIndicatorSpecification\" : [ { \"version\" : \"version\" }, { \"version\" : \"version\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json-patch-query+json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/merge-patch+json"))) { + String exampleString = "Custom MIME type example not yet supported: application/merge-patch+json"; + ApiUtil.setExampleResponse(request, "application/merge-patch+json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /performanceIndicatorGroupSpecification/{id} : Retrieves a PerformanceIndicatorGroupSpecification by ID + * This operation retrieves a PerformanceIndicatorGroupSpecification entity. Attribute selection enabled for all first level attributes. + * + * @param id Identifier of the Resource (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "retrievePerformanceIndicatorGroupSpecification", + summary = "Retrieves a PerformanceIndicatorGroupSpecification by ID", + description = "This operation retrieves a PerformanceIndicatorGroupSpecification entity. Attribute selection enabled for all first level attributes.", + tags = { "performanceIndicatorGroupSpecification" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PerformanceIndicatorGroupSpecification.class)) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/performanceIndicatorGroupSpecification/{id}", + produces = { "application/json" } + ) + + default ResponseEntity<PerformanceIndicatorGroupSpecification> retrievePerformanceIndicatorGroupSpecification( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"groupCategory\" : \"groupCategory\", \"name\" : \"name\", \"href\" : \"href\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\", \"performanceIndicatorSpecification\" : [ { \"version\" : \"version\" }, { \"version\" : \"version\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorGroupSpecificationApiController.java b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorGroupSpecificationApiController.java new file mode 100644 index 0000000000000000000000000000000000000000..03a4e52746ec4ea3fc1e460404975d0da98a3f0a --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorGroupSpecificationApiController.java @@ -0,0 +1,28 @@ +package org.etsi.osl.tmf.pm628.api; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; + +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 +@RequestMapping("/performance/v5") +public class PerformanceIndicatorGroupSpecificationApiController implements PerformanceIndicatorGroupSpecificationApi { + + private final NativeWebRequest request; + + @Autowired + public PerformanceIndicatorGroupSpecificationApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional<NativeWebRequest> getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorSpecificationApi.java b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorSpecificationApi.java new file mode 100755 index 0000000000000000000000000000000000000000..f5c96ef885b2e767fc01120c1385a568ce0e6930 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorSpecificationApi.java @@ -0,0 +1,690 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.6.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pm628.api; + +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.tags.Tag; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.common.model.Error; +import org.etsi.osl.tmf.pm628.model.PerformanceIndicatorSpecification; +import org.etsi.osl.tmf.pm628.model.PerformanceIndicatorSpecificationFVO; +import org.etsi.osl.tmf.pm628.model.PerformanceIndicatorSpecificationMVO; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.annotation.Generated; +import java.util.List; +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") +@Validated +@Tag(name = "performanceIndicatorSpecification", description = "Operations for PerformanceIndicatorSpecification Resource") +public interface PerformanceIndicatorSpecificationApi { + + default Optional<NativeWebRequest> getRequest() { + return Optional.empty(); + } + + /** + * POST /performanceIndicatorSpecification : Creates a PerformanceIndicatorSpecification + * This operation creates a PerformanceIndicatorSpecification entity. + * + * @param performanceIndicatorSpecificationFVO The PerformanceIndicatorSpecification to be created (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return OK/Created (status code 201) + * or Accepted (status code 202) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Conflict (status code 409) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "createPerformanceIndicatorSpecification", + summary = "Creates a PerformanceIndicatorSpecification", + description = "This operation creates a PerformanceIndicatorSpecification entity.", + tags = { "performanceIndicatorSpecification" }, + responses = { + @ApiResponse(responseCode = "201", description = "OK/Created", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PerformanceIndicatorSpecification.class)) + }), + @ApiResponse(responseCode = "202", description = "Accepted"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.POST, + value = "/performanceIndicatorSpecification", + produces = { "application/json" }, + consumes = { "application/json" } + ) + + default ResponseEntity<PerformanceIndicatorSpecification> createPerformanceIndicatorSpecification( + @Parameter(name = "PerformanceIndicatorSpecificationFVO", description = "The PerformanceIndicatorSpecification to be created", required = true) @Valid @RequestBody PerformanceIndicatorSpecificationFVO performanceIndicatorSpecificationFVO, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"derivationAlgorithm\" : \"derivationAlgorithm\", \"derivationMethod\" : \"derivationMethod\", \"performanceIndicatorSpecRelationship\" : [ { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } }, { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } } ], \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"name\" : \"name\", \"description\" : \"description\", \"perspective\" : \"perspective\", \"indicatorCategory\" : \"indicatorCategory\", \"indicatorUnit\" : \"indicatorUnit\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * DELETE /performanceIndicatorSpecification/{id} : Deletes a PerformanceIndicatorSpecification + * This operation deletes a PerformanceIndicatorSpecification entity. + * + * @param id Identifier of the Resource (required) + * @return Accepted (status code 202) + * or Deleted (status code 204) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Conflict (status code 409) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "deletePerformanceIndicatorSpecification", + summary = "Deletes a PerformanceIndicatorSpecification", + description = "This operation deletes a PerformanceIndicatorSpecification entity.", + tags = { "performanceIndicatorSpecification" }, + responses = { + @ApiResponse(responseCode = "202", description = "Accepted"), + @ApiResponse(responseCode = "204", description = "Deleted"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.DELETE, + value = "/performanceIndicatorSpecification/{id}", + produces = { "application/json" } + ) + + default ResponseEntity<Void> deletePerformanceIndicatorSpecification( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /performanceIndicatorSpecification : List or find PerformanceIndicatorSpecification objects + * List or find PerformanceIndicatorSpecification objects + * + * @param fields Comma-separated properties to be provided in response (optional) + * @param offset Requested index for start of resources to be provided in response (optional) + * @param limit Requested number of resources to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "listPerformanceIndicatorSpecification", + summary = "List or find PerformanceIndicatorSpecification objects", + description = "List or find PerformanceIndicatorSpecification objects", + tags = { "performanceIndicatorSpecification" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = PerformanceIndicatorSpecification.class))) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/performanceIndicatorSpecification", + produces = { "application/json" } + ) + + default ResponseEntity<List<PerformanceIndicatorSpecification>> listPerformanceIndicatorSpecification( + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields, + @Parameter(name = "offset", description = "Requested index for start of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "offset", required = false) Integer offset, + @Parameter(name = "limit", description = "Requested number of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false) Integer limit + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"derivationAlgorithm\" : \"derivationAlgorithm\", \"derivationMethod\" : \"derivationMethod\", \"performanceIndicatorSpecRelationship\" : [ { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } }, { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } } ], \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"name\" : \"name\", \"description\" : \"description\", \"perspective\" : \"perspective\", \"indicatorCategory\" : \"indicatorCategory\", \"indicatorUnit\" : \"indicatorUnit\" }, { \"derivationAlgorithm\" : \"derivationAlgorithm\", \"derivationMethod\" : \"derivationMethod\", \"performanceIndicatorSpecRelationship\" : [ { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } }, { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } } ], \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"name\" : \"name\", \"description\" : \"description\", \"perspective\" : \"perspective\", \"indicatorCategory\" : \"indicatorCategory\", \"indicatorUnit\" : \"indicatorUnit\" } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * PATCH /performanceIndicatorSpecification/{id} : Updates partially a PerformanceIndicatorSpecification + * This operation updates partially a PerformanceIndicatorSpecification entity. + * + * @param id Identifier of the Resource (required) + * @param performanceIndicatorSpecificationMVO The PerformanceIndicatorSpecification to be patched (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return Success (status code 200) + * or Accepted (status code 202) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Conflict (status code 409) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "patchPerformanceIndicatorSpecification", + summary = "Updates partially a PerformanceIndicatorSpecification", + description = "This operation updates partially a PerformanceIndicatorSpecification entity.", + tags = { "performanceIndicatorSpecification" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PerformanceIndicatorSpecification.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = PerformanceIndicatorSpecification.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = PerformanceIndicatorSpecification.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = PerformanceIndicatorSpecification.class)) + }), + @ApiResponse(responseCode = "202", description = "Accepted"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/merge-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch+json", schema = @Schema(implementation = Error.class)), + @Content(mediaType = "application/json-patch-query+json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.PATCH, + value = "/performanceIndicatorSpecification/{id}", + produces = { "application/json", "application/merge-patch+json", "application/json-patch+json", "application/json-patch-query+json" }, + consumes = { "application/json", "application/merge-patch+json", "application/json-patch+json", "application/json-patch-query+json" } + ) + + default ResponseEntity<PerformanceIndicatorSpecification> patchPerformanceIndicatorSpecification( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "PerformanceIndicatorSpecificationMVO", description = "The PerformanceIndicatorSpecification to be patched", required = true) @Valid @RequestBody PerformanceIndicatorSpecificationMVO performanceIndicatorSpecificationMVO, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"derivationAlgorithm\" : \"derivationAlgorithm\", \"derivationMethod\" : \"derivationMethod\", \"performanceIndicatorSpecRelationship\" : [ { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } }, { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } } ], \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"name\" : \"name\", \"description\" : \"description\", \"perspective\" : \"perspective\", \"indicatorCategory\" : \"indicatorCategory\", \"indicatorUnit\" : \"indicatorUnit\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json-patch+json"))) { + String exampleString = "{ \"derivationAlgorithm\" : \"derivationAlgorithm\", \"derivationMethod\" : \"derivationMethod\", \"performanceIndicatorSpecRelationship\" : [ { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } }, { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } } ], \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"name\" : \"name\", \"description\" : \"description\", \"perspective\" : \"perspective\", \"indicatorCategory\" : \"indicatorCategory\", \"indicatorUnit\" : \"indicatorUnit\" }"; + ApiUtil.setExampleResponse(request, "application/json-patch+json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json-patch-query+json"))) { + String exampleString = "{ \"derivationAlgorithm\" : \"derivationAlgorithm\", \"derivationMethod\" : \"derivationMethod\", \"performanceIndicatorSpecRelationship\" : [ { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } }, { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } } ], \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"name\" : \"name\", \"description\" : \"description\", \"perspective\" : \"perspective\", \"indicatorCategory\" : \"indicatorCategory\", \"indicatorUnit\" : \"indicatorUnit\" }"; + ApiUtil.setExampleResponse(request, "application/json-patch-query+json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/merge-patch+json"))) { + String exampleString = "Custom MIME type example not yet supported: application/merge-patch+json"; + ApiUtil.setExampleResponse(request, "application/merge-patch+json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /performanceIndicatorSpecification/{id} : Retrieves a PerformanceIndicatorSpecification by ID + * This operation retrieves a PerformanceIndicatorSpecification entity. Attribute selection enabled for all first level attributes. + * + * @param id Identifier of the Resource (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "retrievePerformanceIndicatorSpecification", + summary = "Retrieves a PerformanceIndicatorSpecification by ID", + description = "This operation retrieves a PerformanceIndicatorSpecification entity. Attribute selection enabled for all first level attributes.", + tags = { "performanceIndicatorSpecification" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PerformanceIndicatorSpecification.class)) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/performanceIndicatorSpecification/{id}", + produces = { "application/json" } + ) + + default ResponseEntity<PerformanceIndicatorSpecification> retrievePerformanceIndicatorSpecification( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"derivationAlgorithm\" : \"derivationAlgorithm\", \"derivationMethod\" : \"derivationMethod\", \"performanceIndicatorSpecRelationship\" : [ { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } }, { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" } } ], \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"name\" : \"name\", \"description\" : \"description\", \"perspective\" : \"perspective\", \"indicatorCategory\" : \"indicatorCategory\", \"indicatorUnit\" : \"indicatorUnit\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorSpecificationApiController.java b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorSpecificationApiController.java new file mode 100755 index 0000000000000000000000000000000000000000..d86b31fdbf108dab0889a1f92f291e8d91bf68e4 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceIndicatorSpecificationApiController.java @@ -0,0 +1,123 @@ +package org.etsi.osl.tmf.pm628.api; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.pm628.model.MeasurementCollectionJob; +import org.etsi.osl.tmf.pm628.model.PerformanceIndicatorSpecification; +import org.etsi.osl.tmf.pm628.model.PerformanceIndicatorSpecificationFVO; +import org.etsi.osl.tmf.pm628.model.PerformanceIndicatorSpecificationMVO; +import org.etsi.osl.tmf.pm628.reposervices.PerformanceIndicatorSpecificationService; +import org.etsi.osl.tmf.pm628.api.PerformanceIndicatorSpecificationApiController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.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.context.request.NativeWebRequest; + +import javax.annotation.Generated; +import java.util.List; +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 +@RequestMapping("/performance/v5") +public class PerformanceIndicatorSpecificationApiController implements PerformanceIndicatorSpecificationApi { + + private static final Logger log = LoggerFactory.getLogger(PerformanceIndicatorSpecificationApiController.class); + + private final NativeWebRequest request; + + @Autowired + PerformanceIndicatorSpecificationService performanceIndicatorSpecificationService; + + @Autowired + public PerformanceIndicatorSpecificationApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional<NativeWebRequest> getRequest() { + return Optional.ofNullable(request); + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<PerformanceIndicatorSpecification> createPerformanceIndicatorSpecification( + @Parameter(name = "PerformanceIndicatorSpecificationFVO", description = "The PerformanceIndicatorSpecification to be created", required = true) @Valid @RequestBody PerformanceIndicatorSpecificationFVO performanceIndicatorSpecificationFVO, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + try { + return new ResponseEntity<PerformanceIndicatorSpecification>(performanceIndicatorSpecificationService.createPerformanceIndicatorSpecification(performanceIndicatorSpecificationFVO), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<PerformanceIndicatorSpecification>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<Void> deletePerformanceIndicatorSpecification( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id + ) { + try { + return new ResponseEntity<Void>(performanceIndicatorSpecificationService.deletePerformanceIndicatorSpecification(id), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<Void>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<List<PerformanceIndicatorSpecification>> listPerformanceIndicatorSpecification( + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields, + @Parameter(name = "offset", description = "Requested index for start of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "offset", required = false) Integer offset, + @Parameter(name = "limit", description = "Requested number of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false) Integer limit + ) { + try { + // #TODO: Add parameters to findAllPerformanceIndicatorSpecifications + return new ResponseEntity<List<PerformanceIndicatorSpecification>>(performanceIndicatorSpecificationService.findAllPerformanceIndicatorSpecifications(), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<List<PerformanceIndicatorSpecification>>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<PerformanceIndicatorSpecification> patchPerformanceIndicatorSpecification( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "PerformanceIndicatorSpecificationMVO", description = "The PerformanceIndicatorSpecification to be patched", required = true) @Valid @RequestBody PerformanceIndicatorSpecificationMVO performanceIndicatorSpecificationMVO, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + try { + return new ResponseEntity<PerformanceIndicatorSpecification>(performanceIndicatorSpecificationService.updatePerformanceIndicatorSpecification(id, performanceIndicatorSpecificationMVO), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<PerformanceIndicatorSpecification>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + @PreAuthorize("hasRole('ROLE_USER')") + @Override + public ResponseEntity<PerformanceIndicatorSpecification> retrievePerformanceIndicatorSpecification( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + try { + // #TODO: Add parameters to findPerformanceIndicatorSpecificationByUuid + return new ResponseEntity<PerformanceIndicatorSpecification>(performanceIndicatorSpecificationService.findPerformanceIndicatorSpecificationByUuid(id), HttpStatus.OK); + } catch (Exception e) { + log.error("Couldn't serialize response for content type application/json", e); + return new ResponseEntity<PerformanceIndicatorSpecification>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceMeasurementApi.java b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceMeasurementApi.java new file mode 100644 index 0000000000000000000000000000000000000000..cc3a71f6ba89dc68cde788a7e4a8321f083d69c3 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceMeasurementApi.java @@ -0,0 +1,273 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.6.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pm628.api; + +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.tags.Tag; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.common.model.Error; +import org.etsi.osl.tmf.pm628.model.PerformanceMeasurement; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.annotation.Generated; +import java.util.List; +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") +@Validated +@Tag(name = "performanceMeasurement", description = "Operations for PerformanceMeasurement Resource") +public interface PerformanceMeasurementApi { + + default Optional<NativeWebRequest> getRequest() { + return Optional.empty(); + } + + /** + * GET /performanceMeasurement : List or find PerformanceMeasurement objects + * List or find PerformanceMeasurement objects + * + * @param fields Comma-separated properties to be provided in response (optional) + * @param offset Requested index for start of resources to be provided in response (optional) + * @param limit Requested number of resources to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "listPerformanceMeasurement", + summary = "List or find PerformanceMeasurement objects", + description = "List or find PerformanceMeasurement objects", + tags = { "performanceMeasurement" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = PerformanceMeasurement.class))) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/performanceMeasurement", + produces = { "application/json" } + ) + + default ResponseEntity<List<PerformanceMeasurement>> listPerformanceMeasurement( + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields, + @Parameter(name = "offset", description = "Requested index for start of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "offset", required = false) Integer offset, + @Parameter(name = "limit", description = "Requested number of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false) Integer limit + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"measurementCollectionJob\" : { }, \"description\" : \"description\", \"relatedMeasurement\" : [ { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"relatedMeasurement\" : { \"version\" : \"version\" } }, { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"relatedMeasurement\" : { \"version\" : \"version\" } } ] }, { \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"measurementCollectionJob\" : { }, \"description\" : \"description\", \"relatedMeasurement\" : [ { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"relatedMeasurement\" : { \"version\" : \"version\" } }, { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"relatedMeasurement\" : { \"version\" : \"version\" } } ] } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /performanceMeasurement/{id} : Retrieves a PerformanceMeasurement by ID + * This operation retrieves a PerformanceMeasurement entity. Attribute selection enabled for all first level attributes. + * + * @param id Identifier of the Resource (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "retrievePerformanceMeasurement", + summary = "Retrieves a PerformanceMeasurement by ID", + description = "This operation retrieves a PerformanceMeasurement entity. Attribute selection enabled for all first level attributes.", + tags = { "performanceMeasurement" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = PerformanceMeasurement.class)) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/performanceMeasurement/{id}", + produces = { "application/json" } + ) + + default ResponseEntity<PerformanceMeasurement> retrievePerformanceMeasurement( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"measurementCollectionJob\" : { }, \"description\" : \"description\", \"relatedMeasurement\" : [ { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"relatedMeasurement\" : { \"version\" : \"version\" } }, { \"role\" : \"role\", \"relationshipType\" : \"relationshipType\", \"validFor\" : { \"startDateTime\" : \"1985-04-12T23:20:50.52Z\", \"endDateTime\" : \"1985-04-12T23:20:50.52Z\" }, \"relatedMeasurement\" : { \"version\" : \"version\" } } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceMeasurementApiController.java b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceMeasurementApiController.java new file mode 100644 index 0000000000000000000000000000000000000000..d9e059e8e3e5f5488beeed60e95a810a098bed73 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/PerformanceMeasurementApiController.java @@ -0,0 +1,28 @@ +package org.etsi.osl.tmf.pm628.api; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; + +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 +@RequestMapping("/performance/v5") +public class PerformanceMeasurementApiController implements PerformanceMeasurementApi { + + private final NativeWebRequest request; + + @Autowired + public PerformanceMeasurementApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional<NativeWebRequest> getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/TrackingRecordApi.java b/src/main/java/org/etsi/osl/tmf/pm628/api/TrackingRecordApi.java new file mode 100644 index 0000000000000000000000000000000000000000..516e9741de4f19c5395c3c7c48dc2b41bfd0454c --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/TrackingRecordApi.java @@ -0,0 +1,273 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.6.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.etsi.osl.tmf.pm628.api; + +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.tags.Tag; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.common.model.Error; +import org.etsi.osl.tmf.pm628.model.TrackingRecord; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.context.request.NativeWebRequest; + +import javax.annotation.Generated; +import java.util.List; +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") +@Validated +@Tag(name = "trackingRecord", description = "Operations for TrackingRecord Resource") +public interface TrackingRecordApi { + + default Optional<NativeWebRequest> getRequest() { + return Optional.empty(); + } + + /** + * GET /trackingRecord : List or find TrackingRecord objects + * List or find TrackingRecord objects + * + * @param fields Comma-separated properties to be provided in response (optional) + * @param offset Requested index for start of resources to be provided in response (optional) + * @param limit Requested number of resources to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "listTrackingRecord", + summary = "List or find TrackingRecord objects", + description = "List or find TrackingRecord objects", + tags = { "trackingRecord" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = TrackingRecord.class))) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/trackingRecord", + produces = { "application/json" } + ) + + default ResponseEntity<List<TrackingRecord>> listTrackingRecord( + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields, + @Parameter(name = "offset", description = "Requested index for start of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "offset", required = false) Integer offset, + @Parameter(name = "limit", description = "Requested number of resources to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false) Integer limit + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "[ { \"systemId\" : \"systemId\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"description\" : \"[\\\"acknowledge\\\",\\\"clear\\\"]\", \"time\" : \"2000-01-23T04:56:07.000+00:00\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\", \"user\" : \"user\", \"characteristic\" : [ { \"characteristicRelationship\" : [ { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" }, { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"valueType\" : \"valueType\", \"name\" : \"name\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" }, { \"characteristicRelationship\" : [ { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" }, { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"valueType\" : \"valueType\", \"name\" : \"name\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" } ] }, { \"systemId\" : \"systemId\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"description\" : \"[\\\"acknowledge\\\",\\\"clear\\\"]\", \"time\" : \"2000-01-23T04:56:07.000+00:00\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\", \"user\" : \"user\", \"characteristic\" : [ { \"characteristicRelationship\" : [ { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" }, { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"valueType\" : \"valueType\", \"name\" : \"name\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" }, { \"characteristicRelationship\" : [ { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" }, { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"valueType\" : \"valueType\", \"name\" : \"name\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" } ] } ]"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + /** + * GET /trackingRecord/{id} : Retrieves a TrackingRecord by ID + * This operation retrieves a TrackingRecord entity. Attribute selection enabled for all first level attributes. + * + * @param id Identifier of the Resource (required) + * @param fields Comma-separated properties to be provided in response (optional) + * @return Success (status code 200) + * or Bad Request (status code 400) + * or Unauthorized (status code 401) + * or Forbidden (status code 403) + * or Not Found (status code 404) + * or Method Not allowed (status code 405) + * or Internal Server Error (status code 500) + * or Not Implemented (status code 501) + * or Service Unavailable (status code 503) + */ + @Operation( + operationId = "retrieveTrackingRecord", + summary = "Retrieves a TrackingRecord by ID", + description = "This operation retrieves a TrackingRecord entity. Attribute selection enabled for all first level attributes.", + tags = { "trackingRecord" }, + responses = { + @ApiResponse(responseCode = "200", description = "Success", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = TrackingRecord.class)) + }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "403", description = "Forbidden", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "405", description = "Method Not allowed", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "501", description = "Not Implemented", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = Error.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = "/trackingRecord/{id}", + produces = { "application/json" } + ) + + default ResponseEntity<TrackingRecord> retrieveTrackingRecord( + @Parameter(name = "id", description = "Identifier of the Resource", required = true, in = ParameterIn.PATH) @PathVariable("id") String id, + @Parameter(name = "fields", description = "Comma-separated properties to be provided in response", in = ParameterIn.QUERY) @Valid @RequestParam(value = "fields", required = false) String fields + ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"systemId\" : \"systemId\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"description\" : \"[\\\"acknowledge\\\",\\\"clear\\\"]\", \"time\" : \"2000-01-23T04:56:07.000+00:00\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\", \"user\" : \"user\", \"characteristic\" : [ { \"characteristicRelationship\" : [ { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" }, { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"valueType\" : \"valueType\", \"name\" : \"name\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" }, { \"characteristicRelationship\" : [ { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" }, { \"@baseType\" : \"@baseType\", \"relationshipType\" : \"relationshipType\", \"@type\" : \"@type\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" } ], \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"valueType\" : \"valueType\", \"name\" : \"name\", \"id\" : \"id\", \"@schemaLocation\" : \"@schemaLocation\" } ] }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"reason\" : \"reason\", \"code\" : \"code\", \"@baseType\" : \"@baseType\", \"@type\" : \"@type\", \"@schemaLocation\" : \"@schemaLocation\", \"message\" : \"message\", \"referenceError\" : \"referenceError\", \"status\" : \"status\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/api/TrackingRecordApiController.java b/src/main/java/org/etsi/osl/tmf/pm628/api/TrackingRecordApiController.java new file mode 100644 index 0000000000000000000000000000000000000000..0cddb3105831ecc54c396e30fe1ddded18de1132 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/api/TrackingRecordApiController.java @@ -0,0 +1,28 @@ +package org.etsi.osl.tmf.pm628.api; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; + +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 +@RequestMapping("/performance/v5") +public class TrackingRecordApiController implements TrackingRecordApi { + + private final NativeWebRequest request; + + @Autowired + public TrackingRecordApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional<NativeWebRequest> getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/repo/DataAccessEndpointRepository.java b/src/main/java/org/etsi/osl/tmf/pm628/repo/DataAccessEndpointRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..71ae6bc132c975cac4e54b9a999b06dbbbc4454d --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/repo/DataAccessEndpointRepository.java @@ -0,0 +1,13 @@ +package org.etsi.osl.tmf.pm628.repo; + +import org.etsi.osl.tmf.pm628.model.DataAccessEndpoint; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface DataAccessEndpointRepository extends CrudRepository<DataAccessEndpoint, Long>, PagingAndSortingRepository<DataAccessEndpoint, Long> { + Optional<DataAccessEndpoint> findByUuid(String uuid); +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/repo/MeasurementCollectionJobRepository.java b/src/main/java/org/etsi/osl/tmf/pm628/repo/MeasurementCollectionJobRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..444e9d0c0a7100a6db058e558bf67220eaca5e0a --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/repo/MeasurementCollectionJobRepository.java @@ -0,0 +1,16 @@ +package org.etsi.osl.tmf.pm628.repo; + +import org.etsi.osl.tmf.pm628.model.ExecutionStateType; +import org.etsi.osl.tmf.pm628.model.MeasurementCollectionJob; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface MeasurementCollectionJobRepository extends CrudRepository<MeasurementCollectionJob, Long>, PagingAndSortingRepository<MeasurementCollectionJob, Long> { + Optional<MeasurementCollectionJob> findByUuid(String uuid); + + Iterable<MeasurementCollectionJob> findByExecutionState(ExecutionStateType executionState); +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/repo/PerformanceIndicatorSpecificationRepository.java b/src/main/java/org/etsi/osl/tmf/pm628/repo/PerformanceIndicatorSpecificationRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..0764d9cf5eb21521e26c7f6fe7ddfedf0eac9a16 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/repo/PerformanceIndicatorSpecificationRepository.java @@ -0,0 +1,13 @@ +package org.etsi.osl.tmf.pm628.repo; + +import org.etsi.osl.tmf.pm628.model.PerformanceIndicatorSpecification; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface PerformanceIndicatorSpecificationRepository extends CrudRepository<PerformanceIndicatorSpecification, Long>, PagingAndSortingRepository<PerformanceIndicatorSpecification, Long> { + Optional<PerformanceIndicatorSpecification> findByUuid(String uuid); +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/reposervices/DataAccessEndpointService.java b/src/main/java/org/etsi/osl/tmf/pm628/reposervices/DataAccessEndpointService.java new file mode 100644 index 0000000000000000000000000000000000000000..4b7c0029973246454c257e99a4c22c9738151da7 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/reposervices/DataAccessEndpointService.java @@ -0,0 +1,71 @@ +package org.etsi.osl.tmf.pm628.reposervices; + + +import jakarta.validation.Valid; +import org.etsi.osl.tmf.pm628.model.DataAccessEndpoint; +import org.etsi.osl.tmf.pm628.model.DataAccessEndpointFVO; +import org.etsi.osl.tmf.pm628.model.DataAccessEndpointMVO; +import org.etsi.osl.tmf.pm628.model.DataAccessEndpointMapper; +import org.etsi.osl.tmf.pm628.repo.DataAccessEndpointRepository; +import org.mapstruct.factory.Mappers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Optional; + +@Service +@Transactional +public class DataAccessEndpointService { + + private static final Logger log = LoggerFactory.getLogger(DataAccessEndpointService.class); + + private final DataAccessEndpointRepository dataAccessEndpointRepository; + + @Autowired + public DataAccessEndpointService(DataAccessEndpointRepository dataAccessEndpointRepository) { + this.dataAccessEndpointRepository = dataAccessEndpointRepository; + } + + public List<DataAccessEndpoint> findAllDataAccessEndpoints(){ + log.debug("DataAccessEndpoint LIST"); + return (List<DataAccessEndpoint>) dataAccessEndpointRepository.findAll(); + } + + public DataAccessEndpoint findDataAccessEndpointByUuid(String uuid){ + log.debug("DataAccessEndpoint FIND BY UUID"); + Optional<DataAccessEndpoint> dataAccessEndpoint = dataAccessEndpointRepository.findByUuid(uuid); + return dataAccessEndpoint.orElse(null); + } + + public DataAccessEndpoint createDataAccessEndpoint(DataAccessEndpointFVO dataAccessEndpointFVO){ + log.debug("DataAccessEndpoint CREATE: {}",dataAccessEndpointFVO); + + DataAccessEndpointMapper mapper = Mappers.getMapper(DataAccessEndpointMapper.class); + DataAccessEndpoint dataAccessEndpoint = mapper.createDataAccessEndpoint(dataAccessEndpointFVO); + + return dataAccessEndpointRepository.save(dataAccessEndpoint); + } + + public DataAccessEndpoint updateDataAccessEndpoint(String uuid, @Valid DataAccessEndpointMVO dataAccessEndpointUpdate){ + log.debug("DataAccessEndpoint UPDATE with UUID: {}", uuid); + DataAccessEndpoint dataAccessEndpoint = dataAccessEndpointRepository.findByUuid(uuid). + orElseThrow(() -> new IllegalArgumentException("No Data Access Endpoint with UUID: " + uuid)); + + DataAccessEndpointMapper mapper = Mappers.getMapper(DataAccessEndpointMapper.class); + + dataAccessEndpoint = mapper.updateDataAccessEndpoint(dataAccessEndpointUpdate, dataAccessEndpoint); + dataAccessEndpointRepository.save(dataAccessEndpoint); + return dataAccessEndpoint; + } + + public void deleteDataAccessEndpoint(String uuid){ + log.debug("DataAccessEndpoint DELETE with UUID:{}", uuid); + DataAccessEndpoint dataAccessEndpoint = dataAccessEndpointRepository.findByUuid(uuid) + .orElseThrow(() -> new IllegalArgumentException("No Data Access Endpoint with UUID: " + uuid)); + dataAccessEndpointRepository.delete(dataAccessEndpoint); + } +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/reposervices/MeasurementCollectionJobService.java b/src/main/java/org/etsi/osl/tmf/pm628/reposervices/MeasurementCollectionJobService.java new file mode 100755 index 0000000000000000000000000000000000000000..9aecf9e688298bb9270ce3085c9d558223d7fc74 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/reposervices/MeasurementCollectionJobService.java @@ -0,0 +1,396 @@ +package org.etsi.osl.tmf.pm628.reposervices; + +import jakarta.persistence.EntityManagerFactory; +import org.hibernate.query.Query; +import jakarta.validation.Valid; +import org.etsi.osl.tmf.pm628.api.MeasurementCollectionJobApiRouteBuilderEvents; +import org.etsi.osl.tmf.pm628.model.*; +import org.etsi.osl.tmf.pm628.repo.MeasurementCollectionJobRepository; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.mapstruct.factory.Mappers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.*; + +@Service +@Transactional +public class MeasurementCollectionJobService { + + private static final Logger log = LoggerFactory.getLogger(MeasurementCollectionJobService.class); + + @Autowired + private final MeasurementCollectionJobRepository measurementCollectionJobRepository; + + @Autowired + MeasurementCollectionJobApiRouteBuilderEvents routeBuilderEvents; + + private SessionFactory sessionFactory; + + @Autowired + public MeasurementCollectionJobService(MeasurementCollectionJobRepository measurementCollectionJobRepository, EntityManagerFactory factory) { + this.measurementCollectionJobRepository = measurementCollectionJobRepository; + + if (factory.unwrap(SessionFactory.class) == null) { + throw new NullPointerException("factory is not a hibernate factory"); + } + this.sessionFactory = factory.unwrap(SessionFactory.class); + } + + public List<MeasurementCollectionJob> findAllMeasurementCollectionJobs(){ + log.debug("MeasurementCollectionJobService: LIST"); + return (List<MeasurementCollectionJob>) measurementCollectionJobRepository.findAll(); + } + + public List<MeasurementCollectionJob> findAllByExecutionState(ExecutionStateType executionState) { + log.debug("find by state:" + executionState ); + return (List<MeasurementCollectionJob>) this.measurementCollectionJobRepository.findByExecutionState(executionState); + } + + @Transactional + public List findAll(@Valid String fields, Map<String, String> allParams) throws UnsupportedEncodingException { + Session session = sessionFactory.openSession(); + Transaction tx = session.beginTransaction(); + List<Map<String, Object>> resultList = new ArrayList<>(); + + try { + StringBuilder sql = new StringBuilder("SELECT "); + sql.append("mcj.uuid as uuid, ") + .append("mcj.creationTime as creationTime, ") + .append("mcj.reportingPeriod as reportingPeriod, ") + .append("mcj.granularity as granularity, ") + .append("mcj.consumingApplicationId as consumingApplicationId, ") + .append("mcj.producingApplicationId as producingApplicationId, ") + .append("mcj.executionState as executionState, ") + .append("mcj.jobId as jobId, ") + // DataAccessEndpoint attributes + .append("dae.uuid as dataAccessEndpoint_uuid, ") + .append("dae.uri as dataAccessEndpoint_uri, ") + .append("dae.apiType as dataAccessEndpoint_apiType, ") + .append("dae.resourceStatus as dataAccessEndpoint_resourceStatus, ") + .append("dae.operationalState as dataAccessEndpoint_operationalState, ") + // DataAccessEndpoint uriQueryFilter mappings attributes + .append("map.filterTemplate.name as dae_uriqf_mapping_name, ") + .append("map.filterTemplate.description as dae_uriqf_mapping_description, ") + .append("map.stringArray.value as dae_uriqf_mapping_value, ") + .append("map.filterTemplate.id as dae_uriqf_mapping_id, ") + // DataAccessEndpoint resourceOrderItem attributes + .append("roi.resourceOrderHref as dae_resOrdItem_resourceOrderHref, ") + .append("roi.resourceOrderId as dae_resOrdItem_resourceOrderId, ") + .append("roi.itemAction as dae_resOrdItem_itemAction, ") + .append("roi.itemId as dae_resOrdItem_itemId, ") + .append("roi.role as dae_resOrdItem_role, ") + // ScheduleDefinition attributes + .append("sd.scheduleDefinitionStartTime as scheduleDefinition_startTime, ") + .append("sd.scheduleDefinitionEndTime as scheduleDefinition_endTime, ") + .append("sd.recurringFrequency as scheduleDefinition_recurringFrequency, ") + .append("sd.excludedDate as scheduleDefinition_excludedDate, ") + .append("sd.scheduleDefinitionHourRange as scheduleDefinition_hourRange, ") + .append("sd.monthlyScheduleDayOfMonthDefinition as scheduleDefinition_monthlyScheduleDayOfMonthDefinition, ") + .append("sd.dateScheduleDefintion as scheduleDefinition_dateScheduleDefintion, ") + .append("wsd.dates as scheduleDefinition_weeklyScheduledDefinition_Dates, ") + .append("sd.monthlyScheduleDayOfWeekDefinition.recurringDaySequence as scheduleDefinition_monthlyScheduleDayOfWeekDefinition_recurringDaySequence, ") + .append("domr.dates as scheduleDefinition_monthlyScheduleDayOfWeekDefinition_dayOfMonthRecurrence_dates "); + + if (fields != null && !fields.isEmpty()) { + String[] fieldArray = fields.split(","); + for (String field : fieldArray) { + sql.append(", mcj.").append(field.trim()).append(" as ").append(field.trim()); + } + } + + sql.append(" FROM PM628_MCJob mcj ") + .append("LEFT JOIN mcj.dataAccessEndpoint dae ") + .append("LEFT JOIN dae.uriQueryFilter.mappings map ") + .append("LEFT JOIN dae.resourceOrderItem roi ") + .append("LEFT JOIN mcj.scheduleDefinition sd ") + .append("LEFT JOIN sd.weeklyScheduledDefinition wsd ") + .append("LEFT JOIN sd.monthlyScheduleDayOfWeekDefinition.dayOfMonthRecurrence domr "); + + if (!allParams.isEmpty()) { + sql.append(" WHERE "); + for (String paramName : allParams.keySet()) { + sql.append("mcj.").append(paramName).append(" LIKE :").append(paramName).append(" AND "); + } + sql.setLength(sql.length() - 5); // Remove the last " AND " + } + + sql.append(" ORDER BY mcj.creationTime DESC"); + + Query query = session.createQuery(sql.toString()); + for (Map.Entry<String, String> entry : allParams.entrySet()) { + query.setParameter(entry.getKey(), "%" + URLDecoder.decode(entry.getValue(), StandardCharsets.UTF_8.toString()) + "%"); + } + + List<Object[]> queryResult = query.list(); + Map<String, Map<String, Object>> mcJobMap = new LinkedHashMap<>(); + Map<String, Map<String, Object>> daeMap = new LinkedHashMap<>(); + Map<String, Map<String, Object>> sdMap = new LinkedHashMap<>(); + + for (Object[] row : queryResult) { + String mcjUuid = (String) row[0]; + + // If this mcjUuid hasn't been seen, create a new entry for it + mcJobMap.computeIfAbsent(mcjUuid, k -> { + Map<String, Object> mcJobData = new LinkedHashMap<>(); + mcJobData.put("uuid", row[0]); + mcJobData.put("creationTime", row[1]); + mcJobData.put("reportingPeriod", row[2]); + mcJobData.put("granularity", row[3]); + mcJobData.put("consumingApplicationId", row[4]); + mcJobData.put("producingApplicationId", row[5]); + mcJobData.put("executionState", row[6]); + mcJobData.put("jobId", row[7]); + mcJobData.put("dataAccessEndpoint", new ArrayList<Map<String, Object>>()); + mcJobData.put("scheduleDefinition", new ArrayList<Map<String, Object>>()); + + if (fields != null && !fields.isEmpty()) { + String[] fieldArray = fields.split(","); + for (int i = 0; i < fieldArray.length; i++) { + mcJobData.put(fieldArray[i].trim(), row[9 + i]); + } + } + return mcJobData; + }); + + String daeUuid = (String) row[8]; + + // Check if DataAccessEndpoint fields are null; if so, skip adding it + if (daeUuid != null) { + Map<String, Object> daeData = daeMap.computeIfAbsent(daeUuid, k -> { + Map<String, Object> newDaeData = new LinkedHashMap<>(); + newDaeData.put("uuid", row[8]); + newDaeData.put("uri", row[9]); + newDaeData.put("apiType", row[10]); + newDaeData.put("resourceStatus", row[11]); + newDaeData.put("operationalState", row[12]); + newDaeData.put("uriQueryFilter", new LinkedHashMap<String, Object>()); + newDaeData.put("resourceOrderItem", new ArrayList<Map<String, Object>>()); + ((List<Map<String, Object>>) mcJobMap.get(mcjUuid).get("dataAccessEndpoint")).add(newDaeData); + return newDaeData; + }); + + // Create uriQueryFilter map and add mappings + Map<String, Object> uriQueryFilter = (Map<String, Object>) daeData.get("uriQueryFilter"); + Set<Map<String, Object>> mappingsSet = (Set<Map<String, Object>>) uriQueryFilter.computeIfAbsent("mappings", k -> new LinkedHashSet<>()); + + // Check if mapping fields are null; if so, skip adding it + if (row[13] != null || row[14] != null || row[15] != null || row[16] != null) { + Map<String, Object> mappingData = new LinkedHashMap<>(); + mappingData.put("name", row[13]); + mappingData.put("description", row[14]); + mappingData.put("value", row[15]); + mappingData.put("id", row[16]); + mappingsSet.add(mappingData); + } + + // Retrieve resourceOrderItem and add to DAE + List<Map<String, Object>> roiList = (List<Map<String, Object>>) daeData.get("resourceOrderItem"); + + // Check if resource order item fields are null; if so, skip adding it + if (row[17] != null || row[18] != null || row[19] != null || row[20] != null || row[21] != null) { + Map<String, Object> roiData = new LinkedHashMap<>(); + roiData.put("resourceOrderHref", row[17]); + roiData.put("resourceOrderId", row[18]); + roiData.put("itemAction", row[19]); + roiData.put("itemId", row[20]); + roiData.put("role", row[21]); + roiList.add(roiData); + } + } + + // Check if ScheduleDefinition fields are null; if so, skip adding it + if (row[22] != null || row[23] != null || row[24] != null || row[25] != null || row[26] != null || row[27] != null || row[28] != null || row[29] != null | row[30] != null) { + String sdUuid = mcjUuid + "_" + row[22] + "_" + row[23]; // Unique key for schedule definition + + Map<String, Object> sdData = sdMap.computeIfAbsent(sdUuid, k -> { + Map<String, Object> newSdData = new LinkedHashMap<>(); + newSdData.put("scheduleDefinitionStartTime", row[22]); + newSdData.put("scheduleDefinitionEndTime", row[23]); + newSdData.put("recurringFrequency", row[24]); + newSdData.put("excludedDate", new LinkedHashSet<>()); + newSdData.put("scheduleDefinitionHourRange", row[26]); + newSdData.put("monthlyScheduleDayOfMonthDefinition", new LinkedHashSet<>()); + newSdData.put("dateScheduleDefintion", new LinkedHashSet<>()); + newSdData.put("weeklyScheduledDefinition", new LinkedHashMap<>()); + newSdData.put("monthlyScheduleDayOfWeekDefinition", new LinkedHashMap<>()); + ((List<Map<String, Object>>) mcJobMap.get(mcjUuid).get("scheduleDefinition")).add(newSdData); + return newSdData; + }); + + // Add excludedDate + if (row[25] != null) { + ((Set<Object>) sdData.get("excludedDate")).add(row[25]); + } + + // Add monthlyScheduleDayOfMonthDefinition + if (row[27] != null) { + ((Set<Object>) sdData.get("monthlyScheduleDayOfMonthDefinition")).add(row[27]); + } + + // Add dateScheduleDefintion + if (row[28] != null) { + ((Set<Object>) sdData.get("dateScheduleDefintion")).add(row[28]); + } + + // Add weeklyScheduledDefinition + Map<String, Object> weeklyScheduledDefinition = (Map<String, Object>) sdData.get("weeklyScheduledDefinition"); + if (row[29] != null) { + Set<Map<String, Object>> dayOfWeekRecurrence = (Set<Map<String, Object>>) weeklyScheduledDefinition.computeIfAbsent("dayOfWeekRecurrence", k -> new LinkedHashSet<>()); + Map<String, Object> wsdData = new LinkedHashMap<>(); + wsdData.put("dates", row[29]); + dayOfWeekRecurrence.add(wsdData); + } + + // Add monthlyScheduleDayOfWeekDefinition + Map<String, Object> monthlyScheduleDayOfWeekDefinition = (Map<String, Object>) sdData.get("monthlyScheduleDayOfWeekDefinition"); + if (row[30] != null) { + monthlyScheduleDayOfWeekDefinition.put("recurringDaySequence", row[30]); + } + if (row[31] != null) { + Set<Map<String, Object>> dayOfMonthRecurrence = (Set<Map<String, Object>>) monthlyScheduleDayOfWeekDefinition.computeIfAbsent("dayOfMonthRecurrence", k -> new LinkedHashSet<>()); + Map<String, Object> domrData = new LinkedHashMap<>(); + domrData.put("dates", row[31]); + dayOfMonthRecurrence.add(domrData); + } + } + } + resultList.addAll(mcJobMap.values()); + } catch (Exception e) { + if (tx != null) { + tx.rollback(); + } + log.error("Error executing query", e); + } finally { + tx.commit(); + session.close(); + } + + return resultList; + } + + public MeasurementCollectionJob findMeasurementCollectionJobByUuid(String uuid){ + log.debug("MeasurementCollectionJob FIND BY UUID"); + Optional<MeasurementCollectionJob> measurementCollectionJob = measurementCollectionJobRepository.findByUuid(uuid); + return measurementCollectionJob.orElse(null); + } + + public MeasurementCollectionJob createMeasurementCollectionJob(MeasurementCollectionJobFVO measurementCollectionJobFVO){ + log.debug("MeasurementCollectionJob CREATE: {}", measurementCollectionJobFVO); + + MeasurementCollectionJobMapper mapper = Mappers.getMapper(MeasurementCollectionJobMapper.class); + MeasurementCollectionJob mcj = mapper.createMeasurementCollectionJob(measurementCollectionJobFVO); + + raiseMCJCreateNotification(mcj); + + return this.measurementCollectionJobRepository.save(mcj); + } + + public MeasurementCollectionJob updateMeasurementCollectionJob(String uuid, @Valid MeasurementCollectionJobMVO measurementCollectionJobUpdate){ + log.debug("MeasurementCollectionJob UPDATE with UUID: {}", uuid); + + MeasurementCollectionJob measurementCollectionJob = measurementCollectionJobRepository.findByUuid(uuid). + orElseThrow(() -> new IllegalArgumentException("No MeasurementCollectionJob with UUID: " + uuid)); + + ExecutionStateType originalExecutionState = measurementCollectionJob.getExecutionState(); + boolean executionStateChanged = false; + + MeasurementCollectionJobMapper mapper = Mappers.getMapper(MeasurementCollectionJobMapper.class); + measurementCollectionJob = mapper.updateMeasurementCollectionJob(measurementCollectionJobUpdate, measurementCollectionJob); + + this.measurementCollectionJobRepository.save(measurementCollectionJob); + + // This may be unnecessary since MeasurementCollectionJobMVO doesn't have the executionState attribute + executionStateChanged = !originalExecutionState.equals(measurementCollectionJob.getExecutionState()); + + if (executionStateChanged) { + raiseMCJExecutionStateChangeNotification(measurementCollectionJob); + } else { + raiseMCJAttributeValueChangeNotification(measurementCollectionJob); + } + + return measurementCollectionJob; + } + + public Void deleteMeasurementCollectionJob(String uuid){ + log.debug("MeasurementCollectionJob DELETE with UUID:{}", uuid); + MeasurementCollectionJob measurementCollectionJob = measurementCollectionJobRepository.findByUuid(uuid) + .orElseThrow(() -> new IllegalArgumentException("No MeasurementCollectionJob with UUID: " + uuid)); + measurementCollectionJobRepository.delete(measurementCollectionJob); + + raiseMCJDeleteNotification(measurementCollectionJob); + + return null; + } + + private void raiseMCJCreateNotification(MeasurementCollectionJob mcj){ + // Create the event payload + MeasurementCollectionJobRef ref = new MeasurementCollectionJobRef(); + ref.setId(mcj.getUuid()); + ref.setHref(mcj.getHref()); + + MeasurementCollectionJobCreateEventPayload payload = new MeasurementCollectionJobCreateEventPayload(); + payload.setMeasurementCollectionJob(ref); + + // Create the event + MeasurementCollectionJobCreateEvent event = new MeasurementCollectionJobCreateEvent(); + event.setTitle("MeasurementCollectionJob created"); + event.setDescription("MeasurementCollectionJob with UUID: " + mcj.getUuid() + " has been created"); + event.setEvent(payload); + + routeBuilderEvents.publishEvent(event, mcj.getUuid()); + } + + private void raiseMCJAttributeValueChangeNotification(MeasurementCollectionJob mcj){ + + // Create the event payload + MeasurementCollectionJobAttributeValueChangeEventPayload payload = new MeasurementCollectionJobAttributeValueChangeEventPayload(); + payload.setMeasurementCollectionJob(mcj); + + // Create the event + MeasurementCollectionJobAttributeValueChangeEvent event = new MeasurementCollectionJobAttributeValueChangeEvent(); + event.setTitle("MeasurementCollectionJob attribute value changed"); + event.setDescription("MeasurementCollectionJob with UUID: " + mcj.getUuid() + " has been updated"); + event.setEvent(payload); + + routeBuilderEvents.publishEvent(event, mcj.getUuid()); + } + + private void raiseMCJExecutionStateChangeNotification(MeasurementCollectionJob mcj){ + + // Create the event payload + MeasurementCollectionJobExecutionStateChangeEventPayload payload = new MeasurementCollectionJobExecutionStateChangeEventPayload(); + payload.setMeasurementCollectionJob(mcj); + + // Create the event + MeasurementCollectionJobExecutionStateChangeEvent event = new MeasurementCollectionJobExecutionStateChangeEvent(); + event.setTitle("MeasurementCollectionJob execution state changed"); + event.setDescription("MeasurementCollectionJob with UUID: " + mcj.getUuid() + " execution state has been updated"); + event.setEvent(payload); + + routeBuilderEvents.publishEvent(event, mcj.getUuid()); + } + + private void raiseMCJDeleteNotification(MeasurementCollectionJob mcj){ + + // Create the event payload + MeasurementCollectionJobDeleteEventPayload payload = new MeasurementCollectionJobDeleteEventPayload(); + payload.setMeasurementCollectionJob(mcj); + + // Create the event + MeasurementCollectionJobDeleteEvent event = new MeasurementCollectionJobDeleteEvent(); + event.setTitle("MeasurementCollectionJob deleted"); + event.setDescription("MeasurementCollectionJob with UUID: " + mcj.getUuid() + " execution state has been deleted"); + event.setEvent(payload); + + routeBuilderEvents.publishEvent(event, mcj.getUuid()); + } +} diff --git a/src/main/java/org/etsi/osl/tmf/pm628/reposervices/PerformanceIndicatorSpecificationService.java b/src/main/java/org/etsi/osl/tmf/pm628/reposervices/PerformanceIndicatorSpecificationService.java new file mode 100644 index 0000000000000000000000000000000000000000..a543118dba5aa5122cfb27fe13354a3593811c82 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/pm628/reposervices/PerformanceIndicatorSpecificationService.java @@ -0,0 +1,68 @@ +package org.etsi.osl.tmf.pm628.reposervices; + +import org.etsi.osl.tmf.pm628.model.*; +import org.etsi.osl.tmf.pm628.repo.PerformanceIndicatorSpecificationRepository; +import org.mapstruct.factory.Mappers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +@Service +@Transactional +public class PerformanceIndicatorSpecificationService { + private static final Logger log = LoggerFactory.getLogger(MeasurementCollectionJobService.class); + + private final PerformanceIndicatorSpecificationRepository performanceIndicatorSpecificationRepository; + + @Autowired + public PerformanceIndicatorSpecificationService(PerformanceIndicatorSpecificationRepository performanceIndicatorSpecificationRepository) { + this.performanceIndicatorSpecificationRepository = performanceIndicatorSpecificationRepository; + } + + public List<PerformanceIndicatorSpecification> findAllPerformanceIndicatorSpecifications(){ + log.debug("PerformanceIndicatorSpecificationService: LIST"); + return (List<PerformanceIndicatorSpecification>) performanceIndicatorSpecificationRepository.findAll(); + } + + public PerformanceIndicatorSpecification findPerformanceIndicatorSpecificationByUuid(String uuid){ + log.debug("PerformanceIndicatorSpecification FIND BY UUID"); + Optional<PerformanceIndicatorSpecification> performanceIndicatorSpecification = performanceIndicatorSpecificationRepository.findByUuid(uuid); + return performanceIndicatorSpecification.orElse(null); + } + + public PerformanceIndicatorSpecification createPerformanceIndicatorSpecification(PerformanceIndicatorSpecificationFVO performanceIndicatorSpecificationFVO){ + log.debug("PerformanceIndicatorSpecification CREATE: {}", performanceIndicatorSpecificationFVO); + + PerformanceIndicatorSpecificationMapper mapper = Mappers.getMapper(PerformanceIndicatorSpecificationMapper.class); + PerformanceIndicatorSpecification pis = mapper.createPerformanceIndicatorSpecification(performanceIndicatorSpecificationFVO); + + return performanceIndicatorSpecificationRepository.save(pis); + } + + public PerformanceIndicatorSpecification updatePerformanceIndicatorSpecification(String uuid, PerformanceIndicatorSpecificationMVO performanceIndicatorSpecificationMVO){ + log.debug("PerformanceIndicatorSpecification UPDATE with UUID: {}", uuid); + PerformanceIndicatorSpecification performanceIndicatorSpecification = performanceIndicatorSpecificationRepository.findByUuid(uuid). + orElseThrow(() -> new IllegalArgumentException("No PerformanceIndicatorSpecification with UUID: " + uuid)); + + PerformanceIndicatorSpecificationMapper mapper = Mappers.getMapper(PerformanceIndicatorSpecificationMapper.class); + performanceIndicatorSpecification = mapper.updatePerformanceIndicatorSpecification(performanceIndicatorSpecificationMVO, performanceIndicatorSpecification); + + performanceIndicatorSpecificationRepository.save(performanceIndicatorSpecification); + return performanceIndicatorSpecification; + } + + public Void deletePerformanceIndicatorSpecification(String uuid){ + log.debug("PerformanceIndicatorSpecification DELETE with UUID:{}", uuid); + PerformanceIndicatorSpecification performanceIndicatorSpecification = performanceIndicatorSpecificationRepository.findByUuid(uuid) + .orElseThrow(() -> new IllegalArgumentException("No PerformanceIndicatorSpecification with UUID: " + uuid)); + performanceIndicatorSpecificationRepository.delete(performanceIndicatorSpecification); + + return null; + } +} diff --git a/src/main/java/org/etsi/osl/tmf/util/RFC3339DateFormat.java b/src/main/java/org/etsi/osl/tmf/util/RFC3339DateFormat.java new file mode 100644 index 0000000000000000000000000000000000000000..357f0bbb7b2476d3557f3a9ad1883db85b55ae84 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/util/RFC3339DateFormat.java @@ -0,0 +1,38 @@ +package org.etsi.osl.tmf.util; + +import com.fasterxml.jackson.databind.util.StdDateFormat; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return this; + } +} \ No newline at end of file diff --git a/src/main/resources/application-testing.yml b/src/main/resources/application-testing.yml index f2371674f5f489b2aa167c3048be939ebe9713de..719f8c57fedd3186a081820e20377eedd6965e36 100644 --- a/src/main/resources/application-testing.yml +++ b/src/main/resources/application-testing.yml @@ -105,6 +105,12 @@ 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" +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" @@ -126,6 +132,10 @@ EVENT_INDIVIDUAL_CHANGED: "jms:topic:EVENT.INDIVIDUAL.CHANGE" EVENT_ORGANIZATION_CREATE: "jms:topic:EVENT.ORGANIZATION.CREATE" EVENT_ORGANIZATION_CHANGED: "jms:topic:EVENT.ORGANIZATION.CHANGE" EVENT_ALARM_CREATE: "jms:topic:EVENT.ALARM.CREATE" +EVENT_MEASUREMENT_COLLECTION_JOB_CREATE: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.CREATE" +EVENT_MEASUREMENT_COLLECTION_JOB_EXECUTION_STATE_CHANGED: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.STATECHANGED" +EVENT_MEASUREMENT_COLLECTION_JOB_DELETE: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.DELETE" +EVENT_MEASUREMENT_COLLECTION_JOB_ATTRIBUTE_VALUE_CHANGED: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.ATTRCHANGED" #QUEUE MESSSAGES WITH VNFNSD CATALOG NFV_CATALOG_GET_NSD_BY_ID: "jms:queue:NFVCATALOG.GET.NSD_BY_ID" diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 6028f7fa2687b4801778c43d603cdd215afbdfc1..163f1d379831b166225b0ac421eb8a1998ed8993 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -135,6 +135,12 @@ 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" +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" @@ -156,6 +162,10 @@ EVENT_INDIVIDUAL_CHANGED: "jms:topic:EVENT.INDIVIDUAL.CHANGE" EVENT_ORGANIZATION_CREATE: "jms:topic:EVENT.ORGANIZATION.CREATE" EVENT_ORGANIZATION_CHANGED: "jms:topic:EVENT.ORGANIZATION.CHANGE" EVENT_ALARM_CREATE: "jms:topic:EVENT.ALARM.CREATE" +EVENT_MEASUREMENT_COLLECTION_JOB_CREATE: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.CREATE" +EVENT_MEASUREMENT_COLLECTION_JOB_EXECUTION_STATE_CHANGED: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.STATECHANGED" +EVENT_MEASUREMENT_COLLECTION_JOB_DELETE: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.DELETE" +EVENT_MEASUREMENT_COLLECTION_JOB_ATTRIBUTE_VALUE_CHANGED: "jms:topic:EVENT.MEASUREMENTCOLLECTIONJOB.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/pm628/MeasurementCollectionJobApiControllerTest.java b/src/test/java/org/etsi/osl/services/api/pm628/MeasurementCollectionJobApiControllerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..40a2697c2ed42e1a4e955744fe733cfeca4776c7 --- /dev/null +++ b/src/test/java/org/etsi/osl/services/api/pm628/MeasurementCollectionJobApiControllerTest.java @@ -0,0 +1,249 @@ +package org.etsi.osl.services.api.pm628; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.io.IOUtils; +import org.etsi.osl.tmf.JsonUtils; +import org.etsi.osl.tmf.OpenAPISpringBoot; +import org.etsi.osl.tmf.pm628.model.*; +import org.etsi.osl.tmf.pm628.reposervices.MeasurementCollectionJobService; +import org.etsi.osl.tmf.ri639.model.ResourceAdministrativeStateType; +import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; +import org.etsi.osl.tmf.ri639.model.ResourceUsageStateType; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors; +import org.springframework.security.web.FilterChainProxy; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.WebApplicationContext; + +import java.io.*; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +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.status; + +@RunWith(SpringRunner.class) +@Transactional +@SpringBootTest( + webEnvironment = SpringBootTest.WebEnvironment.MOCK, + classes = OpenAPISpringBoot.class +) +//@AutoConfigureTestDatabase //this automatically uses h2 +@AutoConfigureMockMvc +@ActiveProfiles("testing") +//@TestPropertySource( +// locations = "classpath:application-testing.yml") +public class MeasurementCollectionJobApiControllerTest { + + private static final int FIXED_BOOTSTRAPS_JOBS = 0; + + @Autowired + private MockMvc mvc; + + @Autowired + private WebApplicationContext context; + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private FilterChainProxy springSecurityFilterChain; + + @Autowired + MeasurementCollectionJobService measurementCollectionJobService; + + @Before + public void setup() throws Exception { + mvc = MockMvcBuilders.webAppContextSetup(context). + apply(springSecurity(springSecurityFilterChain)).build(); + + } + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testFindAllMeasurementCollectionJobs() throws Exception { + String response = mvc + .perform(MockMvcRequestBuilders.get("/monitoring/v5/measurementCollectionJob") + .with( SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); + + List<MeasurementCollectionJob> mcjList = objectMapper.readValue(response, new TypeReference<List<MeasurementCollectionJob>>() {}); + assertThat(mcjList.size()).isEqualTo(0); + } + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testFindMeasurementCollectionJobByUuid() throws Exception { + String response = createMeasurementCollectionJob(); + MeasurementCollectionJob mcj = JsonUtils.toJsonObj(response, MeasurementCollectionJob.class); + String id = mcj.getUuid(); + + String response2 = mvc + .perform(MockMvcRequestBuilders.get("/monitoring/v5/measurementCollectionJob/" + id) + .with( SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); + + MeasurementCollectionJob mcj2 = JsonUtils.toJsonObj(response2, MeasurementCollectionJob.class); + + assertThat(mcj2.getConsumingApplicationId()).isEqualTo(mcj.getConsumingApplicationId()); + assertThat(mcj2.getJobId()).isEqualTo(mcj.getJobId()); + assertThat(mcj2.getAdminState()).isEqualTo(mcj.getAdminState()); + assertThat(mcj2.getExecutionState()).isEqualTo(mcj.getExecutionState()); + assertThat(mcj2.getGranularity()).isEqualTo(mcj.getGranularity()); + assertThat(mcj2.getReportingPeriod()).isEqualTo(mcj.getReportingPeriod()); + } + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testCreateMeasurementCollectionJob() throws Exception { + String response = createMeasurementCollectionJob(); + MeasurementCollectionJob mcj = JsonUtils.toJsonObj(response, MeasurementCollectionJob.class); + + assertThat(mcj.getConsumingApplicationId()).isEqualTo("4000"); + assertThat(mcj.getJobId()).isEqualTo("400"); + assertThat(mcj.getAdminState()).isEqualTo(AdministrativeState.LOCKED); + assertThat(mcj.getExecutionState()).isEqualTo(ExecutionStateType.ACKNOWLEDGED); + assertThat(mcj.getGranularity()).isEqualTo(Granularity.fromValue("g_1mn")); + assertThat(mcj.getReportingPeriod()).isEqualTo(ReportingPeriod.fromValue("r_1mn")); + } + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testUpdateMeasurementCollectionJob() throws Exception { + String response = createMeasurementCollectionJob(); + MeasurementCollectionJob mcj = JsonUtils.toJsonObj(response, MeasurementCollectionJob.class); + String id = mcj.getUuid(); + + MeasurementCollectionJobMVO mcjMVO = new MeasurementCollectionJobMVO(); + mcjMVO.setOutputFormat("Test Output Format"); + mcjMVO.setGranularity(Granularity.G_5MN); + mcjMVO.setReportingPeriod(ReportingPeriod.R_1H); + + List<DataAccessEndpointMVO> daeList =new ArrayList<>(); + DataAccessEndpointMVO daeMVO = new DataAccessEndpointMVO(); + daeMVO.setUri(URI.create("https://test.com")); + daeMVO.setApiType("Test API type"); + daeMVO.setValue("Test value"); + daeMVO.setCategory("Test category"); + daeMVO.setDescription("Test description"); + daeMVO.setName("Test name"); + daeMVO.setEndOperatingDate(OffsetDateTime.now()); + daeMVO.setAdministrativeState(ResourceAdministrativeStateType.LOCKED); + daeMVO.setOperationalState(ResourceOperationalStateType.ENABLE); + daeMVO.setResourceStatus(ResourceStatusType.AVAILABLE); + daeMVO.setUsageState(ResourceUsageStateType.IDLE); + + DataFilterMapMVO dfmMVO = new DataFilterMapMVO(); + List<DataFilterMapItemMVO> mappings = new ArrayList<>(); + + DataFilterMapItemMVO dfmiMVO = new DataFilterMapItemMVO(); + + // Set filterTemplate value for dfmiMVO + DataFilterTemplateMVO dftMVO = new DataFilterTemplateMVO(); + dftMVO.setName("Test DataFilterTemplate"); + dftMVO.setDescription("A Test DataFilterTemplate"); + dfmiMVO.setFilterTemplate(dftMVO); + + // Set stringArray value for dfmiMVO + DataFilterAttributeStringArray dfasa = new DataFilterAttributeStringArray(); + List<String> list = new ArrayList<>(); + list.add("Test DataFilterAttributeString 1"); + list.add("Test DataFilterAttributeString 2"); + dfasa.setValue(list); + dfmiMVO.setStringArray(dfasa); + + mappings.add(dfmiMVO); + dfmMVO.setMappings(mappings); + daeMVO.setUriQueryFilter(dfmMVO); + daeList.add(daeMVO); + mcjMVO.setDataAccessEndpoint(daeList); + + String response2 = mvc + .perform(MockMvcRequestBuilders.patch("/monitoring/v5/measurementCollectionJob/" + id) + .with( SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON).content(JsonUtils.toJson(mcjMVO))) + .andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); + + MeasurementCollectionJob updatedMcj = JsonUtils.toJsonObj(response2, MeasurementCollectionJob.class); + + assertThat(updatedMcj.getOutputFormat()).isEqualTo("Test Output Format"); + assertThat(updatedMcj.getGranularity()).isEqualTo(Granularity.G_5MN); + assertThat(updatedMcj.getReportingPeriod()).isEqualTo(ReportingPeriod.R_1H); + + List<DataAccessEndpoint> dataAccessEndpointList = updatedMcj.getDataAccessEndpoint(); + DataAccessEndpoint updatedDae = dataAccessEndpointList.get(0); + assertThat(updatedDae.getUri()).isEqualTo(URI.create("https://test.com")); + assertThat(updatedDae.getApiType()).isEqualTo("Test API type"); + assertThat(updatedDae.getValue()).isEqualTo("Test value"); + assertThat(updatedDae.getCategory()).isEqualTo("Test category"); + assertThat(updatedDae.getDescription()).isEqualTo("Test description"); + assertThat(updatedDae.getName()).isEqualTo("Test name"); + assertThat(updatedDae.getEndOperatingDate()).isEqualTo(daeMVO.getEndOperatingDate()); + assertThat(updatedDae.getAdministrativeState()).isEqualTo(ResourceAdministrativeStateType.LOCKED); + assertThat(updatedDae.getOperationalState()).isEqualTo(ResourceOperationalStateType.ENABLE); + assertThat(updatedDae.getResourceStatus()).isEqualTo(ResourceStatusType.AVAILABLE); + assertThat(updatedDae.getUsageState()).isEqualTo(ResourceUsageStateType.IDLE); + } + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testDeleteMeasurementCollectionJob() throws Exception { + String response = createMeasurementCollectionJob(); + MeasurementCollectionJob mcj = JsonUtils.toJsonObj(response, MeasurementCollectionJob.class); + String id = mcj.getUuid(); + + mvc + .perform(MockMvcRequestBuilders.delete("/monitoring/v5/measurementCollectionJob/" + id) + .with( SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andReturn().getResponse().getContentAsString(); + + assertThat(measurementCollectionJobService.findAllMeasurementCollectionJobs().size()).isEqualTo(FIXED_BOOTSTRAPS_JOBS); + } + + + + private String createMeasurementCollectionJob() throws Exception { + assertThat(measurementCollectionJobService.findAllMeasurementCollectionJobs().size()).isEqualTo(FIXED_BOOTSTRAPS_JOBS); + + File fvo = new File("src/test/resources/testMeasurementCollectionJobFVO.json"); + InputStream in = new FileInputStream(fvo); + String mcjFVOText = IOUtils.toString(in, "UTF-8"); + + MeasurementCollectionJobFVO mcjFVO = JsonUtils.toJsonObj(mcjFVOText, MeasurementCollectionJobFVO.class); + + String response = mvc + .perform(MockMvcRequestBuilders.post("/monitoring/v5/measurementCollectionJob") + .with( SecurityMockMvcRequestPostProcessors.csrf()) + .contentType(MediaType.APPLICATION_JSON).content(JsonUtils.toJson(mcjFVO))) + .andExpect(status().isOk()).andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn().getResponse().getContentAsString(); + + assertThat(measurementCollectionJobService.findAllMeasurementCollectionJobs().size()).isEqualTo(FIXED_BOOTSTRAPS_JOBS + 1); + + return response; + } +} diff --git a/src/test/java/org/etsi/osl/services/api/pm628/MeasurementCollectionJobServiceTest.java b/src/test/java/org/etsi/osl/services/api/pm628/MeasurementCollectionJobServiceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d718e0ab2f954b6ab5510258ee4a01911b596564 --- /dev/null +++ b/src/test/java/org/etsi/osl/services/api/pm628/MeasurementCollectionJobServiceTest.java @@ -0,0 +1,195 @@ +package org.etsi.osl.services.api.pm628; + +import org.apache.commons.io.IOUtils; +import org.etsi.osl.tmf.JsonUtils; +import org.etsi.osl.tmf.OpenAPISpringBoot; +import org.etsi.osl.tmf.pm628.model.*; +import org.etsi.osl.tmf.pm628.reposervices.MeasurementCollectionJobService; +import org.etsi.osl.tmf.ri639.model.ResourceAdministrativeStateType; +import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; +import org.etsi.osl.tmf.ri639.model.ResourceUsageStateType; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@Transactional +@SpringBootTest( + webEnvironment = SpringBootTest.WebEnvironment.MOCK, + classes = OpenAPISpringBoot.class +) +//@AutoConfigureTestDatabase //this automatically uses h2 +@AutoConfigureMockMvc +@ActiveProfiles("testing") +public class MeasurementCollectionJobServiceTest { + + private static final int FIXED_BOOTSTRAPS_JOBS = 0; + + @Autowired + MeasurementCollectionJobService measurementCollectionJobService; + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testFindAllMeasurementCollectionJobs() throws Exception { + createMeasurementCollectionJob(); + + List<MeasurementCollectionJob> mcjList = measurementCollectionJobService.findAllMeasurementCollectionJobs(); + + assertThat(mcjList.size()).isEqualTo(FIXED_BOOTSTRAPS_JOBS + 1); + } + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testFindAllByExecutionState() throws Exception { + createMeasurementCollectionJob(); + + List<MeasurementCollectionJob> mcjList = measurementCollectionJobService.findAllByExecutionState(ExecutionStateType.ACKNOWLEDGED); + + assertThat(mcjList.size()).isEqualTo(FIXED_BOOTSTRAPS_JOBS + 1); + } + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testFindMeasurementCollectionJobByUuid() throws Exception { + MeasurementCollectionJob mcj = createMeasurementCollectionJob(); + String id = mcj.getUuid(); + + MeasurementCollectionJob mcj2 = measurementCollectionJobService.findMeasurementCollectionJobByUuid(id); + + assertThat(mcj2.getConsumingApplicationId()).isEqualTo(mcj.getConsumingApplicationId()); + assertThat(mcj2.getJobId()).isEqualTo(mcj.getJobId()); + assertThat(mcj2.getAdminState()).isEqualTo(mcj.getAdminState()); + assertThat(mcj2.getExecutionState()).isEqualTo(mcj.getExecutionState()); + assertThat(mcj2.getGranularity()).isEqualTo(mcj.getGranularity()); + assertThat(mcj2.getReportingPeriod()).isEqualTo(mcj.getReportingPeriod()); + } + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testCreateMeasurementCollectionJob() throws Exception { + MeasurementCollectionJob mcj = createMeasurementCollectionJob(); + + assertThat(mcj.getConsumingApplicationId()).isEqualTo("4000"); + assertThat(mcj.getJobId()).isEqualTo("400"); + assertThat(mcj.getAdminState()).isEqualTo(AdministrativeState.LOCKED); + assertThat(mcj.getExecutionState()).isEqualTo(ExecutionStateType.ACKNOWLEDGED); + assertThat(mcj.getGranularity()).isEqualTo(Granularity.fromValue("g_1mn")); + assertThat(mcj.getReportingPeriod()).isEqualTo(ReportingPeriod.fromValue("r_1mn")); + } + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testUpdateMeasurementCollectionJob() throws Exception { + MeasurementCollectionJob mcj = createMeasurementCollectionJob(); + String id = mcj.getUuid(); + + MeasurementCollectionJobMVO mcjMVO = new MeasurementCollectionJobMVO(); + mcjMVO.setOutputFormat("Test Output Format"); + mcjMVO.setGranularity(Granularity.G_5MN); + mcjMVO.setReportingPeriod(ReportingPeriod.R_1H); + + List<DataAccessEndpointMVO> daeList =new ArrayList<>(); + DataAccessEndpointMVO daeMVO = new DataAccessEndpointMVO(); + daeMVO.setUri(URI.create("https://test.com")); + daeMVO.setApiType("Test API type"); + daeMVO.setValue("Test value"); + daeMVO.setCategory("Test category"); + daeMVO.setDescription("Test description"); + daeMVO.setName("Test name"); + daeMVO.setEndOperatingDate(OffsetDateTime.now()); + daeMVO.setAdministrativeState(ResourceAdministrativeStateType.LOCKED); + daeMVO.setOperationalState(ResourceOperationalStateType.ENABLE); + daeMVO.setResourceStatus(ResourceStatusType.AVAILABLE); + daeMVO.setUsageState(ResourceUsageStateType.IDLE); + + DataFilterMapMVO dfmMVO = new DataFilterMapMVO(); + List<DataFilterMapItemMVO> mappings = new ArrayList<>(); + + DataFilterMapItemMVO dfmiMVO = new DataFilterMapItemMVO(); + + // Set filterTemplate value for dfmiMVO + DataFilterTemplateMVO dftMVO = new DataFilterTemplateMVO(); + dftMVO.setName("Test DataFilterTemplate"); + dftMVO.setDescription("A Test DataFilterTemplate"); + dfmiMVO.setFilterTemplate(dftMVO); + + // Set stringArray value for dfmiMVO + DataFilterAttributeStringArray dfasa = new DataFilterAttributeStringArray(); + List<String> list = new ArrayList<>(); + list.add("Test DataFilterAttributeString 1"); + list.add("Test DataFilterAttributeString 2"); + dfasa.setValue(list); + dfmiMVO.setStringArray(dfasa); + + mappings.add(dfmiMVO); + dfmMVO.setMappings(mappings); + daeMVO.setUriQueryFilter(dfmMVO); + daeList.add(daeMVO); + mcjMVO.setDataAccessEndpoint(daeList); + + MeasurementCollectionJob updatedMcj = measurementCollectionJobService.updateMeasurementCollectionJob(id, mcjMVO); + + assertThat(updatedMcj.getOutputFormat()).isEqualTo("Test Output Format"); + assertThat(updatedMcj.getGranularity()).isEqualTo(Granularity.G_5MN); + assertThat(updatedMcj.getReportingPeriod()).isEqualTo(ReportingPeriod.R_1H); + + List<DataAccessEndpoint> dataAccessEndpointList = updatedMcj.getDataAccessEndpoint(); + DataAccessEndpoint updatedDae = dataAccessEndpointList.get(0); + assertThat(updatedDae.getUri()).isEqualTo(URI.create("https://test.com")); + assertThat(updatedDae.getApiType()).isEqualTo("Test API type"); + assertThat(updatedDae.getValue()).isEqualTo("Test value"); + assertThat(updatedDae.getCategory()).isEqualTo("Test category"); + assertThat(updatedDae.getDescription()).isEqualTo("Test description"); + assertThat(updatedDae.getName()).isEqualTo("Test name"); + assertThat(updatedDae.getEndOperatingDate()).isEqualTo(daeMVO.getEndOperatingDate()); + assertThat(updatedDae.getAdministrativeState()).isEqualTo(ResourceAdministrativeStateType.LOCKED); + assertThat(updatedDae.getOperationalState()).isEqualTo(ResourceOperationalStateType.ENABLE); + assertThat(updatedDae.getResourceStatus()).isEqualTo(ResourceStatusType.AVAILABLE); + assertThat(updatedDae.getUsageState()).isEqualTo(ResourceUsageStateType.IDLE); + } + + @WithMockUser(username="osadmin", roles = {"USER","ADMIN"}) + @Test + public void testDeleteMeasurementCollectionJob() throws Exception { + MeasurementCollectionJob mcj = createMeasurementCollectionJob(); + String id = mcj.getUuid(); + + measurementCollectionJobService.deleteMeasurementCollectionJob(id); + + assertThat(measurementCollectionJobService.findAllMeasurementCollectionJobs().size()).isEqualTo(FIXED_BOOTSTRAPS_JOBS); + } + + + + private MeasurementCollectionJob createMeasurementCollectionJob() throws Exception { + assertThat(measurementCollectionJobService.findAllMeasurementCollectionJobs().size()).isEqualTo(FIXED_BOOTSTRAPS_JOBS); + + File fvo = new File("src/test/resources/testMeasurementCollectionJobFVO.json"); + InputStream in = new FileInputStream(fvo); + String mcjFVOText = IOUtils.toString(in, "UTF-8"); + + MeasurementCollectionJobFVO mcjFVO = JsonUtils.toJsonObj(mcjFVOText, MeasurementCollectionJobFVO.class); + + MeasurementCollectionJob response = measurementCollectionJobService.createMeasurementCollectionJob(mcjFVO); + + assertThat(measurementCollectionJobService.findAllMeasurementCollectionJobs().size()).isEqualTo(FIXED_BOOTSTRAPS_JOBS + 1); + + return response; + } +} diff --git a/src/test/resources/testMeasurementCollectionJobFVO.json b/src/test/resources/testMeasurementCollectionJobFVO.json new file mode 100644 index 0000000000000000000000000000000000000000..3854d4e47a8bacd2af998805f2ffdf3033c27a8e --- /dev/null +++ b/src/test/resources/testMeasurementCollectionJobFVO.json @@ -0,0 +1,271 @@ +{ + "consumingApplicationId": "4000", + "creationTime": "2020-06-23T14:12:01.078Z", + "jobId": "400", + "jobPriority": 3, + "lastModifiedTime": "2020-06-23T14:12:01.079Z", + "outputFormat": "string", + "producingApplicationId": "NT_101", + "adminState": "locked", + "executionState": "acknowledged", + "fileTransferData": [ + { + "fileFormat": "csv", + "fileLocation": "https://host:port/tmf-api/performanceManagement/v5/FileTransferData", + "transportProtocol": "ftp", + "compressionType": { + "compressionEnumType": "no_compression" + }, + "packingType": { + "packingEnumType": "NO_PACKING" + }, + "retentionPeriod": { + "amount": 1, + "units": "month" + }, + "@baseType": "FileTransferData", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/fileTransferLocation", + "@type": "FileTransferData" + } + ], + "granularity": "g_1mn", + "performanceIndicatorGroupSpecification": [ + { + "name": "My critical performance indicators", + "groupCategory": "CPUGroup", + "performanceIndicatorSpecification": [ + { + "uuid": "5000", + "href": "https://host:port/tmf-api/performanceManagement/v5/performanceIndicatorSpecification/5000", + "@type": "PerformanceIndicatorSpecificationRef" + } + ], + "@baseType": "PerformanceIndicatorGroupSpecification", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/PerformanceIndicatorGroupSpecification.schema.json", + "@type": "PerformanceIndicatorGroupSpecification" + } + ], + "performanceIndicatorSpecification": [ + { + "uuid": "101", + "href": "https://host:port/tmf-api/performanceManagement/v5/performanceIndicatorSpecification/101", + "derivationAlgorithm": "na", + "derivationMethod": "average", + "description": "The average CPU speed", + "indicatorCategory": "CPU", + "indicatorUnit": "GHz", + "name": "CPU Speed", + "perspective": "aggregation over a collection of systems", + "collectionType": "cumulative", + "indicatorType": "float", + "performanceIndicatorSpecRelationship": [ + { + "uuid": "321", + "href": "https://host:port/tmf-api/performanceManagement/v5/performanceIndicatorSpecRelationship/321", + "relationshipType": "reliesOn", + "validFor": { + "endDateTime": "1985-04-12T23:20:50.52Z", + "startDateTime": "1985-04-12T23:20:50.52Z" + }, + "@baseType": "PerformanceIndicatorSpecRelationship", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/PerformanceIndicatorSpecRelationship.schema.json", + "@type": "PerformanceIndicatorSpecRelationship" + } + ], + "validFor": { + "endDateTime": "1985-04-12T23:20:50.52Z", + "startDateTime": "1985-04-12T23:20:50.52Z" + }, + "@baseType": "PerformanceIndicatorSpecification", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/PerformanceIndicatorSpecification.schema.json", + "@type": "PerformanceIndicatorSpecification" + } + ], + "reportingPeriod": "r_1mn", + "scheduleDefinition": [ + { + "recurringFrequency": "weekly", + "scheduleDefinitionEndTime": "2020-06-23T14:12:01.080Z", + "scheduleDefinitionHourRange": "2", + "scheduleDefinitionStartTime": "2020-06-23T14:12:01.080Z", + "WeeklyScheduledDefinition": [ + { + "dates": "2020-06-23T14:12:01.080Z", + "@baseType": "WeeklyScheduledDefinition", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/WeeklyScheduledDefinition.schema.json", + "@type": "WeeklyScheduledDefinition" + } + ], + "@baseType": "ScheduleDefinition", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/ScheduleDefinition.schema.json", + "@type": "ScheduleDefinition" + }, + { + "recurringFrequency": "daily", + "scheduleDefinitionEndTime": "2026-06-23T14:12:01.080Z", + "scheduleDefinitionHourRange": "3", + "scheduleDefinitionStartTime": "2024-06-23T14:12:01.080Z", + "excludedDate": [ + "2024-07-23T14:12:01.080Z", + "2024-08-23T14:12:01.080Z" + ], + "WeeklyScheduledDefinition": [ + { + "dates": "2020-06-23T14:12:01.080Z", + "@baseType": "WeeklyScheduledDefinition", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/WeeklyScheduledDefinition.schema.json", + "@type": "WeeklyScheduledDefinition" + }, + { + "dates": "2025-06-23T14:12:01.080Z", + "@baseType": "WeeklyScheduledDefinition", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/WeeklyScheduledDefinition.schema.json", + "@type": "WeeklyScheduledDefinition" + } + ], + "monthlyScheduleDayOfMonthDefinition": [ + "2024-09-23T14:12:01.080Z", + "2024-10-23T14:12:01.080Z" + ], + "MonthlyScheduleDayOfWeekDefinition": { + "dayOfMonthRecurrence": [ + { + "dates": "2025-06-23T14:12:01.080Z", + "@baseType": "DayOfMonthRecurrence", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/DayOfMonthRecurrence.schema.json", + "@type": "DayOfMonthRecurrence" + }, + { + "dates": "2025-07-23T14:12:01.080Z", + "@baseType": "DayOfMonthRecurrence", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/DayOfMonthRecurrence.schema.json", + "@type": "DayOfMonthRecurrence" + } + ], + "recurringDaySequence": "first", + "@baseType": "MonthlyScheduleDayOfWeekDefinition", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/MonthlyScheduleDayOfWeekDefinition.schema.json", + "@type": "MonthlyScheduleDayOfWeekDefinition" + }, + "dateScheduleDefintion": [ + "2024-11-23T14:12:01.080Z", + "2024-12-23T14:12:01.080Z" + ], + "@baseType": "ScheduleDefinition", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/schemas/Tmf/common/ScheduleDefinition.schema.json", + "@type": "ScheduleDefinition" + } + ], + "trackingRecord": [ + { + "href": "https://host:port/tmf-api/performanceManagement/v5/fileTransferLocation", + "description": "NT_101 tracking", + "systemId": "NT_101", + "time": "2020-06-23T17:55:51.671Z", + "user": "NP1", + "@baseType": "TrackingRecord", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/fileTransferLocation", + "@type": "TrackingRecord" + } + ], + "dataAccessEndpoint": [ + { + "href": "https://host:port/tmf-api/performanceManagement/v5/dataAccessEndpoint/123-xxx", + "apiType": "REST", + "category": "topic", + "description": "Measurement collection job 123-xxx subscriber topic", + "endOperatingDate": "2022-05-13T10:13:42.971Z", + "name": "123-xxx subscriber topic", + "resourceVersion": "1.0", + "startOperatingDate": "2022-05-13T10:13:42.971Z", + "uri": "https://pubsub.googleapis.com/v1/", + "uriQueryFilter": { + "mappings": [ + { + "filterTemplate": { + "name": "myRangeFilterSearch0", + "@type": "DataFilterTemplateRange", + "description": "A Test filter template" + }, + "stringArray": { + "value": [ + "field01", + "field02", + "field03" + ], + "@type": "DataFilterAttributeStringArray" + } + }, + { + "filterTemplate": { + "name": "myRegExSampleSearch0", + "@type": "DataFilterTemplateRegex", + "description": "Another test filter template" + }, + "stringArray": { + "value": [ + "field11", + "field12", + "field13" + ], + "@type": "DataFilterAttributeStringArray" + } + }, + { + "filterTemplate": { + "name": "myBooleanFilterSearch0", + "@type": "DataFilterTemplateBoolean" + }, + "stringArray": { + "value": [ + "field1", + "field2", + "field3" + ], + "@type": "DataFilterAttributeStringArray" + } + } + ], + "@type": "DataFilterMap" + }, + "value": "myLogicalResourceValue", + "administrativeState": "locked", + "operationalState": "enable", + "resourceCharacteristic": [ + { + "name": "myCharName", + "valueType": "string", + "characteristicRelationship": [ + { + "relationshipType": "string", + "@baseType": "CharacteristicRelationship", + "@schemaLocation": "https://myschemas.com/CharacteristicRelationship.schema.json", + "@type": "CharacteristicRelationship" + } + ], + "@baseType": "Characteristic", + "@schemaLocation": "https://myschemas.com/StringCharacteristic.schema.json", + "@type": "StringCharacteristic" + } + ], + "resourceSpecification": { + "id": "1", + "href": "https://host:port/tmf-api/performanceManagement/v5/ResourceSpecification/1", + "name": "mySpecName", + "version": "1.0", + "@baseType": "ResourceSpecification", + "@schemaLocation": "https://mySchemas.com/ResourceSpecification.schema.json", + "@type": "ResourceSpecification", + "@referredType": "ResourceSpecification" + }, + "resourceStatus": "standby", + "usageState": "idle", + "@baseType": "DataAccessEndpoint", + "@schemaLocation": "https://myschemas.com/dataAccessEndpoint", + "@type": "DataAccessEndpoint" + } + ], + "@baseType": "MeasurementCollectionJob", + "@schemaLocation": "https://host:port/tmf-api/performanceManagement/v5/fileTransferLocation", + "@type": "MeasurementCollectionJob" +} \ No newline at end of file