use of org.springframework.web.util.UriBuilder in project dhis2-core by dhis2.
the class GistPager method computeBaseURL.
public static URI computeBaseURL(GistQuery query, Map<String, String[]> params, Function<Class<?>, Schema> schemaByType) {
UriBuilder url = UriComponentsBuilder.fromUriString(query.getEndpointRoot());
Owner owner = query.getOwner();
if (owner != null) {
Schema o = schemaByType.apply(owner.getType());
url.pathSegment(o.getRelativeApiEndpoint().substring(1), owner.getId(), o.getProperty(owner.getCollectionProperty()).key(), "gist");
} else {
Schema s = schemaByType.apply(query.getElementType());
url.pathSegment(s.getRelativeApiEndpoint().substring(1), "gist");
}
params.forEach(url::queryParam);
return url.build();
}
Aggregations