From a69ea0c057a82623e9449dd9d14ca094dd4c1801 Mon Sep 17 00:00:00 2001 From: pranav-super Date: Wed, 27 Nov 2024 08:39:54 -0800 Subject: [PATCH] minor fix to attribute retrieval in scheduling --- .../services/GraphQLMerlinDatabaseService.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/scheduler-server/src/main/java/gov/nasa/jpl/aerie/scheduler/server/services/GraphQLMerlinDatabaseService.java b/scheduler-server/src/main/java/gov/nasa/jpl/aerie/scheduler/server/services/GraphQLMerlinDatabaseService.java index 9887565638..2d60f6a7f5 100644 --- a/scheduler-server/src/main/java/gov/nasa/jpl/aerie/scheduler/server/services/GraphQLMerlinDatabaseService.java +++ b/scheduler-server/src/main/java/gov/nasa/jpl/aerie/scheduler/server/services/GraphQLMerlinDatabaseService.java @@ -1193,18 +1193,11 @@ private List parseExternalEvents(final JsonArray eventsJson, fina ); final var end = start.plus(Duration.fromString(e.getString("duration"))); - // TODO: all of the properties of eventJson are strings. Including things (like attributes, source_range, etc.) that should be objects - // find a better way to handle this -// final var eventAttributesJson = e.getJsonObject("attributes"); -// final var eventAttributes = new HashMap(); -// for (final var attributeJson: eventAttributesJson.entrySet()) { -// eventAttributes.put( -// attributeJson.getKey(), -// serializedValueP.parse(attributeJson.getValue()).getSuccessOrThrow() -// ); -// } + // TODO: all of the properties of eventJson are strings, except attributes. Including things like source_range, etc., + // that should be objects...find a better way to handle this final var eventAttributes = SchedulerParsers - .parseJson(e.getString("attributes"), new SerializedValueJsonParser()).asMap().get(); + .parseJson(e.getJsonObject("attributes").toString(), new SerializedValueJsonParser()).asMap().get(); + // convert eventAttributes to a Map(); @@ -1215,7 +1208,7 @@ private List parseExternalEvents(final JsonArray eventsJson, fina // ); // } final var sourceAttributes = SchedulerParsers - .parseJson(e.getJsonObject("external_source").getString("attributes"), new SerializedValueJsonParser()).asMap().get(); + .parseJson(e.getJsonObject("external_source").getJsonObject("attributes").toString(), new SerializedValueJsonParser()).asMap().get(); result.add(new ExternalEvent( e.getString("event_key"),