Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -55,7 +56,7 @@

@RestController
@Tag(name = "EDC data operations", description = "UI API for uploading and downloading data, managing EDC data transfers, and related operations")
@RequestMapping(value = "/api/ui", produces = "application/json")
@RequestMapping(value = "/api/ui", produces = MediaType.APPLICATION_JSON_VALUE)
public class EdcDataController {

private final DataAccessService dataAccessService;
Expand All @@ -66,7 +67,7 @@ public EdcDataController(DataAccessService dataAccessService, ObjectMapper objec
this.objectMapper = objectMapper;
}

@PostMapping(path = "service-providers/{providerId}/tenants/{tenantId}/participants/{participantId}/files", consumes = "multipart/form-data")
@PostMapping(path = "service-providers/{providerId}/tenants/{tenantId}/participants/{participantId}/files", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
// @PreAuthorize("hasRole('USER')")
@Operation(summary = "Upload a file", description = "Uploads a file for a specific participant with associated metadata")
@ApiResponses(value = {
Expand Down Expand Up @@ -196,7 +197,7 @@ public ResponseEntity<List<Contract>> listContracts(@PathVariable Long providerI
@Parameter(name = "providerId", description = "Database ID of the service provider", required = true)
@Parameter(name = "tenantId", description = "Database ID of the tenant", required = true)
@Parameter(name = "participantId", description = "Database ID of the participant", required = true)
@PostMapping(value = "service-providers/{providerId}/tenants/{tenantId}/participants/{participantId}/contracts", produces = "text/plain")
@PostMapping(value = "service-providers/{providerId}/tenants/{tenantId}/participants/{participantId}/contracts", produces = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<String> requestContract(@PathVariable Long providerId,
@PathVariable Long tenantId,
@PathVariable Long participantId,
Expand Down Expand Up @@ -269,7 +270,7 @@ public ResponseEntity<ContractNegotiation> getContractNegotiation(@PathVariable
}


@PostMapping("service-providers/{providerId}/tenants/{tenantId}/participants/{participantId}/transfers")
@PostMapping(value = "service-providers/{providerId}/tenants/{tenantId}/participants/{participantId}/transfers", produces = MediaType.TEXT_PLAIN_VALUE)
@Operation(summary = "Initiate a transfer process", description = "Triggers a transfer process with a counter-party based on the provided contract agreement details")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Transfer process started successfully."),
Expand All @@ -296,7 +297,15 @@ public ResponseEntity<TransferProcess> getTransferProcess(@PathVariable Long pro
return ResponseEntity.ok(transferProcess);
}

@GetMapping("service-providers/{providerId}/tenants/{tenantId}/participants/{participantId}/files/{fileId}")
@Operation(summary = "Download file")
@ApiResponse(
responseCode = "200",
content = @Content(
mediaType = MediaType.APPLICATION_OCTET_STREAM_VALUE,
schema = @Schema(type = "string", format = "binary")
)
)
@GetMapping(value = "service-providers/{providerId}/tenants/{tenantId}/participants/{participantId}/files/{fileId}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public ResponseEntity<byte[]> downloadData(@PathVariable Long providerId,
@PathVariable Long tenantId,
@PathVariable Long participantId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void uploadFileForParticipant(Long participantId, Map<String, Object> pub


//2. track uploaded file in DB
participant.getUploadedFiles().add(new UploadedFile(fileId, originalFilename, contentType, publicMetadata));
participant.getUploadedFiles().add(new UploadedFile(fileId, originalFilename, contentType, combinedMetadata));
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.metaformsystems.redline.infrastructure.client.management.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Map;
Expand All @@ -28,6 +29,7 @@ public class TransferRequest {
private String protocol = "dataspace-protocol-http:2025-1";
private String counterPartyAddress;
private String contractId;
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> dataDestination;
private String transferType;

Expand Down
Loading