From 4d44e9a166c0f4f0ba3b8d58e3fb930662e2bd9e Mon Sep 17 00:00:00 2001 From: southeo Date: Wed, 1 May 2024 09:20:10 +0200 Subject: [PATCH] remove fdo profile from request --- .../backend/domain/FdoProfileAttributes.java | 16 +++++------- .../backend/service/FdoRecordService.java | 26 +++++++------------ .../backend/testutils/TestUtils.java | 3 --- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/main/java/eu/dissco/orchestration/backend/domain/FdoProfileAttributes.java b/src/main/java/eu/dissco/orchestration/backend/domain/FdoProfileAttributes.java index f77ca6a..8323379 100644 --- a/src/main/java/eu/dissco/orchestration/backend/domain/FdoProfileAttributes.java +++ b/src/main/java/eu/dissco/orchestration/backend/domain/FdoProfileAttributes.java @@ -4,20 +4,16 @@ @Getter public enum FdoProfileAttributes { - FDO_PROFILE("fdoProfile", null), // Issued for agent should be DiSSCo PID; currently it's set as Naturalis's ROR - ISSUED_FOR_AGENT("issuedForAgent", "https://ror.org/0566bfb96"), + ISSUED_FOR_AGENT("issuedForAgent"), // Mapping - SOURCE_DATA_STANDARD("sourceDataStandard", null), + SOURCE_DATA_STANDARD("sourceDataStandard"), // Source System - SOURCE_SYSTEM_NAME("sourceSystemName", null), - MAS_NAME("machineAnnotationServiceName", null); + SOURCE_SYSTEM_NAME("sourceSystemName"), + MAS_NAME("machineAnnotationServiceName"); private final String attribute; - private final String defaultValue; - private FdoProfileAttributes(String attribute, String defaultValue) { - this.attribute = attribute; - this.defaultValue = defaultValue; - } + FdoProfileAttributes(String attribute) { + this.attribute = attribute;} } diff --git a/src/main/java/eu/dissco/orchestration/backend/service/FdoRecordService.java b/src/main/java/eu/dissco/orchestration/backend/service/FdoRecordService.java index 2246b56..a84b135 100644 --- a/src/main/java/eu/dissco/orchestration/backend/service/FdoRecordService.java +++ b/src/main/java/eu/dissco/orchestration/backend/service/FdoRecordService.java @@ -1,6 +1,5 @@ package eu.dissco.orchestration.backend.service; -import static eu.dissco.orchestration.backend.domain.FdoProfileAttributes.FDO_PROFILE; import static eu.dissco.orchestration.backend.domain.FdoProfileAttributes.ISSUED_FOR_AGENT; import static eu.dissco.orchestration.backend.domain.FdoProfileAttributes.MAS_NAME; import static eu.dissco.orchestration.backend.domain.FdoProfileAttributes.SOURCE_DATA_STANDARD; @@ -23,6 +22,7 @@ public class FdoRecordService { private final ObjectMapper mapper; + private static final String ISSUED_FOR_AGENT_ROR = "https://ror.org/0566bfb96"; public JsonNode buildCreateRequest(Object object, ObjectType type) { var request = mapper.createObjectNode(); @@ -56,29 +56,23 @@ private JsonNode buildRequestAttributes(Object object, ObjectType type) { } private JsonNode buildMappingAttributes(Mapping mapping) { - var attributes = buildGeneralAttributes(ObjectType.MAPPING); - attributes.put(SOURCE_DATA_STANDARD.getAttribute(), mapping.sourceDataStandard()); - return attributes; + return buildGeneralAttributes() + .put(SOURCE_DATA_STANDARD.getAttribute(), mapping.sourceDataStandard()); } private JsonNode buildMasAttributes(MachineAnnotationService mas) { - var attributes = buildGeneralAttributes(ObjectType.MAS); - attributes.put(MAS_NAME.getAttribute(), mas.getName()); - return attributes; + return buildGeneralAttributes() + .put(MAS_NAME.getAttribute(), mas.getName()); } private JsonNode buildSourceSystemAttributes(SourceSystem sourceSystem) { - var attributes = buildGeneralAttributes(ObjectType.SOURCE_SYSTEM); - attributes.put(SOURCE_SYSTEM_NAME.getAttribute(), sourceSystem.name()); - return attributes; + return buildGeneralAttributes() + .put(SOURCE_SYSTEM_NAME.getAttribute(), sourceSystem.name()); } - private ObjectNode buildGeneralAttributes(ObjectType type) { - var attributes = mapper.createObjectNode(); - attributes.put(FDO_PROFILE.getAttribute(), type.getFdoProfile()); - attributes.put(ISSUED_FOR_AGENT.getAttribute(), ISSUED_FOR_AGENT.getDefaultValue()); - return attributes; + private ObjectNode buildGeneralAttributes() { + return mapper.createObjectNode() + .put(ISSUED_FOR_AGENT.getAttribute(), ISSUED_FOR_AGENT_ROR); } - } diff --git a/src/test/java/eu/dissco/orchestration/backend/testutils/TestUtils.java b/src/test/java/eu/dissco/orchestration/backend/testutils/TestUtils.java index 95aca56..5e98669 100644 --- a/src/test/java/eu/dissco/orchestration/backend/testutils/TestUtils.java +++ b/src/test/java/eu/dissco/orchestration/backend/testutils/TestUtils.java @@ -263,7 +263,6 @@ public static JsonNode givenMasHandleRequest() throws Exception { "data": { "type": "https://hdl.handle.net/21.T11148/22e71a0015cbcfba8ffa", "attributes": { - "fdoProfile": "https://hdl.handle.net/21.T11148/22e71a0015cbcfba8ffa", "issuedForAgent": "https://ror.org/0566bfb96", "machineAnnotationServiceName":"A Machine Annotation Service" } @@ -277,7 +276,6 @@ public static JsonNode givenSourceSystemHandleRequest() throws Exception{ "data": { "type": "https://hdl.handle.net/21.T11148/417a4f472f60f7974c12", "attributes": { - "fdoProfile": "https://hdl.handle.net/21.T11148/417a4f472f60f7974c12", "issuedForAgent": "https://ror.org/0566bfb96", "sourceSystemName":"Naturalis Tunicate DWCA endpoint" } @@ -291,7 +289,6 @@ public static JsonNode givenMappingHandleRequest() throws Exception { "data": { "type": "https://hdl.handle.net/21.T11148/ce794a6f4df42eb7e77e", "attributes": { - "fdoProfile": "https://hdl.handle.net/21.T11148/ce794a6f4df42eb7e77e", "issuedForAgent": "https://ror.org/0566bfb96", "sourceDataStandard": "dwc" }