use of io.crnk.core.queryspec.DefaultQuerySpecSerializer in project crnk-framework by crnk-project.
the class SleuthUtil method getQuery.
public static String getQuery(RepositoryRequestSpec request, ResourceRegistry resourceRegistry) {
QueryAdapter queryAdapter = request.getQueryAdapter();
StringBuilder builder = new StringBuilder();
builder.append("?");
if (queryAdapter instanceof QuerySpecAdapter) {
QuerySpec querySpec = request.getQuerySpec(queryAdapter.getResourceInformation());
DefaultQuerySpecSerializer serializer = new DefaultQuerySpecSerializer(resourceRegistry);
Map<String, Set<String>> parameters = serializer.serialize(querySpec);
for (Map.Entry<String, Set<String>> entry : parameters.entrySet()) {
if (builder.length() > 1) {
builder.append("&");
}
builder.append(entry.getKey());
builder.append("=");
builder.append(StringUtils.join(",", entry.getValue()));
}
return builder.toString();
}
return null;
}
use of io.crnk.core.queryspec.DefaultQuerySpecSerializer in project crnk-framework by crnk-project.
the class BraveUtil method getQuery.
public static String getQuery(RepositoryRequestSpec request, ResourceRegistry resourceRegistry) {
QueryAdapter queryAdapter = request.getQueryAdapter();
StringBuilder builder = new StringBuilder();
builder.append("?");
if (queryAdapter instanceof QuerySpecAdapter) {
QuerySpec querySpec = request.getQuerySpec(queryAdapter.getResourceInformation());
DefaultQuerySpecSerializer serializer = new DefaultQuerySpecSerializer(resourceRegistry);
Map<String, Set<String>> parameters = serializer.serialize(querySpec);
for (Map.Entry<String, Set<String>> entry : parameters.entrySet()) {
if (builder.length() > 1) {
builder.append("&");
}
builder.append(entry.getKey());
builder.append("=");
builder.append(StringUtils.join(",", entry.getValue()));
}
return builder.toString();
}
return null;
}
Aggregations