From baffc4550373216dafaf3809fd7b20f7ebba06de Mon Sep 17 00:00:00 2001 From: Luke Sikina Date: Tue, 2 Jan 2024 10:52:27 -0500 Subject: [PATCH] wow we sort them too --- .../hms/dbmi/avillach/hpds/service/QueryService.java | 6 +++--- .../dbmi/avillach/hpds/service/util/QueryDecorator.java | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/QueryService.java b/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/QueryService.java index 2940b1b8..fe120904 100644 --- a/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/QueryService.java +++ b/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/QueryService.java @@ -72,8 +72,9 @@ public QueryService ( public AsyncResult runQuery(Query query) throws ClassNotFoundException, IOException { // Merging fields from filters into selected fields for user validation of results - - Collections.sort(query.getFields()); + List fields = query.getFields(); + Collections.sort(fields); + query.setFields(fields); AsyncResult result = initializeResult(query); @@ -125,7 +126,6 @@ private AsyncResult initializeResult(Query query) throws ClassNotFoundException, queryDecorator.setId(query); result.id = query.getId(); result.processor = p; - queryDecorator.setId(query); results.put(result.id, result); return result; } diff --git a/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/util/QueryDecorator.java b/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/util/QueryDecorator.java index cb1d4ece..ed3d3c36 100644 --- a/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/util/QueryDecorator.java +++ b/service/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/service/util/QueryDecorator.java @@ -7,9 +7,7 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.TreeSet; +import java.util.*; @Component public class QueryDecorator { @@ -24,6 +22,11 @@ public void setId(Query query) { // first. This can mutate the query, resulting in shifting UUIDs // To stabilize things, we're always going to call that, and shift the logic here mergeFilterFieldsIntoSelectedFields(query); + + // we also sort things sometimes + List fields = query.getFields(); + Collections.sort(fields); + query.setFields(fields); String id = UUIDv5.UUIDFromString(query.toString()).toString(); query.setId(id);