/** * Creates a new ApiFilter based on this ApiFilter, except with the new set of filter values replacing this * ApiFilter's filter values. * * @param values The new set of values to use in the new ApiFilter * * @return the new ApiFilter object */ public ApiFilter withValues(Collection<String> values) { return new ApiFilter(dimension, dimensionField, operation, values); }
/** * Calculate the macro-adjusted DateTime under the TimeGrain. * * @param dateTime DateTime to adjust * @param timeGrain TimeGrain to adjust the DateTime for * * @return the macro-adjusted DateTime */ public DateTime getDateTime(DateTime dateTime, TimeGrain timeGrain) { return calculation.getDateTime(dateTime, timeGrain); } }
/** * Builder for ResponseWriter, a serializer allowing customized response from Fili. * * @param mappers Shared instance of {@link com.fasterxml.jackson.databind.ObjectMapper} * * @return FiliResponseWriter */ protected ResponseWriter buildResponseWriter(ObjectMappersSuite mappers) { return new FiliResponseWriter( new FiliResponseWriterSelector( new CsvResponseWriter(mappers), new JsonResponseWriter(mappers), new JsonApiResponseWriter(mappers) ) ); }
/** * Extracts the operation to be performed by the ApiJobStore filter query. * * @param tokenizedQuery The tokenized filter expression. * * @return The operation to be performed by the ApiJobStore filter query. * @throws BadFilterException if the operation does not exist */ private FilterOperation extractOperation(Matcher tokenizedQuery) throws BadFilterException { String operationName = tokenizedQuery.group(2); try { return DefaultFilterOperation.fromString(operationName); } catch (IllegalArgumentException ignored) { LOG.debug(FILTER_OPERATOR_INVALID.logFormat(operationName)); throw new BadFilterException(FILTER_OPERATOR_INVALID.format(operationName)); } }
/** * Verifies that the passed parameter is greater than 0. * * @param parameter The parameter to be validated. * @param parameterName The name of the parameter to appear in the error message * * @throws BadPaginationException if 'parameter' is not greater than 0. */ private static void validate(int parameter, String parameterName) throws BadPaginationException { if (parameter < MINIMAL_VALUE) { ErrorMessageFormat errorMessage = ErrorMessageFormat.PAGINATION_PARAMETER_INVALID; LOG.debug(errorMessage.logFormat(parameterName, parameter)); throw new BadPaginationException(errorMessage.format(parameterName, parameter)); } }
/** * Initialize the MetricsFilterSetBuilder. By default it is FilteredThetaSketchMetricsHelper * * @return An instance of MetricsFilterSetBuilder */ protected MetricsFilterSetBuilder initializeMetricsFilterSetBuilder() { return new FilteredThetaSketchMetricsHelper(); }
/** * Builds the value for the Content-Type header. The value is constructed out of data provided by the * Response Format Type. * * @param responseFormatType data object that contains information necessary to build the response headers * @return the value for the Content-Type header */ public String getContentTypeValue(ResponseFormatType responseFormatType) { return responseFormatType.getContentType() + "; charset=" + responseFormatType.getCharset(); }
/** * Confirm count size is non negative. * * @param countRequest The value of the count from the request (if any) * @param count The bound value for the count */ protected void validateCount(String countRequest, int count) { // This is the validation part for count that is inlined here because currently it is very brief. if (count < 0) { LOG.debug(INTEGER_INVALID.logFormat(countRequest, "count")); throw new BadApiRequestException(INTEGER_INVALID.logFormat(countRequest, "count")); } } /**
/** * Constructor. * * @param value String that was not able to be parsed into a Granularity. */ public GranularityParseException(String value) { super(UNKNOWN_GRANULARITY.format(value)); } }
/** * Create a ResponseFormatResolver for Servlet objects. * <p> * Currently default types are json, jsonapi and csv types. * * @return A ResponseFormatResolver */ protected ResponseFormatResolver buildResponseFormatResolver() { return new DefaultResponseFormatResolver(); }
/** * Constructor. * * @param key Initial key with which to populate the map * @param value Initial value with which to populate the map */ public TableView (String key, Object value) { this.put(key, value); } }
@Override public String getName() { return name(); }
private Set<Dimension> getFilterDimensions() { return FieldConverterSupplier.metricsFilterSetBuilder.gatherFilterDimensions(filter); }
public String getLogMessage() { return PAGINATION_PAGE_INVALID.logFormat(page, rowsPerPage, lastPage); }
/** * Creates a new ApiFilter based on this ApiFilter, except with the new DimensionField replacing this ApiFilter's * DimensionField. * * @param dimensionField The new DimensionField to use in the new ApiFilter. * @return the new ApiFilter object. */ public ApiFilter withDimensionField(DimensionField dimensionField) { return new ApiFilter(dimension, dimensionField, operation, values); }
/** * Initialize the MetricsFilterSetBuilder. By default it is FilteredThetaSketchMetricsHelper * * @return An instance of MetricsFilterSetBuilder */ protected MetricsFilterSetBuilder initializeMetricsFilterSetBuilder() { return new FilteredThetaSketchMetricsHelper(); }
@Override public String getMessage() { return PAGINATION_PAGE_INVALID.format(page, rowsPerPage, lastPage); }
/** * Creates a new ApiFilter based on this ApiFilter, except with the new dimension replacing this ApiFilter's * dimension. * * @param dimension The new dimension to use in the new ApiFilter. * @return the new ApiFilter object. */ public ApiFilter withDimension(Dimension dimension) { return new ApiFilter(dimension, dimensionField, operation, values); }
/** * Creates a new ApiFilter based on this ApiFilter, except with the new FilterOperation replacing this ApiFilter's * FilterOperation. * * @param operation The new operation to use in the new ApiFilter. * @return the new ApiFilter object. */ public ApiFilter withOperation(FilterOperation operation) { return new ApiFilter(dimension, dimensionField, operation, values); }