use of com.google.gerrit.server.restapi.change.ChangesCollection in project gerrit by GerritCodeReview.
the class RestApiServlet method createRequestInfo.
private RequestInfo createRequestInfo(TraceContext traceContext, String requestUri, List<IdString> path) {
RequestInfo.Builder requestInfo = RequestInfo.builder(RequestInfo.RequestType.REST, globals.currentUser.get(), traceContext).requestUri(requestUri);
if (path.size() < 1) {
return requestInfo.build();
}
RestCollection<?, ?> rootCollection = members.get();
String resourceId = path.get(0).get();
if (rootCollection instanceof ProjectsCollection) {
requestInfo.project(Project.nameKey(resourceId));
} else if (rootCollection instanceof ChangesCollection) {
Optional<ChangeNotes> changeNotes = globals.changeFinder.findOne(resourceId);
if (changeNotes.isPresent()) {
requestInfo.project(changeNotes.get().getProjectName());
}
}
return requestInfo.build();
}
Aggregations