diff --git a/src/main/java/org/openepics/names/rest/api/v1/INames.java b/src/main/java/org/openepics/names/rest/api/v1/INames.java index 759e6e916178a63899fe824c1a016bee475d364e..05f413f1416283d7399b79070588c838b18fc4f6 100644 --- a/src/main/java/org/openepics/names/rest/api/v1/INames.java +++ b/src/main/java/org/openepics/names/rest/api/v1/INames.java @@ -28,11 +28,13 @@ import org.openepics.names.rest.beans.response.ResponseBoolean; import org.openepics.names.rest.beans.response.ResponseBooleanList; import org.openepics.names.rest.beans.response.ResponsePageNameElements; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import io.swagger.v3.oas.annotations.Hidden; @@ -120,33 +122,52 @@ public interface INames { */ @Operation( summary = "Create names by array of name elements", - description = "Create names by array of name elements. " - + "Return array of created name elements." - + "\n\n" - + "Required attributes: \n" - + "- parentsystemstructure \n" - + "- description \n" - + "- comment \n" - + "\n\n" - + "Uuid is created by Naming." + description = """ + Create names by array of name elements. + Return array of created name elements. + + Required attributes: + - parentsystemstructure + - description + - comment + + Uuid is created by Naming. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of created name elements.", - content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return array of created name elements.", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( - method = RequestMethod.POST, + @PostMapping( produces = {"application/json"}, consumes = {"application/json"}) public List<NameElement> createNames( - @Parameter(in = ParameterIn.DEFAULT, description = "array of name elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = NameElementCommand.class, - requiredProperties = {"parentsystemstructure","parentdevicestructure","index","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of name elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = NameElementCommand.class, + requiredProperties = {"parentsystemstructure","parentdevicestructure","index","description","comment"})))) @RequestBody List<NameElementCommand> nameElements); // ---------------------------------------------------------------------------------------------------- @@ -167,19 +188,32 @@ public interface INames { */ @Operation( summary = "Find valid names (search)", - description = "Find valid names (search). " - + "Return paged array of name elements." + description = """ + Find valid names (search). + Return paged array of name elements. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return paged array of name elements.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageNameElements.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return paged array of name elements.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponsePageNameElements.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( - method = RequestMethod.GET, + @GetMapping( produces = {"application/json"}) public ResponsePageNameElements readNames( @Parameter(in = ParameterIn.QUERY, description = "if deleted names are to be included or not, omitted for both deleted and not deleted names") @RequestParam(required = false) Boolean deleted, @@ -203,20 +237,33 @@ public interface INames { */ @Operation( summary = "Find valid names by name or uuid (search)", - description = "Find valid names by name or uuid (search). " - + "Return paged array of name elements." + description = """ + Find valid names by name or uuid (search). + Return paged array of name elements. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return paged array of name elements.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageNameElements.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return paged array of name elements.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponsePageNameElements.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/{name}", - method = RequestMethod.GET, produces = {"application/json"}) public ResponsePageNameElements readNames( @Parameter(in = ParameterIn.PATH, description = "name or uuid to search for") @PathVariable("name") String name, @@ -238,20 +285,33 @@ public interface INames { */ @Operation( summary = "Find valid names by system structure mnemonic path (search)", - description = "Find valid names by system structure mnemonic path (search). " - + "Return paged array of name elements." + description = """ + Find valid names by system structure mnemonic path (search). + Return paged array of name elements. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return paged array of name elements.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageNameElements.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return paged array of name elements.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponsePageNameElements.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/systemstructure/{mnemonicpath}", - method = RequestMethod.GET, produces = {"application/json"}) public ResponsePageNameElements readNamesSystemStructure( @Parameter(in = ParameterIn.PATH, description = "mnemonic path to search for") @PathVariable("mnemonicpath") String mnemonicpath, @@ -273,20 +333,33 @@ public interface INames { */ @Operation( summary = "Find valid names by device structure mnemonic path (search)", - description = "Find valid names by device structure mnemonic path (search). " - + "Return paged array of name elements." + description = """ + Find valid names by device structure mnemonic path (search). + Return paged array of name elements. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return paged array of name elements.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageNameElements.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return paged array of name elements.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponsePageNameElements.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/devicestructure/{mnemonicpath}", - method = RequestMethod.GET, produces = {"application/json"}) public ResponsePageNameElements readNamesDeviceStructure( @Parameter(in = ParameterIn.PATH, description = "mnemonic path to search for") @PathVariable("mnemonicpath") String mnemonicpath, @@ -308,20 +381,33 @@ public interface INames { */ @Operation( summary = "Find history for name by uuid (exact match)", - description = "Find history for name by uuid (exact match). " - + "Return paged array of name elements." + description = """ + Find history for name by uuid (exact match). + Return paged array of name elements. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return paged array of name elements.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageNameElements.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return paged array of name elements.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponsePageNameElements.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/history/{uuid}", - method = RequestMethod.GET, produces = {"application/json"}) public ResponsePageNameElements readNamesHistory( @Parameter(in = ParameterIn.PATH, description = "uuid to find history for") @PathVariable("uuid") String uuid, @@ -343,17 +429,28 @@ public interface INames { description = "Return name equivalence for name." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return name equivalence.", - content = @Content(mediaType = "text/plain", schema = @Schema(implementation = String.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return name equivalence.", + content = @Content( + mediaType = "text/plain", + schema = @Schema(implementation = String.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( - value = "/equivalence/{name}", - method = RequestMethod.GET) + @GetMapping( + value = "/equivalence/{name}") public String equivalenceName( @Parameter(in = ParameterIn.PATH, description = "name to get name equivalence for") @PathVariable("name") String name); @@ -373,17 +470,28 @@ public interface INames { description = "Return if name exists (exact match)." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if name exists, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if name exists, false otherwise. " + "Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBoolean.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBoolean.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/exists/{name}", - method = RequestMethod.GET, produces = {"application/json"}) public ResponseEntity<ResponseBoolean> existsName( @Parameter(in = ParameterIn.PATH, description = "name to check if it exists") @PathVariable("name") String name); @@ -402,21 +510,34 @@ public interface INames { */ @Operation( summary = "Return if name is legacy name (exact match)", - description = "Return if name is legacy name (exact match). " - + "A name is considered legacy name if one or more of its parents is deleted." + description = """ + Return if name is legacy name (exact match). + A name is considered legacy name if one or more of its parents is deleted. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if name is legacy name, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if name is legacy name, false otherwise. " + "Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBoolean.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBoolean.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/islegacy/{name}", - method = RequestMethod.GET, produces = {"application/json"}) public ResponseEntity<ResponseBoolean> isLegacyName( @Parameter(in = ParameterIn.PATH, description = "name to check if it is legacy name") @PathVariable("name") String name); @@ -435,21 +556,34 @@ public interface INames { */ @Operation( summary = "Return if name is valid to create (exact match)", - description = "Return if name is valid to create (exact match). " - + "Method answers question 'would it be ok to create given name?'." + description = """ + Return if name is valid to create (exact match). + Method answers question 'would it be ok to create given name?'. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if name is valid to create, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if name is valid to create, false otherwise. " + "Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBoolean.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBoolean.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/isvalidtocreate/{name}", - method = RequestMethod.GET, produces = {"application/json"}) public ResponseEntity<ResponseBoolean> isValidToCreateName( @Parameter(in = ParameterIn.PATH, description = "name to check if it is valid to create") @PathVariable("name") String name); @@ -471,33 +605,52 @@ public interface INames { @Hidden @Operation( summary = "Return if name elements are valid to create", - description = "Return if name elements are valid to create. " - + "If names are valid to create, successful create of names can be expected." - + "\n\n" - + "Required attributes: \n" - + "- parentsystemstructure \n" - + "- description \n" - + "- comment" + description = """ + Return if name elements are valid to create. + If names are valid to create, successful create of names can be expected. + + Required attributes: + - parentsystemstructure + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if all name elements validated ok, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if all name elements validated ok, false otherwise. " + "Responses contain array with result for each name element. Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBooleanList.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBooleanList.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/validatecreate", - method = RequestMethod.GET, produces = {"application/json"}, consumes = {"application/json"}) public ResponseEntity<ResponseBooleanList> validateNamesCreate( - @Parameter(in = ParameterIn.DEFAULT, description = "array of name elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = NameElementCommand.class, - requiredProperties = {"parentsystemstructure","parentdevicestructure","index","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of name elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = NameElementCommand.class, + requiredProperties = {"parentsystemstructure","parentdevicestructure","index","description","comment"})))) @RequestBody List<NameElementCommand> nameElements); /** @@ -515,34 +668,53 @@ public interface INames { @Hidden @Operation( summary = "Return if name elements are valid to update", - description = "Return if name elements are valid to update. " - + "If names are valid to update, successful update of names can be expected." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- parentsystemstructure \n" - + "- description \n" - + "- comment" + description = """ + Return if name elements are valid to update. + If names are valid to update, successful update of names can be expected. + + Required attributes: + - uuid + - parentsystemstructure + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if all name elements validated ok, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if all name elements validated ok, false otherwise. " + "Responses contain array with result for each name element. Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBooleanList.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBooleanList.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/validateupdate", - method = RequestMethod.GET, produces = {"application/json"}, consumes = {"application/json"}) public ResponseEntity<ResponseBooleanList> validateNamesUpdate( - @Parameter(in = ParameterIn.DEFAULT, description = "array of name elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = NameElementCommand.class, - requiredProperties = {"uuid","parentsystemstructure","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of name elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = NameElementCommand.class, + requiredProperties = {"uuid","parentsystemstructure","description","comment"})))) @RequestBody List<NameElementCommand> nameElements); /** @@ -560,32 +732,51 @@ public interface INames { @Hidden @Operation( summary = "Return if name elements are valid to delete", - description = "Return if name elements are valid to delete. " - + "If names are valid to update, successful delete of names can be expected." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- comment" + description = """ + Return if name elements are valid to delete. + If names are valid to update, successful delete of names can be expected. + + Required attributes: + - uuid + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if all name elements validated ok, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if all name elements validated ok, false otherwise. " + "Responses contain array with result for each name element. Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBooleanList.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBooleanList.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/validatedelete", - method = RequestMethod.GET, produces = {"application/json"}, consumes = {"application/json"}) public ResponseEntity<ResponseBooleanList> validateNamesDelete( - @Parameter(in = ParameterIn.DEFAULT, description = "array of name elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = NameElementCommand.class, - requiredProperties = {"uuid","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of name elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = NameElementCommand.class, + requiredProperties = {"uuid","comment"})))) @RequestBody List<NameElementCommand> nameElements); // ---------------------------------------------------------------------------------------------------- @@ -599,35 +790,53 @@ public interface INames { */ @Operation( summary = "Update names by array of name elements", - description = "Update names by array of name elements. " - + "Return array of updated name elements." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- parentsystemstructure \n" - + "- description \n" - + "- comment \n" - + "\n\n" - + "Other attributes are optional." + description = """ + Update names by array of name elements. + Return array of updated name elements. + + Required attributes: + - uuid + - parentsystemstructure + - description + - comment + + Other attributes are optional. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of updated name elements.", - content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return array of updated name elements.", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( - method = RequestMethod.PUT, + @PutMapping( produces = {"application/json"}, consumes = {"application/json"}) - @PutMapping public List<NameElement> updateNames( - @Parameter(in = ParameterIn.DEFAULT, description = "array of name elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = NameElementCommand.class, - requiredProperties = {"uuid","parentsystemstructure","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of name elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = NameElementCommand.class, + requiredProperties = {"uuid","parentsystemstructure","description","comment"})))) @RequestBody List<NameElementCommand> nameElements); // ---------------------------------------------------------------------------------------------------- @@ -641,32 +850,51 @@ public interface INames { */ @Operation( summary = "Delete names by array of name elements", - description = "Delete names by array of name elements. " - + "Return array of deleted name elements." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- comment \n" - + "\n\n" - + "Other attributes are not considered." + description = """ + Delete names by array of name elements. + Return array of deleted name elements. + + Required attributes: + - uuid + - comment + + Other attributes are not considered. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of deleted name elements.", - content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return array of deleted name elements.", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( - method = RequestMethod.DELETE, + @DeleteMapping( produces = {"application/json"}, consumes = {"application/json"}) public List<NameElement> deleteNames( - @Parameter(in = ParameterIn.DEFAULT, description = "array of name elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = NameElementCommand.class, - requiredProperties = {"uuid","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of name elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = NameElementCommand.class, + requiredProperties = {"uuid","comment"})))) @RequestBody List<NameElementCommand> nameElements); } diff --git a/src/main/java/org/openepics/names/rest/api/v1/IStructures.java b/src/main/java/org/openepics/names/rest/api/v1/IStructures.java index 126dbe9fcb6dbf3f57f6c6253269176fa6a84c94..3b75c3ab9982431fb94e9274436dcf59ffae88a1 100644 --- a/src/main/java/org/openepics/names/rest/api/v1/IStructures.java +++ b/src/main/java/org/openepics/names/rest/api/v1/IStructures.java @@ -30,11 +30,14 @@ import org.openepics.names.rest.beans.response.ResponseBoolean; import org.openepics.names.rest.beans.response.ResponseBooleanList; import org.openepics.names.rest.beans.response.ResponsePageStructureElements; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import io.swagger.v3.oas.annotations.Hidden; @@ -140,36 +143,55 @@ public interface IStructures { */ @Operation( summary = "Create (propose) structures by array of structure elements", - description = "Create (propose) structures by array of structure elements. " - + "Return array of created structure elements (proposals)." - + "\n\n" - + "Required attributes: \n" - + "- type \n" - + "- parent (System, Subsystem, DeviceGroup, DeviceType) \n" - + "- name \n" - + "- mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) \n" - + "- description \n" - + "- comment \n" - + "\n\n" - + "Uuid is created by Naming." + description = """ + Create (propose) structures by array of structure elements. + Return array of created structure elements (proposals). + + Required attributes: + - type + - parent (System, Subsystem, DeviceGroup, DeviceType) + - name + - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) + - description + - comment + + Uuid is created by Naming. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements for created structures (proposals).", - content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return array of structure elements for created structures (proposals).", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( - method = RequestMethod.POST, + @PostMapping( produces = {"application/json"}, consumes = {"application/json"}) public List<StructureElement> createStructures( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"type","parent","name","mnemonic","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"type","parent","name","mnemonic","description","comment"})))) @RequestBody List<StructureElementCommand> structureElements); // ---------------------------------------------------------------------------------------------------- @@ -192,22 +214,34 @@ public interface IStructures { */ @Operation( summary = "Find valid structures (search)", - description = "Find valid structures (search). " - + "Return paged array of structure elements." + description = """ + Find valid structures (search). + Return paged array of structure elements. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return paged array of structure elements.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageStructureElements.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return paged array of structure elements.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponsePageStructureElements.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/{type}", - method = RequestMethod.GET, produces = {"application/json"}) - @GetMapping public ResponsePageStructureElements readStructures( @Parameter(in = ParameterIn.PATH, description = "type of structure to search in") @PathVariable("type") Type type, @Parameter(in = ParameterIn.QUERY, description = "statuses of structures to search for") @RequestParam(required = false) Status[] statuses, @@ -233,22 +267,34 @@ public interface IStructures { */ @Operation( summary = "Find valid children structures by type and parent uuid (exact match)", - description = "Find valid children structures by type and parent uuid (exact match). " - + "Return paged array of structure elements." -) + description = """ + Find valid children structures by type and parent uuid (exact match). + Return paged array of structure elements. + """ + ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return paged array of structure elements.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageStructureElements.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return paged array of structure elements.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponsePageStructureElements.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/children/{type}/{uuid}", - method = RequestMethod.GET, produces = {"application/json"}) - @GetMapping public ResponsePageStructureElements readStructuresChildren( @Parameter(in = ParameterIn.PATH, description = "type of structure to search in") @PathVariable("type") Type type, @Parameter(in = ParameterIn.PATH, description = "uuid to find structure for") @PathVariable("uuid") String uuid, @@ -270,22 +316,34 @@ public interface IStructures { */ @Operation( summary = "Find valid structures by mnemonic (search)", - description = "Find valid structures by mnemonic (search). " - + "Return paged array of structure elements." + description = """ + Find valid structures by mnemonic (search). + Return paged array of structure elements. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return paged array of structure elements.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageStructureElements.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return paged array of structure elements.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponsePageStructureElements.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/mnemonic/{mnemonic}", - method = RequestMethod.GET, produces = {"application/json"}) - @GetMapping public ResponsePageStructureElements readStructuresMnemonic( @Parameter(in = ParameterIn.PATH, description = "mnemonic to search for") @PathVariable("mnemonic") String mnemonic, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldStructure orderBy, @@ -306,22 +364,34 @@ public interface IStructures { */ @Operation( summary = "Find valid structures by mnemonic path (search)", - description = "Find valid structures by mnemonic path (search). " - + "Return paged array of structure elements." + description = """ + Find valid structures by mnemonic path (search). + Return paged array of structure elements. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return paged array of structure elements.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageStructureElements.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return paged array of structure elements.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponsePageStructureElements.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/mnemonicpath/{mnemonicpath}", - method = RequestMethod.GET, produces = {"application/json"}) - @GetMapping public ResponsePageStructureElements readStructuresMnemonicpath( @Parameter(in = ParameterIn.PATH, description = "mnemonic path to search for") @PathVariable("mnemonicpath") String mnemonicpath, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldStructure orderBy, @@ -343,20 +413,33 @@ public interface IStructures { */ @Operation( summary = "Find history for structure by uuid (exact match)", - description = "Find history for structure by uuid (exact match). " - + "Return paged array of structure elements." + description = """ + Find history for structure by uuid (exact match). + Return paged array of structure elements. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return paged array of structure elements.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageStructureElements.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return paged array of structure elements.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponsePageStructureElements.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/history/{uuid}", - method = RequestMethod.GET, produces = {"application/json"}) public ResponsePageStructureElements readStructuresHistory( @Parameter(in = ParameterIn.PATH, description = "uuid to find structure for") @PathVariable("uuid") String uuid, @@ -379,17 +462,28 @@ public interface IStructures { description = "Return mnemonic equivalence for mnemonic." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return mnemonic equivalence.", - content = @Content(mediaType = "text/plain", schema = @Schema(implementation = String.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return mnemonic equivalence.", + content = @Content( + mediaType = "text/plain", + schema = @Schema(implementation = String.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( - value = "/equivalence/{mnemonic}", - method = RequestMethod.GET) + @GetMapping( + value = "/equivalence/{mnemonic}") public String equivalenceMnemonic( @Parameter(in = ParameterIn.PATH, description = "mnemonic to get mnemonic equivalence for") @PathVariable("mnemonic") String mnemonic); @@ -411,21 +505,34 @@ public interface IStructures { */ @Operation( summary = "Return if mnemonic path exists in structure (exact match)", - description = "Return if mnemonic path exists in structure (exact match). " - + "Returned object has three fields (message, details, response)." + description = """ + Return if mnemonic path exists in structure (exact match). + Returned object has three fields (message, details, response). + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if mnemonic path exists, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if mnemonic path exists, false otherwise. " + "Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBoolean.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBoolean.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( - value = "/exists/{type}/{mnemonicpath}", - method = RequestMethod.GET) + @GetMapping( + value = "/exists/{type}/{mnemonicpath}") public ResponseEntity<ResponseBoolean> existsStructure( @Parameter(in = ParameterIn.PATH, description = "type of structure to search in") @PathVariable("type") Type type, @Parameter(in = ParameterIn.PATH, description = "mnemonic path to find structure for") @PathVariable("mnemonicpath") String mnemonicpath); @@ -447,26 +554,39 @@ public interface IStructures { */ @Operation( summary = "Return if mnemonic path is valid to create in structure", - description = "Return if mnemonic path is valid to create in structure. " - + "Method answers question 'would it be ok to create given mnemonic path in structure?'." - + "\n\n" - + "Note that method can not fully answer question posed above. One reason is that system group " - + "may have empty mnemonic. Another reason is that device groups has no mnemonic and is " - + "between discipline and device type. Thus it can not be found which discipline (uuid-wise) " - + "that a device type belongs." + description = """ + Return if mnemonic path is valid to create in structure. + Method answers question 'would it be ok to create given mnemonic path in structure?'. + + Note that method can not fully answer question posed above. One reason is that system group + may have empty mnemonic. Another reason is that device groups has no mnemonic and is + between discipline and device type. Thus it can not be found which discipline (uuid-wise) + that a device type belongs. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if structure is valid to create, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if structure is valid to create, false otherwise. " + "Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBoolean.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBoolean.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/isvalidtocreate/{type}/{mnemonicpath}", - method = RequestMethod.GET, produces = {"application/json"}) public ResponseEntity<ResponseBoolean> isValidToCreateStructure( @Parameter(in = ParameterIn.PATH, description = "type of structure to search in") @PathVariable("type") Type type, @@ -494,36 +614,55 @@ public interface IStructures { @Hidden @Operation( summary = "Return if structure elements are valid to create (propose)", - description = "Return if structure elements are valid to create (propose). " - + "If structure elements are valid to create, successful create of structures can be expected." - + "\n\n" - + "Required attributes: \n" - + "- type \n" - + "- parent (System, Subsystem, DeviceGroup, DeviceType) \n" - + "- name \n" - + "- mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) \n" - + "- description \n" - + "- comment" + description = """ + Return if structure elements are valid to create (propose). + If structure elements are valid to create, successful create of structures can be expected. + + Required attributes: + - type + - parent (System, Subsystem, DeviceGroup, DeviceType) + - name + - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + "Responses contain array with result for each structure element. Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBooleanList.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBooleanList.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/validatecreate", - method = RequestMethod.GET, produces = {"application/json"}, consumes = {"application/json"}) public ResponseEntity<ResponseBooleanList> validateStructuresCreate( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"type","parent","name","mnemonic","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"type","parent","name","mnemonic","description","comment"})))) @RequestBody List<StructureElementCommand> structureElements); /** @@ -546,37 +685,56 @@ public interface IStructures { @Hidden @Operation( summary = "Return if structure elements are valid to update (propose)", - description = "Return if structure elements are valid to update (propose). " - + "If structure elements are valid to update, successful update of structures can be expected." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- type \n" - + "- parent (System, Subsystem, DeviceGroup, DeviceType) \n" - + "- name \n" - + "- mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) \n" - + "- description \n" - + "- comment" + description = """ + Return if structure elements are valid to update (propose). + If structure elements are valid to update, successful update of structures can be expected. + + Required attributes: + - uuid + - type + - parent (System, Subsystem, DeviceGroup, DeviceType) + - name + - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + "Responses contain array with result for each structure element. Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBooleanList.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBooleanList.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/validateupdate", - method = RequestMethod.GET, produces = {"application/json"}, consumes = {"application/json"}) public ResponseEntity<ResponseBooleanList> validateStructuresUpdate( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) @RequestBody List<StructureElementCommand> structureElements); /** @@ -599,33 +757,52 @@ public interface IStructures { @Hidden @Operation( summary = "Return if structure elements are valid to delete (propose)", - description = "Return if structure elements are valid to delete (propose). " - + "If structure elements are valid to delete, successful delete of structures can be expected." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- type \n" - + "- comment" + description = """ + Return if structure elements are valid to delete (propose). + If structure elements are valid to delete, successful delete of structures can be expected. + + Required attributes: + - uuid + - type + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + "Responses contain array with result for each structure element. Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBooleanList.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBooleanList.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/validatedelete", - method = RequestMethod.GET, produces = {"application/json"}, consumes = {"application/json"}) public ResponseEntity<ResponseBooleanList> validateStructuresDelete( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"uuid","type","comment"})))) @RequestBody List<StructureElementCommand> structureElements); /** @@ -648,37 +825,56 @@ public interface IStructures { @Hidden @Operation( summary = "Return if structure elements are valid to approve", - description = "Return if structure elements are valid to approve. " - + "If structure elements are valid to approve, successful approve of structures can be expected." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- type \n" - + "- parent (System, Subsystem, DeviceGroup, DeviceType) \n" - + "- name \n" - + "- mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) \n" - + "- description \n" - + "- comment" + description = """ + Return if structure elements are valid to approve. + If structure elements are valid to approve, successful approve of structures can be expected. + + Required attributes: + - uuid + - type + - parent (System, Subsystem, DeviceGroup, DeviceType) + - name + - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + "Responses contain array with result for each structure element. Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBooleanList.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBooleanList.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/validateapprove", - method = RequestMethod.GET, produces = {"application/json"}, consumes = {"application/json"}) public ResponseEntity<ResponseBooleanList> validateStructuresApprove( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) @RequestBody List<StructureElementCommand> structureElements); /** @@ -701,37 +897,56 @@ public interface IStructures { @Hidden @Operation( summary = "Return if structure elements are valid to cancel", - description = "Return if structure elements are valid to cancel. " - + "If structure elements are valid to cancel, successful cancel of structures can be expected." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- type \n" - + "- parent (System, Subsystem, DeviceGroup, DeviceType) \n" - + "- name \n" - + "- mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) \n" - + "- description \n" - + "- comment" + description = """ + Return if structure elements are valid to cancel. + If structure elements are valid to cancel, successful cancel of structures can be expected. + + Required attributes: + - uuid + - type + - parent (System, Subsystem, DeviceGroup, DeviceType) + - name + - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + "Responses contain array with result for each structure element. Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBooleanList.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBooleanList.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/validatecancel", - method = RequestMethod.GET, produces = {"application/json"}, consumes = {"application/json"}) public ResponseEntity<ResponseBooleanList> validateStructuresCancel( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) @RequestBody List<StructureElementCommand> structureElements); /** @@ -754,37 +969,56 @@ public interface IStructures { @Hidden @Operation( summary = "Return if structure elements are valid to reject", - description = "Return if structure elements are valid to reject. " - + "If structure elements are valid to reject, successful reject of structures can be expected." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- type \n" - + "- parent (System, Subsystem, DeviceGroup, DeviceType) \n" - + "- name \n" - + "- mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) \n" - + "- description \n" - + "- comment" + description = """ + Return if structure elements are valid to reject. + If structure elements are valid to reject, successful reject of structures can be expected. + + Required attributes: + - uuid + - type + - parent (System, Subsystem, DeviceGroup, DeviceType) + - name + - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Response is true if all structure elements validated ok, false otherwise. " + "Responses contain array with result for each structure element. Message and details are available if no response is available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponseBooleanList.class))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = ResponseBooleanList.class))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @GetMapping( value = "/validatereject", - method = RequestMethod.GET, produces = {"application/json"}, consumes = {"application/json"}) public ResponseEntity<ResponseBooleanList> validateStructuresReject( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) @RequestBody List<StructureElementCommand> structureElements); // ---------------------------------------------------------------------------------------------------- @@ -798,35 +1032,54 @@ public interface IStructures { */ @Operation( summary = "Update (propose) structures by array of structure elements", - description = "Update (propose) structures by array of structure elements. " - + "Return array of updated structure elements (proposals)." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- type \n" - + "- parent (System, Subsystem, DeviceGroup, DeviceType) \n" - + "- name \n" - + "- mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) \n" - + "- description \n" - + "- comment" + description = """ + Update (propose) structures by array of structure elements. + Return array of updated structure elements (proposals). + + Required attributes: + - uuid + - type + - parent (System, Subsystem, DeviceGroup, DeviceType) + - name + - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements for updated structures (proposals).", - content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return array of structure elements for updated structures (proposals).", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( - method = RequestMethod.PUT, + @PutMapping( produces = {"application/json"}, consumes = {"application/json"}) public List<StructureElement> updateStructures( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) @RequestBody List<StructureElementCommand> structureElements); // ---------------------------------------------------------------------------------------------------- @@ -840,33 +1093,52 @@ public interface IStructures { */ @Operation( summary = "Delete (propose) structures by array of structure elements", - description = "Delete (propose) structures by array of structure elements. " - + "Return array of deleted structure elements (proposals)." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- type \n" - + "- comment \n" - + "\n\n" - + "Other attributes are not considered." + description = """ + Delete (propose) structures by array of structure elements. + Return array of deleted structure elements (proposals). + + Required attributes: + - uuid + - type + - comment + + Other attributes are not considered. + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements for deleted structures (proposals).", - content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return array of structure elements for deleted structures (proposals).", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( - method = RequestMethod.DELETE, + @DeleteMapping( produces = {"application/json"}, consumes = {"application/json"}) public List<StructureElement> deleteStructures( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"uuid","type","comment"})))) @RequestBody List<StructureElementCommand> structureElements); @@ -881,36 +1153,55 @@ public interface IStructures { */ @Operation( summary = "Approve structures (proposals) by array of structure elements", - description = "Approve structures (proposals) by array of structure elements. " - + "Return array of approved structure elements." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- type \n" - + "- parent (System, Subsystem, DeviceGroup, DeviceType) \n" - + "- name \n" - + "- mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) \n" - + "- description \n" - + "- comment" + description = """ + Approve structures (proposals) by array of structure elements. + Return array of approved structure elements. + + Required attributes: + - uuid + - type + - parent (System, Subsystem, DeviceGroup, DeviceType) + - name + - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements for approved structures.", - content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return array of structure elements for approved structures.", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @PatchMapping( value = "/approve", - method = RequestMethod.PATCH, produces = {"application/json"}, consumes = {"application/json"}) public List<StructureElement> approveStructures( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) @RequestBody List<StructureElementCommand> structureElements); /** @@ -922,36 +1213,55 @@ public interface IStructures { */ @Operation( summary = "Cancel structures (proposals) by array of structure elements", - description = "Cancel structures (proposals) by array of structure elements. " - + "Return array of cancelled structure elements." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- type \n" - + "- parent (System, Subsystem, DeviceGroup, DeviceType) \n" - + "- name \n" - + "- mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) \n" - + "- description \n" - + "- comment" + description = """ + Cancel structures (proposals) by array of structure elements. + Return array of cancelled structure elements. + + Required attributes: + - uuid + - type + - parent (System, Subsystem, DeviceGroup, DeviceType) + - name + - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements for cancelled structures.", - content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return array of structure elements for cancelled structures.", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @PatchMapping( value = "/cancel", - method = RequestMethod.PATCH, produces = {"application/json"}, consumes = {"application/json"}) public List<StructureElement> cancelStructures( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) @RequestBody List<StructureElementCommand> structureElements); /** @@ -963,36 +1273,55 @@ public interface IStructures { */ @Operation( summary = "Reject structures (proposals) by array of structure elements", - description = "Reject structures (proposals) by array of structure elements. " - + "Return array of rejected structure elements." - + "\n\n" - + "Required attributes: \n" - + "- uuid \n" - + "- type \n" - + "- parent (System, Subsystem, DeviceGroup, DeviceType) \n" - + "- name \n" - + "- mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) \n" - + "- description \n" - + "- comment" + description = """ + Reject structures (proposals) by array of structure elements. + Return array of rejected structure elements. + + Required attributes: + - uuid + - type + - parent (System, Subsystem, DeviceGroup, DeviceType) + - name + - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) + - description + - comment + """ ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements for rejected structures.", - content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), - @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), - @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) + @ApiResponse( + responseCode = "200", + description = "Method completed OK. Return array of structure elements for rejected structures.", + content = @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse( + responseCode = "400", + description = "Bad request. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))), + @ApiResponse( + responseCode = "500", + description = "Internal server error. Message and details are available.", + content = @Content( + mediaType = "application/json", + schema = @Schema(implementation = Response.class))) }) - @RequestMapping( + @PatchMapping( value = "/reject", - method = RequestMethod.PATCH, produces = {"application/json"}, consumes = {"application/json"}) public List<StructureElement> rejectStructures( - @Parameter(in = ParameterIn.DEFAULT, description = "array of structure elements", required = true, - content = @Content(mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) + @Parameter( + in = ParameterIn.DEFAULT, + description = "array of structure elements", + required = true, + content = @Content( + mediaType = "application/json", + array = @ArraySchema( + schema = @Schema( + implementation = StructureElementCommand.class, + requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) @RequestBody List<StructureElementCommand> structureElements); } diff --git a/src/main/java/org/openepics/names/rest/beans/FieldName.java b/src/main/java/org/openepics/names/rest/beans/FieldName.java index f73973c707b8b8097e957f496b7aefc8627c68f6..3fcb8ffe47ec0c1e3267a146c7ce30a816888018 100644 --- a/src/main/java/org/openepics/names/rest/beans/FieldName.java +++ b/src/main/java/org/openepics/names/rest/beans/FieldName.java @@ -18,19 +18,30 @@ package org.openepics.names.rest.beans; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This enum represents fields for name in beans and for communication. * * @author Lars Johansson */ +@Schema(description = "A collection of values for fields for a name that may used in client query " + + "for information to server.") public enum FieldName { + @Schema(description = "Identity of the name. Value is set server-side.") UUID, + @Schema(description = "Name (verbose) of the name.") NAME, + @Schema(description = "Name equivalence of the name.") NAMEEQUIVALENCE, + @Schema(description = "Mnemonic path for for the system structure.") SYSTEMSTRUCTURE, + @Schema(description = "Mnemonic path for for the device structure.") DEVICESTRUCTURE, + @Schema(description = "Description of the name.") DESCRIPTION, + @Schema(description = "Date and time when the name was created.") WHEN; } diff --git a/src/main/java/org/openepics/names/rest/beans/FieldStructure.java b/src/main/java/org/openepics/names/rest/beans/FieldStructure.java index f8cf33e9e6fd3bce91393642f0353855d763d515..b25cf986ec114e230e7ffe88dc78ec561d6c7a6a 100644 --- a/src/main/java/org/openepics/names/rest/beans/FieldStructure.java +++ b/src/main/java/org/openepics/names/rest/beans/FieldStructure.java @@ -18,20 +18,32 @@ package org.openepics.names.rest.beans; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This enum represents fields for structures in beans and for communication. * * @author Lars Johansson */ +@Schema(description = "A collection of values for fields for a structure entry that may used in client query " + + "for information to server.") public enum FieldStructure { + @Schema(description = "Identity of the structure entry. Value is set server-side.") UUID, + @Schema(description = "Identity for the structure entry parent (if the structure entry has a parent).") PARENT, + @Schema(description = "Name of the structure entry.") NAME, + @Schema(description = "Mnemonic of the structure entry.") MNEMONIC, + @Schema(description = "Mnemonic equivalence of the structure entry.") MNEMONICEQUIVALENCE, + @Schema(description = "Mnemonic path for for the structure entry.") MNEMONICPATH, + @Schema(description = "Description of the structure entry.") DESCRIPTION, + @Schema(description = "Date and time when the structure entry was created.") WHEN; } diff --git a/src/main/java/org/openepics/names/rest/beans/Status.java b/src/main/java/org/openepics/names/rest/beans/Status.java index 72a67ea2578958dac08487619c9e25f39aff2ab8..231ebc04ade70e5d8c8c8326777fd96d0279c374 100644 --- a/src/main/java/org/openepics/names/rest/beans/Status.java +++ b/src/main/java/org/openepics/names/rest/beans/Status.java @@ -18,17 +18,26 @@ package org.openepics.names.rest.beans; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This enum represents status for names and structures data in beans and for communication. * * @author Lars Johansson */ +@Schema(description = "A collection of values for status of a name and structure entry. " + + "It is used to show where in its lifecycle that a name and structure entry is located.") public enum Status { + @Schema(description = "(Proposal for) Name or structure entry has been approved by administrator.") APPROVED, + @Schema(description = "Name or structure entry that is no longer in use with data considered history.") ARCHIVED, + @Schema(description = "(Proposal for) Name or structure entry has been cancelled by user.") CANCELLED, + @Schema(description = "(Proposal for) Name or structure entry has been entered by user and is pending for administrator to approve or reject.") PENDING, + @Schema(description = "(Proposal for) Name or structure entry has been rejected by administrator.") REJECTED; } diff --git a/src/main/java/org/openepics/names/rest/beans/Type.java b/src/main/java/org/openepics/names/rest/beans/Type.java index fad17a5e23d5a117c72dedc8b0f813a8f8845806..ee72e4f6c0eec17d8d1c39a4e7911bd92a431512 100644 --- a/src/main/java/org/openepics/names/rest/beans/Type.java +++ b/src/main/java/org/openepics/names/rest/beans/Type.java @@ -18,18 +18,29 @@ package org.openepics.names.rest.beans; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This enum represents types for structures data in beans and for communication. * * @author Lars Johansson */ +@Schema(description = "A collection of values for type of structure entry. " + + "It is used to show what kind of entry and which level in parent / child hierarchy " + + "for system structure and device structure.") public enum Type { + @Schema(description = "System structure 1st level.") SYSTEMGROUP, + @Schema(description = "System structure 2nd level.") SYSTEM, + @Schema(description = "System structure 3rd level.") SUBSYSTEM, + @Schema(description = "Device structure 1st level.") DISCIPLINE, + @Schema(description = "Device structure 2nd level.") DEVICEGROUP, + @Schema(description = "Device structure 3rd level.") DEVICETYPE; } diff --git a/src/main/java/org/openepics/names/rest/beans/element/NameElement.java b/src/main/java/org/openepics/names/rest/beans/element/NameElement.java index fe91fe70e6c6a1936e36e3e8a7e15aaed2daf4de..e3d1cf62bb43608f040d70a40a43abcdfef5af53 100644 --- a/src/main/java/org/openepics/names/rest/beans/element/NameElement.java +++ b/src/main/java/org/openepics/names/rest/beans/element/NameElement.java @@ -24,12 +24,16 @@ import java.util.UUID; import org.openepics.names.rest.beans.Status; +import io.swagger.v3.oas.annotations.media.Schema; + /** * Bean (data transfer object) for communication and (json, xml) serialization. * Intended for operations that read names. * * @author Lars Johansson */ +@Schema(description = "A collection of attributes that is used to encapsulate a name. " + + "It used to show information for a name.") public class NameElement extends NameElementCommand implements Serializable { /** @@ -37,13 +41,21 @@ public class NameElement extends NameElementCommand implements Serializable { */ private static final long serialVersionUID = 2716415801117244814L; + @Schema(description = "Mnemonic path for for the system structure.") private String systemstructure; + @Schema(description = "Mnemonic path for for the device structure.") private String devicestructure; + @Schema(description = "Name (verbose) of the name.") private String name; + @Schema(description = "Status of the name.") private Status status; + @Schema(description = "If the name is latest (with status APPROVED) in its line of entries.") private Boolean latest; + @Schema(description = "If the name is deleted.") private Boolean deleted; + @Schema(description = "Date and time when the name was created.") private Date when; + @Schema(description = "(User) Name of who created the name.") private String who; /** diff --git a/src/main/java/org/openepics/names/rest/beans/element/NameElementCommand.java b/src/main/java/org/openepics/names/rest/beans/element/NameElementCommand.java index f3905d082a102c4e79b3cc177204493573ceb039..b1899d42a8cfb5723cd7d6e7d212ad3b4f6573a6 100644 --- a/src/main/java/org/openepics/names/rest/beans/element/NameElementCommand.java +++ b/src/main/java/org/openepics/names/rest/beans/element/NameElementCommand.java @@ -21,12 +21,16 @@ package org.openepics.names.rest.beans.element; import java.io.Serializable; import java.util.UUID; +import io.swagger.v3.oas.annotations.media.Schema; + /** * Bean (data transfer object) for communication and (json, xml) serialization. * Intended for operations that modify names. * * @author Lars Johansson */ +@Schema(description = "A collection of attributes that is used to encapsulate a command for a name " + + "from client to server. It used to create, update, delete and validate a name.") public class NameElementCommand implements Serializable { /** @@ -34,11 +38,17 @@ public class NameElementCommand implements Serializable { */ private static final long serialVersionUID = -3166840982436164399L; + @Schema(description = "Identity of the name. Value is set server-side.") private UUID uuid; + @Schema(description = "Identity for the system structure parent.") private UUID parentsystemstructure; + @Schema(description = "Identity for the device structure parent.") private UUID parentdevicestructure; + @Schema(description = "Index (instance) of the name.") private String index; + @Schema(description = "Description of the name.") private String description; + @Schema(description = "Comment of the name command.") private String comment; /** diff --git a/src/main/java/org/openepics/names/rest/beans/element/StructureElement.java b/src/main/java/org/openepics/names/rest/beans/element/StructureElement.java index a94e8d541213631c626077569a98f42a74f38ff7..68f76cc3e8ead2cd1f2db51c1737aa61ba734251 100644 --- a/src/main/java/org/openepics/names/rest/beans/element/StructureElement.java +++ b/src/main/java/org/openepics/names/rest/beans/element/StructureElement.java @@ -25,12 +25,16 @@ import java.util.UUID; import org.openepics.names.rest.beans.Status; import org.openepics.names.rest.beans.Type; +import io.swagger.v3.oas.annotations.media.Schema; + /** * Bean (data transfer object) for communication and (json, xml) serialization. * Intended for operations that read structures. * * @author Lars Johansson */ +@Schema(description = "A collection of attributes that is used to encapsulate a structure entry. " + + "It used to show information for a structure entry.") public class StructureElement extends StructureElementCommand implements Serializable { /** @@ -38,12 +42,19 @@ public class StructureElement extends StructureElementCommand implements Seriali */ private static final long serialVersionUID = 356654987707139728L; + @Schema(description = "Mnemonic path of the structure entry.") private String mnemonicpath; + @Schema(description = "Level of the structure entry.") private Integer level; + @Schema(description = "Status of the structure entry.") private Status status; + @Schema(description = "If the structure entry is latest (with status APPROVED) in its line of entries.") private Boolean latest; + @Schema(description = "If the structure entry is deleted.") private Boolean deleted; + @Schema(description = "Date and time when the structure entry was created.") private Date when; + @Schema(description = "(User) Name of who created the structure entry.") private String who; /** diff --git a/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommand.java b/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommand.java index a1376d4ca62c1f21cbc851ccc6638504ed46d8e1..d64eaee01f1eea6f6ddf25be336e373e0768a05e 100644 --- a/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommand.java +++ b/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommand.java @@ -23,12 +23,17 @@ import java.util.UUID; import org.openepics.names.rest.beans.Type; +import io.swagger.v3.oas.annotations.media.Schema; + /** * Bean (data transfer object) for communication and (json, xml) serialization. * Intended for operations that modify structures. * * @author Lars Johansson */ +@Schema(description = "A collection of attributes that is used to encapsulate a command for a structure entry " + + "from client to server. It used to create, update, delete and validate " + + "and approve, cancel, reject a structure entry.") public class StructureElementCommand implements Serializable { /** @@ -36,26 +41,33 @@ public class StructureElementCommand implements Serializable { */ private static final long serialVersionUID = 788979309267676232L; + @Schema(description = "Identity of the structure entry. Value is set server-side.") private UUID uuid; + @Schema(description = "Type of the structure entry.") private Type type; + @Schema(description = "Identity for the structure entry parent (if the structure entry has a parent).") private UUID parent; + @Schema(description = "Name of the structure entry.") private String name; + @Schema(description = "Mnemonic of the structure entry.") private String mnemonic; + @Schema(description = "Description of the structure entry.") private String description; + @Schema(description = "Comment of the structure entry command.") private String comment; /** * Public constructor. */ public StructureElementCommand() { - }; + } /** * Public constructor. * * @param uuid uuid * @param type type - * @param parent parent + * @param parent parent uuid * @param name name * @param mnemonic mnemonic * @param description description diff --git a/src/main/java/org/openepics/names/rest/beans/response/Response.java b/src/main/java/org/openepics/names/rest/beans/response/Response.java index 32cebcbc53d8f8a1bb82e8b1e3365bcda0fbb958..58b15877a25bf5f1d092a3adf14bba58d9bc3f78 100644 --- a/src/main/java/org/openepics/names/rest/beans/response/Response.java +++ b/src/main/java/org/openepics/names/rest/beans/response/Response.java @@ -20,11 +20,16 @@ package org.openepics.names.rest.beans.response; import org.springframework.http.HttpHeaders; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This class is used to ensure response to request origin are handled in a uniform way. * * @author Lars Johansson */ +@Schema(description = "A collection of attributes that is used to encapsulate a response from server to client. " + + "It used to show information related to an operation for a name and structure entry. " + + "Values are set server-side.") public class Response { private static final String CONTENT_TYPE = "Content-Type"; @@ -32,8 +37,11 @@ public class Response { public static final HttpHeaders HEADER_JSON = new HttpHeaders(); + @Schema(description = "Message of the response.") private String message = null; + @Schema(description = "Details for the message of the response.") private String details = null; + @Schema(description = "Field of the response for the object that was sent to server.") private String field = null; /** diff --git a/src/main/java/org/openepics/names/rest/beans/response/ResponseBoolean.java b/src/main/java/org/openepics/names/rest/beans/response/ResponseBoolean.java index 4eaf1a0eee5ecda4ddc7d91a650ea53307542e35..3b6d9ad44fc0c50de1c0aafb1bb61b4e87148d93 100644 --- a/src/main/java/org/openepics/names/rest/beans/response/ResponseBoolean.java +++ b/src/main/java/org/openepics/names/rest/beans/response/ResponseBoolean.java @@ -18,13 +18,19 @@ package org.openepics.names.rest.beans.response; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This class is used to ensure response to request origin are handled in a uniform way. * * @author Lars Johansson */ +@Schema(description = "A collection of attributes that is used to encapsulate a response from server to client. " + + "It used to show information related to an operation for a name and structure entry. " + + "Values are set server-side.") public class ResponseBoolean extends Response { + @Schema(description = "Outcome of the response.") private Boolean value = null; /** diff --git a/src/main/java/org/openepics/names/rest/beans/response/ResponseBooleanList.java b/src/main/java/org/openepics/names/rest/beans/response/ResponseBooleanList.java index 6f0561dc4fe6a1bd75d1d33476cc9a17015714f7..6e0989c9cbf521ca89379eb7d1b795f6c20dfd08 100644 --- a/src/main/java/org/openepics/names/rest/beans/response/ResponseBooleanList.java +++ b/src/main/java/org/openepics/names/rest/beans/response/ResponseBooleanList.java @@ -22,13 +22,19 @@ import java.util.List; import com.google.common.collect.Lists; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This class is used to ensure response to request origin are handled in a uniform way. * * @author Lars Johansson */ +@Schema(description = "A collection of attributes that is used to encapsulate a response from server to client. " + + "It used to show information related to an operation for a name and structure entry. " + + "Values are set server-side.") public class ResponseBooleanList extends ResponseBoolean { + @Schema(description = "Items that are returned to client from server.") private List<ResponseBoolean> list = Lists.newArrayList(); /** diff --git a/src/main/java/org/openepics/names/rest/beans/response/ResponsePage.java b/src/main/java/org/openepics/names/rest/beans/response/ResponsePage.java index 6fe92e8d07f30752830b6fc1294950285c0e5d70..e2c0d096bf00ce92dd8bddc8ba5b6855e7ceb145 100644 --- a/src/main/java/org/openepics/names/rest/beans/response/ResponsePage.java +++ b/src/main/java/org/openepics/names/rest/beans/response/ResponsePage.java @@ -18,20 +18,29 @@ package org.openepics.names.rest.beans.response; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This class is used to ensure response to request origin are handled in a uniform way. * * @author Lars Johansson */ +@Schema(description = "A collection of attributes that is used to encapsulate a response from server to client. " + + "It used to show information related to an operation for a name and structure entry. " + + "Values are set server-side.") public abstract class ResponsePage extends Response { // note // offset - page // limit - page size + @Schema(description = "Total count of items that may be returned to client from server.") private Long totalCount; + @Schema(description = "Count of items that is returned to client from server.") private Integer listSize; + @Schema(description = "Page number for response to client from server.") private Integer page; + @Schema(description = "Page size for response to client from server.") private Integer pageSize; /** diff --git a/src/main/java/org/openepics/names/rest/beans/response/ResponsePageNameElements.java b/src/main/java/org/openepics/names/rest/beans/response/ResponsePageNameElements.java index eae2830ad9603000fb4c46466cbd601dc20d17ac..75e35639a86091115fa756a032fe6d5c1605f44d 100644 --- a/src/main/java/org/openepics/names/rest/beans/response/ResponsePageNameElements.java +++ b/src/main/java/org/openepics/names/rest/beans/response/ResponsePageNameElements.java @@ -24,13 +24,19 @@ import org.openepics.names.rest.beans.element.NameElement; import com.google.common.collect.Lists; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This class is used to ensure response to request origin are handled in a uniform way. * * @author Lars Johansson */ +@Schema(description = "A collection of attributes that is used to encapsulate a response from server to client. " + + "It used to show information related to an operation for a name and structure entry. " + + "Values are set server-side.") public class ResponsePageNameElements extends ResponsePage { + @Schema(description = "Items (names) that are returned to client from server.") private List<NameElement> list = Lists.newArrayList(); /** diff --git a/src/main/java/org/openepics/names/rest/beans/response/ResponsePageStructureElements.java b/src/main/java/org/openepics/names/rest/beans/response/ResponsePageStructureElements.java index 2e7fa5869ffcb6949f88d3754be4e5c0ad618381..ca46f30b6fb24e4f7b7256e772a405989dfbcf1a 100644 --- a/src/main/java/org/openepics/names/rest/beans/response/ResponsePageStructureElements.java +++ b/src/main/java/org/openepics/names/rest/beans/response/ResponsePageStructureElements.java @@ -24,13 +24,19 @@ import org.openepics.names.rest.beans.element.StructureElement; import com.google.common.collect.Lists; +import io.swagger.v3.oas.annotations.media.Schema; + /** * This class is used to ensure response to request origin are handled in a uniform way. * * @author Lars Johansson */ +@Schema(description = "A collection of attributes that is used to encapsulate a response from server to client. " + + "It used to show information related to an operation for a name and structure entry. " + + "Values are set server-side.") public class ResponsePageStructureElements extends ResponsePage { + @Schema(description = "Items (structure entries) that are returned to client from server.") private List<StructureElement> list = Lists.newArrayList(); /** diff --git a/src/main/java/org/openepics/names/rest/controller/HealthcheckController.java b/src/main/java/org/openepics/names/rest/controller/HealthcheckController.java index 84bf8aabf714bf3df732611330bfdeefe5b558d5..c3634e3ec75f81f6fb10acff729a47a5ba7051a3 100644 --- a/src/main/java/org/openepics/names/rest/controller/HealthcheckController.java +++ b/src/main/java/org/openepics/names/rest/controller/HealthcheckController.java @@ -62,8 +62,10 @@ public class HealthcheckController { */ @Operation( summary = "Perform healthcheck for Naming application in general and healtcheck endpoint in particular", - description = "Perform healthcheck for Naming application in general and healtcheck endpoint in particular. " - + "To be used mainly for checking HTTP response code, in particular HTTP STATUS OK - 200." + description = """ + Perform healthcheck for Naming application in general and healtcheck endpoint in particular. + To be used mainly for checking HTTP response code, in particular HTTP STATUS OK - 200. + """ ) @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Method completed OK. Return healthcheck as server timestamp.", content = @Content(mediaType = "text/plain", schema = @Schema(implementation = String.class)))