563128 - Add swagger documentation to REST endpoints
Change-Id: I843088fc0b1e761d070156aa28c04c7d3291a992
Signed-off-by: Simon Skoczylas <simon.skoczylas@karakun.com>
diff --git a/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/ChannelGroupResource.java b/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/ChannelGroupResource.java
index 4527875..a4164ec 100644
--- a/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/ChannelGroupResource.java
+++ b/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/ChannelGroupResource.java
@@ -49,13 +49,18 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.vavr.collection.List;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
* {@link ChannelGroup} resource
- *
+ *
* @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
*
*/
@@ -80,7 +85,12 @@
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
- public Response getChannelGroups(@PathParam("SOURCENAME") String sourceName, @QueryParam("filter") String filter) {
+ @Operation(summary = "Find ChannelGroups by filter", description = "Get a list of ChannelGroups matched by an optional filter", responses = {
+ @ApiResponse(description = "The ChannelGroup", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
+ public Response getChannelGroups(
+ @Parameter(description = "Name of the MDM datasource", required = true) @PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
+ @QueryParam("filter") String filter) {
try {
java.util.List<ChannelGroup> channelGroups = this.channelGroupService.getChannelGroups(sourceName, filter);
@@ -94,19 +104,23 @@
/**
* returns a {@link ChannelGroup} identified by the given id.
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
- * @param channelId id of the {@link ChannelGroup}
+ * @param id id of the {@link ChannelGroup}
* @return the matching {@link ChannelGroup}
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
- @Path("/{CHANNELGROUP_ID}")
- public Response getChannelGroup(@PathParam("SOURCENAME") String sourceName,
- @PathParam("CHANNELGROUP_ID") String channelGroupId) {
+ @Path("/{ID}")
+ @Operation(summary = "Find a ChannelGroup by ID", description = "Returns ChannelGroup based on ID", responses = {
+ @ApiResponse(description = "The ChannelGroup", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error")})
+ public Response getChannelGroup(
+ @Parameter(description = "Name of the MDM datasource", required = true) @PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
+ @Parameter(description = "ID of the ChannelGroup", required = true) @PathParam(REQUESTPARAM_ID) String id) {
try {
- ChannelGroup channelGroup = this.channelGroupService.getChannelGroup(sourceName, channelGroupId);
+ ChannelGroup channelGroup = this.channelGroupService.getChannelGroup(sourceName, id);
return ServiceUtils.toResponse(new MDMEntityResponse(ChannelGroup.class, channelGroup), Status.OK);
} catch (RuntimeException e) {
@@ -117,14 +131,18 @@
/**
* delegates the request to the {@link ChannelGroupService}
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @return the result of the delegated request as {@link Response}
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/localizations")
- public Response localize(@PathParam("SOURCENAME") String sourceName) {
+ @Operation(summary = "Get the ChannelGroup localizations", description = "Returns ChannelGroup localizations", responses = {
+ @ApiResponse(description = "The ChannelGroup localizations", content = @Content(schema = @Schema(implementation = I18NResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
+ public Response localize(
+ @Parameter(description = "Name of the MDM datasource", required = true) @PathParam(REQUESTPARAM_SOURCENAME) String sourceName) {
try {
Map<Attribute, String> localizedAttributeMap = this.channelGroupService.localizeAttributes(sourceName);
@@ -139,7 +157,7 @@
/**
* Returns the created {@link ChannelGroup}.
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param body The {@link ChannelGroup} to create.
* @return the created {@link ChannelGroup} as {@link Response}.
@@ -147,7 +165,12 @@
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
- public Response create(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName, String body) {
+ @Operation(summary = "Create a new ChannelGroup", responses = {
+ @ApiResponse(description = "The ChannelGroup", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
+ public Response create(
+ @Parameter(description = "Name of the MDM datasource", required = true) @PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
+ String body) {
return entityService
.create(V(sourceName), ChannelGroup.class,
@@ -159,7 +182,7 @@
/**
* Updates the {@link ChannelGroup} with all parameters set in the given JSON
* body of the request.
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param id the identifier of the {@link ChannelGroup} to update.
* @param body the body of the request containing the attributes to update
@@ -169,7 +192,12 @@
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{" + REQUESTPARAM_ID + "}")
- public Response update(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName, @PathParam(REQUESTPARAM_ID) String id,
+ @Operation(summary = "Updates the ChannelGroup with all parameters set in the body of the request", responses = {
+ @ApiResponse(description = "The ChannelGroup", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
+ public Response update(
+ @Parameter(description = "Name of the MDM datasource", required = true) @PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
+ @Parameter(description = "ID of the Uni", required = true) @PathParam(REQUESTPARAM_ID) String id,
String body) {
RequestBody requestBody = RequestBody.create(body);
@@ -182,7 +210,7 @@
/**
* Deletes and returns the deleted {@link ChannelGroup}.
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param id The identifier of the {@link ChannelGroup} to delete.
* @return the deleted {@link ValueList }s as {@link Response}
@@ -190,8 +218,12 @@
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("/{" + REQUESTPARAM_ID + "}")
- public Response delete(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
- @PathParam(REQUESTPARAM_ID) String id) {
+ @Operation(summary = "Delete an existing ChannelGroup", responses = {
+ @ApiResponse(description = "The deleted ChannelGroup", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
+ public Response delete(
+ @Parameter(description = "Name of the MDM datasource", required = true) @PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
+ @Parameter(description = "ID of the Uni", required = true) @PathParam(REQUESTPARAM_ID) String id) {
return entityService.delete(V(sourceName), entityService.find(V(sourceName), ChannelGroup.class, V(id)))
.map(e -> ServiceUtils.buildEntityResponse(e, Status.OK)).recover(ServiceUtils.ERROR_RESPONSE_SUPPLIER)
.getOrElse(ServiceUtils.SERVER_ERROR_RESPONSE);
diff --git a/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/ChannelResource.java b/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/ChannelResource.java
index bfb0c9a..33119fa 100644
--- a/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/ChannelResource.java
+++ b/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/ChannelResource.java
@@ -62,7 +62,7 @@
/**
* {@link Channel} resource
- *
+ *
* @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
*
*/
@@ -80,16 +80,15 @@
/**
* delegates the request to the {@link ChannelService}
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param filter filter string to filter the {@link Channel} result
* @return the result of the delegated request as {@link Response}
*/
@GET
- @Operation(summary = "Find Channels by filter", description = "Get list of users", responses = {
- @ApiResponse(description = "The user", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
- @ApiResponse(responseCode = "400", description = "Error") })
-
+ @Operation(summary = "Find Channels by filter", description = "Get list of Channels", responses = {
+ @ApiResponse(description = "The Channels", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
@Produces(MediaType.APPLICATION_JSON)
public Response getChannels(
@Parameter(description = "Name of the MDM datasource", required = true) @PathParam("SOURCENAME") String sourceName,
@@ -107,23 +106,23 @@
/**
* delegates the request to the {@link ChannelService}
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
- * @param testId id of the {@link Test}
+ * @param id id of the {@link Test}
* @return the result of the delegated request as {@link Response}
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
- @Path("/{CHANNEL_ID}")
- @Operation(summary = "Find a Channel by ID", description = "Returns Channels based on ID", responses = {
- @ApiResponse(description = "The channel", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
- @ApiResponse(responseCode = "400", description = "Invalid ID supplied") })
+ @Path("/{ID}")
+ @Operation(summary = "Find a Channel by ID", description = "Returns Channel based on ID", responses = {
+ @ApiResponse(description = "The Channel", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Invalid ID supplied") })
public Response getChannel(
@Parameter(description = "Name of the MDM datasource", required = true) @PathParam("SOURCENAME") String sourceName,
- @Parameter(description = "ID of the Channel", required = true) @PathParam("CHANNEL_ID") String channelId) {
+ @Parameter(description = "ID of the Channel", required = true) @PathParam("ID") String id) {
try {
- Channel channel = this.channelService.getChannel(sourceName, channelId);
+ Channel channel = this.channelService.getChannel(sourceName, id);
return ServiceUtils.toResponse(new MDMEntityResponse(Channel.class, channel), Status.OK);
} catch (RuntimeException e) {
@@ -134,13 +133,13 @@
/**
* delegates the request to the {@link ChannelService}
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @return the result of the delegated request as {@link Response}
*/
@GET
@Operation(summary = "Get the Channel localizations", description = "Returns Channel localizations", responses = {
- @ApiResponse(description = "The project localizations", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(description = "The Channel localizations", content = @Content(schema = @Schema(implementation = I18NResponse.class))),
@ApiResponse(responseCode = "500", description = "Error") })
@Produces(MediaType.APPLICATION_JSON)
@Path("/localizations")
@@ -157,10 +156,10 @@
throw new WebApplicationException(e.getMessage(), e, Status.INTERNAL_SERVER_ERROR);
}
}
-
+
/**
* Returns the created {@link Channel}.
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param body The {@link Channel} to create.
* @return the created {@link Channel} as {@link Response}.
@@ -168,7 +167,12 @@
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
- public Response create(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName, String body) {
+ @Operation(summary = "Create a new Channel", responses = {
+ @ApiResponse(description = "The Channel", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
+ public Response create(
+ @Parameter(description = "Name of the MDM datasource", required = true) @PathParam("SOURCENAME") String sourceName,
+ String body) {
return entityService
.create(V(sourceName), Channel.class,
@@ -180,7 +184,7 @@
/**
* Updates the {@link Channel} with all parameters set in the given JSON body
* of the request.
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param id the identifier of the {@link Channel} to update.
* @param body the body of the request containing the attributes to update
@@ -190,7 +194,12 @@
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{" + REQUESTPARAM_ID + "}")
- public Response update(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName, @PathParam(REQUESTPARAM_ID) String id,
+ @Operation(summary = "Updates the Channel with all parameters set in the body of the request", responses = {
+ @ApiResponse(description = "The Channel", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
+ public Response update(
+ @Parameter(description = "Name of the MDM datasource", required = true) @PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
+ @Parameter(description = "ID of the Channel", required = true) @PathParam(REQUESTPARAM_ID) String id,
String body) {
RequestBody requestBody = RequestBody.create(body);
@@ -203,7 +212,7 @@
/**
* Deletes and returns the deleted {@link Channel}.
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param id The identifier of the {@link Channel} to delete.
* @return the deleted {@link ValueList }s as {@link Response}
@@ -211,8 +220,12 @@
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("/{" + REQUESTPARAM_ID + "}")
- public Response delete(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
- @PathParam(REQUESTPARAM_ID) String id) {
+ @Operation(summary = "Delete an existing Channel", responses = {
+ @ApiResponse(description = "The deleted Channel", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
+ public Response delete(
+ @Parameter(description = "Name of the MDM datasource", required = true) @PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
+ @Parameter(description = "ID of the Channel", required = true) @PathParam(REQUESTPARAM_ID) String id) {
return entityService.delete(V(sourceName), entityService.find(V(sourceName), Channel.class, V(id)))
.map(e -> ServiceUtils.buildEntityResponse(e, Status.OK)).recover(ServiceUtils.ERROR_RESPONSE_SUPPLIER)
.getOrElse(ServiceUtils.SERVER_ERROR_RESPONSE);
diff --git a/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/TestResource.java b/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/TestResource.java
index 358ee3b..8c2b128 100644
--- a/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/TestResource.java
+++ b/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/TestResource.java
@@ -76,7 +76,7 @@
/**
* {@link Test} resource
- *
+ *
* @author Sebastian Dirsch, Gigatronik Ingolstadt GmbH
*
*/
@@ -105,7 +105,7 @@
/**
* delegates the request to the {@link TestService}
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param filter filter string to filter the {@link Test} result
* @return the result of the delegated request as {@link Response}
@@ -126,13 +126,13 @@
/**
* delegates the request to the {@link TestService}
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @return the result of the delegated request as {@link Response}
*/
@GET
@Operation(summary = "Get the search attributes", description = "Get a list of search attributes", responses = {
- @ApiResponse(description = "The search attributes", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(description = "The search attributes", content = @Content(schema = @Schema(implementation = SearchAttributeResponse.class))),
@ApiResponse(responseCode = "400", description = "Error") })
@Produces(MediaType.APPLICATION_JSON)
@Path("/searchattributes")
@@ -146,7 +146,7 @@
/**
* delegates the request to the {@link TestService}
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param id id of the {@link Test}
* @return the result of the delegated request as {@link Response}
@@ -167,13 +167,13 @@
/**
* delegates the request to the {@link TestService}
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @return the result of the delegated request as {@link Response}
*/
@GET
@Operation(summary = "Get the Test localizations", description = "Returns Test localizations", responses = {
- @ApiResponse(description = "The Test localizations", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(description = "The Test localizations", content = @Content(schema = @Schema(implementation = I18NResponse.class))),
@ApiResponse(responseCode = "500", description = "Error") })
@Produces(MediaType.APPLICATION_JSON)
@Path("/localizations")
@@ -193,7 +193,7 @@
/**
* Returns the created {@link Test}.
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param body The {@link Test} to create.
* @return the created {@link Test} as {@link Response}.
@@ -258,7 +258,7 @@
/**
* Updates the {@link Test} with all parameters set in the given JSON body of
* the request.
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param id the identifier of the {@link TestValue} to update.
* @param body the body of the request containing the attributes to update
@@ -287,7 +287,7 @@
/**
* Deletes and returns the deleted {@link Test}.
- *
+ *
* @param sourceName name of the source (MDM {@link Environment} name)
* @param id The identifier of the {@link Test} to delete.
* @return the deleted {@link ValueList }s as {@link Response}
@@ -327,7 +327,7 @@
@Produces(MediaType.APPLICATION_JSON)
@Path("/{" + REQUESTPARAM_ID + "}/contexts")
public Response findContext(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
- @PathParam(REQUESTPARAM_ID) String id) {
+ @PathParam(REQUESTPARAM_ID) String id) {
return contextService.getTestContext(V(sourceName), V(id), false).map(ServiceUtils::contextMapToJava)
.map(ContextResponse::new).map(contextResponse -> ServiceUtils.toResponse(contextResponse, Status.OK))
.recover(ServiceUtils.ERROR_RESPONSE_SUPPLIER).getOrElse(ServiceUtils.SERVER_ERROR_RESPONSE);
@@ -348,7 +348,7 @@
@Path("/{" + REQUESTPARAM_ID + "}/contexts")
@RolesAllowed({ "write-user" })
public Response updateContext(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
- @PathParam(REQUESTPARAM_ID) String id, String body) {
+ @PathParam(REQUESTPARAM_ID) String id, String body) {
return entityService.find(V(sourceName), TestStep.class, V(id))
.map(testStep -> contextService.updateContext(body, testStep)).map(ContextResponse::new)
diff --git a/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/UnitResource.java b/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/UnitResource.java
index 62cf093..4a1795d 100644
--- a/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/UnitResource.java
+++ b/nucleus/businessobjects/src/main/java/org/eclipse/mdm/businessobjects/boundary/UnitResource.java
@@ -39,11 +39,18 @@
import org.eclipse.mdm.api.base.model.Environment;
import org.eclipse.mdm.api.base.model.PhysicalDimension;
import org.eclipse.mdm.api.base.model.Unit;
+import org.eclipse.mdm.businessobjects.entity.I18NResponse;
+import org.eclipse.mdm.businessobjects.entity.MDMEntityResponse;
import org.eclipse.mdm.businessobjects.entity.SearchAttribute;
+import org.eclipse.mdm.businessobjects.entity.SearchAttributeResponse;
import org.eclipse.mdm.businessobjects.service.EntityService;
import org.eclipse.mdm.businessobjects.utils.RequestBody;
import org.eclipse.mdm.businessobjects.utils.ServiceUtils;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
@@ -69,6 +76,9 @@
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{" + REQUESTPARAM_ID + "}")
+ @Operation(summary = "Find a Unit by ID", description = "Returns Unit based on ID", responses = {
+ @ApiResponse(description = "The Unit", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error")})
public Response find(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName, @PathParam(REQUESTPARAM_ID) String id) {
return entityService.find(V(sourceName), Unit.class, V(id))
.map(e -> ServiceUtils.buildEntityResponse(e, Status.OK)).recover(ServiceUtils.ERROR_RESPONSE_SUPPLIER)
@@ -85,6 +95,9 @@
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
+ @Operation(summary = "Find Units by filter", description = "Get a list of Units matched by an optional filter", responses = {
+ @ApiResponse(description = "The Unit", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
public Response findAll(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
@QueryParam("filter") String filter) {
return entityService.findAll(V(sourceName), Unit.class, filter)
@@ -102,6 +115,9 @@
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
+ @Operation(summary = "Create a new Unit", responses = {
+ @ApiResponse(description = "The Unit", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
public Response create(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName, String body) {
RequestBody requestBody = RequestBody.create(body);
@@ -127,6 +143,9 @@
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/{" + REQUESTPARAM_ID + "}")
+ @Operation(summary = "Updates the Unit with all parameters set in the body of the request", responses = {
+ @ApiResponse(description = "The Unit", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
public Response update(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName, @PathParam(REQUESTPARAM_ID) String id,
String body) {
RequestBody requestBody = RequestBody.create(body);
@@ -149,6 +168,9 @@
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("/{" + REQUESTPARAM_ID + "}")
+ @Operation(summary = "Delete an existing Unit", responses = {
+ @ApiResponse(description = "The deleted Unit", content = @Content(schema = @Schema(implementation = MDMEntityResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
public Response delete(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName,
@PathParam(REQUESTPARAM_ID) String id) {
return entityService.delete(V(sourceName), entityService.find(V(sourceName), Unit.class, V(id)))
@@ -165,6 +187,9 @@
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/searchattributes")
+ @Operation(summary = "Get the search attributes", description = "Get a list of search attributes", responses = {
+ @ApiResponse(description = "The search attributes", content = @Content(schema = @Schema(implementation = SearchAttributeResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
public Response getSearchAttributes(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName) {
return ServiceUtils.buildSearchAttributesResponse(V(sourceName), Unit.class, entityService);
}
@@ -178,6 +203,9 @@
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/localizations")
+ @Operation(summary = "Get the Unit localizations", description = "Returns Unit localizations", responses = {
+ @ApiResponse(description = "The Unit localizations", content = @Content(schema = @Schema(implementation = I18NResponse.class))),
+ @ApiResponse(responseCode = "500", description = "Error") })
public Response localize(@PathParam(REQUESTPARAM_SOURCENAME) String sourceName) {
return ServiceUtils.buildLocalizationResponse(V(sourceName), Unit.class, entityService);
}