Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for passing additional filters to EntityRequest #199

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -74,6 +75,24 @@
return this.build(context, arguments, entityScope, selectionSet);
}

@Override
public Single<EntityRequest> rebuildWithAdditionalFilters(
EntityRequest originalRequest, List<FilterArgument> filterArguments) {
return this.resultSetRequestBuilder
.rebuildWithAdditionalFilters(originalRequest.resultSetRequest(), filterArguments)
.map(

Check warning on line 83 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java#L81-L83

Added lines #L81 - L83 were not covered by tests
newResultSetRequest ->
new DefaultEntityRequest(
originalRequest.entityType(),

Check warning on line 86 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java#L85-L86

Added lines #L85 - L86 were not covered by tests
newResultSetRequest,
originalRequest.metricRequests(),
originalRequest.incomingEdgeRequests(),
originalRequest.outgoingEdgeRequests(),
originalRequest.includeInactive(),
originalRequest.fetchTotal(),
originalRequest.labelRequest()));

Check warning on line 93 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/DefaultEntityRequestBuilder.java#L88-L93

Added lines #L88 - L93 were not covered by tests
}

private Single<EntityRequest> build(
GraphQlRequestContext context,
Map<String, Object> arguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
aaron-steinfeld marked this conversation as resolved.
Show resolved Hide resolved

@Override
default GraphQlRequestContext context() {
return resultSetRequest().context();

Check warning on line 15 in hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java

View check run for this annotation

Codecov / codecov/patch

hypertrace-graphql-entity-schema/src/main/java/org/hypertrace/graphql/entity/request/EntityRequest.java#L15

Added line #L15 was not covered by tests
}

String entityType();

ResultSetRequest<AggregatableOrderArgument> resultSetRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

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 {
Single<EntityRequest> build(
GraphQlRequestContext context,
Map<String, Object> arguments,
DataFetchingFieldSelectionSet selectionSet);

Single<EntityRequest> rebuildWithAdditionalFilters(
EntityRequest originalRequest, List<FilterArgument> filterArguments);
}