diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java index 39a9e154..788a0725 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java @@ -18,6 +18,7 @@ import org.hypertrace.core.graphql.common.request.ResultSetRequestBuilder; import org.hypertrace.core.graphql.common.schema.arguments.TimeRangeArgument; import org.hypertrace.core.graphql.common.schema.results.ResultSet; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; import org.hypertrace.core.graphql.common.schema.results.arguments.space.SpaceArgument; import org.hypertrace.core.graphql.context.GraphQlRequestContext; import org.hypertrace.core.graphql.deserialization.ArgumentDeserializer; @@ -74,6 +75,24 @@ public Single build( return this.build(context, arguments, entityScope, selectionSet); } + @Override + public Single rebuildWithAdditionalFilters( + EntityRequest originalRequest, List filterArguments) { + return this.resultSetRequestBuilder + .rebuildWithAdditionalFilters(originalRequest.resultSetRequest(), filterArguments) + .map( + newResultSetRequest -> + new DefaultEntityRequest( + originalRequest.entityType(), + newResultSetRequest, + originalRequest.metricRequests(), + originalRequest.incomingEdgeRequests(), + originalRequest.outgoingEdgeRequests(), + originalRequest.includeInactive(), + originalRequest.fetchTotal(), + originalRequest.labelRequest())); + } + private Single build( GraphQlRequestContext context, Map arguments, diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java index 7f25cf51..3562b1e1 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java @@ -2,11 +2,19 @@ import java.util.List; import java.util.Optional; +import org.hypertrace.core.graphql.common.request.ContextualRequest; import org.hypertrace.core.graphql.common.request.ResultSetRequest; +import org.hypertrace.core.graphql.context.GraphQlRequestContext; import org.hypertrace.graphql.metric.request.MetricRequest; import org.hypertrace.graphql.metric.schema.argument.AggregatableOrderArgument; -public interface EntityRequest { +public interface EntityRequest extends ContextualRequest { + + @Override + default GraphQlRequestContext context() { + return resultSetRequest().context(); + } + String entityType(); ResultSetRequest resultSetRequest(); diff --git a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequestBuilder.java b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequestBuilder.java index e0e8bd16..411a86b3 100644 --- a/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequestBuilder.java +++ b/hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequestBuilder.java @@ -2,7 +2,9 @@ import graphql.schema.DataFetchingFieldSelectionSet; import io.reactivex.rxjava3.core.Single; +import java.util.List; import java.util.Map; +import org.hypertrace.core.graphql.common.schema.results.arguments.filter.FilterArgument; import org.hypertrace.core.graphql.context.GraphQlRequestContext; public interface EntityRequestBuilder { @@ -10,4 +12,7 @@ Single build( GraphQlRequestContext context, Map arguments, DataFetchingFieldSelectionSet selectionSet); + + Single rebuildWithAdditionalFilters( + EntityRequest originalRequest, List filterArguments); }