1 package de.dlr.shepard.endpoints; 2 3 import de.dlr.shepard.mongoDB.StructuredData; 4 import de.dlr.shepard.mongoDB.StructuredDataPayload; 5 import de.dlr.shepard.neo4Core.io.PermissionsIO; 6 import de.dlr.shepard.neo4Core.io.RolesIO; 7 import de.dlr.shepard.neo4Core.io.StructuredDataContainerIO; 8 import de.dlr.shepard.neo4Core.orderBy.ContainerAttributes; 9 import de.dlr.shepard.util.Constants; 10 import io.swagger.v3.oas.annotations.Operation; 11 import io.swagger.v3.oas.annotations.media.ArraySchema; 12 import io.swagger.v3.oas.annotations.media.Content; 13 import io.swagger.v3.oas.annotations.media.Schema; 14 import io.swagger.v3.oas.annotations.parameters.RequestBody; 15 import io.swagger.v3.oas.annotations.responses.ApiResponse; 16 import io.swagger.v3.oas.annotations.tags.Tag; 17 import jakarta.validation.Valid; 18 import jakarta.ws.rs.core.Response; 19 20 public interface StructuredDataRest { 21 22 @Tag(name = Constants.STRUCTUREDDATA) 23 @Operation(description = "Get all structured data containers") 24 @ApiResponse(description = "ok", responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = StructuredDataContainerIO.class)))) 25 @ApiResponse(description = "not found", responseCode = "404") 26 Response getAllStructuredDataContainers(String name, Integer page, Integer size, ContainerAttributes orderAttribute, 27 Boolean orderDesc); 28 29 @Tag(name = Constants.STRUCTUREDDATA) 30 @Operation(description = "Get structured data container") 31 @ApiResponse(description = "ok", responseCode = "200", content = @Content(schema = @Schema(implementation = StructuredDataContainerIO.class))) 32 @ApiResponse(description = "not found", responseCode = "404") 33 Response getStructuredDataContainer(long structuredDataId); 34 35 @Tag(name = Constants.STRUCTUREDDATA) 36 @Operation(description = "Delete structured data container") 37 @ApiResponse(description = "deleted", responseCode = "204") 38 @ApiResponse(description = "not found", responseCode = "404") 39 Response deleteStructuredDataContainer(long structuredDataId); 40 41 @Tag(name = Constants.STRUCTUREDDATA) 42 @Operation(description = "Create a new structured data container") 43 @ApiResponse(description = "created", responseCode = "201", content = @Content(schema = @Schema(implementation = StructuredDataContainerIO.class))) 44 @ApiResponse(description = "not found", responseCode = "404") 45 Response createStructuredDataContainer( 46 @RequestBody(required = true, content = @Content(schema = @Schema(implementation = StructuredDataContainerIO.class))) @Valid StructuredDataContainerIO structuredDataContainer); 47 48 @Tag(name = Constants.STRUCTUREDDATA) 49 @Operation(description = "Upload a new structured data object") 50 @ApiResponse(description = "created", responseCode = "201", content = @Content(schema = @Schema(implementation = StructuredData.class))) 51 @ApiResponse(description = "not found", responseCode = "404") 52 Response createStructuredData(long structuredDataId, 53 @RequestBody(required = true, content = @Content(schema = @Schema(implementation = StructuredDataPayload.class))) @Valid StructuredDataPayload payload); 54 55 @Tag(name = Constants.STRUCTUREDDATA) 56 @Operation(description = "Get structured data objects") 57 @ApiResponse(description = "ok", responseCode = "200", content = @Content(array = @ArraySchema(schema = @Schema(implementation = StructuredData.class)))) 58 @ApiResponse(description = "not found", responseCode = "404") 59 Response getAllStructuredDatas(long structuredDataId); 60 61 @Tag(name = Constants.STRUCTUREDDATA) 62 @Operation(description = "Download structured data") 63 @ApiResponse(description = "ok", responseCode = "200", content = @Content(schema = @Schema(implementation = StructuredDataPayload.class))) 64 @ApiResponse(description = "not found", responseCode = "404") 65 Response getStructuredData(long structuredDataId, String oid); 66 67 @Tag(name = Constants.STRUCTUREDDATA) 68 @Operation(description = "Delete structured data") 69 @ApiResponse(description = "ok", responseCode = "204") 70 @ApiResponse(description = "not found", responseCode = "404") 71 Response deleteStructuredData(long structuredDataId, String oid); 72 73 @Tag(name = Constants.STRUCTUREDDATA) 74 @Operation(description = "Get permissions") 75 @ApiResponse(description = "ok", responseCode = "200", content = @Content(schema = @Schema(implementation = PermissionsIO.class))) 76 @ApiResponse(description = "not found", responseCode = "404") 77 Response getStructuredDataPermissions(long structuredDataId); 78 79 @Tag(name = Constants.STRUCTUREDDATA) 80 @Operation(description = "Edit permissions") 81 @ApiResponse(description = "ok", responseCode = "200", content = @Content(schema = @Schema(implementation = PermissionsIO.class))) 82 @ApiResponse(description = "not found", responseCode = "404") 83 Response editStructuredDataPermissions(long structuredDataId, 84 @RequestBody(required = true, content = @Content(schema = @Schema(implementation = PermissionsIO.class))) @Valid PermissionsIO permissions); 85 86 @Tag(name = Constants.STRUCTUREDDATA) 87 @Operation(description = "Get roles") 88 @ApiResponse(description = "ok", responseCode = "200", content = @Content(schema = @Schema(implementation = RolesIO.class))) 89 @ApiResponse(description = "not found", responseCode = "404") 90 Response getStructuredDataRoles(long structuredDataId); 91 }