From aa72781388f3e6408bb43f1b024d88ec1c9d2c10 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Tue, 4 Oct 2022 20:29:28 +0100 Subject: Add data type properties workspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements the properties workspace for a data type, with the list and filter feature. Change-Id: I2ec337a0481bddd5fe32e45644abdc88e197fa49 Issue-ID: SDC-4214 Signed-off-by: André Schmid --- .../openecomp/sdc/be/servlets/DataTypeServlet.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'catalog-be/src/main/java') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DataTypeServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DataTypeServlet.java index d9846a7fb1..e39e0d2c0d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DataTypeServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/DataTypeServlet.java @@ -22,16 +22,19 @@ package org.openecomp.sdc.be.servlets; import com.jcabi.aspects.Loggable; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.servers.Server; import io.swagger.v3.oas.annotations.tags.Tag; +import java.util.List; import java.util.Optional; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -45,6 +48,8 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition; import org.openecomp.sdc.be.exception.BusinessException; import org.openecomp.sdc.be.impl.ComponentsUtils; +import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.dto.PropertyDefinitionDto; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.exception.OperationException; import org.openecomp.sdc.be.model.operations.impl.DataTypeOperation; import org.openecomp.sdc.common.api.Constants; @@ -99,4 +104,19 @@ public class DataTypeServlet extends BeGenericServlet { return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), dataType); } + @GET + @Path("{id}/properties") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Operation(description = "Get a data type properties", method = "GET", summary = "Returns the data type properties", responses = { + @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = PropertyDefinition.class)))), + @ApiResponse(responseCode = "200", description = "Data type found, properties may be empty"), + @ApiResponse(responseCode = "403", description = "Restricted operation"), + @ApiResponse(responseCode = "404", description = "Data type not found")}) + @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) + public Response fetchProperties(@PathParam("id") final String id) { + final List allProperties = dataTypeOperation.findAllProperties(id); + return buildOkResponse(allProperties); + } + } -- cgit 1.2.3-korg