Skip to content

Commit

Permalink
Metadata type definition for the TestToolApi (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkvdVorst authored May 24, 2024
1 parent ad6faa3 commit 36ad5ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/nl/nn/testtool/MetadataExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,19 @@ public boolean isLong(String metadataName) {
}

public boolean isTimestamp(String metadataName) {
return metadataName.equals("endTime");
return metadataName.equals("endTime") || metadataName.equals("startTime");
}

public String getType(String metadataName) {
if (this.isInteger(metadataName)) {
return "int";
}
if (this.isLong(metadataName)) {
return "long";
}
if (this.isTimestamp(metadataName)) {
return "timestamp";
}
return "string";
}
}
5 changes: 5 additions & 0 deletions src/main/java/nl/nn/testtool/web/api/TestToolApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ public Response getViewsResponse() {
map.put("metadataLabels", getMetadataLabels(view.getMetadataNames()));
map.put("crudStorage", view.getDebugStorage() instanceof CrudStorage);
map.put("nodeLinkStrategy", view.getNodeLinkStrategy());
Map<String, String> metadataTypes = new HashMap<>();
for(String metadataName : view.getMetadataNames()) {
metadataTypes.put(metadataName, metadataExtractor.getType(metadataName));
}
map.put("metadataTypes", metadataTypes);
response.put(view.getName(), map);
}
return Response.ok(response).build();
Expand Down

0 comments on commit 36ad5ff

Please sign in to comment.