Skip to content

Commit

Permalink
undo TargetNodeRecurseFetcher List->Set change
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Nov 14, 2022
1 parent 0dc7626 commit 77c1b14
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -98,7 +97,7 @@ boolean blocking() {
public List<TargetNode> getAuthenticated(DataFetchingEnvironment environment) throws Exception {
AbstractNode node = environment.getSource();
FilterInput filter = FilterInput.from(environment);
Set<TargetNode> result = new HashSet<>();
List<TargetNode> result = new ArrayList<>();
if (node instanceof TargetNode) {
result.add((TargetNode) node);
} else if (node instanceof EnvironmentNode) {
Expand All @@ -117,15 +116,15 @@ public List<TargetNode> getAuthenticated(DataFetchingEnvironment environment) th
result =
result.stream()
.filter(n -> Objects.equals(n.getName(), nodeName))
.collect(Collectors.toSet());
.collect(Collectors.toList());
}
if (filter.contains(FilterInput.Key.LABELS)) {
List<String> labels = filter.get(FilterInput.Key.LABELS);
for (String label : labels) {
result =
result.stream()
.filter(n -> LabelSelectorMatcher.parse(label).test(n.getLabels()))
.collect(Collectors.toSet());
.collect(Collectors.toList());
}
}
if (filter.contains(FilterInput.Key.ANNOTATIONS)) {
Expand All @@ -146,9 +145,9 @@ public List<TargetNode> getAuthenticated(DataFetchingEnvironment environment) th
n ->
LabelSelectorMatcher.parse(annotation)
.test(mergedAnnotations.apply(n)))
.collect(Collectors.toSet());
.collect(Collectors.toList());
}
}
return new ArrayList<>(result);
return result;
}
}

0 comments on commit 77c1b14

Please sign in to comment.