/** * Get the logical tables for which the given logical dimension is valid. * * @param dimension Dimension to look up Logical Tables by * * @return The list of logical tables that have the dimension */ public List<LogicalTable> findByDimension(Dimension dimension) { return values() .stream() .filter(it -> it.getDimensions().contains(dimension)) .collect(Collectors.toList()); } }
/** * Ensure all request dimensions are part of the logical table. * * @param requestDimensions The dimensions being requested * @param table The logical table being checked * * @throws BadApiRequestException if any of the dimensions do not match the logical table */ protected void validateRequestDimensions(Set<Dimension> requestDimensions, LogicalTable table) throws BadApiRequestException { // Requested dimensions must lie in the logical table requestDimensions = new HashSet<>(requestDimensions); requestDimensions.removeAll(table.getDimensions()); if (!requestDimensions.isEmpty()) { List<String> dimensionNames = requestDimensions.stream() .map(Dimension::getApiName) .collect(Collectors.toList()); LOG.debug(DIMENSIONS_NOT_IN_TABLE.logFormat(dimensionNames, table.getName())); throw new BadApiRequestException(DIMENSIONS_NOT_IN_TABLE.format(dimensionNames, table.getName())); } }
resultRow.put( "dimensions", DimensionsServlet.getDimensionListSummaryView(logicalTable.getDimensions(), uriInfo) ); resultRow.put(
new SimpleImmutableEntry<>( "dimensions", DimensionsServlet.getDimensionListSummaryView(logicalTable.getDimensions(), uriInfo) ), new SimpleImmutableEntry<>(
if (!table.getDimensions().contains(newFilter.getDimension())) { String filterDimensionName = newFilter.getDimension().getApiName(); LOG.debug(FILTER_DIMENSION_NOT_IN_TABLE.logFormat(filterDimensionName, table));
/** * Method to provide grain level details(with metrics and dimensions) of the given logical table. * * @param logicalTable Logical Table at the grain level * @param grain Table grain * @param uriInfo Uri information to construct the uri's * * @return logical table details at grain level with all the associated meta data */ @Override public TableGrainView formatTableGrain(LogicalTable logicalTable, String grain, UriInfo uriInfo) { TableGrainView resultRow = new TableGrainView(); resultRow.put("name", grain); resultRow.put("longName", StringUtils.capitalize(grain)); resultRow.put("description", "The " + logicalTable.getName() + " " + grain + " grain"); resultRow.put("retention", logicalTable.getRetention().toString()); resultRow.put("dimensions", getDimensionListFullView(logicalTable.getDimensions(), uriInfo)); resultRow.put( "metrics", MetricsServlet.getLogicalMetricListSummaryView(logicalTable.getLogicalMetrics(), uriInfo) ); return resultRow; }