use of org.hypertrace.gateway.service.v1.entity.BulkUpdateEntitiesResponse in project gateway-service by hypertrace.
the class GatewayServiceImpl method bulkUpdateEntities.
@Override
public void bulkUpdateEntities(BulkUpdateEntitiesRequest request, StreamObserver<BulkUpdateEntitiesResponse> responseObserver) {
LOG.debug("Received request: {}", request);
try {
String tenantId = org.hypertrace.core.grpcutils.context.RequestContext.CURRENT.get().getTenantId().orElseThrow(() -> new ServiceException("Tenant id is missing in the request."));
BulkUpdateEntitiesResponse response = entityService.bulkUpdateEntities(tenantId, request, org.hypertrace.core.grpcutils.context.RequestContext.CURRENT.get().getRequestHeaders());
LOG.debug("Received response: {}", response);
responseObserver.onNext(response);
responseObserver.onCompleted();
} catch (Exception e) {
LOG.error("Error while handling bulkUpdateEntities: {}.", request, e);
responseObserver.onError(e);
}
}
use of org.hypertrace.gateway.service.v1.entity.BulkUpdateEntitiesResponse in project gateway-service by hypertrace.
the class EdsEntityUpdater method bulkUpdateEntities.
public BulkUpdateEntitiesResponse bulkUpdateEntities(BulkUpdateEntitiesRequest request, UpdateExecutionContext updateExecutionContext) {
MultiValuedAttributeOperation multiValuedAttributeOperation = request.getOperation().getMultiValuedAttributeOperation();
org.hypertrace.entity.query.service.v1.BulkEntityArrayAttributeUpdateRequest updateRequest = org.hypertrace.entity.query.service.v1.BulkEntityArrayAttributeUpdateRequest.newBuilder().setEntityType(request.getEntityType()).addAllEntityIds(request.getEntityIdsList()).setOperation(EntityServiceAndGatewayServiceConverter.convertToBulkEntityArrayAttributeUpdateOperation(multiValuedAttributeOperation.getType())).setAttribute(EntityServiceAndGatewayServiceConverter.convertToQueryColumnIdentifier(multiValuedAttributeOperation.getAttribute())).addAllValues(multiValuedAttributeOperation.getValuesList().stream().map(value -> EntityServiceAndGatewayServiceConverter.convertToQueryLiteral(value)).collect(Collectors.toList())).build();
eqsClient.bulkUpdateEntityArrayAttribute(updateRequest, updateExecutionContext.getRequestHeaders());
return BulkUpdateEntitiesResponse.newBuilder().build();
}
Aggregations