-
Notifications
You must be signed in to change notification settings - Fork 0
Feature update schema improvements #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Added isSameSchema function, allowing RDF models to be compared. - Added GetAllSchemas function, fetching all current schemas in the FDP. - Added SchemaToolsTest.java, testing this new feature. - Improved readability in SchemaTools.java by splitting up functons inside run.
…date' into feature-update-schema-improvements # Conflicts: # src/main/java/nl/healthri/fdp/uploadschema/utils/RdfUtils.java
|
PatrickDekkerHealthRI
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the FDP GetAllSchema can be removed i think ?
|
|
||
| public List<SchemaDataResponse> GetAllSchemas(){ | ||
| logger.info("Getting all metadata schemas"); | ||
| try { | ||
| HttpClient client = HttpClient.newBuilder() | ||
| .build(); | ||
|
|
||
| HttpRequest request = HttpRequest.newBuilder() | ||
| .GET() | ||
| .uri(new URI(url + "/metadata-schemas/")) | ||
| .header("accept", "application/json") | ||
| .header("Content-Type", "application/json") | ||
| .header("Authorization", String.valueOf(token)) | ||
| .build(); | ||
|
|
||
| HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); | ||
|
|
||
| // Handle each response based on Fair Data Point (FDP) Swagger documentation. | ||
| switch (response.statusCode()) { | ||
| case 200 -> logger.info("Successfully received all schemas from FDP"); | ||
| case 400 -> | ||
| throw new IllegalArgumentException(String.valueOf(HttpStatus.SC_BAD_REQUEST)); | ||
| case 401 -> | ||
| throw new SecurityException(String.valueOf(HttpStatus.SC_UNAUTHORIZED)); | ||
| case 403 -> | ||
| throw new SecurityException(String.valueOf(HttpStatus.SC_FORBIDDEN)); | ||
| case 404 -> | ||
| throw new IOException(String.valueOf(HttpStatus.SC_NOT_FOUND)); | ||
| case 500 -> | ||
| throw new IOException(String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR)); | ||
| default -> { | ||
| throw new RuntimeException("Unexpected HTTP status: " + response.statusCode()); | ||
| } | ||
| } | ||
|
|
||
| ObjectMapper objectMapper = new ObjectMapper(); | ||
| TypeReference<List<SchemaDataResponse>> schemaDataTypeReference = new TypeReference<List<SchemaDataResponse>>(){}; | ||
| List<SchemaDataResponse> schemaDataResponseList = objectMapper.readValue(response.body(), schemaDataTypeReference); | ||
|
|
||
| return schemaDataResponseList; | ||
|
|
||
| } catch (Exception e) { | ||
| throw new RuntimeException(e); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove




No description provided.