Skip to content

Commit

Permalink
refactor: default context
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-steinfeld committed Oct 5, 2023
1 parent c1c6f22 commit e802523
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private Single<EntityRequest> buildEntityRequest(
context, entityType, this.entityFieldsByType.get(entityType)),
(resultSetRequest, metricRequestList, optionalLabelRequest) ->
new DefaultEntityRequest(
context, entityType, resultSetRequest, metricRequestList, optionalLabelRequest));
entityType, resultSetRequest, metricRequestList, optionalLabelRequest));
}

private Single<List<AttributeAssociation<FilterArgument>>> buildIdFilter(
Expand All @@ -304,7 +304,6 @@ private Single<List<AttributeAssociation<FilterArgument>>> buildIdFilter(
@Value
@Accessors(fluent = true)
private static class DefaultEntityRequest implements EntityRequest {
GraphQlRequestContext context;
String entityType;
ResultSetRequest<AggregatableOrderArgument> resultSetRequest;
List<MetricRequest> metricRequests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public Single<EntityRequest> rebuildWithAdditionalFilters(
.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.context(),
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(),
Expand Down Expand Up @@ -133,7 +132,6 @@ private Single<EntityRequest> build(
outgoingEdges,
optionalLabelsAttributeRequest) ->
new DefaultEntityRequest(
context,
scope,
resultSetRequest,
metricRequestList,
Expand Down Expand Up @@ -178,7 +176,6 @@ private Optional<String> space(Map<String, Object> arguments) {
@Value
@Accessors(fluent = true)
private static class DefaultEntityRequest implements EntityRequest {
GraphQlRequestContext context;
String entityType;
ResultSetRequest<AggregatableOrderArgument> resultSetRequest;
List<MetricRequest> metricRequests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
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 extends ContextualRequest {

@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 @@ -90,7 +90,6 @@ private Single<EntityRequest> build(
context, timeRange, space, this.getOutgoingEdges(neighborFields)),
(resultSetRequest, metricRequestList, incomingEdges, outgoingEdges) ->
new NeighborEntityRequest(
context,
entityScope,
resultSetRequest,
metricRequestList,
Expand Down Expand Up @@ -175,7 +174,6 @@ private static class EntityNeighborIdFilter implements FilterArgument {
@Value
@Accessors(fluent = true)
private static class NeighborEntityRequest implements EntityRequest {
GraphQlRequestContext context;
String entityType;
ResultSetRequest<AggregatableOrderArgument> resultSetRequest;
List<MetricRequest> metricRequests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private Single<EntityRequest> buildEntityRequest(
filterArguments,
selectionSet.getFields().stream(),
Optional.empty())
.map(request -> new DefaultEntityRequest(context, entityType, request, fetchTotal));
.map(request -> new DefaultEntityRequest(entityType, request, fetchTotal));
}

private Single<List<AttributeAssociation<FilterArgument>>> buildLabelIdFilter(
Expand All @@ -303,7 +303,6 @@ private Single<List<AttributeAssociation<FilterArgument>>> buildLabelIdFilter(
@Value
@Accessors(fluent = true)
private static class DefaultEntityRequest implements EntityRequest {
GraphQlRequestContext context;
String entityType;
ResultSetRequest<AggregatableOrderArgument> resultSetRequest;
List<MetricRequest> metricRequests = Collections.emptyList(); // Only support attributes for now
Expand Down

0 comments on commit e802523

Please sign in to comment.