use of com.google.gerrit.extensions.common.FetchInfo in project gerrit by GerritCodeReview.
the class ChangeJson method makeFetchMap.
private Map<String, FetchInfo> makeFetchMap(ChangeControl ctl, PatchSet in) throws OrmException {
Map<String, FetchInfo> r = new LinkedHashMap<>();
for (DynamicMap.Entry<DownloadScheme> e : downloadSchemes) {
String schemeName = e.getExportName();
DownloadScheme scheme = e.getProvider().get();
if (!scheme.isEnabled() || (scheme.isAuthRequired() && !userProvider.get().isIdentifiedUser())) {
continue;
}
if (!scheme.isAuthSupported() && !ctl.forUser(anonymous).isPatchVisible(in, db.get())) {
continue;
}
String projectName = ctl.getProject().getNameKey().get();
String url = scheme.getUrl(projectName);
String refName = in.getRefName();
FetchInfo fetchInfo = new FetchInfo(url, refName);
r.put(schemeName, fetchInfo);
if (has(DOWNLOAD_COMMANDS)) {
populateFetchMap(scheme, downloadCommands, projectName, refName, fetchInfo);
}
}
return r;
}
use of com.google.gerrit.extensions.common.FetchInfo in project gerrit by GerritCodeReview.
the class ChangeEditJson method fillFetchMap.
private Map<String, FetchInfo> fillFetchMap(ChangeEdit edit) {
Map<String, FetchInfo> r = new LinkedHashMap<>();
for (DynamicMap.Entry<DownloadScheme> e : downloadSchemes) {
String schemeName = e.getExportName();
DownloadScheme scheme = e.getProvider().get();
if (!scheme.isEnabled() || (scheme.isAuthRequired() && !userProvider.get().isIdentifiedUser())) {
continue;
}
// No fluff, just stuff
if (!scheme.isAuthSupported()) {
continue;
}
String projectName = edit.getChange().getProject().get();
String refName = edit.getRefName();
FetchInfo fetchInfo = new FetchInfo(scheme.getUrl(projectName), refName);
r.put(schemeName, fetchInfo);
ChangeJson.populateFetchMap(scheme, downloadCommands, projectName, refName, fetchInfo);
}
return r;
}
Aggregations