Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(content analytics) fixes #30521 : Allow users to pass down simple Strings to query for Content Analytics data #30899

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ public Builder timeDimensions(final String timeDimensions) {
}
final String[] timeParams = timeDimensions.split(COMMA);
final Map<String, String> timeDimensionsData = new HashMap<>();
timeDimensionsData.put(TIME_DIMENSIONS_DIMENSION_ATTR, addScheme(timeParams[0]));
timeDimensionsData.put(TIME_DIMENSIONS_DIMENSION_ATTR, addScheme(timeParams[0].trim()));
if (timeParams.length > 1) {
final String[] granularityAndRange = timeParams[1].split(COLON);
if (granularityAndRange.length > 1) {
timeDimensionsData.put(GRANULARITY_ATTR, granularityAndRange[0]);
timeDimensionsData.put(DATE_RANGE_ATTR, granularityAndRange[1]);
timeDimensionsData.put(GRANULARITY_ATTR, granularityAndRange[0].trim());
timeDimensionsData.put(DATE_RANGE_ATTR, granularityAndRange[1].trim());
} else {
timeDimensionsData.put(DATE_RANGE_ATTR, granularityAndRange[0]);
timeDimensionsData.put(DATE_RANGE_ATTR, granularityAndRange[0].trim());
}
} else {
timeDimensionsData.put(DATE_RANGE_ATTR, DEFAULT_DATE_RANGE);
Expand All @@ -262,11 +262,11 @@ public Builder filters(final String filters) {
}
final String[] filterArr = filters.split(COMMA);
for (final String filter : filterArr) {
final String[] filterParams = filter.split(SPACE);
final String[] filterParams = filter.trim().split(SPACE);
final Map<String, Object> filterDataMap = new HashMap<>();
filterDataMap.put(MEMBER_ATTR, addScheme(filterParams[0]));
filterDataMap.put(OPERATOR_ATTR, filterParams[1]);
final String[] filterValues = filterParams[2].split(DOUBLE_PIPE);
filterDataMap.put(MEMBER_ATTR, addScheme(filterParams[0].trim()));
filterDataMap.put(OPERATOR_ATTR, filterParams[1].trim());
final String[] filterValues = filterParams[2].trim().split(DOUBLE_PIPE);
filterDataMap.put(VALUES_ATTR, filterValues);
this.filters.add(filterDataMap);
}
Expand All @@ -290,9 +290,9 @@ public Builder order(final String order) {
}
final Set<String> orderCriteria = Set.of(order.split(COMMA));
for (final String orderCriterion : orderCriteria) {
final String[] orderParams = orderCriterion.split(SPACE);
final String[] orderParams = orderCriterion.trim().split(SPACE);
if (orderParams.length > 1) {
this.order.add(new String[]{addScheme(orderParams[0]), orderParams[1]});
this.order.add(new String[]{ addScheme(orderParams[0]), orderParams[1].trim() });
} else {
this.order.add(orderParams);
}
Expand Down Expand Up @@ -375,7 +375,7 @@ private Set<String> addScheme(final Set<String> terms) {
* @return The term with the default scheme added if it doesn't contain it.
*/
private String addScheme(final String term) {
return term.contains(PERIOD) ? term : scheme + PERIOD + term;
return UtilMethods.isSet(term) && term.contains(PERIOD) ? term.trim() : scheme + PERIOD + term.trim();
}

}
Expand Down
Loading