use of io.crnk.legacy.queryParams.params.TypedParams in project crnk-framework by crnk-project.
the class QuerySpecAdapter method getIncludedRelations.
@Override
public TypedParams<IncludedRelationsParams> getIncludedRelations() {
Map<String, IncludedRelationsParams> params = new HashMap<>();
addRelations(params, querySpec);
for (QuerySpec relatedSpec : querySpec.getNestedSpecs()) {
addRelations(params, relatedSpec);
}
return new TypedParams<>(params);
}
use of io.crnk.legacy.queryParams.params.TypedParams in project crnk-framework by crnk-project.
the class JsonApiQueryParamsParser method parseSortingParameters.
@Override
protected TypedParams<SortingParams> parseSortingParameters(final QueryParamsParserContext context) {
String sortingKey = RestrictedQueryParamsMembers.sort.name();
Set<String> rawSortingQueryParams = parseDelimitedParameters(context.getParameterValue(sortingKey));
Map<String, SortingParams> decodedSortingMap = new LinkedHashMap<>();
if (!rawSortingQueryParams.isEmpty()) {
Map<String, RestrictedSortingValues> temporarySortingMap = new LinkedHashMap<>();
for (String sortParam : rawSortingQueryParams) {
if (sortParam.startsWith(JSON_API_SORT_INDICATOR_DESC)) {
temporarySortingMap.put(sortParam.substring(1), RestrictedSortingValues.desc);
} else {
temporarySortingMap.put(sortParam, RestrictedSortingValues.asc);
}
}
decodedSortingMap.put(context.getRequestedResourceInformation().getResourceType(), new SortingParams(temporarySortingMap));
}
return new TypedParams<>(Collections.unmodifiableMap(decodedSortingMap));
}
use of io.crnk.legacy.queryParams.params.TypedParams in project crnk-framework by crnk-project.
the class JsonApiQueryParamsParser method parseIncludedRelationsParameters.
@Override
protected TypedParams<IncludedRelationsParams> parseIncludedRelationsParameters(QueryParamsParserContext context) {
String includeKey = RestrictedQueryParamsMembers.include.name();
Map<String, Set<String>> inclusions = filterQueryParamsByKey(context, includeKey);
Map<String, IncludedRelationsParams> decodedInclusions = new LinkedHashMap<>();
if (inclusions.containsKey(RestrictedQueryParamsMembers.include.name())) {
Set<Inclusion> inclusionSet = new LinkedHashSet<>();
for (String inclusion : inclusions.get(RestrictedQueryParamsMembers.include.name())) {
inclusionSet.add(new Inclusion(inclusion));
}
decodedInclusions.put(context.getRequestedResourceInformation().getResourceType(), new IncludedRelationsParams(inclusionSet));
}
return new TypedParams<>(Collections.unmodifiableMap(decodedInclusions));
}
use of io.crnk.legacy.queryParams.params.TypedParams in project crnk-framework by crnk-project.
the class QuerySpecAdapter method getIncludedFields.
@Override
public TypedParams<IncludedFieldsParams> getIncludedFields() {
Map<String, IncludedFieldsParams> params = new HashMap<>();
addFields(params, querySpec);
for (QuerySpec relatedSpec : querySpec.getNestedSpecs()) {
addFields(params, relatedSpec);
}
return new TypedParams<>(params);
}
Aggregations