final ConfigurationProvider conf = Services.getInstance().getConfigurationProvider();
final List<PropertyKey> searchKeys = new LinkedList<>();
for (final String name : request.getParameterMap().keySet()) {
final PropertyKey key = conf.getPropertyKeyForJSONName(type, getFirstPartOfString(name));
if (key != null) {
if (key.isSearchable()) {
// add to list of searchable keys
searchKeys.add(key);
} else if (!JsonRestServlet.commonRequestParameters.contains(name)) {
throw new FrameworkException(400, "Search key " + name + " is not indexed.");
}
} else if (!JsonRestServlet.commonRequestParameters.contains(name)) {
// exclude common request parameters here (should not throw exception)
throw new FrameworkException(400, "Invalid search key " + name);
}
}
// sort list of search keys according to their desired order
// so that querying search attributes can use other attributes
// to refine their partial results.
Collections.sort(searchKeys, new PropertyKeyProcessingOrderComparator());
for (final PropertyKey key : searchKeys) {
// hand list of search attributes over to key
key.extractSearchableAttribute(securityContext, request, query);
}
}
}