Skip to content

Commit

Permalink
Merge pull request #60 from DiSSCo/feature/fdo-1.0
Browse files Browse the repository at this point in the history
update fdo requests
  • Loading branch information
southeo authored Oct 21, 2024
2 parents e26ed7d + b42303c commit 9335d34
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum FdoProfileAttributes {
SOURCE_DATA_STANDARD("sourceDataStandard"),
// Source System
SOURCE_SYSTEM_NAME("sourceSystemName"),
MAS_NAME("masName");
MAS_NAME("machineAnnotationServiceName");

private final String attribute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@ public class FdoProperties {
@NotBlank
private String masType = "https://doi.org/21.T11148/22e71a0015cbcfba8ffa";

@NotBlank
private String issuedForAgent = "https://ror.org/0566bfb96";


}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package eu.dissco.orchestration.backend.service;

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;
import static eu.dissco.orchestration.backend.domain.FdoProfileAttributes.SOURCE_SYSTEM_NAME;
Expand All @@ -9,7 +8,6 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import eu.dissco.orchestration.backend.domain.ObjectType;
import eu.dissco.orchestration.backend.properties.FdoProperties;
import eu.dissco.orchestration.backend.schema.DataMappingRequest;
Expand Down Expand Up @@ -67,17 +65,17 @@ private JsonNode buildRequestAttributes(Object object, ObjectType type) {
}

private JsonNode buildMappingAttributes(DataMappingRequest mapping) {
return buildGeneralAttributes()
return mapper.createObjectNode()
.put(SOURCE_DATA_STANDARD.getAttribute(), mapping.getOdsMappingDataStandard().toString());
}

private JsonNode buildMasAttributes(MachineAnnotationServiceRequest mas) {
return buildGeneralAttributes()
return mapper.createObjectNode()
.put(MAS_NAME.getAttribute(), mas.getSchemaName());
}

private JsonNode buildSourceSystemAttributes(SourceSystemRequest sourceSystemRequest) {
return buildGeneralAttributes()
return mapper.createObjectNode()
.put(SOURCE_SYSTEM_NAME.getAttribute(), sourceSystemRequest.getSchemaName());
}

Expand All @@ -95,10 +93,4 @@ private String getFdoType(ObjectType type) {
default -> throw new IllegalStateException();
}
}

private ObjectNode buildGeneralAttributes() {
return mapper.createObjectNode()
.put(ISSUED_FOR_AGENT.getAttribute(), fdoProperties.getIssuedForAgent());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,7 @@ public static JsonNode givenMasHandleRequest() throws Exception {
"data": {
"type": "https://doi.org/21.T11148/22e71a0015cbcfba8ffa",
"attributes": {
"issuedForAgent": "https://ror.org/0566bfb96",
"masName":"A Machine Annotation Service"
"machineAnnotationServiceName":"A Machine Annotation Service"
}
}
}""");
Expand All @@ -387,7 +386,6 @@ public static JsonNode givenSourceSystemHandleRequest() throws Exception {
"data": {
"type": "https://doi.org/21.T11148/417a4f472f60f7974c12",
"attributes": {
"issuedForAgent": "https://ror.org/0566bfb96",
"sourceSystemName":"Naturalis Tunicate DWCA endpoint"
}
}
Expand All @@ -400,7 +398,6 @@ public static JsonNode givenMappingHandleRequest() throws Exception {
"data": {
"type": "https://doi.org/21.T11148/ce794a6f4df42eb7e77e",
"attributes": {
"issuedForAgent": "https://ror.org/0566bfb96",
"sourceDataStandard": "dwc"
}
}
Expand Down

0 comments on commit 9335d34

Please sign in to comment.