/** * Cardinality metrics depend on dimensions not metrics. * * @param dependentDimensions The dimension names for this cardinality metric */ @Override protected void assertDependentMetricsExist(List<String> dependentDimensions) { for (String dependentDimension : dependentDimensions) { if (dimensionDictionary.findByApiName(dependentDimension) == null) { String message = String.format( "Cardinality metric dependent dimension %s is not in the dimension dictionary", dependentDimension); LOG.error(message); throw new IllegalArgumentException(message); } } }
/** * Bind a map from String dimension names to dimension keys. * * @param dimensionNameMap The configuration map from dimension names to sets of dimension key values. * @param dimensionDictionary The dictionary of dimensions to use for binding. * * @return a map of dimensions to dimension key values. */ private Map<Dimension, Set<String>> toDimensionValuesMap( Map<String, Set<String>> dimensionNameMap, DimensionDictionary dimensionDictionary ) { return dimensionNameMap.entrySet().stream() .collect(Collectors.toMap( entry -> dimensionDictionary.findByApiName(entry.getKey()), Map.Entry::getValue ) ); } }
/** * Method to get dimension from DimensionDictionary for a given name. * * @param dimensionName To find Dimension from dimension dictionary * * @return The dimension with the given name */ private Dimension resolveDimensionName(String dimensionName) { Dimension dimension = dimensionDictionary.findByApiName(dimensionName); if (dimension == null) { String msg = ErrorMessageFormat.UNABLE_TO_FIND_DIMENSION_FROM_DICTIONARY.format(dimensionName); LOG.error(msg); throw new DeserializationException(msg); } return dimension; }
public Response getDimensionLastUpdated(@PathParam("dimensionName") String dimensionName) { Dimension dimension = dimensionDictionary.findByApiName(dimensionName); if (dimension == null) { String message = String.format("Dimension %s cannot be found.", dimensionName);
try { Dimension dimension = dimensionDictionary.findByApiName(dimensionName); if (dimension == null) { String message = String.format("Dimension %s cannot be found.", dimensionName);
List<String> invalidDimensions = new ArrayList<>(); for (String dimApiName : dimApiNames) { Dimension dimension = dimensionDictionary.findByApiName(dimApiName);
/** * Extracts the list of dimensions from the url dimension path segments and "show" matrix params and generates a map * of dimension to dimension fields which needs to be annotated on the response. * <p> * If no "show" matrix param has been set, it returns the default dimension fields configured for the dimension. * * @param apiDimensionPathSegments Path segments for the dimensions * @param dimensionDictionary Dimension dictionary to look the dimensions up in * * @return A map of dimension to requested dimension fields */ protected LinkedHashMap<Dimension, LinkedHashSet<DimensionField>> generateDimensionFields( @NotNull List<PathSegment> apiDimensionPathSegments, @NotNull DimensionDictionary dimensionDictionary ) { try (TimedPhase timer = RequestLog.startTiming("GeneratingDimensionFields")) { return apiDimensionPathSegments.stream() .filter(pathSegment -> !pathSegment.getPath().isEmpty()) .collect(Collectors.toMap( pathSegment -> dimensionDictionary.findByApiName(pathSegment.getPath()), pathSegment -> bindShowClause(pathSegment, dimensionDictionary), (LinkedHashSet<DimensionField> e, LinkedHashSet<DimensionField> i) -> { e.addAll(i); return e; }, LinkedHashMap::new )); } }
try { Dimension dimension = dimensionDictionary.findByApiName(dimensionName); if (dimension == null) { String message = String.format("Dimension %s cannot be found.", dimensionName);
Dimension dimension = dimensionDictionary.findByApiName(pathSegment.getPath()); List<String> showFields = pathSegment.getMatrixParameters().entrySet().stream() .filter(entry -> entry.getKey().equals("show"))
try { Dimension dimension = dimensionDictionary.findByApiName(dimensionName); if (dimension == null) { String message = String.format("Dimension %s cannot be found.", dimensionName);
Dimension dimension = dimensionDictionary.findByApiName(filterDimensionName);
.stream() .collect(Collectors.toMap( e -> dimensionDictionary.findByApiName(e.getKey()), Map.Entry::getValue, (value1, value2) -> value1,