/** * Generates the dimension names and its unique id map from Result for custom serialization. * * @param result Result object for the custom serialization * * @return custom map of dimension names and their respective unique id */ private Map<String, String> getDimensionValues(Result result) { return result.getDimensionRows().entrySet().stream().collect(Collectors.toMap( columnRow -> columnRow.getKey().getName(), columnRow -> columnRow.getValue().get(columnRow.getKey().getDimension().getKey()) )); }
/** * Extracts dimension rows for the given dimension columns. * * @param dimensionRowsNode JsonNode which contains all the dimension rows which contains dimension names * and its unique id as its value * @param dimensionColumns DimensionColumns which needs to have dimension rows * * @return Map of all the dimensionRows associated with dimensionColumns */ private Map<DimensionColumn, DimensionRow> extractDimensionValues( JsonNode dimensionRowsNode, Set<DimensionColumn> dimensionColumns ) { return dimensionColumns.stream().collect(Collectors.toMap( Function.identity(), dimensionColumn -> dimensionColumn.getDimension().findDimensionRowByKeyValue( dimensionRowsNode.get(dimensionColumn.getDimension().getApiName()).asText() ) )); }
@Override public String toString() { return "{dim:'" + getName() + "'}"; } }
for (Entry<DimensionColumn, DimensionRow> dce : dr.entrySet()) { DimensionRow drow = dce.getValue(); Dimension dimension = dce.getKey().getDimension();
/** * Extract the dimension rows for a json object given the set of all available dimension columns and the json * object. * * @param dimensionColumns the set of dimension columns * @param entry the json object * * @return map of dimension columns to dimension rows */ private LinkedHashMap<DimensionColumn, DimensionRow> extractDimensionRows( Set<DimensionColumn> dimensionColumns, JsonNode entry ) { LinkedHashMap<DimensionColumn, DimensionRow> dimensionRows = new LinkedHashMap<>(); for (DimensionColumn dc : dimensionColumns) { JsonNode fieldNode = entry.get(dc.getName()); String fieldValue = ""; if (fieldNode != null) { fieldValue = fieldNode.asText(""); } DimensionRow drow = dc.getDimension().findDimensionRowByKeyValue(fieldValue); if (drow == null) { drow = dc.getDimension().createEmptyDimensionRow(fieldValue); } dimensionRows.put(dc, drow); } return dimensionRows; }
for (Entry<DimensionColumn, DimensionRow> dimensionColumnEntry : dr.entrySet()) { Dimension dimension = dimensionColumnEntry.getKey().getDimension(); DimensionRow dimensionRow = dimensionColumnEntry.getValue(); Set<DimensionField> requestedDimensionFields = requestedApiDimensionFields.get(dimension);
if (request instanceof DataApiRequest) { DataApiRequest dataApiRequest = (DataApiRequest) request; if (dataApiRequest.getDimensionFields().get(dimensionColumn.getDimension()).isEmpty()) { continue; sidecars.put(dimensionColumn.getDimension(), new LinkedHashSet<>());
Dimension dimension = ((DimensionColumn) key).getDimension(); String dimensionApiName = dimension.getApiName(); row.put("name", dimensionApiName);