Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit f1d2581

Browse files
authored
Clean up project structure
1 parent da6d02c commit f1d2581

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

src/main/java/io/dataspaceconnector/service/message/handler/processor/DataRequestProcessor.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*
22
* Copyright 2020 Fraunhofer Institute for Software and Systems Engineering
3-
* Copyright 2021 Fraunhofer Institute for Applied Information Technology
43
*
54
* Licensed under the Apache License, Version 2.0 (the "License");
65
* you may not use this file except in compliance with the License.
@@ -16,10 +15,7 @@
1615
*/
1716
package io.dataspaceconnector.service.message.handler.processor;
1817

19-
import com.fasterxml.jackson.annotation.JsonInclude;
2018
import com.fasterxml.jackson.databind.ObjectMapper;
21-
import de.fraunhofer.fit.appstore.model.portainer.Template;
22-
import de.fraunhofer.fit.appstore.services.registry.RegistryService;
2319
import de.fraunhofer.iais.eis.ArtifactRequestMessageImpl;
2420
import de.fraunhofer.ids.messaging.handler.message.MessagePayload;
2521
import io.dataspaceconnector.common.exception.InvalidInputException;
@@ -35,6 +31,7 @@
3531
import lombok.RequiredArgsConstructor;
3632
import lombok.extern.log4j.Log4j2;
3733
import org.springframework.stereotype.Component;
34+
import org.springframework.util.Base64Utils;
3835

3936
/**
4037
* Fetches the data of an artifact as the response to an ArtifactRequestMessage.
@@ -55,11 +52,6 @@ class DataRequestProcessor extends IdsProcessor<
5552
*/
5653
private final @NonNull EntityResolver entityResolver;
5754

58-
/**
59-
* Service for registry management.
60-
*/
61-
private final @NonNull RegistryService registryService;
62-
6355
/**
6456
* Fetches the data of the requested artifact as the response payload and creates an
6557
* ArtifactResponseMessage as the response header.
@@ -81,25 +73,10 @@ protected Response processInternal(final RouteMsg<ArtifactRequestMessageImpl,
8173
final var queryInput = getQueryInputFromPayload(msg.getBody());
8274
final var data = entityResolver.getDataByArtifactId(artifact, queryInput);
8375

84-
// Add user credentials to template.
85-
final var userCreds = registryService.createUserCredentialsForPullingImages();
86-
userCreds.setEmail(null);
87-
userCreds.setRealname(null);
88-
89-
final var objectMapper = new ObjectMapper();
90-
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
91-
92-
final var dataTmp = objectMapper.readValue(data.readAllBytes(), Template.class);
93-
dataTmp.setRegistryUser(userCreds);
94-
95-
// TODO: EXCEPTION HANDLING FOR OBJECT MAPPING (JSON TO OBJECT AND OBJECT TO JSON)
96-
final var newData
97-
= objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(dataTmp);
98-
9976
final var desc = new ArtifactResponseMessageDesc(issuer, messageId, transferContract);
10077
final var responseHeader = messageService.buildMessage(desc);
10178

102-
return new Response(responseHeader, newData);
79+
return new Response(responseHeader, Base64Utils.encodeToString(data.readAllBytes()));
10380
}
10481

10582
/**

0 commit comments

Comments
 (0)