Use native constructors instead of Guava to instantiate empty collections
It's not necessary to use Guava's helper methods when instantiating empty collections. Just use the native constructors. Change-Id: I7f454909b15924ee49e149edf9f053da9f718502
This commit is contained in:
@@ -1804,7 +1804,7 @@ public class MyMenu implements TopMenu {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public MyMenu(@PluginName String name) {
|
public MyMenu(@PluginName String name) {
|
||||||
menuEntries = Lists.newArrayList();
|
menuEntries = new ArrayList<>();
|
||||||
menuEntries.add(new MenuEntry("My Menu", Collections.singletonList(
|
menuEntries.add(new MenuEntry("My Menu", Collections.singletonList(
|
||||||
new MenuItem("My Screen", "#/x/" + name + "/my-screen", ""))));
|
new MenuItem("My Screen", "#/x/" + name + "/my-screen", ""))));
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.acceptance;
|
package com.google.gerrit.acceptance;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.TimeUtil;
|
import com.google.gerrit.common.TimeUtil;
|
||||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
import com.google.gerrit.server.CurrentUser;
|
import com.google.gerrit.server.CurrentUser;
|
||||||
@@ -32,6 +31,7 @@ import com.google.inject.Provider;
|
|||||||
import com.google.inject.Scope;
|
import com.google.inject.Scope;
|
||||||
import com.google.inject.util.Providers;
|
import com.google.inject.util.Providers;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/** Guice scopes for state during an Acceptance Test connection. */
|
/** Guice scopes for state during an Acceptance Test connection. */
|
||||||
@@ -44,7 +44,7 @@ public class AcceptanceTestRequestScope {
|
|||||||
|
|
||||||
public static class Context implements RequestContext {
|
public static class Context implements RequestContext {
|
||||||
private final RequestCleanup cleanup = new RequestCleanup();
|
private final RequestCleanup cleanup = new RequestCleanup();
|
||||||
private final Map<Key<?>, Object> map = Maps.newHashMap();
|
private final Map<Key<?>, Object> map = new HashMap<>();
|
||||||
private final SchemaFactory<ReviewDb> schemaFactory;
|
private final SchemaFactory<ReviewDb> schemaFactory;
|
||||||
private final SshSession session;
|
private final SshSession session;
|
||||||
private final CurrentUser user;
|
private final CurrentUser user;
|
||||||
|
@@ -21,7 +21,6 @@ import static com.google.gerrit.acceptance.rest.account.AccountAssert.assertAcco
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||||
import com.google.gerrit.acceptance.NoHttpd;
|
import com.google.gerrit.acceptance.NoHttpd;
|
||||||
@@ -49,6 +48,7 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ public class GroupsIT extends AbstractDaemonTest {
|
|||||||
String p = createGroup("parent");
|
String p = createGroup("parent");
|
||||||
String g1 = createGroup("newGroup1");
|
String g1 = createGroup("newGroup1");
|
||||||
String g2 = createGroup("newGroup2");
|
String g2 = createGroup("newGroup2");
|
||||||
List<String> groups = Lists.newLinkedList();
|
List<String> groups = new LinkedList<>();
|
||||||
groups.add(g1);
|
groups.add(g1);
|
||||||
groups.add(g2);
|
groups.add(g2);
|
||||||
gApi.groups().id(p).addGroups(g1, g2);
|
gApi.groups().id(p).addGroups(g1, g2);
|
||||||
|
@@ -26,7 +26,6 @@ import static org.junit.Assert.fail;
|
|||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||||
import com.google.gerrit.acceptance.NoHttpd;
|
import com.google.gerrit.acceptance.NoHttpd;
|
||||||
import com.google.gerrit.acceptance.PushOneCommit;
|
import com.google.gerrit.acceptance.PushOneCommit;
|
||||||
@@ -82,6 +81,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
mergeResults = Maps.newHashMap();
|
mergeResults = new HashMap<>();
|
||||||
eventListenerRegistration =
|
eventListenerRegistration =
|
||||||
eventListeners.add(new UserScopedEventListener() {
|
eventListeners.add(new UserScopedEventListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@@ -20,7 +20,6 @@ import static com.google.gerrit.extensions.client.ListChangesOption.CURRENT_REVI
|
|||||||
import static com.google.gerrit.extensions.client.ListChangesOption.MESSAGES;
|
import static com.google.gerrit.extensions.client.ListChangesOption.MESSAGES;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||||
import com.google.gerrit.acceptance.NoHttpd;
|
import com.google.gerrit.acceptance.NoHttpd;
|
||||||
import com.google.gerrit.acceptance.PushOneCommit;
|
import com.google.gerrit.acceptance.PushOneCommit;
|
||||||
@@ -29,6 +28,7 @@ import com.google.gerrit.extensions.common.ChangeInfo;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@NoHttpd
|
@NoHttpd
|
||||||
@@ -39,7 +39,7 @@ public class ListChangesOptionsIT extends AbstractDaemonTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
results = Lists.newArrayList();
|
results = new ArrayList<>();
|
||||||
results.add(push("file contents", null));
|
results.add(push("file contents", null));
|
||||||
changeId = results.get(0).getChangeId();
|
changeId = results.get(0).getChangeId();
|
||||||
results.add(push("new contents 1", changeId));
|
results.add(push("new contents 1", changeId));
|
||||||
|
@@ -17,7 +17,6 @@ package com.google.gerrit.server.cache.h2;
|
|||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
import com.google.gerrit.extensions.events.LifecycleListener;
|
import com.google.gerrit.extensions.events.LifecycleListener;
|
||||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||||
@@ -40,6 +39,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@@ -70,7 +70,7 @@ class H2CacheFactory implements PersistentCacheFactory, LifecycleListener {
|
|||||||
config = cfg;
|
config = cfg;
|
||||||
cacheDir = getCacheDir(site, cfg.getString("cache", null, "directory"));
|
cacheDir = getCacheDir(site, cfg.getString("cache", null, "directory"));
|
||||||
h2CacheSize = cfg.getLong("cache", null, "h2CacheSize", -1);
|
h2CacheSize = cfg.getLong("cache", null, "h2CacheSize", -1);
|
||||||
caches = Lists.newLinkedList();
|
caches = new LinkedList<>();
|
||||||
this.cacheMap = cacheMap;
|
this.cacheMap = cacheMap;
|
||||||
|
|
||||||
if (cacheDir != null) {
|
if (cacheDir != null) {
|
||||||
|
@@ -17,7 +17,6 @@ package com.google.gerrit.httpd.plugins;
|
|||||||
import static com.google.gerrit.server.plugins.AutoRegisterUtil.calculateBindAnnotation;
|
import static com.google.gerrit.server.plugins.AutoRegisterUtil.calculateBindAnnotation;
|
||||||
|
|
||||||
import com.google.common.collect.LinkedListMultimap;
|
import com.google.common.collect.LinkedListMultimap;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.gerrit.extensions.annotations.Export;
|
import com.google.gerrit.extensions.annotations.Export;
|
||||||
import com.google.gerrit.server.plugins.InvalidPluginException;
|
import com.google.gerrit.server.plugins.InvalidPluginException;
|
||||||
@@ -28,13 +27,14 @@ import com.google.inject.TypeLiteral;
|
|||||||
import com.google.inject.servlet.ServletModule;
|
import com.google.inject.servlet.ServletModule;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
|
|
||||||
class HttpAutoRegisterModuleGenerator extends ServletModule
|
class HttpAutoRegisterModuleGenerator extends ServletModule
|
||||||
implements ModuleGenerator {
|
implements ModuleGenerator {
|
||||||
private final Map<String, Class<HttpServlet>> serve = Maps.newHashMap();
|
private final Map<String, Class<HttpServlet>> serve = new HashMap<>();
|
||||||
private final Multimap<TypeLiteral<?>, Class<?>> listeners = LinkedListMultimap.create();
|
private final Multimap<TypeLiteral<?>, Class<?>> listeners = LinkedListMultimap.create();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -66,8 +66,10 @@ import java.io.UnsupportedEncodingException;
|
|||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
@@ -100,7 +102,7 @@ class HttpPluginServlet extends HttpServlet
|
|||||||
private final int sshPort;
|
private final int sshPort;
|
||||||
private final RestApiServlet managerApi;
|
private final RestApiServlet managerApi;
|
||||||
|
|
||||||
private List<Plugin> pending = Lists.newArrayList();
|
private List<Plugin> pending = new ArrayList<>();
|
||||||
private ContextMapper wrapper;
|
private ContextMapper wrapper;
|
||||||
private final ConcurrentMap<String, PluginHolder> plugins
|
private final ConcurrentMap<String, PluginHolder> plugins
|
||||||
= Maps.newConcurrentMap();
|
= Maps.newConcurrentMap();
|
||||||
@@ -370,10 +372,10 @@ class HttpPluginServlet extends HttpServlet
|
|||||||
String prefix, String pluginName,
|
String prefix, String pluginName,
|
||||||
PluginResourceKey cacheKey, HttpServletResponse res,long lastModifiedTime)
|
PluginResourceKey cacheKey, HttpServletResponse res,long lastModifiedTime)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
List<PluginEntry> cmds = Lists.newArrayList();
|
List<PluginEntry> cmds = new ArrayList<>();
|
||||||
List<PluginEntry> servlets = Lists.newArrayList();
|
List<PluginEntry> servlets = new ArrayList<>();
|
||||||
List<PluginEntry> restApis = Lists.newArrayList();
|
List<PluginEntry> restApis = new ArrayList<>();
|
||||||
List<PluginEntry> docs = Lists.newArrayList();
|
List<PluginEntry> docs = new ArrayList<>();
|
||||||
PluginEntry about = null;
|
PluginEntry about = null;
|
||||||
Enumeration<PluginEntry> entries = scanner.entries();
|
Enumeration<PluginEntry> entries = scanner.entries();
|
||||||
while (entries.hasMoreElements()) {
|
while (entries.hasMoreElements()) {
|
||||||
@@ -443,7 +445,7 @@ class HttpPluginServlet extends HttpServlet
|
|||||||
private void sendMarkdownAsHtml(String md, String pluginName,
|
private void sendMarkdownAsHtml(String md, String pluginName,
|
||||||
PluginResourceKey cacheKey, HttpServletResponse res, long lastModifiedTime)
|
PluginResourceKey cacheKey, HttpServletResponse res, long lastModifiedTime)
|
||||||
throws UnsupportedEncodingException, IOException {
|
throws UnsupportedEncodingException, IOException {
|
||||||
Map<String, String> macros = Maps.newHashMap();
|
Map<String, String> macros = new HashMap<>();
|
||||||
macros.put("PLUGIN", pluginName);
|
macros.put("PLUGIN", pluginName);
|
||||||
macros.put("SSH_HOST", sshHost);
|
macros.put("SSH_HOST", sshHost);
|
||||||
macros.put("SSH_PORT", "" + sshPort);
|
macros.put("SSH_PORT", "" + sshPort);
|
||||||
|
@@ -16,7 +16,6 @@ package com.google.gerrit.httpd.plugins;
|
|||||||
|
|
||||||
import static javax.servlet.http.HttpServletResponse.SC_NOT_IMPLEMENTED;
|
import static javax.servlet.http.HttpServletResponse.SC_NOT_IMPLEMENTED;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.extensions.registration.RegistrationHandle;
|
import com.google.gerrit.extensions.registration.RegistrationHandle;
|
||||||
import com.google.gerrit.httpd.resources.Resource;
|
import com.google.gerrit.httpd.resources.Resource;
|
||||||
import com.google.gerrit.server.config.GerritServerConfig;
|
import com.google.gerrit.server.config.GerritServerConfig;
|
||||||
@@ -33,6 +32,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.FilterChain;
|
import javax.servlet.FilterChain;
|
||||||
@@ -55,7 +55,7 @@ public class LfsPluginServlet extends HttpServlet
|
|||||||
public static final String URL_REGEX =
|
public static final String URL_REGEX =
|
||||||
"^(?:/a)?(?:/p/|/)(.+)(?:/info/lfs/objects/batch)$";
|
"^(?:/a)?(?:/p/|/)(.+)(?:/info/lfs/objects/batch)$";
|
||||||
|
|
||||||
private List<Plugin> pending = Lists.newArrayList();
|
private List<Plugin> pending = new ArrayList<>();
|
||||||
private final String pluginName;
|
private final String pluginName;
|
||||||
private GuiceFilter filter;
|
private GuiceFilter filter;
|
||||||
|
|
||||||
|
@@ -18,7 +18,6 @@ import static com.google.gerrit.common.FileUtil.lastModified;
|
|||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.hash.Hasher;
|
import com.google.common.hash.Hasher;
|
||||||
import com.google.common.hash.Hashing;
|
import com.google.common.hash.Hashing;
|
||||||
import com.google.common.primitives.Bytes;
|
import com.google.common.primitives.Bytes;
|
||||||
@@ -231,7 +230,7 @@ public class HostPageServlet extends HttpServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void plugins(StringWriter w) {
|
private void plugins(StringWriter w) {
|
||||||
List<String> urls = Lists.newArrayList();
|
List<String> urls = new ArrayList<>();
|
||||||
for (WebUiPlugin u : plugins) {
|
for (WebUiPlugin u : plugins) {
|
||||||
urls.add(String.format("plugins/%s/%s",
|
urls.add(String.format("plugins/%s/%s",
|
||||||
u.getPluginName(),
|
u.getPluginName(),
|
||||||
|
@@ -24,7 +24,6 @@ import com.google.common.base.Strings;
|
|||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||||
import com.google.gerrit.extensions.restapi.BinaryResult;
|
import com.google.gerrit.extensions.restapi.BinaryResult;
|
||||||
import com.google.gerrit.extensions.restapi.Url;
|
import com.google.gerrit.extensions.restapi.Url;
|
||||||
@@ -40,6 +39,7 @@ import org.kohsuke.args4j.CmdLineException;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -107,7 +107,7 @@ class ParameterParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Set<String> query(HttpServletRequest req) {
|
private static Set<String> query(HttpServletRequest req) {
|
||||||
Set<String> params = Sets.newHashSet();
|
Set<String> params = new HashSet<>();
|
||||||
if (!Strings.isNullOrEmpty(req.getQueryString())) {
|
if (!Strings.isNullOrEmpty(req.getQueryString())) {
|
||||||
for (String kvPair : Splitter.on('&').split(req.getQueryString())) {
|
for (String kvPair : Splitter.on('&').split(req.getQueryString())) {
|
||||||
params.add(Iterables.getFirst(
|
params.add(Iterables.getFirst(
|
||||||
|
@@ -40,9 +40,7 @@ import com.google.common.collect.ImmutableMultimap;
|
|||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.LinkedHashMultimap;
|
import com.google.common.collect.LinkedHashMultimap;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.common.io.BaseEncoding;
|
import com.google.common.io.BaseEncoding;
|
||||||
import com.google.common.io.CountingOutputStream;
|
import com.google.common.io.CountingOutputStream;
|
||||||
import com.google.common.math.IntMath;
|
import com.google.common.math.IntMath;
|
||||||
@@ -123,10 +121,14 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.zip.GZIPOutputStream;
|
import java.util.zip.GZIPOutputStream;
|
||||||
@@ -712,13 +714,13 @@ public class RestApiServlet extends HttpServlet {
|
|||||||
|
|
||||||
private static void enablePartialGetFields(GsonBuilder gb,
|
private static void enablePartialGetFields(GsonBuilder gb,
|
||||||
Multimap<String, String> config) {
|
Multimap<String, String> config) {
|
||||||
final Set<String> want = Sets.newHashSet();
|
final Set<String> want = new HashSet<>();
|
||||||
for (String p : config.get("fields")) {
|
for (String p : config.get("fields")) {
|
||||||
Iterables.addAll(want, OptionUtil.splitOptionValue(p));
|
Iterables.addAll(want, OptionUtil.splitOptionValue(p));
|
||||||
}
|
}
|
||||||
if (!want.isEmpty()) {
|
if (!want.isEmpty()) {
|
||||||
gb.addSerializationExclusionStrategy(new ExclusionStrategy() {
|
gb.addSerializationExclusionStrategy(new ExclusionStrategy() {
|
||||||
private final Map<String, String> names = Maps.newHashMap();
|
private final Map<String, String> names = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSkipField(FieldAttributes field) {
|
public boolean shouldSkipField(FieldAttributes field) {
|
||||||
@@ -917,7 +919,7 @@ public class RestApiServlet extends HttpServlet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, RestView<RestResource>> r = Maps.newTreeMap();
|
Map<String, RestView<RestResource>> r = new TreeMap<>();
|
||||||
for (String plugin : views.plugins()) {
|
for (String plugin : views.plugins()) {
|
||||||
RestView<RestResource> action = views.get(plugin, name);
|
RestView<RestResource> action = views.get(plugin, name);
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
@@ -950,7 +952,7 @@ public class RestApiServlet extends HttpServlet {
|
|||||||
if (Strings.isNullOrEmpty(path)) {
|
if (Strings.isNullOrEmpty(path)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<IdString> out = Lists.newArrayList();
|
List<IdString> out = new ArrayList<>();
|
||||||
for (String p : Splitter.on('/').split(path)) {
|
for (String p : Splitter.on('/').split(path)) {
|
||||||
out.add(IdString.fromUrl(p));
|
out.add(IdString.fromUrl(p));
|
||||||
}
|
}
|
||||||
|
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.httpd.rpc.account;
|
package com.google.gerrit.httpd.rpc.account;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.data.AgreementInfo;
|
import com.google.gerrit.common.data.AgreementInfo;
|
||||||
import com.google.gerrit.common.data.ContributorAgreement;
|
import com.google.gerrit.common.data.ContributorAgreement;
|
||||||
import com.google.gerrit.common.data.PermissionRule;
|
import com.google.gerrit.common.data.PermissionRule;
|
||||||
@@ -29,7 +27,9 @@ import com.google.inject.Inject;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -54,14 +54,14 @@ class AgreementInfoFactory extends Handler<AgreementInfo> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AgreementInfo call() throws Exception {
|
public AgreementInfo call() throws Exception {
|
||||||
List<String> accepted = Lists.newArrayList();
|
List<String> accepted = new ArrayList<>();
|
||||||
Map<String, ContributorAgreement> agreements = Maps.newHashMap();
|
Map<String, ContributorAgreement> agreements = new HashMap<>();
|
||||||
Collection<ContributorAgreement> cas =
|
Collection<ContributorAgreement> cas =
|
||||||
projectCache.getAllProjects().getConfig().getContributorAgreements();
|
projectCache.getAllProjects().getConfig().getContributorAgreements();
|
||||||
for (ContributorAgreement ca : cas) {
|
for (ContributorAgreement ca : cas) {
|
||||||
agreements.put(ca.getName(), ca.forUi());
|
agreements.put(ca.getName(), ca.forUi());
|
||||||
|
|
||||||
List<AccountGroup.UUID> groupIds = Lists.newArrayList();
|
List<AccountGroup.UUID> groupIds = new ArrayList<>();
|
||||||
for (PermissionRule rule : ca.getAccepted()) {
|
for (PermissionRule rule : ca.getAccepted()) {
|
||||||
if ((rule.getAction() == Action.ALLOW) && (rule.getGroup() != null)) {
|
if ((rule.getAction() == Action.ALLOW) && (rule.getGroup() != null)) {
|
||||||
if (rule.getGroup().getUUID() == null) {
|
if (rule.getGroup().getUUID() == null) {
|
||||||
|
@@ -226,7 +226,7 @@ public class LuceneVersionManager implements LifecycleListener {
|
|||||||
|
|
||||||
private <K, V, I extends Index<K, V>> TreeMap<Integer, Version<V>>
|
private <K, V, I extends Index<K, V>> TreeMap<Integer, Version<V>>
|
||||||
scanVersions(IndexDefinition<K, V, I> def, GerritIndexStatus cfg) {
|
scanVersions(IndexDefinition<K, V, I> def, GerritIndexStatus cfg) {
|
||||||
TreeMap<Integer, Version<V>> versions = Maps.newTreeMap();
|
TreeMap<Integer, Version<V>> versions = new TreeMap<>();
|
||||||
for (Schema<V> schema : def.getSchemas().values()) {
|
for (Schema<V> schema : def.getSchemas().values()) {
|
||||||
// This part is Lucene-specific.
|
// This part is Lucene-specific.
|
||||||
Path p = getDir(sitePaths, def.getName(), schema);
|
Path p = getDir(sitePaths, def.getName(), schema);
|
||||||
|
@@ -20,7 +20,6 @@ import com.google.common.base.MoreObjects;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.common.Nullable;
|
import com.google.gerrit.common.Nullable;
|
||||||
import com.google.gerrit.common.PageLinks;
|
import com.google.gerrit.common.PageLinks;
|
||||||
import com.google.gerrit.common.auth.openid.OpenIdUrls;
|
import com.google.gerrit.common.auth.openid.OpenIdUrls;
|
||||||
@@ -46,6 +45,7 @@ import org.w3c.dom.Document;
|
|||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ class LoginForm extends HttpServlet {
|
|||||||
suggestProviders = ImmutableSet.of();
|
suggestProviders = ImmutableSet.of();
|
||||||
ssoUrl = authConfig.getOpenIdSsoUrl();
|
ssoUrl = authConfig.getOpenIdSsoUrl();
|
||||||
} else {
|
} else {
|
||||||
Set<String> providers = Sets.newHashSet();
|
Set<String> providers = new HashSet<>();
|
||||||
for (Map.Entry<String, String> e : ALL_PROVIDERS.entrySet()) {
|
for (Map.Entry<String, String> e : ALL_PROVIDERS.entrySet()) {
|
||||||
if (impl.isAllowedOpenID(e.getValue())) {
|
if (impl.isAllowedOpenID(e.getValue())) {
|
||||||
providers.add(e.getKey());
|
providers.add(e.getKey());
|
||||||
|
@@ -123,7 +123,7 @@ public class Init extends BaseInit {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void afterInit(SiteRun run) throws Exception {
|
protected void afterInit(SiteRun run) throws Exception {
|
||||||
List<Module> modules = Lists.newArrayList();
|
List<Module> modules = new ArrayList<>();
|
||||||
modules.add(new AbstractModule() {
|
modules.add(new AbstractModule() {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
|
@@ -17,7 +17,6 @@ package com.google.gerrit.pgm;
|
|||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.gerrit.server.schema.DataSourceProvider.Context.MULTI_USER;
|
import static com.google.gerrit.server.schema.DataSourceProvider.Context.MULTI_USER;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.common.Die;
|
import com.google.gerrit.common.Die;
|
||||||
import com.google.gerrit.lifecycle.LifecycleManager;
|
import com.google.gerrit.lifecycle.LifecycleManager;
|
||||||
import com.google.gerrit.lucene.LuceneIndexModule;
|
import com.google.gerrit.lucene.LuceneIndexModule;
|
||||||
@@ -42,6 +41,7 @@ import org.eclipse.jgit.util.io.NullOutputStream;
|
|||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -114,7 +114,7 @@ public class Reindex extends SiteProgram {
|
|||||||
if (changesVersion != null) {
|
if (changesVersion != null) {
|
||||||
versions.put(ChangeSchemaDefinitions.INSTANCE.getName(), changesVersion);
|
versions.put(ChangeSchemaDefinitions.INSTANCE.getName(), changesVersion);
|
||||||
}
|
}
|
||||||
List<Module> modules = Lists.newArrayList();
|
List<Module> modules = new ArrayList<>();
|
||||||
Module indexModule;
|
Module indexModule;
|
||||||
switch (IndexModule.getIndexType(dbInjector)) {
|
switch (IndexModule.getIndexType(dbInjector)) {
|
||||||
case LUCENE:
|
case LUCENE:
|
||||||
|
@@ -20,7 +20,6 @@ import static com.google.inject.Stage.PRODUCTION;
|
|||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.common.Die;
|
import com.google.gerrit.common.Die;
|
||||||
import com.google.gerrit.common.IoUtil;
|
import com.google.gerrit.common.IoUtil;
|
||||||
import com.google.gerrit.pgm.init.api.ConsoleUI;
|
import com.google.gerrit.pgm.init.api.ConsoleUI;
|
||||||
@@ -247,7 +246,7 @@ public class BaseInit extends SiteProgram {
|
|||||||
bind(Path.class).annotatedWith(SitePath.class).toInstance(sitePath);
|
bind(Path.class).annotatedWith(SitePath.class).toInstance(sitePath);
|
||||||
List<String> plugins =
|
List<String> plugins =
|
||||||
MoreObjects.firstNonNull(
|
MoreObjects.firstNonNull(
|
||||||
getInstallPlugins(), Lists.<String> newArrayList());
|
getInstallPlugins(), new ArrayList<String>());
|
||||||
bind(new TypeLiteral<List<String>>() {}).annotatedWith(
|
bind(new TypeLiteral<List<String>>() {}).annotatedWith(
|
||||||
InstallPlugins.class).toInstance(plugins);
|
InstallPlugins.class).toInstance(plugins);
|
||||||
bind(new TypeLiteral<Boolean>() {}).annotatedWith(
|
bind(new TypeLiteral<Boolean>() {}).annotatedWith(
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.pgm.init;
|
package com.google.gerrit.pgm.init;
|
||||||
|
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.common.PluginData;
|
import com.google.gerrit.common.PluginData;
|
||||||
import com.google.gerrit.pgm.init.api.ConsoleUI;
|
import com.google.gerrit.pgm.init.api.ConsoleUI;
|
||||||
import com.google.gerrit.pgm.init.api.InitFlags;
|
import com.google.gerrit.pgm.init.api.InitFlags;
|
||||||
@@ -30,6 +29,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -55,7 +55,7 @@ public class InitPlugins implements InitStep {
|
|||||||
private static List<PluginData> listPlugins(final SitePaths site,
|
private static List<PluginData> listPlugins(final SitePaths site,
|
||||||
final boolean deleteTempPluginFile, PluginsDistribution pluginsDistribution)
|
final boolean deleteTempPluginFile, PluginsDistribution pluginsDistribution)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final List<PluginData> result = Lists.newArrayList();
|
final List<PluginData> result = new ArrayList<>();
|
||||||
pluginsDistribution.foreach(new PluginsDistribution.Processor() {
|
pluginsDistribution.foreach(new PluginsDistribution.Processor() {
|
||||||
@Override
|
@Override
|
||||||
public void process(String pluginName, InputStream in) throws IOException {
|
public void process(String pluginName, InputStream in) throws IOException {
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.pgm.util;
|
package com.google.gerrit.pgm.util;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.extensions.events.LifecycleListener;
|
import com.google.gerrit.extensions.events.LifecycleListener;
|
||||||
import com.google.gerrit.lifecycle.LifecycleModule;
|
import com.google.gerrit.lifecycle.LifecycleModule;
|
||||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
@@ -24,6 +23,7 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import com.google.inject.ProvisionException;
|
import com.google.inject.ProvisionException;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ class PerThreadReviewDbModule extends LifecycleModule {
|
|||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
final List<ReviewDb> dbs = Collections.synchronizedList(
|
final List<ReviewDb> dbs = Collections.synchronizedList(
|
||||||
Lists.<ReviewDb> newArrayList());
|
new ArrayList<ReviewDb>());
|
||||||
final ThreadLocal<ReviewDb> localDb = new ThreadLocal<>();
|
final ThreadLocal<ReviewDb> localDb = new ThreadLocal<>();
|
||||||
|
|
||||||
bind(ReviewDb.class).toProvider(new Provider<ReviewDb>() {
|
bind(ReviewDb.class).toProvider(new Provider<ReviewDb>() {
|
||||||
|
@@ -18,7 +18,6 @@ import static com.google.gerrit.server.config.GerritServerConfigModule.getSecure
|
|||||||
import static com.google.inject.Scopes.SINGLETON;
|
import static com.google.inject.Scopes.SINGLETON;
|
||||||
import static com.google.inject.Stage.PRODUCTION;
|
import static com.google.inject.Stage.PRODUCTION;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.common.Die;
|
import com.google.gerrit.common.Die;
|
||||||
import com.google.gerrit.extensions.events.LifecycleListener;
|
import com.google.gerrit.extensions.events.LifecycleListener;
|
||||||
import com.google.gerrit.lifecycle.LifecycleModule;
|
import com.google.gerrit.lifecycle.LifecycleModule;
|
||||||
@@ -224,7 +223,7 @@ public abstract class SiteProgram extends AbstractProgram {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Module> modules = Lists.newArrayList();
|
List<Module> modules = new ArrayList<>();
|
||||||
modules.add(new AbstractModule() {
|
modules.add(new AbstractModule() {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
|
@@ -18,7 +18,6 @@ import static com.googlecode.prolog_cafe.lang.PrologMachineCopy.save;
|
|||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
import com.google.gerrit.reviewdb.client.RefNames;
|
import com.google.gerrit.reviewdb.client.RefNames;
|
||||||
@@ -61,6 +60,7 @@ import java.net.URL;
|
|||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -283,7 +283,7 @@ public class RulesCache {
|
|||||||
predicateProviders, cl)));
|
predicateProviders, cl)));
|
||||||
ctl.setEnabled(EnumSet.allOf(Prolog.Feature.class), false);
|
ctl.setEnabled(EnumSet.allOf(Prolog.Feature.class), false);
|
||||||
|
|
||||||
List<String> packages = Lists.newArrayList();
|
List<String> packages = new ArrayList<>();
|
||||||
packages.addAll(PACKAGE_LIST);
|
packages.addAll(PACKAGE_LIST);
|
||||||
for (PredicateProvider predicateProvider : predicateProviders) {
|
for (PredicateProvider predicateProvider : predicateProviders) {
|
||||||
packages.addAll(predicateProvider.getPackages());
|
packages.addAll(predicateProvider.getPackages());
|
||||||
|
@@ -16,7 +16,6 @@ package com.google.gerrit.rules;
|
|||||||
|
|
||||||
import static com.google.gerrit.rules.StoredValue.create;
|
import static com.google.gerrit.rules.StoredValue.create;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace;
|
import com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace;
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
import com.google.gerrit.reviewdb.client.Change;
|
import com.google.gerrit.reviewdb.client.Change;
|
||||||
@@ -45,6 +44,7 @@ import org.eclipse.jgit.lib.ObjectId;
|
|||||||
import org.eclipse.jgit.lib.Repository;
|
import org.eclipse.jgit.lib.Repository;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public final class StoredValues {
|
public final class StoredValues {
|
||||||
@@ -150,7 +150,7 @@ public final class StoredValues {
|
|||||||
new StoredValue<Map<Account.Id, IdentifiedUser>>() {
|
new StoredValue<Map<Account.Id, IdentifiedUser>>() {
|
||||||
@Override
|
@Override
|
||||||
protected Map<Account.Id, IdentifiedUser> createValue(Prolog engine) {
|
protected Map<Account.Id, IdentifiedUser> createValue(Prolog engine) {
|
||||||
return Maps.newHashMap();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -19,7 +19,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
|
|
||||||
import com.google.common.collect.HashBasedTable;
|
import com.google.common.collect.HashBasedTable;
|
||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Table;
|
import com.google.common.collect.Table;
|
||||||
import com.google.gerrit.common.data.LabelType;
|
import com.google.gerrit.common.data.LabelType;
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
@@ -148,7 +147,7 @@ public class ApprovalCopier {
|
|||||||
private static TreeMap<Integer, PatchSet> getPatchSets(ChangeData cd)
|
private static TreeMap<Integer, PatchSet> getPatchSets(ChangeData cd)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
Collection<PatchSet> patchSets = cd.patchSets();
|
Collection<PatchSet> patchSets = cd.patchSets();
|
||||||
TreeMap<Integer, PatchSet> result = Maps.newTreeMap();
|
TreeMap<Integer, PatchSet> result = new TreeMap<>();
|
||||||
for (PatchSet ps : patchSets) {
|
for (PatchSet ps : patchSets) {
|
||||||
result.put(ps.getId().get(), ps);
|
result.put(ps.getId().get(), ps);
|
||||||
}
|
}
|
||||||
|
@@ -152,7 +152,7 @@ public class PatchLineCommentsUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
notes.load();
|
notes.load();
|
||||||
List<PatchLineComment> comments = Lists.newArrayList();
|
List<PatchLineComment> comments = new ArrayList<>();
|
||||||
comments.addAll(notes.getComments().values());
|
comments.addAll(notes.getComments().values());
|
||||||
return sort(comments);
|
return sort(comments);
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ public class PatchLineCommentsUtil {
|
|||||||
db.patchComments().byChange(notes.getChangeId()), Status.DRAFT));
|
db.patchComments().byChange(notes.getChangeId()), Status.DRAFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PatchLineComment> comments = Lists.newArrayList();
|
List<PatchLineComment> comments = new ArrayList<>();
|
||||||
for (Ref ref : getDraftRefs(notes.getChangeId())) {
|
for (Ref ref : getDraftRefs(notes.getChangeId())) {
|
||||||
Account.Id account = Account.Id.fromRefSuffix(ref.getName());
|
Account.Id account = Account.Id.fromRefSuffix(ref.getName());
|
||||||
if (account != null) {
|
if (account != null) {
|
||||||
@@ -192,7 +192,7 @@ public class PatchLineCommentsUtil {
|
|||||||
if (!migration.readChanges()) {
|
if (!migration.readChanges()) {
|
||||||
return sort(db.patchComments().byPatchSet(psId).toList());
|
return sort(db.patchComments().byPatchSet(psId).toList());
|
||||||
}
|
}
|
||||||
List<PatchLineComment> comments = Lists.newArrayList();
|
List<PatchLineComment> comments = new ArrayList<>();
|
||||||
comments.addAll(publishedByPatchSet(db, notes, psId));
|
comments.addAll(publishedByPatchSet(db, notes, psId));
|
||||||
|
|
||||||
for (Ref ref : getDraftRefs(notes.getChangeId())) {
|
for (Ref ref : getDraftRefs(notes.getChangeId())) {
|
||||||
@@ -262,7 +262,7 @@ public class PatchLineCommentsUtil {
|
|||||||
}
|
}
|
||||||
}).toSortedList(PLC_ORDER);
|
}).toSortedList(PLC_ORDER);
|
||||||
}
|
}
|
||||||
List<PatchLineComment> comments = Lists.newArrayList();
|
List<PatchLineComment> comments = new ArrayList<>();
|
||||||
comments.addAll(notes.getDraftComments(author).values());
|
comments.addAll(notes.getDraftComments(author).values());
|
||||||
return sort(comments);
|
return sort(comments);
|
||||||
}
|
}
|
||||||
@@ -274,7 +274,7 @@ public class PatchLineCommentsUtil {
|
|||||||
return sort(db.patchComments().draftByAuthor(author).toList());
|
return sort(db.patchComments().draftByAuthor(author).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PatchLineComment> comments = Lists.newArrayList();
|
List<PatchLineComment> comments = new ArrayList<>();
|
||||||
try (Repository repo = repoManager.openRepository(allUsers)) {
|
try (Repository repo = repoManager.openRepository(allUsers)) {
|
||||||
for (String refName : repo.getRefDatabase()
|
for (String refName : repo.getRefDatabase()
|
||||||
.getRefs(RefNames.REFS_DRAFT_COMMENTS).keySet()) {
|
.getRefs(RefNames.REFS_DRAFT_COMMENTS).keySet()) {
|
||||||
|
@@ -129,7 +129,7 @@ public class ReviewersUtil {
|
|||||||
suggestedAccounts = suggestAccount(suggestReviewers, visibilityControl);
|
suggestedAccounts = suggestAccount(suggestReviewers, visibilityControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SuggestedReviewerInfo> reviewer = Lists.newArrayList();
|
List<SuggestedReviewerInfo> reviewer = new ArrayList<>();
|
||||||
for (AccountInfo a : suggestedAccounts) {
|
for (AccountInfo a : suggestedAccounts) {
|
||||||
SuggestedReviewerInfo info = new SuggestedReviewerInfo();
|
SuggestedReviewerInfo info = new SuggestedReviewerInfo();
|
||||||
info.account = a;
|
info.account = a;
|
||||||
|
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.access;
|
package com.google.gerrit.server.access;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.extensions.api.access.ProjectAccessInfo;
|
import com.google.gerrit.extensions.api.access.ProjectAccessInfo;
|
||||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||||
@@ -28,14 +26,16 @@ import com.google.inject.Inject;
|
|||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public class ListAccess implements RestReadView<TopLevelResource> {
|
public class ListAccess implements RestReadView<TopLevelResource> {
|
||||||
|
|
||||||
@Option(name = "--project", aliases = {"-p"}, metaVar = "PROJECT",
|
@Option(name = "--project", aliases = {"-p"}, metaVar = "PROJECT",
|
||||||
usage = "projects for which the access rights should be returned")
|
usage = "projects for which the access rights should be returned")
|
||||||
private List<String> projects = Lists.newArrayList();
|
private List<String> projects = new ArrayList<>();
|
||||||
|
|
||||||
private final GetAccess getAccess;
|
private final GetAccess getAccess;
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public class ListAccess implements RestReadView<TopLevelResource> {
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, ProjectAccessInfo> apply(TopLevelResource resource)
|
public Map<String, ProjectAccessInfo> apply(TopLevelResource resource)
|
||||||
throws ResourceNotFoundException, ResourceConflictException, IOException {
|
throws ResourceNotFoundException, ResourceConflictException, IOException {
|
||||||
Map<String, ProjectAccessInfo> access = Maps.newTreeMap();
|
Map<String, ProjectAccessInfo> access = new TreeMap<>();
|
||||||
for (String p : projects) {
|
for (String p : projects) {
|
||||||
Project.NameKey projectName = new Project.NameKey(p);
|
Project.NameKey projectName = new Project.NameKey(p);
|
||||||
access.put(p, getAccess.apply(projectName));
|
access.put(p, getAccess.apply(projectName));
|
||||||
|
@@ -17,7 +17,6 @@ package com.google.gerrit.server.account;
|
|||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
import com.google.gerrit.reviewdb.client.AccountExternalId;
|
import com.google.gerrit.reviewdb.client.AccountExternalId;
|
||||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
@@ -33,6 +32,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ public class AccountByEmailCacheImpl implements AccountByEmailCache {
|
|||||||
@Override
|
@Override
|
||||||
public Set<Account.Id> load(String email) throws Exception {
|
public Set<Account.Id> load(String email) throws Exception {
|
||||||
try (ReviewDb db = schema.open()) {
|
try (ReviewDb db = schema.open()) {
|
||||||
Set<Account.Id> r = Sets.newHashSet();
|
Set<Account.Id> r = new HashSet<>();
|
||||||
for (Account a : db.accounts().byPreferredEmail(email)) {
|
for (Account a : db.accounts().byPreferredEmail(email)) {
|
||||||
r.add(a.getId());
|
r.add(a.getId());
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,6 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.extensions.common.AccountInfo;
|
import com.google.gerrit.extensions.common.AccountInfo;
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
import com.google.gerrit.server.account.AccountDirectory.DirectoryException;
|
import com.google.gerrit.server.account.AccountDirectory.DirectoryException;
|
||||||
@@ -28,9 +26,11 @@ import com.google.gwtorm.server.OrmException;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.assistedinject.Assisted;
|
import com.google.inject.assistedinject.Assisted;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -57,8 +57,8 @@ public class AccountLoader {
|
|||||||
AccountLoader(InternalAccountDirectory directory, @Assisted boolean detailed) {
|
AccountLoader(InternalAccountDirectory directory, @Assisted boolean detailed) {
|
||||||
this.directory = directory;
|
this.directory = directory;
|
||||||
options = detailed ? DETAILED_OPTIONS : InternalAccountDirectory.ID_ONLY;
|
options = detailed ? DETAILED_OPTIONS : InternalAccountDirectory.ID_ONLY;
|
||||||
created = Maps.newHashMap();
|
created = new HashMap<>();
|
||||||
provided = Lists.newArrayList();
|
provided = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountInfo get(Account.Id id) {
|
public AccountInfo get(Account.Id id) {
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.account;
|
package com.google.gerrit.server.account;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
import com.google.gerrit.reviewdb.client.AccountExternalId;
|
import com.google.gerrit.reviewdb.client.AccountExternalId;
|
||||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
@@ -154,7 +153,7 @@ public class AccountResolver {
|
|||||||
|
|
||||||
// more than one match, try to return the best one
|
// more than one match, try to return the best one
|
||||||
String name = nameOrEmail.substring(0, lt - 1);
|
String name = nameOrEmail.substring(0, lt - 1);
|
||||||
Set<Account.Id> nameMatches = Sets.newHashSet();
|
Set<Account.Id> nameMatches = new HashSet<>();
|
||||||
for (Account.Id id : ids) {
|
for (Account.Id id : ids) {
|
||||||
Account a = byId.get(id).getAccount();
|
Account a = byId.get(id).getAccount();
|
||||||
if (name.equals(a.getFullName())) {
|
if (name.equals(a.getFullName())) {
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.account;
|
package com.google.gerrit.server.account;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.audit.AuditService;
|
import com.google.gerrit.audit.AuditService;
|
||||||
import com.google.gerrit.common.TimeUtil;
|
import com.google.gerrit.common.TimeUtil;
|
||||||
import com.google.gerrit.common.data.GlobalCapability;
|
import com.google.gerrit.common.data.GlobalCapability;
|
||||||
@@ -51,6 +50,7 @@ import org.eclipse.jgit.errors.ConfigInvalidException;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -214,7 +214,7 @@ public class CreateAccount implements RestModifyView<TopLevelResource, Input> {
|
|||||||
|
|
||||||
private Set<AccountGroup.Id> parseGroups(List<String> groups)
|
private Set<AccountGroup.Id> parseGroups(List<String> groups)
|
||||||
throws UnprocessableEntityException {
|
throws UnprocessableEntityException {
|
||||||
Set<AccountGroup.Id> groupIds = Sets.newHashSet();
|
Set<AccountGroup.Id> groupIds = new HashSet<>();
|
||||||
if (groups != null) {
|
if (groups != null) {
|
||||||
for (String g : groups) {
|
for (String g : groups) {
|
||||||
groupIds.add(GroupDescriptions.toAccountGroup(
|
groupIds.add(GroupDescriptions.toAccountGroup(
|
||||||
|
@@ -33,8 +33,6 @@ import static com.google.gerrit.common.data.GlobalCapability.VIEW_PLUGINS;
|
|||||||
import static com.google.gerrit.common.data.GlobalCapability.VIEW_QUEUE;
|
import static com.google.gerrit.common.data.GlobalCapability.VIEW_QUEUE;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.common.data.GlobalCapability;
|
import com.google.gerrit.common.data.GlobalCapability;
|
||||||
import com.google.gerrit.common.data.PermissionRange;
|
import com.google.gerrit.common.data.PermissionRange;
|
||||||
import com.google.gerrit.extensions.config.CapabilityDefinition;
|
import com.google.gerrit.extensions.config.CapabilityDefinition;
|
||||||
@@ -54,7 +52,9 @@ import com.google.inject.Singleton;
|
|||||||
|
|
||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ class GetCapabilities implements RestReadView<AccountResource> {
|
|||||||
@Option(name = "-q", metaVar = "CAP", usage = "Capability to inspect")
|
@Option(name = "-q", metaVar = "CAP", usage = "Capability to inspect")
|
||||||
void addQuery(String name) {
|
void addQuery(String name) {
|
||||||
if (query == null) {
|
if (query == null) {
|
||||||
query = Sets.newHashSet();
|
query = new HashSet<>();
|
||||||
}
|
}
|
||||||
Iterables.addAll(query, OptionUtil.splitOptionValue(name));
|
Iterables.addAll(query, OptionUtil.splitOptionValue(name));
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ class GetCapabilities implements RestReadView<AccountResource> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CapabilityControl cc = resource.getUser().getCapabilities();
|
CapabilityControl cc = resource.getUser().getCapabilities();
|
||||||
Map<String, Object> have = Maps.newLinkedHashMap();
|
Map<String, Object> have = new LinkedHashMap<>();
|
||||||
for (String name : GlobalCapability.getAllNames()) {
|
for (String name : GlobalCapability.getAllNames()) {
|
||||||
if (!name.equals(PRIORITY) && want(name) && cc.canPerform(name)) {
|
if (!name.equals(PRIORITY) && want(name) && cc.canPerform(name)) {
|
||||||
if (GlobalCapability.hasRange(name)) {
|
if (GlobalCapability.hasRange(name)) {
|
||||||
|
@@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.account;
|
package com.google.gerrit.server.account;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.extensions.restapi.RestReadView;
|
import com.google.gerrit.extensions.restapi.RestReadView;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -27,7 +27,7 @@ public class GetEmails implements RestReadView<AccountResource> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EmailInfo> apply(AccountResource rsrc) {
|
public List<EmailInfo> apply(AccountResource rsrc) {
|
||||||
List<EmailInfo> emails = Lists.newArrayList();
|
List<EmailInfo> emails = new ArrayList<>();
|
||||||
for (String email : rsrc.getUser().getEmailAddresses()) {
|
for (String email : rsrc.getUser().getEmailAddresses()) {
|
||||||
if (email != null) {
|
if (email != null) {
|
||||||
EmailInfo e = new EmailInfo();
|
EmailInfo e = new EmailInfo();
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.account;
|
package com.google.gerrit.server.account;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.common.errors.NoSuchGroupException;
|
import com.google.gerrit.common.errors.NoSuchGroupException;
|
||||||
import com.google.gerrit.extensions.common.GroupInfo;
|
import com.google.gerrit.extensions.common.GroupInfo;
|
||||||
import com.google.gerrit.extensions.restapi.RestReadView;
|
import com.google.gerrit.extensions.restapi.RestReadView;
|
||||||
@@ -26,6 +25,7 @@ import com.google.gwtorm.server.OrmException;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -43,7 +43,7 @@ public class GetGroups implements RestReadView<AccountResource> {
|
|||||||
public List<GroupInfo> apply(AccountResource resource) throws OrmException {
|
public List<GroupInfo> apply(AccountResource resource) throws OrmException {
|
||||||
IdentifiedUser user = resource.getUser();
|
IdentifiedUser user = resource.getUser();
|
||||||
Account.Id userId = user.getAccountId();
|
Account.Id userId = user.getAccountId();
|
||||||
List<GroupInfo> groups = Lists.newArrayList();
|
List<GroupInfo> groups = new ArrayList<>();
|
||||||
for (AccountGroup.UUID uuid : user.getEffectiveGroups().getKnownGroups()) {
|
for (AccountGroup.UUID uuid : user.getEffectiveGroups().getKnownGroups()) {
|
||||||
GroupControl ctl;
|
GroupControl ctl;
|
||||||
try {
|
try {
|
||||||
|
@@ -17,7 +17,6 @@ package com.google.gerrit.server.account;
|
|||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGroupById;
|
import com.google.gerrit.reviewdb.client.AccountGroupById;
|
||||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
@@ -33,6 +32,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
@@ -150,7 +150,7 @@ public class GroupIncludeCacheImpl implements GroupIncludeCache {
|
|||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<AccountGroup.UUID> ids = Sets.newHashSet();
|
Set<AccountGroup.UUID> ids = new HashSet<>();
|
||||||
for (AccountGroupById agi : db.accountGroupById()
|
for (AccountGroupById agi : db.accountGroupById()
|
||||||
.byGroup(group.get(0).getId())) {
|
.byGroup(group.get(0).getId())) {
|
||||||
ids.add(agi.getIncludeUUID());
|
ids.add(agi.getIncludeUUID());
|
||||||
@@ -172,13 +172,13 @@ public class GroupIncludeCacheImpl implements GroupIncludeCache {
|
|||||||
@Override
|
@Override
|
||||||
public Set<AccountGroup.UUID> load(AccountGroup.UUID key) throws Exception {
|
public Set<AccountGroup.UUID> load(AccountGroup.UUID key) throws Exception {
|
||||||
try (ReviewDb db = schema.open()) {
|
try (ReviewDb db = schema.open()) {
|
||||||
Set<AccountGroup.Id> ids = Sets.newHashSet();
|
Set<AccountGroup.Id> ids = new HashSet<>();
|
||||||
for (AccountGroupById agi : db.accountGroupById()
|
for (AccountGroupById agi : db.accountGroupById()
|
||||||
.byIncludeUUID(key)) {
|
.byIncludeUUID(key)) {
|
||||||
ids.add(agi.getGroupId());
|
ids.add(agi.getGroupId());
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<AccountGroup.UUID> groupArray = Sets.newHashSet();
|
Set<AccountGroup.UUID> groupArray = new HashSet<>();
|
||||||
for (AccountGroup g : db.accountGroups().get(ids)) {
|
for (AccountGroup g : db.accountGroups().get(ids)) {
|
||||||
groupArray.add(g.getGroupUUID());
|
groupArray.add(g.getGroupUUID());
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ public class GroupIncludeCacheImpl implements GroupIncludeCache {
|
|||||||
@Override
|
@Override
|
||||||
public Set<AccountGroup.UUID> load(String key) throws Exception {
|
public Set<AccountGroup.UUID> load(String key) throws Exception {
|
||||||
try (ReviewDb db = schema.open()) {
|
try (ReviewDb db = schema.open()) {
|
||||||
Set<AccountGroup.UUID> ids = Sets.newHashSet();
|
Set<AccountGroup.UUID> ids = new HashSet<>();
|
||||||
for (AccountGroupById agi : db.accountGroupById().all()) {
|
for (AccountGroupById agi : db.accountGroupById().all()) {
|
||||||
if (!AccountGroup.isInternalGroup(agi.getIncludeUUID())) {
|
if (!AccountGroup.isInternalGroup(agi.getIncludeUUID())) {
|
||||||
ids.add(agi.getIncludeUUID());
|
ids.add(agi.getIncludeUUID());
|
||||||
|
@@ -46,7 +46,7 @@ public interface GroupMembership {
|
|||||||
* Implementors may implement the method as:
|
* Implementors may implement the method as:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Set<AccountGroup.UUID> r = Sets.newHashSet();
|
* Set<AccountGroup.UUID> r = new HashSet<>();
|
||||||
* for (AccountGroup.UUID id : groupIds)
|
* for (AccountGroup.UUID id : groupIds)
|
||||||
* if (contains(id)) r.add(id);
|
* if (contains(id)) r.add(id);
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@@ -22,6 +22,7 @@ import com.google.gerrit.server.IdentifiedUser;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.assistedinject.Assisted;
|
import com.google.inject.assistedinject.Assisted;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -102,7 +103,7 @@ public class IncludingGroupMembership implements GroupMembership {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<AccountGroup.UUID> intersection(Iterable<AccountGroup.UUID> groupIds) {
|
public Set<AccountGroup.UUID> intersection(Iterable<AccountGroup.UUID> groupIds) {
|
||||||
Set<AccountGroup.UUID> r = Sets.newHashSet();
|
Set<AccountGroup.UUID> r = new HashSet<>();
|
||||||
for (AccountGroup.UUID id : groupIds) {
|
for (AccountGroup.UUID id : groupIds) {
|
||||||
if (contains(id)) {
|
if (contains(id)) {
|
||||||
r.add(id);
|
r.add(id);
|
||||||
|
@@ -35,6 +35,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -180,7 +181,7 @@ public class UniversalGroupBackend implements GroupBackend {
|
|||||||
}
|
}
|
||||||
lookups.put(m, uuid);
|
lookups.put(m, uuid);
|
||||||
}
|
}
|
||||||
Set<AccountGroup.UUID> groups = Sets.newHashSet();
|
Set<AccountGroup.UUID> groups = new HashSet<>();
|
||||||
for (Map.Entry<GroupMembership, Collection<AccountGroup.UUID>> entry
|
for (Map.Entry<GroupMembership, Collection<AccountGroup.UUID>> entry
|
||||||
: lookups.asMap().entrySet()) {
|
: lookups.asMap().entrySet()) {
|
||||||
groups.addAll(entry.getKey().intersection(entry.getValue()));
|
groups.addAll(entry.getKey().intersection(entry.getValue()));
|
||||||
@@ -190,7 +191,7 @@ public class UniversalGroupBackend implements GroupBackend {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<AccountGroup.UUID> getKnownGroups() {
|
public Set<AccountGroup.UUID> getKnownGroups() {
|
||||||
Set<AccountGroup.UUID> groups = Sets.newHashSet();
|
Set<AccountGroup.UUID> groups = new HashSet<>();
|
||||||
for (GroupMembership m : memberships.values()) {
|
for (GroupMembership m : memberships.values()) {
|
||||||
groups.addAll(m.getKnownGroups());
|
groups.addAll(m.getKnownGroups());
|
||||||
}
|
}
|
||||||
|
@@ -16,11 +16,11 @@ package com.google.gerrit.server.auth;
|
|||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,8 +38,8 @@ public final class UniversalAuthBackend implements AuthBackend {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AuthUser authenticate(final AuthRequest request) throws AuthException {
|
public AuthUser authenticate(final AuthRequest request) throws AuthException {
|
||||||
List<AuthUser> authUsers = Lists.newArrayList();
|
List<AuthUser> authUsers = new ArrayList<>();
|
||||||
List<AuthException> authExs = Lists.newArrayList();
|
List<AuthException> authExs = new ArrayList<>();
|
||||||
for (AuthBackend backend : authBackends) {
|
for (AuthBackend backend : authBackends) {
|
||||||
try {
|
try {
|
||||||
authUsers.add(checkNotNull(backend.authenticate(request)));
|
authUsers.add(checkNotNull(backend.authenticate(request)));
|
||||||
|
@@ -125,6 +125,8 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -280,7 +282,7 @@ public class ChangeJson {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
List<List<ChangeInfo>> res = Lists.newArrayListWithCapacity(in.size());
|
List<List<ChangeInfo>> res = Lists.newArrayListWithCapacity(in.size());
|
||||||
Map<Change.Id, ChangeInfo> out = Maps.newHashMap();
|
Map<Change.Id, ChangeInfo> out = new HashMap<>();
|
||||||
for (QueryResult r : in) {
|
for (QueryResult r : in) {
|
||||||
List<ChangeInfo> infos = toChangeInfo(out, r.changes());
|
List<ChangeInfo> infos = toChangeInfo(out, r.changes());
|
||||||
if (!infos.isEmpty() && r.moreChanges()) {
|
if (!infos.isEmpty() && r.moreChanges()) {
|
||||||
@@ -610,7 +612,7 @@ public class ChangeJson {
|
|||||||
// Include a user in the output for this label if either:
|
// Include a user in the output for this label if either:
|
||||||
// - They are an explicit reviewer.
|
// - They are an explicit reviewer.
|
||||||
// - They ever voted on this change.
|
// - They ever voted on this change.
|
||||||
Set<Account.Id> allUsers = Sets.newHashSet();
|
Set<Account.Id> allUsers = new HashSet<>();
|
||||||
allUsers.addAll(cd.reviewers().values());
|
allUsers.addAll(cd.reviewers().values());
|
||||||
for (PatchSetApproval psa : cd.approvals().values()) {
|
for (PatchSetApproval psa : cd.approvals().values()) {
|
||||||
allUsers.add(psa.getAccountId());
|
allUsers.add(psa.getAccountId());
|
||||||
@@ -667,7 +669,7 @@ public class ChangeJson {
|
|||||||
private Map<String, LabelWithStatus> labelsForClosedChange(ChangeData cd,
|
private Map<String, LabelWithStatus> labelsForClosedChange(ChangeData cd,
|
||||||
LabelTypes labelTypes, boolean standard, boolean detailed)
|
LabelTypes labelTypes, boolean standard, boolean detailed)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
Set<Account.Id> allUsers = Sets.newHashSet();
|
Set<Account.Id> allUsers = new HashSet<>();
|
||||||
if (detailed) {
|
if (detailed) {
|
||||||
// Users expect to see all reviewers on closed changes, even if they
|
// Users expect to see all reviewers on closed changes, even if they
|
||||||
// didn't vote on the latest patch set. If we don't need detailed labels,
|
// didn't vote on the latest patch set. If we don't need detailed labels,
|
||||||
@@ -680,7 +682,7 @@ public class ChangeJson {
|
|||||||
|
|
||||||
// We can only approximately reconstruct what the submit rule evaluator
|
// We can only approximately reconstruct what the submit rule evaluator
|
||||||
// would have done. These should really come from a stored submit record.
|
// would have done. These should really come from a stored submit record.
|
||||||
Set<String> labelNames = Sets.newHashSet();
|
Set<String> labelNames = new HashSet<>();
|
||||||
Multimap<Account.Id, PatchSetApproval> current = HashMultimap.create();
|
Multimap<Account.Id, PatchSetApproval> current = HashMultimap.create();
|
||||||
for (PatchSetApproval a : cd.currentApprovals()) {
|
for (PatchSetApproval a : cd.currentApprovals()) {
|
||||||
allUsers.add(a.getAccountId());
|
allUsers.add(a.getAccountId());
|
||||||
@@ -755,7 +757,7 @@ public class ChangeJson {
|
|||||||
|
|
||||||
private void setLabelValues(LabelType type, LabelWithStatus l) {
|
private void setLabelValues(LabelType type, LabelWithStatus l) {
|
||||||
l.label().defaultValue = type.getDefaultValue();
|
l.label().defaultValue = type.getDefaultValue();
|
||||||
l.label().values = Maps.newLinkedHashMap();
|
l.label().values = new LinkedHashMap<>();
|
||||||
for (LabelValue v : type.getValues()) {
|
for (LabelValue v : type.getValues()) {
|
||||||
l.label().values.put(v.formatValue(), v.getText());
|
l.label().values.put(v.formatValue(), v.getText());
|
||||||
}
|
}
|
||||||
@@ -871,7 +873,7 @@ public class ChangeJson {
|
|||||||
private Map<String, RevisionInfo> revisions(ChangeControl ctl,
|
private Map<String, RevisionInfo> revisions(ChangeControl ctl,
|
||||||
Map<PatchSet.Id, PatchSet> map) throws PatchListNotAvailableException,
|
Map<PatchSet.Id, PatchSet> map) throws PatchListNotAvailableException,
|
||||||
GpgException, OrmException, IOException {
|
GpgException, OrmException, IOException {
|
||||||
Map<String, RevisionInfo> res = Maps.newLinkedHashMap();
|
Map<String, RevisionInfo> res = new LinkedHashMap<>();
|
||||||
for (PatchSet in : map.values()) {
|
for (PatchSet in : map.values()) {
|
||||||
if ((has(ALL_REVISIONS)
|
if ((has(ALL_REVISIONS)
|
||||||
|| in.getId().equals(ctl.getChange().currentPatchSetId()))
|
|| in.getId().equals(ctl.getChange().currentPatchSetId()))
|
||||||
@@ -1003,7 +1005,7 @@ public class ChangeJson {
|
|||||||
|
|
||||||
private Map<String, FetchInfo> makeFetchMap(ChangeControl ctl, PatchSet in)
|
private Map<String, FetchInfo> makeFetchMap(ChangeControl ctl, PatchSet in)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
Map<String, FetchInfo> r = Maps.newLinkedHashMap();
|
Map<String, FetchInfo> r = new LinkedHashMap<>();
|
||||||
|
|
||||||
for (DynamicMap.Entry<DownloadScheme> e : downloadSchemes) {
|
for (DynamicMap.Entry<DownloadScheme> e : downloadSchemes) {
|
||||||
String schemeName = e.getExportName();
|
String schemeName = e.getExportName();
|
||||||
@@ -1049,7 +1051,7 @@ public class ChangeJson {
|
|||||||
private static void addCommand(FetchInfo fetchInfo, String commandName,
|
private static void addCommand(FetchInfo fetchInfo, String commandName,
|
||||||
String c) {
|
String c) {
|
||||||
if (fetchInfo.commands == null) {
|
if (fetchInfo.commands == null) {
|
||||||
fetchInfo.commands = Maps.newTreeMap();
|
fetchInfo.commands = new TreeMap<>();
|
||||||
}
|
}
|
||||||
fetchInfo.commands.put(commandName, c);
|
fetchInfo.commands.put(commandName, c);
|
||||||
}
|
}
|
||||||
@@ -1063,7 +1065,7 @@ public class ChangeJson {
|
|||||||
|
|
||||||
private static void addApproval(LabelInfo label, ApprovalInfo approval) {
|
private static void addApproval(LabelInfo label, ApprovalInfo approval) {
|
||||||
if (label.all == null) {
|
if (label.all == null) {
|
||||||
label.all = Lists.newArrayList();
|
label.all = new ArrayList<>();
|
||||||
}
|
}
|
||||||
label.all.add(approval);
|
label.all.add(approval);
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.change;
|
package com.google.gerrit.server.change;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.Nullable;
|
import com.google.gerrit.common.Nullable;
|
||||||
import com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace;
|
import com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace;
|
||||||
import com.google.gerrit.extensions.common.FileInfo;
|
import com.google.gerrit.extensions.common.FileInfo;
|
||||||
@@ -33,6 +32,7 @@ import com.google.inject.Singleton;
|
|||||||
import org.eclipse.jgit.lib.ObjectId;
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class FileInfoJson {
|
public class FileInfoJson {
|
||||||
@@ -57,7 +57,7 @@ public class FileInfoJson {
|
|||||||
PatchList list = patchListCache.get(
|
PatchList list = patchListCache.get(
|
||||||
new PatchListKey(a, b, Whitespace.IGNORE_NONE), change.getProject());
|
new PatchListKey(a, b, Whitespace.IGNORE_NONE), change.getProject());
|
||||||
|
|
||||||
Map<String, FileInfo> files = Maps.newTreeMap();
|
Map<String, FileInfo> files = new TreeMap<>();
|
||||||
for (PatchListEntry e : list.getPatches()) {
|
for (PatchListEntry e : list.getPatches()) {
|
||||||
FileInfo d = new FileInfo();
|
FileInfo d = new FileInfo();
|
||||||
d.status = e.getChangeType() != Patch.ChangeType.MODIFIED
|
d.status = e.getChangeType() != Patch.ChangeType.MODIFIED
|
||||||
|
@@ -231,7 +231,7 @@ public class Files implements ChildCollection<RevisionResource, FileResource> {
|
|||||||
|
|
||||||
private List<String> scan(Account.Id userId, PatchSet.Id psId)
|
private List<String> scan(Account.Id userId, PatchSet.Id psId)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
List<String> r = Lists.newArrayList();
|
List<String> r = new ArrayList<>();
|
||||||
for (AccountPatchReview w : db.get().accountPatchReviews()
|
for (AccountPatchReview w : db.get().accountPatchReviews()
|
||||||
.byReviewer(userId, psId)) {
|
.byReviewer(userId, psId)) {
|
||||||
r.add(w.getKey().getPatchKey().getFileName());
|
r.add(w.getKey().getPatchKey().getFileName());
|
||||||
|
@@ -17,7 +17,6 @@ package com.google.gerrit.server.change;
|
|||||||
import com.google.common.collect.LinkedListMultimap;
|
import com.google.common.collect.LinkedListMultimap;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
||||||
import org.eclipse.jgit.errors.MissingObjectException;
|
import org.eclipse.jgit.errors.MissingObjectException;
|
||||||
@@ -35,6 +34,8 @@ import java.io.IOException;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -107,8 +108,8 @@ public class IncludedInResolver {
|
|||||||
|
|
||||||
private boolean includedInOne(final Collection<Ref> refs) throws IOException {
|
private boolean includedInOne(final Collection<Ref> refs) throws IOException {
|
||||||
parseCommits(refs);
|
parseCommits(refs);
|
||||||
List<RevCommit> before = Lists.newLinkedList();
|
List<RevCommit> before = new LinkedList<>();
|
||||||
List<RevCommit> after = Lists.newLinkedList();
|
List<RevCommit> after = new LinkedList<>();
|
||||||
partition(before, after);
|
partition(before, after);
|
||||||
// It is highly likely that the target is reachable from the "after" set
|
// It is highly likely that the target is reachable from the "after" set
|
||||||
// Within the "before" set we are trying to handle cases arising from clock skew
|
// Within the "before" set we are trying to handle cases arising from clock skew
|
||||||
@@ -120,7 +121,7 @@ public class IncludedInResolver {
|
|||||||
*/
|
*/
|
||||||
private Set<String> includedIn(final Collection<RevCommit> tips, int limit)
|
private Set<String> includedIn(final Collection<RevCommit> tips, int limit)
|
||||||
throws IOException, MissingObjectException, IncorrectObjectTypeException {
|
throws IOException, MissingObjectException, IncorrectObjectTypeException {
|
||||||
Set<String> result = Sets.newHashSet();
|
Set<String> result = new HashSet<>();
|
||||||
for (RevCommit tip : tips) {
|
for (RevCommit tip : tips) {
|
||||||
boolean commitFound = false;
|
boolean commitFound = false;
|
||||||
rw.resetRetain(RevFlag.UNINTERESTING, containsTarget);
|
rw.resetRetain(RevFlag.UNINTERESTING, containsTarget);
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.change;
|
package com.google.gerrit.server.change;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.extensions.restapi.RestReadView;
|
import com.google.gerrit.extensions.restapi.RestReadView;
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||||
@@ -25,6 +24,7 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ class ListReviewers implements RestReadView<ChangeResource> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ReviewerInfo> apply(ChangeResource rsrc) throws OrmException {
|
public List<ReviewerInfo> apply(ChangeResource rsrc) throws OrmException {
|
||||||
Map<Account.Id, ReviewerResource> reviewers = Maps.newLinkedHashMap();
|
Map<Account.Id, ReviewerResource> reviewers = new LinkedHashMap<>();
|
||||||
ReviewDb db = dbProvider.get();
|
ReviewDb db = dbProvider.get();
|
||||||
for (Account.Id accountId
|
for (Account.Id accountId
|
||||||
: approvalsUtil.getReviewers(db, rsrc.getNotes()).values()) {
|
: approvalsUtil.getReviewers(db, rsrc.getNotes()).values()) {
|
||||||
|
@@ -24,8 +24,6 @@ import com.google.auto.value.AutoValue;
|
|||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.common.hash.HashCode;
|
import com.google.common.hash.HashCode;
|
||||||
@@ -410,8 +408,8 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PatchLineComment> del = Lists.newArrayList();
|
List<PatchLineComment> del = new ArrayList<>();
|
||||||
List<PatchLineComment> ups = Lists.newArrayList();
|
List<PatchLineComment> ups = new ArrayList<>();
|
||||||
|
|
||||||
Set<CommentSetEntry> existingIds = in.omitDuplicateComments
|
Set<CommentSetEntry> existingIds = in.omitDuplicateComments
|
||||||
? readExistingComments(ctx)
|
? readExistingComments(ctx)
|
||||||
@@ -490,7 +488,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
|||||||
|
|
||||||
private Map<String, PatchLineComment> changeDrafts(ChangeContext ctx)
|
private Map<String, PatchLineComment> changeDrafts(ChangeContext ctx)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
Map<String, PatchLineComment> drafts = Maps.newHashMap();
|
Map<String, PatchLineComment> drafts = new HashMap<>();
|
||||||
for (PatchLineComment c : plcUtil.draftByChangeAuthor(
|
for (PatchLineComment c : plcUtil.draftByChangeAuthor(
|
||||||
ctx.getDb(), ctx.getNotes(), user.getAccountId())) {
|
ctx.getDb(), ctx.getNotes(), user.getAccountId())) {
|
||||||
c.setTag(in.tag);
|
c.setTag(in.tag);
|
||||||
@@ -501,7 +499,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
|||||||
|
|
||||||
private Map<String, PatchLineComment> patchSetDrafts(ChangeContext ctx)
|
private Map<String, PatchLineComment> patchSetDrafts(ChangeContext ctx)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
Map<String, PatchLineComment> drafts = Maps.newHashMap();
|
Map<String, PatchLineComment> drafts = new HashMap<>();
|
||||||
for (PatchLineComment c : plcUtil.draftByPatchSetAuthor(ctx.getDb(),
|
for (PatchLineComment c : plcUtil.draftByPatchSetAuthor(ctx.getDb(),
|
||||||
psId, user.getAccountId(), ctx.getNotes())) {
|
psId, user.getAccountId(), ctx.getNotes())) {
|
||||||
drafts.put(c.getKey().get(), c);
|
drafts.put(c.getKey().get(), c);
|
||||||
@@ -588,8 +586,8 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PatchSetApproval> del = Lists.newArrayList();
|
List<PatchSetApproval> del = new ArrayList<>();
|
||||||
List<PatchSetApproval> ups = Lists.newArrayList();
|
List<PatchSetApproval> ups = new ArrayList<>();
|
||||||
Map<String, PatchSetApproval> current = scanLabels(ctx, del);
|
Map<String, PatchSetApproval> current = scanLabels(ctx, del);
|
||||||
LabelTypes labelTypes = ctx.getControl().getLabelTypes();
|
LabelTypes labelTypes = ctx.getControl().getLabelTypes();
|
||||||
Map<String, Short> allApprovals = getAllApprovals(labelTypes,
|
Map<String, Short> allApprovals = getAllApprovals(labelTypes,
|
||||||
@@ -690,7 +688,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
|||||||
private Map<String, PatchSetApproval> scanLabels(ChangeContext ctx,
|
private Map<String, PatchSetApproval> scanLabels(ChangeContext ctx,
|
||||||
List<PatchSetApproval> del) throws OrmException {
|
List<PatchSetApproval> del) throws OrmException {
|
||||||
LabelTypes labelTypes = ctx.getControl().getLabelTypes();
|
LabelTypes labelTypes = ctx.getControl().getLabelTypes();
|
||||||
Map<String, PatchSetApproval> current = Maps.newHashMap();
|
Map<String, PatchSetApproval> current = new HashMap<>();
|
||||||
|
|
||||||
for (PatchSetApproval a : approvalsUtil.byPatchSetUser(
|
for (PatchSetApproval a : approvalsUtil.byPatchSetUser(
|
||||||
ctx.getDb(), ctx.getControl(), psId, user.getAccountId())) {
|
ctx.getDb(), ctx.getControl(), psId, user.getAccountId())) {
|
||||||
|
@@ -17,7 +17,6 @@ package com.google.gerrit.server.change;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.ChangeHooks;
|
import com.google.gerrit.common.ChangeHooks;
|
||||||
import com.google.gerrit.common.TimeUtil;
|
import com.google.gerrit.common.TimeUtil;
|
||||||
import com.google.gerrit.common.data.GroupDescription;
|
import com.google.gerrit.common.data.GroupDescription;
|
||||||
@@ -63,6 +62,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -170,7 +170,7 @@ public class PostReviewers implements RestModifyView<ChangeResource, AddReviewer
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Account.Id, ChangeControl> reviewers = Maps.newHashMap();
|
Map<Account.Id, ChangeControl> reviewers = new HashMap<>();
|
||||||
ChangeControl control = rsrc.getControl();
|
ChangeControl control = rsrc.getControl();
|
||||||
Set<Account> members;
|
Set<Account> members;
|
||||||
try {
|
try {
|
||||||
|
@@ -35,6 +35,7 @@ import com.google.inject.Provider;
|
|||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ public class Revisions implements ChildCollection<ChangeResource, RevisionResour
|
|||||||
// Impossibly long identifier will never match.
|
// Impossibly long identifier will never match.
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
} else {
|
} else {
|
||||||
List<RevisionResource> out = Lists.newArrayList();
|
List<RevisionResource> out = new ArrayList<>();
|
||||||
for (PatchSet ps : psUtil.byChange(dbProvider.get(), change.getNotes())) {
|
for (PatchSet ps : psUtil.byChange(dbProvider.get(), change.getNotes())) {
|
||||||
if (ps.getRevision() != null && ps.getRevision().get().startsWith(id)) {
|
if (ps.getRevision() != null && ps.getRevision().get().startsWith(id)) {
|
||||||
out.add(new RevisionResource(change, ps));
|
out.add(new RevisionResource(change, ps));
|
||||||
|
@@ -16,7 +16,6 @@ package com.google.gerrit.server.change;
|
|||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.data.SubmitRecord;
|
import com.google.gerrit.common.data.SubmitRecord;
|
||||||
import com.google.gerrit.extensions.common.AccountInfo;
|
import com.google.gerrit.extensions.common.AccountInfo;
|
||||||
import com.google.gerrit.extensions.common.TestSubmitRuleInput;
|
import com.google.gerrit.extensions.common.TestSubmitRuleInput;
|
||||||
@@ -34,6 +33,7 @@ import com.google.inject.Provider;
|
|||||||
|
|
||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -116,31 +116,31 @@ public class TestSubmitRule
|
|||||||
switch (n.status) {
|
switch (n.status) {
|
||||||
case OK:
|
case OK:
|
||||||
if (ok == null) {
|
if (ok == null) {
|
||||||
ok = Maps.newLinkedHashMap();
|
ok = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
ok.put(n.label, who);
|
ok.put(n.label, who);
|
||||||
break;
|
break;
|
||||||
case REJECT:
|
case REJECT:
|
||||||
if (reject == null) {
|
if (reject == null) {
|
||||||
reject = Maps.newLinkedHashMap();
|
reject = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
reject.put(n.label, who);
|
reject.put(n.label, who);
|
||||||
break;
|
break;
|
||||||
case NEED:
|
case NEED:
|
||||||
if (need == null) {
|
if (need == null) {
|
||||||
need = Maps.newLinkedHashMap();
|
need = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
need.put(n.label, new None());
|
need.put(n.label, new None());
|
||||||
break;
|
break;
|
||||||
case MAY:
|
case MAY:
|
||||||
if (may == null) {
|
if (may == null) {
|
||||||
may = Maps.newLinkedHashMap();
|
may = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
may.put(n.label, who);
|
may.put(n.label, who);
|
||||||
break;
|
break;
|
||||||
case IMPOSSIBLE:
|
case IMPOSSIBLE:
|
||||||
if (impossible == null) {
|
if (impossible == null) {
|
||||||
impossible = Maps.newLinkedHashMap();
|
impossible = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
impossible.put(n.label, new None());
|
impossible.put(n.label, new None());
|
||||||
break;
|
break;
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.server.config;
|
package com.google.gerrit.server.config;
|
||||||
|
|
||||||
import com.google.common.base.CharMatcher;
|
import com.google.common.base.CharMatcher;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.data.GlobalCapability;
|
import com.google.gerrit.common.data.GlobalCapability;
|
||||||
import com.google.gerrit.extensions.config.CapabilityDefinition;
|
import com.google.gerrit.extensions.config.CapabilityDefinition;
|
||||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||||
@@ -28,6 +27,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/** List capabilities visible to the calling user. */
|
/** List capabilities visible to the calling user. */
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -43,7 +43,7 @@ public class ListCapabilities implements RestReadView<ConfigResource> {
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, CapabilityInfo> apply(ConfigResource resource)
|
public Map<String, CapabilityInfo> apply(ConfigResource resource)
|
||||||
throws IllegalAccessException, NoSuchFieldException {
|
throws IllegalAccessException, NoSuchFieldException {
|
||||||
Map<String, CapabilityInfo> output = Maps.newTreeMap();
|
Map<String, CapabilityInfo> output = new TreeMap<>();
|
||||||
collectCoreCapabilities(output);
|
collectCoreCapabilities(output);
|
||||||
collectPluginCapabilities(output);
|
collectPluginCapabilities(output);
|
||||||
return output;
|
return output;
|
||||||
|
@@ -14,13 +14,13 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.config;
|
package com.google.gerrit.server.config;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||||
import com.google.gerrit.extensions.restapi.RestReadView;
|
import com.google.gerrit.extensions.restapi.RestReadView;
|
||||||
import com.google.gerrit.extensions.webui.TopMenu;
|
import com.google.gerrit.extensions.webui.TopMenu;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -34,7 +34,7 @@ class ListTopMenus implements RestReadView<ConfigResource> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TopMenu.MenuEntry> apply(ConfigResource resource) {
|
public List<TopMenu.MenuEntry> apply(ConfigResource resource) {
|
||||||
List<TopMenu.MenuEntry> entries = Lists.newArrayList();
|
List<TopMenu.MenuEntry> entries = new ArrayList<>();
|
||||||
for (TopMenu extension : extensions) {
|
for (TopMenu extension : extensions) {
|
||||||
entries.addAll(extension.getEntries());
|
entries.addAll(extension.getEntries());
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.config;
|
package com.google.gerrit.server.config;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
import com.google.gerrit.server.git.ProjectLevelConfig;
|
import com.google.gerrit.server.git.ProjectLevelConfig;
|
||||||
import com.google.gerrit.server.plugins.Plugin;
|
import com.google.gerrit.server.plugins.Plugin;
|
||||||
@@ -36,6 +35,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -60,7 +60,7 @@ public class PluginConfigFactory implements ReloadPluginListener {
|
|||||||
this.cfgProvider = cfgProvider;
|
this.cfgProvider = cfgProvider;
|
||||||
this.projectCache = projectCache;
|
this.projectCache = projectCache;
|
||||||
this.projectStateFactory = projectStateFactory;
|
this.projectStateFactory = projectStateFactory;
|
||||||
this.pluginConfigs = Maps.newHashMap();
|
this.pluginConfigs = new HashMap<>();
|
||||||
|
|
||||||
this.cfgSnapshot = FileSnapshot.save(site.gerrit_config.toFile());
|
this.cfgSnapshot = FileSnapshot.save(site.gerrit_config.toFile());
|
||||||
this.cfg = cfgProvider.get();
|
this.cfg = cfgProvider.get();
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.edit;
|
package com.google.gerrit.server.edit;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.extensions.common.CommitInfo;
|
import com.google.gerrit.extensions.common.CommitInfo;
|
||||||
import com.google.gerrit.extensions.common.EditInfo;
|
import com.google.gerrit.extensions.common.EditInfo;
|
||||||
import com.google.gerrit.extensions.common.FetchInfo;
|
import com.google.gerrit.extensions.common.FetchInfo;
|
||||||
@@ -31,6 +30,7 @@ import com.google.inject.Singleton;
|
|||||||
import org.eclipse.jgit.revwalk.RevCommit;
|
import org.eclipse.jgit.revwalk.RevCommit;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -78,7 +78,7 @@ public class ChangeEditJson {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, FetchInfo> fillFetchMap(ChangeEdit edit) {
|
private Map<String, FetchInfo> fillFetchMap(ChangeEdit edit) {
|
||||||
Map<String, FetchInfo> r = Maps.newLinkedHashMap();
|
Map<String, FetchInfo> r = new LinkedHashMap<>();
|
||||||
for (DynamicMap.Entry<DownloadScheme> e : downloadSchemes) {
|
for (DynamicMap.Entry<DownloadScheme> e : downloadSchemes) {
|
||||||
String schemeName = e.getExportName();
|
String schemeName = e.getExportName();
|
||||||
DownloadScheme scheme = e.getProvider().get();
|
DownloadScheme scheme = e.getProvider().get();
|
||||||
|
@@ -19,11 +19,12 @@ import com.google.gerrit.reviewdb.client.Project;
|
|||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class GarbageCollectionQueue {
|
public class GarbageCollectionQueue {
|
||||||
private final Set<Project.NameKey> projectsScheduledForGc = Sets.newHashSet();
|
private final Set<Project.NameKey> projectsScheduledForGc = new HashSet<>();
|
||||||
|
|
||||||
public synchronized Set<Project.NameKey> addAll(Collection<Project.NameKey> projects) {
|
public synchronized Set<Project.NameKey> addAll(Collection<Project.NameKey> projects) {
|
||||||
Set<Project.NameKey> added =
|
Set<Project.NameKey> added =
|
||||||
|
@@ -17,12 +17,12 @@ package com.google.gerrit.server.git;
|
|||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.Nullable;
|
import com.google.gerrit.common.Nullable;
|
||||||
|
|
||||||
import org.eclipse.jgit.lib.ObjectId;
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,7 +50,7 @@ public class MergeTip {
|
|||||||
checkArgument(!toMerge.isEmpty(), "toMerge may not be empty");
|
checkArgument(!toMerge.isEmpty(), "toMerge may not be empty");
|
||||||
this.initialTip = initialTip;
|
this.initialTip = initialTip;
|
||||||
this.branchTip = initialTip;
|
this.branchTip = initialTip;
|
||||||
this.mergeResults = Maps.newHashMap();
|
this.mergeResults = new HashMap<>();
|
||||||
// Assume fast-forward merge until opposite is proven.
|
// Assume fast-forward merge until opposite is proven.
|
||||||
for (CodeReviewCommit commit : toMerge) {
|
for (CodeReviewCommit commit : toMerge) {
|
||||||
mergeResults.put(commit.copy(), commit.copy());
|
mergeResults.put(commit.copy(), commit.copy());
|
||||||
|
@@ -15,12 +15,12 @@
|
|||||||
package com.google.gerrit.server.git;
|
package com.google.gerrit.server.git;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.common.data.GroupReference;
|
import com.google.gerrit.common.data.GroupReference;
|
||||||
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
||||||
import com.google.gerrit.server.mail.Address;
|
import com.google.gerrit.server.mail.Address;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class NotifyConfig implements Comparable<NotifyConfig> {
|
public class NotifyConfig implements Comparable<NotifyConfig> {
|
||||||
@@ -33,8 +33,8 @@ public class NotifyConfig implements Comparable<NotifyConfig> {
|
|||||||
private String filter;
|
private String filter;
|
||||||
|
|
||||||
private Header header;
|
private Header header;
|
||||||
private Set<GroupReference> groups = Sets.newHashSet();
|
private Set<GroupReference> groups = new HashSet<>();
|
||||||
private Set<Address> addresses = Sets.newHashSet();
|
private Set<Address> addresses = new HashSet<>();
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.git;
|
package com.google.gerrit.server.git;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.server.config.RequestScopedReviewDbProvider;
|
import com.google.gerrit.server.config.RequestScopedReviewDbProvider;
|
||||||
import com.google.gerrit.server.util.RequestContext;
|
import com.google.gerrit.server.util.RequestContext;
|
||||||
import com.google.gerrit.server.util.ThreadLocalRequestContext;
|
import com.google.gerrit.server.util.ThreadLocalRequestContext;
|
||||||
@@ -25,6 +24,7 @@ import com.google.inject.OutOfScopeException;
|
|||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import com.google.inject.Scope;
|
import com.google.inject.Scope;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ public class PerThreadRequestScope {
|
|||||||
private final Map<Key<?>, Object> map;
|
private final Map<Key<?>, Object> map;
|
||||||
|
|
||||||
private Context() {
|
private Context() {
|
||||||
map = Maps.newHashMap();
|
map = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T get(Key<T> key, Provider<T> creator) {
|
private <T> T get(Key<T> key, Provider<T> creator) {
|
||||||
|
@@ -69,6 +69,7 @@ import java.util.Collections;
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -527,7 +528,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
|||||||
*/
|
*/
|
||||||
private void loadNotifySections(
|
private void loadNotifySections(
|
||||||
Config rc, Map<String, GroupReference> groupsByName) {
|
Config rc, Map<String, GroupReference> groupsByName) {
|
||||||
notifySections = Maps.newHashMap();
|
notifySections = new HashMap<>();
|
||||||
for (String sectionName : rc.getSubsections(NOTIFY)) {
|
for (String sectionName : rc.getSubsections(NOTIFY)) {
|
||||||
NotifyConfig n = new NotifyConfig();
|
NotifyConfig n = new NotifyConfig();
|
||||||
n.setName(sectionName);
|
n.setName(sectionName);
|
||||||
@@ -683,7 +684,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
|||||||
|
|
||||||
private void loadLabelSections(Config rc) {
|
private void loadLabelSections(Config rc) {
|
||||||
Map<String, String> lowerNames = Maps.newHashMapWithExpectedSize(2);
|
Map<String, String> lowerNames = Maps.newHashMapWithExpectedSize(2);
|
||||||
labelSections = Maps.newLinkedHashMap();
|
labelSections = new LinkedHashMap<>();
|
||||||
for (String name : rc.getSubsections(LABEL)) {
|
for (String name : rc.getSubsections(LABEL)) {
|
||||||
String lower = name.toLowerCase();
|
String lower = name.toLowerCase();
|
||||||
if (lowerNames.containsKey(lower)) {
|
if (lowerNames.containsKey(lower)) {
|
||||||
@@ -693,7 +694,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
|||||||
}
|
}
|
||||||
lowerNames.put(lower, name);
|
lowerNames.put(lower, name);
|
||||||
|
|
||||||
List<LabelValue> values = Lists.newArrayList();
|
List<LabelValue> values = new ArrayList<>();
|
||||||
for (String value : rc.getStringList(LABEL, name, KEY_VALUE)) {
|
for (String value : rc.getStringList(LABEL, name, KEY_VALUE)) {
|
||||||
try {
|
try {
|
||||||
values.add(parseLabelValue(value));
|
values.add(parseLabelValue(value));
|
||||||
@@ -818,7 +819,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadPluginSections(Config rc) {
|
private void loadPluginSections(Config rc) {
|
||||||
pluginConfigs = Maps.newHashMap();
|
pluginConfigs = new HashMap<>();
|
||||||
for (String plugin : rc.getSubsections(PLUGIN)) {
|
for (String plugin : rc.getSubsections(PLUGIN)) {
|
||||||
Config pluginConfig = new Config();
|
Config pluginConfig = new Config();
|
||||||
pluginConfigs.put(plugin, pluginConfig);
|
pluginConfigs.put(plugin, pluginConfig);
|
||||||
@@ -973,7 +974,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
|||||||
private void saveNotifySections(
|
private void saveNotifySections(
|
||||||
Config rc, Set<AccountGroup.UUID> keepGroups) {
|
Config rc, Set<AccountGroup.UUID> keepGroups) {
|
||||||
for (NotifyConfig nc : sort(notifySections.values())) {
|
for (NotifyConfig nc : sort(notifySections.values())) {
|
||||||
List<String> email = Lists.newArrayList();
|
List<String> email = new ArrayList<>();
|
||||||
for (GroupReference gr : nc.getGroups()) {
|
for (GroupReference gr : nc.getGroups()) {
|
||||||
if (gr.getUUID() != null) {
|
if (gr.getUUID() != null) {
|
||||||
keepGroups.add(gr.getUUID());
|
keepGroups.add(gr.getUUID());
|
||||||
@@ -982,7 +983,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
|||||||
}
|
}
|
||||||
Collections.sort(email);
|
Collections.sort(email);
|
||||||
|
|
||||||
List<String> addrs = Lists.newArrayList();
|
List<String> addrs = new ArrayList<>();
|
||||||
for (Address addr : nc.getAddresses()) {
|
for (Address addr : nc.getAddresses()) {
|
||||||
addrs.add(addr.toString());
|
addrs.add(addr.toString());
|
||||||
}
|
}
|
||||||
|
@@ -631,7 +631,7 @@ public class ReceiveCommits {
|
|||||||
rp.sendMessage(COMMAND_REJECTION_MESSAGE_FOOTER);
|
rp.sendMessage(COMMAND_REJECTION_MESSAGE_FOOTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<Branch.NameKey> branches = Sets.newHashSet();
|
Set<Branch.NameKey> branches = new HashSet<>();
|
||||||
for (ReceiveCommand c : commands) {
|
for (ReceiveCommand c : commands) {
|
||||||
if (c.getResult() == OK) {
|
if (c.getResult() == OK) {
|
||||||
if (c.getType() == ReceiveCommand.Type.UPDATE) { // aka fast-forward
|
if (c.getType() == ReceiveCommand.Type.UPDATE) { // aka fast-forward
|
||||||
@@ -789,7 +789,7 @@ public class ReceiveCommits {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> lastCreateChangeErrors = Lists.newArrayList();
|
List<String> lastCreateChangeErrors = new ArrayList<>();
|
||||||
for (CreateRequest create : newChanges) {
|
for (CreateRequest create : newChanges) {
|
||||||
if (create.cmd.getResult() == OK) {
|
if (create.cmd.getResult() == OK) {
|
||||||
okToInsert++;
|
okToInsert++;
|
||||||
@@ -819,7 +819,7 @@ public class ReceiveCommits {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<CheckedFuture<?, RestApiException>> futures = Lists.newArrayList();
|
List<CheckedFuture<?, RestApiException>> futures = new ArrayList<>();
|
||||||
for (ReplaceRequest replace : replaceByChange.values()) {
|
for (ReplaceRequest replace : replaceByChange.values()) {
|
||||||
if (replace.inputCommand == magicBranch.cmd) {
|
if (replace.inputCommand == magicBranch.cmd) {
|
||||||
futures.add(replace.insertPatchSet());
|
futures.add(replace.insertPatchSet());
|
||||||
@@ -1504,7 +1504,7 @@ public class ReceiveCommits {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void selectNewAndReplacedChangesFromMagicBranch() {
|
private void selectNewAndReplacedChangesFromMagicBranch() {
|
||||||
newChanges = Lists.newArrayList();
|
newChanges = new ArrayList<>();
|
||||||
|
|
||||||
SetMultimap<ObjectId, Ref> existing = changeRefsById();
|
SetMultimap<ObjectId, Ref> existing = changeRefsById();
|
||||||
GroupCollector groupCollector = GroupCollector.create(refsById, db, psUtil,
|
GroupCollector groupCollector = GroupCollector.create(refsById, db, psUtil,
|
||||||
@@ -1531,7 +1531,7 @@ public class ReceiveCommits {
|
|||||||
magicBranch.ctl != null ? magicBranch.ctl.getRefName() : null);
|
magicBranch.ctl != null ? magicBranch.ctl.getRefName() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ChangeLookup> pending = Lists.newArrayList();
|
List<ChangeLookup> pending = new ArrayList<>();
|
||||||
Set<Change.Key> newChangeIds = new HashSet<>();
|
Set<Change.Key> newChangeIds = new HashSet<>();
|
||||||
int maxBatchChanges =
|
int maxBatchChanges =
|
||||||
receiveConfig.getEffectiveMaxBatchChangesLimit(user);
|
receiveConfig.getEffectiveMaxBatchChangesLimit(user);
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.server.git;
|
package com.google.gerrit.server.git;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.dircache.DirCache;
|
import org.eclipse.jgit.dircache.DirCache;
|
||||||
import org.eclipse.jgit.dircache.DirCacheBuilder;
|
import org.eclipse.jgit.dircache.DirCacheBuilder;
|
||||||
@@ -50,6 +49,7 @@ import org.eclipse.jgit.util.RawParseUtils;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ public abstract class VersionedMetaData {
|
|||||||
TreeWalk tw = new TreeWalk(reader);
|
TreeWalk tw = new TreeWalk(reader);
|
||||||
tw.addTree(revision.getTree());
|
tw.addTree(revision.getTree());
|
||||||
tw.setRecursive(recursive);
|
tw.setRecursive(recursive);
|
||||||
List<PathInfo> paths = Lists.newArrayList();
|
List<PathInfo> paths = new ArrayList<>();
|
||||||
while (tw.next()) {
|
while (tw.next()) {
|
||||||
paths.add(new PathInfo(tw));
|
paths.add(new PathInfo(tw));
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.git;
|
package com.google.gerrit.server.git;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.util.concurrent.ListenableFutureTask;
|
import com.google.common.util.concurrent.ListenableFutureTask;
|
||||||
import com.google.gerrit.extensions.events.LifecycleListener;
|
import com.google.gerrit.extensions.events.LifecycleListener;
|
||||||
import com.google.gerrit.lifecycle.LifecycleModule;
|
import com.google.gerrit.lifecycle.LifecycleModule;
|
||||||
@@ -129,7 +128,7 @@ public class WorkQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public <T> List<T> getTaskInfos(TaskInfoFactory<T> factory) {
|
public <T> List<T> getTaskInfos(TaskInfoFactory<T> factory) {
|
||||||
List<T> taskInfos = Lists.newArrayList();
|
List<T> taskInfos = new ArrayList<>();
|
||||||
for (Executor exe : queues) {
|
for (Executor exe : queues) {
|
||||||
for (Task<?> task : exe.getTasks()) {
|
for (Task<?> task : exe.getTasks()) {
|
||||||
taskInfos.add(factory.getTaskInfo(task));
|
taskInfos.add(factory.getTaskInfo(task));
|
||||||
|
@@ -21,7 +21,6 @@ import static com.google.gerrit.server.notedb.ReviewerStateInternal.REVIEWER;
|
|||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.data.SubmitRecord;
|
import com.google.gerrit.common.data.SubmitRecord;
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
import com.google.gerrit.reviewdb.client.Branch;
|
import com.google.gerrit.reviewdb.client.Branch;
|
||||||
@@ -63,6 +62,7 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -327,7 +327,7 @@ abstract class SubmitStrategyOp extends BatchUpdate.Op {
|
|||||||
private LabelNormalizer.Result approve(ChangeContext ctx, ChangeUpdate update)
|
private LabelNormalizer.Result approve(ChangeContext ctx, ChangeUpdate update)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
PatchSet.Id psId = update.getPatchSetId();
|
PatchSet.Id psId = update.getPatchSetId();
|
||||||
Map<PatchSetApproval.Key, PatchSetApproval> byKey = Maps.newHashMap();
|
Map<PatchSetApproval.Key, PatchSetApproval> byKey = new HashMap<>();
|
||||||
for (PatchSetApproval psa : args.approvalsUtil.byPatchSet(
|
for (PatchSetApproval psa : args.approvalsUtil.byPatchSet(
|
||||||
ctx.getDb(), ctx.getControl(), psId)) {
|
ctx.getDb(), ctx.getControl(), psId)) {
|
||||||
byKey.put(psa.getKey(), psa);
|
byKey.put(psa.getKey(), psa);
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.git.validators;
|
package com.google.gerrit.server.git.validators;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||||
import com.google.gerrit.extensions.registration.DynamicMap.Entry;
|
import com.google.gerrit.extensions.registration.DynamicMap.Entry;
|
||||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||||
@@ -36,6 +35,7 @@ import org.eclipse.jgit.errors.ConfigInvalidException;
|
|||||||
import org.eclipse.jgit.lib.Repository;
|
import org.eclipse.jgit.lib.Repository;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MergeValidators {
|
public class MergeValidators {
|
||||||
@@ -60,7 +60,7 @@ public class MergeValidators {
|
|||||||
PatchSet.Id patchSetId,
|
PatchSet.Id patchSetId,
|
||||||
IdentifiedUser caller)
|
IdentifiedUser caller)
|
||||||
throws MergeValidationException {
|
throws MergeValidationException {
|
||||||
List<MergeValidationListener> validators = Lists.newLinkedList();
|
List<MergeValidationListener> validators = new LinkedList<>();
|
||||||
|
|
||||||
validators.add(new PluginMergeValidationListener(mergeValidationListeners));
|
validators.add(new PluginMergeValidationListener(mergeValidationListeners));
|
||||||
validators.add(projectConfigValidatorFactory.create());
|
validators.add(projectConfigValidatorFactory.create());
|
||||||
|
@@ -15,7 +15,6 @@ package com.google.gerrit.server.git.validators;
|
|||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.extensions.registration.DynamicSet;
|
import com.google.gerrit.extensions.registration.DynamicSet;
|
||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
import com.google.gerrit.server.IdentifiedUser;
|
import com.google.gerrit.server.IdentifiedUser;
|
||||||
@@ -29,6 +28,7 @@ import org.eclipse.jgit.transport.ReceiveCommand;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RefOperationValidators {
|
public class RefOperationValidators {
|
||||||
@@ -63,7 +63,7 @@ public class RefOperationValidators {
|
|||||||
public List<ValidationMessage> validateForRefOperation()
|
public List<ValidationMessage> validateForRefOperation()
|
||||||
throws RefOperationValidationException {
|
throws RefOperationValidationException {
|
||||||
|
|
||||||
List<ValidationMessage> messages = Lists.newArrayList();
|
List<ValidationMessage> messages = new ArrayList<>();
|
||||||
boolean withException = false;
|
boolean withException = false;
|
||||||
try {
|
try {
|
||||||
for (RefOperationValidationListener listener : refOperationValidationListeners) {
|
for (RefOperationValidationListener listener : refOperationValidationListeners) {
|
||||||
|
@@ -17,7 +17,6 @@ package com.google.gerrit.server.group;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.audit.AuditService;
|
import com.google.gerrit.audit.AuditService;
|
||||||
import com.google.gerrit.common.data.GroupDescription;
|
import com.google.gerrit.common.data.GroupDescription;
|
||||||
import com.google.gerrit.extensions.common.GroupInfo;
|
import com.google.gerrit.extensions.common.GroupInfo;
|
||||||
@@ -39,6 +38,8 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -98,8 +99,8 @@ public class AddIncludedGroups implements RestModifyView<GroupResource, Input> {
|
|||||||
input = Input.init(input);
|
input = Input.init(input);
|
||||||
|
|
||||||
GroupControl control = resource.getControl();
|
GroupControl control = resource.getControl();
|
||||||
Map<AccountGroup.UUID, AccountGroupById> newIncludedGroups = Maps.newHashMap();
|
Map<AccountGroup.UUID, AccountGroupById> newIncludedGroups = new HashMap<>();
|
||||||
List<GroupInfo> result = Lists.newLinkedList();
|
List<GroupInfo> result = new LinkedList<>();
|
||||||
Account.Id me = control.getUser().getAccountId();
|
Account.Id me = control.getUser().getAccountId();
|
||||||
|
|
||||||
for (String includedGroup : input.groups) {
|
for (String includedGroup : input.groups) {
|
||||||
|
@@ -16,7 +16,6 @@ package com.google.gerrit.server.group;
|
|||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.audit.AuditService;
|
import com.google.gerrit.audit.AuditService;
|
||||||
import com.google.gerrit.extensions.common.AccountInfo;
|
import com.google.gerrit.extensions.common.AccountInfo;
|
||||||
import com.google.gerrit.extensions.restapi.AuthException;
|
import com.google.gerrit.extensions.restapi.AuthException;
|
||||||
@@ -47,7 +46,9 @@ import com.google.inject.Provider;
|
|||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -174,7 +175,7 @@ public class AddMembers implements RestModifyView<GroupResource, Input> {
|
|||||||
|
|
||||||
public void addMembers(AccountGroup.Id groupId,
|
public void addMembers(AccountGroup.Id groupId,
|
||||||
Collection<? extends Account.Id> newMemberIds) throws OrmException {
|
Collection<? extends Account.Id> newMemberIds) throws OrmException {
|
||||||
Map<Account.Id, AccountGroupMember> newAccountGroupMembers = Maps.newHashMap();
|
Map<Account.Id, AccountGroupMember> newAccountGroupMembers = new HashMap<>();
|
||||||
for (Account.Id accId : newMemberIds) {
|
for (Account.Id accId : newMemberIds) {
|
||||||
if (!newAccountGroupMembers.containsKey(accId)) {
|
if (!newAccountGroupMembers.containsKey(accId)) {
|
||||||
AccountGroupMember.Key key =
|
AccountGroupMember.Key key =
|
||||||
@@ -212,7 +213,7 @@ public class AddMembers implements RestModifyView<GroupResource, Input> {
|
|||||||
|
|
||||||
private List<AccountInfo> toAccountInfoList(Set<Account.Id> accountIds)
|
private List<AccountInfo> toAccountInfoList(Set<Account.Id> accountIds)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
List<AccountInfo> result = Lists.newLinkedList();
|
List<AccountInfo> result = new LinkedList<>();
|
||||||
AccountLoader loader = infoFactory.create(true);
|
AccountLoader loader = infoFactory.create(true);
|
||||||
for (Account.Id accId : accountIds) {
|
for (Account.Id accId : accountIds) {
|
||||||
result.add(loader.get(accId));
|
result.add(loader.get(accId));
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.server.group;
|
package com.google.gerrit.server.group;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.audit.GroupMemberAuditListener;
|
import com.google.gerrit.audit.GroupMemberAuditListener;
|
||||||
import com.google.gerrit.common.TimeUtil;
|
import com.google.gerrit.common.TimeUtil;
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
@@ -37,6 +36,7 @@ import org.slf4j.Logger;
|
|||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
class DbGroupMemberAuditListener implements GroupMemberAuditListener {
|
class DbGroupMemberAuditListener implements GroupMemberAuditListener {
|
||||||
@@ -61,7 +61,7 @@ class DbGroupMemberAuditListener implements GroupMemberAuditListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onAddAccountsToGroup(Account.Id me,
|
public void onAddAccountsToGroup(Account.Id me,
|
||||||
Collection<AccountGroupMember> added) {
|
Collection<AccountGroupMember> added) {
|
||||||
List<AccountGroupMemberAudit> auditInserts = Lists.newLinkedList();
|
List<AccountGroupMemberAudit> auditInserts = new LinkedList<>();
|
||||||
for (AccountGroupMember m : added) {
|
for (AccountGroupMember m : added) {
|
||||||
AccountGroupMemberAudit audit =
|
AccountGroupMemberAudit audit =
|
||||||
new AccountGroupMemberAudit(m, me, TimeUtil.nowTs());
|
new AccountGroupMemberAudit(m, me, TimeUtil.nowTs());
|
||||||
@@ -79,8 +79,8 @@ class DbGroupMemberAuditListener implements GroupMemberAuditListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onDeleteAccountsFromGroup(Account.Id me,
|
public void onDeleteAccountsFromGroup(Account.Id me,
|
||||||
Collection<AccountGroupMember> removed) {
|
Collection<AccountGroupMember> removed) {
|
||||||
List<AccountGroupMemberAudit> auditInserts = Lists.newLinkedList();
|
List<AccountGroupMemberAudit> auditInserts = new LinkedList<>();
|
||||||
List<AccountGroupMemberAudit> auditUpdates = Lists.newLinkedList();
|
List<AccountGroupMemberAudit> auditUpdates = new LinkedList<>();
|
||||||
try (ReviewDb db = schema.open()) {
|
try (ReviewDb db = schema.open()) {
|
||||||
for (AccountGroupMember m : removed) {
|
for (AccountGroupMember m : removed) {
|
||||||
AccountGroupMemberAudit audit = null;
|
AccountGroupMemberAudit audit = null;
|
||||||
@@ -131,7 +131,7 @@ class DbGroupMemberAuditListener implements GroupMemberAuditListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onDeleteGroupsFromGroup(Account.Id me,
|
public void onDeleteGroupsFromGroup(Account.Id me,
|
||||||
Collection<AccountGroupById> removed) {
|
Collection<AccountGroupById> removed) {
|
||||||
final List<AccountGroupByIdAud> auditUpdates = Lists.newLinkedList();
|
final List<AccountGroupByIdAud> auditUpdates = new LinkedList<>();
|
||||||
try (ReviewDb db = schema.open()) {
|
try (ReviewDb db = schema.open()) {
|
||||||
for (final AccountGroupById g : removed) {
|
for (final AccountGroupById g : removed) {
|
||||||
AccountGroupByIdAud audit = null;
|
AccountGroupByIdAud audit = null;
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
package com.google.gerrit.server.group;
|
package com.google.gerrit.server.group;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.audit.AuditService;
|
import com.google.gerrit.audit.AuditService;
|
||||||
import com.google.gerrit.common.data.GroupDescription;
|
import com.google.gerrit.common.data.GroupDescription;
|
||||||
import com.google.gerrit.extensions.restapi.AuthException;
|
import com.google.gerrit.extensions.restapi.AuthException;
|
||||||
@@ -37,6 +35,8 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public class DeleteIncludedGroups implements RestModifyView<GroupResource, Input
|
|||||||
|
|
||||||
final GroupControl control = resource.getControl();
|
final GroupControl control = resource.getControl();
|
||||||
final Map<AccountGroup.UUID, AccountGroupById> includedGroups = getIncludedGroups(internalGroup.getId());
|
final Map<AccountGroup.UUID, AccountGroupById> includedGroups = getIncludedGroups(internalGroup.getId());
|
||||||
final List<AccountGroupById> toRemove = Lists.newLinkedList();
|
final List<AccountGroupById> toRemove = new LinkedList<>();
|
||||||
|
|
||||||
for (final String includedGroup : input.groups) {
|
for (final String includedGroup : input.groups) {
|
||||||
GroupDescription.Basic d = groupsCollection.parse(includedGroup);
|
GroupDescription.Basic d = groupsCollection.parse(includedGroup);
|
||||||
@@ -100,8 +100,7 @@ public class DeleteIncludedGroups implements RestModifyView<GroupResource, Input
|
|||||||
|
|
||||||
private Map<AccountGroup.UUID, AccountGroupById> getIncludedGroups(
|
private Map<AccountGroup.UUID, AccountGroupById> getIncludedGroups(
|
||||||
final AccountGroup.Id groupId) throws OrmException {
|
final AccountGroup.Id groupId) throws OrmException {
|
||||||
final Map<AccountGroup.UUID, AccountGroupById> groups =
|
final Map<AccountGroup.UUID, AccountGroupById> groups = new HashMap<>();
|
||||||
Maps.newHashMap();
|
|
||||||
for (AccountGroupById g : db.get().accountGroupById().byGroup(groupId)) {
|
for (AccountGroupById g : db.get().accountGroupById().byGroup(groupId)) {
|
||||||
groups.put(g.getIncludeUUID(), g);
|
groups.put(g.getIncludeUUID(), g);
|
||||||
}
|
}
|
||||||
|
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.group;
|
package com.google.gerrit.server.group;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.audit.AuditService;
|
import com.google.gerrit.audit.AuditService;
|
||||||
import com.google.gerrit.extensions.restapi.AuthException;
|
import com.google.gerrit.extensions.restapi.AuthException;
|
||||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||||
@@ -36,6 +34,8 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public class DeleteMembers implements RestModifyView<GroupResource, Input> {
|
|||||||
|
|
||||||
final GroupControl control = resource.getControl();
|
final GroupControl control = resource.getControl();
|
||||||
final Map<Account.Id, AccountGroupMember> members = getMembers(internalGroup.getId());
|
final Map<Account.Id, AccountGroupMember> members = getMembers(internalGroup.getId());
|
||||||
final List<AccountGroupMember> toRemove = Lists.newLinkedList();
|
final List<AccountGroupMember> toRemove = new LinkedList<>();
|
||||||
|
|
||||||
for (final String nameOrEmail : input.members) {
|
for (final String nameOrEmail : input.members) {
|
||||||
Account a = accounts.parse(nameOrEmail).getAccount();
|
Account a = accounts.parse(nameOrEmail).getAccount();
|
||||||
@@ -102,7 +102,7 @@ public class DeleteMembers implements RestModifyView<GroupResource, Input> {
|
|||||||
|
|
||||||
private Map<Account.Id, AccountGroupMember> getMembers(
|
private Map<Account.Id, AccountGroupMember> getMembers(
|
||||||
final AccountGroup.Id groupId) throws OrmException {
|
final AccountGroup.Id groupId) throws OrmException {
|
||||||
final Map<Account.Id, AccountGroupMember> members = Maps.newHashMap();
|
final Map<Account.Id, AccountGroupMember> members = new HashMap<>();
|
||||||
for (final AccountGroupMember m : db.get().accountGroupMembers()
|
for (final AccountGroupMember m : db.get().accountGroupMembers()
|
||||||
.byGroup(groupId)) {
|
.byGroup(groupId)) {
|
||||||
members.put(m.getAccountId(), m);
|
members.put(m.getAccountId(), m);
|
||||||
|
@@ -14,12 +14,12 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.group;
|
package com.google.gerrit.server.group;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.data.GroupDescription;
|
import com.google.gerrit.common.data.GroupDescription;
|
||||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||||
import com.google.gerrit.server.account.GroupBackend;
|
import com.google.gerrit.server.account.GroupBackend;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/** Efficiently builds a {@link GroupInfoCache}. */
|
/** Efficiently builds a {@link GroupInfoCache}. */
|
||||||
@@ -34,7 +34,7 @@ public class GroupInfoCacheFactory {
|
|||||||
@Inject
|
@Inject
|
||||||
GroupInfoCacheFactory(GroupBackend groupBackend) {
|
GroupInfoCacheFactory(GroupBackend groupBackend) {
|
||||||
this.groupBackend = groupBackend;
|
this.groupBackend = groupBackend;
|
||||||
this.out = Maps.newHashMap();
|
this.out = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -18,8 +18,6 @@ import com.google.common.base.MoreObjects;
|
|||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.common.data.GroupDescription;
|
import com.google.gerrit.common.data.GroupDescription;
|
||||||
import com.google.gerrit.common.data.GroupDescriptions;
|
import com.google.gerrit.common.data.GroupDescriptions;
|
||||||
import com.google.gerrit.common.data.GroupReference;
|
import com.google.gerrit.common.data.GroupReference;
|
||||||
@@ -49,11 +47,14 @@ import org.kohsuke.args4j.Option;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/** List groups visible to the calling user. */
|
/** List groups visible to the calling user. */
|
||||||
public class ListGroups implements RestReadView<TopLevelResource> {
|
public class ListGroups implements RestReadView<TopLevelResource> {
|
||||||
@@ -61,7 +62,7 @@ public class ListGroups implements RestReadView<TopLevelResource> {
|
|||||||
protected final GroupCache groupCache;
|
protected final GroupCache groupCache;
|
||||||
|
|
||||||
private final List<ProjectControl> projects = new ArrayList<>();
|
private final List<ProjectControl> projects = new ArrayList<>();
|
||||||
private final Set<AccountGroup.UUID> groupsToInspect = Sets.newHashSet();
|
private final Set<AccountGroup.UUID> groupsToInspect = new HashSet<>();
|
||||||
private final GroupControl.Factory groupControlFactory;
|
private final GroupControl.Factory groupControlFactory;
|
||||||
private final GroupControl.GenericFactory genericGroupControlFactory;
|
private final GroupControl.GenericFactory genericGroupControlFactory;
|
||||||
private final Provider<IdentifiedUser> identifiedUser;
|
private final Provider<IdentifiedUser> identifiedUser;
|
||||||
@@ -177,7 +178,7 @@ public class ListGroups implements RestReadView<TopLevelResource> {
|
|||||||
@Override
|
@Override
|
||||||
public SortedMap<String, GroupInfo> apply(TopLevelResource resource)
|
public SortedMap<String, GroupInfo> apply(TopLevelResource resource)
|
||||||
throws OrmException, BadRequestException {
|
throws OrmException, BadRequestException {
|
||||||
SortedMap<String, GroupInfo> output = Maps.newTreeMap();
|
SortedMap<String, GroupInfo> output = new TreeMap<>();
|
||||||
for (GroupInfo info : get()) {
|
for (GroupInfo info : get()) {
|
||||||
output.put(MoreObjects.firstNonNull(
|
output.put(MoreObjects.firstNonNull(
|
||||||
info.name,
|
info.name,
|
||||||
@@ -209,7 +210,7 @@ public class ListGroups implements RestReadView<TopLevelResource> {
|
|||||||
List<GroupInfo> groupInfos;
|
List<GroupInfo> groupInfos;
|
||||||
List<AccountGroup> groupList;
|
List<AccountGroup> groupList;
|
||||||
if (!projects.isEmpty()) {
|
if (!projects.isEmpty()) {
|
||||||
Map<AccountGroup.UUID, AccountGroup> groups = Maps.newHashMap();
|
Map<AccountGroup.UUID, AccountGroup> groups = new HashMap<>();
|
||||||
for (final ProjectControl projectControl : projects) {
|
for (final ProjectControl projectControl : projects) {
|
||||||
final Set<GroupReference> groupsRefs = projectControl.getAllGroups();
|
final Set<GroupReference> groupsRefs = projectControl.getAllGroups();
|
||||||
for (final GroupReference groupRef : groupsRefs) {
|
for (final GroupReference groupRef : groupsRefs) {
|
||||||
@@ -290,7 +291,7 @@ public class ListGroups implements RestReadView<TopLevelResource> {
|
|||||||
|
|
||||||
private List<GroupInfo> getGroupsOwnedBy(IdentifiedUser user)
|
private List<GroupInfo> getGroupsOwnedBy(IdentifiedUser user)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
List<GroupInfo> groups = Lists.newArrayList();
|
List<GroupInfo> groups = new ArrayList<>();
|
||||||
int found = 0;
|
int found = 0;
|
||||||
int foundIndex = 0;
|
int foundIndex = 0;
|
||||||
for (AccountGroup g : filterGroups(groupCache.all())) {
|
for (AccountGroup g : filterGroups(groupCache.all())) {
|
||||||
@@ -314,7 +315,7 @@ public class ListGroups implements RestReadView<TopLevelResource> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<AccountGroup> filterGroups(final Iterable<AccountGroup> groups) {
|
private List<AccountGroup> filterGroups(final Iterable<AccountGroup> groups) {
|
||||||
final List<AccountGroup> filteredGroups = Lists.newArrayList();
|
final List<AccountGroup> filteredGroups = new ArrayList<>();
|
||||||
final boolean isAdmin =
|
final boolean isAdmin =
|
||||||
identifiedUser.get().getCapabilities().canAdministrateServer();
|
identifiedUser.get().getCapabilities().canAdministrateServer();
|
||||||
for (final AccountGroup group : groups) {
|
for (final AccountGroup group : groups) {
|
||||||
|
@@ -16,7 +16,6 @@ package com.google.gerrit.server.group;
|
|||||||
|
|
||||||
import static com.google.common.base.Strings.nullToEmpty;
|
import static com.google.common.base.Strings.nullToEmpty;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.common.errors.NoSuchGroupException;
|
import com.google.gerrit.common.errors.NoSuchGroupException;
|
||||||
import com.google.gerrit.extensions.common.GroupInfo;
|
import com.google.gerrit.extensions.common.GroupInfo;
|
||||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||||
@@ -31,6 +30,7 @@ import com.google.inject.Singleton;
|
|||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -59,7 +59,7 @@ public class ListIncludedGroups implements RestReadView<GroupResource> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean ownerOfParent = rsrc.getControl().isOwner();
|
boolean ownerOfParent = rsrc.getControl().isOwner();
|
||||||
List<GroupInfo> included = Lists.newArrayList();
|
List<GroupInfo> included = new ArrayList<>();
|
||||||
for (AccountGroupById u : dbProvider.get()
|
for (AccountGroupById u : dbProvider.get()
|
||||||
.accountGroupById()
|
.accountGroupById()
|
||||||
.byGroup(rsrc.toAccountGroup().getId())) {
|
.byGroup(rsrc.toAccountGroup().getId())) {
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.server.group;
|
package com.google.gerrit.server.group;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.data.GroupDetail;
|
import com.google.gerrit.common.data.GroupDetail;
|
||||||
import com.google.gerrit.common.errors.NoSuchGroupException;
|
import com.google.gerrit.common.errors.NoSuchGroupException;
|
||||||
import com.google.gerrit.extensions.common.AccountInfo;
|
import com.google.gerrit.extensions.common.AccountInfo;
|
||||||
@@ -35,6 +34,7 @@ import com.google.inject.Inject;
|
|||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -90,7 +90,7 @@ public class ListMembers implements RestReadView<GroupResource> {
|
|||||||
final HashSet<AccountGroup.UUID> seenGroups) throws OrmException {
|
final HashSet<AccountGroup.UUID> seenGroups) throws OrmException {
|
||||||
seenGroups.add(groupUUID);
|
seenGroups.add(groupUUID);
|
||||||
|
|
||||||
final Map<Account.Id, AccountInfo> members = Maps.newHashMap();
|
final Map<Account.Id, AccountInfo> members = new HashMap<>();
|
||||||
final AccountGroup group = groupCache.get(groupUUID);
|
final AccountGroup group = groupCache.get(groupUUID);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
// the included group is an external group and can't be resolved
|
// the included group is an external group and can't be resolved
|
||||||
|
@@ -22,8 +22,6 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableSortedMap;
|
import com.google.common.collect.ImmutableSortedMap;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.lib.PersonIdent;
|
import org.eclipse.jgit.lib.PersonIdent;
|
||||||
|
|
||||||
@@ -32,6 +30,7 @@ import java.lang.reflect.Modifier;
|
|||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -39,7 +38,7 @@ import java.util.Set;
|
|||||||
public class SchemaUtil {
|
public class SchemaUtil {
|
||||||
public static <V> ImmutableSortedMap<Integer, Schema<V>> schemasFromClass(
|
public static <V> ImmutableSortedMap<Integer, Schema<V>> schemasFromClass(
|
||||||
Class<?> schemasClass, Class<V> valueClass) {
|
Class<?> schemasClass, Class<V> valueClass) {
|
||||||
Map<Integer, Schema<V>> schemas = Maps.newHashMap();
|
Map<Integer, Schema<V>> schemas = new HashMap<>();
|
||||||
for (Field f : schemasClass.getDeclaredFields()) {
|
for (Field f : schemasClass.getDeclaredFields()) {
|
||||||
if (Modifier.isStatic(f.getModifiers())
|
if (Modifier.isStatic(f.getModifiers())
|
||||||
&& Modifier.isFinal(f.getModifiers())
|
&& Modifier.isFinal(f.getModifiers())
|
||||||
@@ -100,7 +99,7 @@ public class SchemaUtil {
|
|||||||
Iterable<String> emails) {
|
Iterable<String> emails) {
|
||||||
Splitter at = Splitter.on('@');
|
Splitter at = Splitter.on('@');
|
||||||
Splitter s = Splitter.on(CharMatcher.anyOf("@.- ")).omitEmptyStrings();
|
Splitter s = Splitter.on(CharMatcher.anyOf("@.- ")).omitEmptyStrings();
|
||||||
HashSet<String> parts = Sets.newHashSet();
|
HashSet<String> parts = new HashSet<>();
|
||||||
for (String email : emails) {
|
for (String email : emails) {
|
||||||
if (email == null) {
|
if (email == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@@ -66,6 +66,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -147,7 +148,7 @@ public class AllChangesIndexer
|
|||||||
totalWork >= 0 ? totalWork : MultiProgressMonitor.UNKNOWN);
|
totalWork >= 0 ? totalWork : MultiProgressMonitor.UNKNOWN);
|
||||||
final Task failedTask = mpm.beginSubTask("failed", MultiProgressMonitor.UNKNOWN);
|
final Task failedTask = mpm.beginSubTask("failed", MultiProgressMonitor.UNKNOWN);
|
||||||
|
|
||||||
final List<ListenableFuture<?>> futures = Lists.newArrayList();
|
final List<ListenableFuture<?>> futures = new ArrayList<>();
|
||||||
final AtomicBoolean ok = new AtomicBoolean(true);
|
final AtomicBoolean ok = new AtomicBoolean(true);
|
||||||
|
|
||||||
for (final Project.NameKey project : projects) {
|
for (final Project.NameKey project : projects) {
|
||||||
|
@@ -222,7 +222,7 @@ public class ChangeField {
|
|||||||
return ImmutableSet.of();
|
return ImmutableSet.of();
|
||||||
}
|
}
|
||||||
Splitter s = Splitter.on('/').omitEmptyStrings();
|
Splitter s = Splitter.on('/').omitEmptyStrings();
|
||||||
Set<String> r = Sets.newHashSet();
|
Set<String> r = new HashSet<>();
|
||||||
for (String path : paths) {
|
for (String path : paths) {
|
||||||
for (String part : s.split(path)) {
|
for (String part : s.split(path)) {
|
||||||
r.add(part);
|
r.add(part);
|
||||||
@@ -302,7 +302,7 @@ public class ChangeField {
|
|||||||
if (c == null) {
|
if (c == null) {
|
||||||
return ImmutableSet.of();
|
return ImmutableSet.of();
|
||||||
}
|
}
|
||||||
Set<Integer> r = Sets.newHashSet();
|
Set<Integer> r = new HashSet<>();
|
||||||
if (!args.allowsDrafts && c.getStatus() == Change.Status.DRAFT) {
|
if (!args.allowsDrafts && c.getStatus() == Change.Status.DRAFT) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -336,7 +336,7 @@ public class ChangeField {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private static Set<String> getRevisions(ChangeData cd) throws OrmException {
|
private static Set<String> getRevisions(ChangeData cd) throws OrmException {
|
||||||
Set<String> revisions = Sets.newHashSet();
|
Set<String> revisions = new HashSet<>();
|
||||||
for (PatchSet ps : cd.patchSets()) {
|
for (PatchSet ps : cd.patchSets()) {
|
||||||
if (ps.getRevision() != null) {
|
if (ps.getRevision() != null) {
|
||||||
revisions.add(ps.getRevision().get());
|
revisions.add(ps.getRevision().get());
|
||||||
@@ -372,8 +372,8 @@ public class ChangeField {
|
|||||||
@Override
|
@Override
|
||||||
public Iterable<String> get(ChangeData input, FillArgs args)
|
public Iterable<String> get(ChangeData input, FillArgs args)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
Set<String> allApprovals = Sets.newHashSet();
|
Set<String> allApprovals = new HashSet<>();
|
||||||
Set<String> distinctApprovals = Sets.newHashSet();
|
Set<String> distinctApprovals = new HashSet<>();
|
||||||
for (PatchSetApproval a : input.currentApprovals()) {
|
for (PatchSetApproval a : input.currentApprovals()) {
|
||||||
if (a.getValue() != 0 && !a.isLegacySubmit()) {
|
if (a.getValue() != 0 && !a.isLegacySubmit()) {
|
||||||
allApprovals.add(formatLabel(a.getLabel(), a.getValue(),
|
allApprovals.add(formatLabel(a.getLabel(), a.getValue(),
|
||||||
@@ -505,7 +505,7 @@ public class ChangeField {
|
|||||||
@Override
|
@Override
|
||||||
public Iterable<String> get(ChangeData input, FillArgs args)
|
public Iterable<String> get(ChangeData input, FillArgs args)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
Set<String> r = Sets.newHashSet();
|
Set<String> r = new HashSet<>();
|
||||||
for (PatchLineComment c : input.publishedComments()) {
|
for (PatchLineComment c : input.publishedComments()) {
|
||||||
r.add(c.getMessage());
|
r.add(c.getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -16,9 +16,9 @@ package com.google.gerrit.server.mail;
|
|||||||
|
|
||||||
import com.google.gerrit.common.errors.EmailException;
|
import com.google.gerrit.common.errors.EmailException;
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
|
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
||||||
import com.google.gerrit.reviewdb.client.Change;
|
import com.google.gerrit.reviewdb.client.Change;
|
||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
import com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType;
|
|
||||||
import com.google.gwtorm.server.OrmException;
|
import com.google.gwtorm.server.OrmException;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.assistedinject.Assisted;
|
import com.google.inject.assistedinject.Assisted;
|
||||||
|
@@ -18,7 +18,6 @@ import static com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailSt
|
|||||||
import static com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.DISABLED;
|
import static com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.DISABLED;
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.common.errors.EmailException;
|
import com.google.gerrit.common.errors.EmailException;
|
||||||
import com.google.gerrit.extensions.api.changes.ReviewInput.NotifyHandling;
|
import com.google.gerrit.extensions.api.changes.ReviewInput.NotifyHandling;
|
||||||
import com.google.gerrit.extensions.client.GeneralPreferencesInfo;
|
import com.google.gerrit.extensions.client.GeneralPreferencesInfo;
|
||||||
@@ -63,7 +62,7 @@ public abstract class OutgoingEmail {
|
|||||||
protected String messageClass;
|
protected String messageClass;
|
||||||
private final HashSet<Account.Id> rcptTo = new HashSet<>();
|
private final HashSet<Account.Id> rcptTo = new HashSet<>();
|
||||||
private final Map<String, EmailHeader> headers;
|
private final Map<String, EmailHeader> headers;
|
||||||
private final Set<Address> smtpRcptTo = Sets.newHashSet();
|
private final Set<Address> smtpRcptTo = new HashSet<>();
|
||||||
private Address smtpFromAddress;
|
private Address smtpFromAddress;
|
||||||
private StringBuilder body;
|
private StringBuilder body;
|
||||||
protected VelocityContext velocityContext;
|
protected VelocityContext velocityContext;
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
package com.google.gerrit.server.mail;
|
package com.google.gerrit.server.mail;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.common.data.GroupDescription;
|
import com.google.gerrit.common.data.GroupDescription;
|
||||||
import com.google.gerrit.common.data.GroupDescriptions;
|
import com.google.gerrit.common.data.GroupDescriptions;
|
||||||
import com.google.gerrit.common.data.GroupReference;
|
import com.google.gerrit.common.data.GroupReference;
|
||||||
@@ -41,6 +39,7 @@ import com.google.gwtorm.server.OrmException;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -100,8 +99,8 @@ public class ProjectWatch {
|
|||||||
|
|
||||||
public static class Watchers {
|
public static class Watchers {
|
||||||
static class List {
|
static class List {
|
||||||
protected final Set<Account.Id> accounts = Sets.newHashSet();
|
protected final Set<Account.Id> accounts = new HashSet<>();
|
||||||
protected final Set<Address> emails = Sets.newHashSet();
|
protected final Set<Address> emails = new HashSet<>();
|
||||||
}
|
}
|
||||||
protected final List to = new List();
|
protected final List to = new List();
|
||||||
protected final List cc = new List();
|
protected final List cc = new List();
|
||||||
@@ -141,8 +140,8 @@ public class ProjectWatch {
|
|||||||
Watchers.List matching,
|
Watchers.List matching,
|
||||||
AccountGroup.UUID startUUID) throws OrmException {
|
AccountGroup.UUID startUUID) throws OrmException {
|
||||||
ReviewDb db = args.db.get();
|
ReviewDb db = args.db.get();
|
||||||
Set<AccountGroup.UUID> seen = Sets.newHashSet();
|
Set<AccountGroup.UUID> seen = new HashSet<>();
|
||||||
List<AccountGroup.UUID> q = Lists.newArrayList();
|
List<AccountGroup.UUID> q = new ArrayList<>();
|
||||||
|
|
||||||
seen.add(startUUID);
|
seen.add(startUUID);
|
||||||
q.add(startUUID);
|
q.add(startUUID);
|
||||||
|
@@ -21,7 +21,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
import com.google.gerrit.reviewdb.client.Account;
|
import com.google.gerrit.reviewdb.client.Account;
|
||||||
@@ -54,6 +53,7 @@ import java.io.OutputStreamWriter;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -147,7 +147,7 @@ public class ChangeNoteUtil {
|
|||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
Set<PatchLineComment.Key> seen = new HashSet<>();
|
Set<PatchLineComment.Key> seen = new HashSet<>();
|
||||||
List<PatchLineComment> result = Lists.newArrayList();
|
List<PatchLineComment> result = new ArrayList<>();
|
||||||
int sizeOfNote = note.length;
|
int sizeOfNote = note.length;
|
||||||
byte[] psb = PATCH_SET.getBytes(UTF_8);
|
byte[] psb = PATCH_SET.getBytes(UTF_8);
|
||||||
byte[] bpsb = BASE_PATCH_SET.getBytes(UTF_8);
|
byte[] bpsb = BASE_PATCH_SET.getBytes(UTF_8);
|
||||||
|
@@ -82,7 +82,9 @@ import java.sql.Timestamp;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -139,15 +141,15 @@ class ChangeNotesParser implements AutoCloseable {
|
|||||||
this.repo = repoManager.openRepository(project);
|
this.repo = repoManager.openRepository(project);
|
||||||
this.noteUtil = noteUtil;
|
this.noteUtil = noteUtil;
|
||||||
this.metrics = metrics;
|
this.metrics = metrics;
|
||||||
approvals = Maps.newHashMap();
|
approvals = new HashMap<>();
|
||||||
reviewers = Maps.newLinkedHashMap();
|
reviewers = new LinkedHashMap<>();
|
||||||
allPastReviewers = Lists.newArrayList();
|
allPastReviewers = new ArrayList<>();
|
||||||
submitRecords = Lists.newArrayListWithExpectedSize(1);
|
submitRecords = Lists.newArrayListWithExpectedSize(1);
|
||||||
allChangeMessages = Lists.newArrayList();
|
allChangeMessages = new ArrayList<>();
|
||||||
changeMessagesByPatchSet = LinkedListMultimap.create();
|
changeMessagesByPatchSet = LinkedListMultimap.create();
|
||||||
comments = ArrayListMultimap.create();
|
comments = ArrayListMultimap.create();
|
||||||
patchSets = Maps.newTreeMap(ReviewDbUtil.intKeyOrdering());
|
patchSets = Maps.newTreeMap(ReviewDbUtil.intKeyOrdering());
|
||||||
patchSetStates = Maps.newHashMap();
|
patchSetStates = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -644,7 +646,7 @@ class ChangeNotesParser implements AutoCloseable {
|
|||||||
new Supplier<Map<Entry<String, String>, Optional<PatchSetApproval>>>() {
|
new Supplier<Map<Entry<String, String>, Optional<PatchSetApproval>>>() {
|
||||||
@Override
|
@Override
|
||||||
public Map<Entry<String, String>, Optional<PatchSetApproval>> get() {
|
public Map<Entry<String, String>, Optional<PatchSetApproval>> get() {
|
||||||
return Maps.newLinkedHashMap();
|
return new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
approvals.put(psId, curr);
|
approvals.put(psId, curr);
|
||||||
@@ -674,7 +676,7 @@ class ChangeNotesParser implements AutoCloseable {
|
|||||||
checkFooter(rec != null, FOOTER_SUBMITTED_WITH, line);
|
checkFooter(rec != null, FOOTER_SUBMITTED_WITH, line);
|
||||||
SubmitRecord.Label label = new SubmitRecord.Label();
|
SubmitRecord.Label label = new SubmitRecord.Label();
|
||||||
if (rec.labels == null) {
|
if (rec.labels == null) {
|
||||||
rec.labels = Lists.newArrayList();
|
rec.labels = new ArrayList<>();
|
||||||
}
|
}
|
||||||
rec.labels.add(label);
|
rec.labels.add(label);
|
||||||
|
|
||||||
|
@@ -32,7 +32,6 @@ import com.google.common.collect.ComparisonChain;
|
|||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
@@ -231,7 +230,7 @@ public class ChangeRebuilderImpl extends ChangeRebuilder {
|
|||||||
Change change = new Change(bundle.getChange());
|
Change change = new Change(bundle.getChange());
|
||||||
// We will rebuild all events, except for draft comments, in buckets based
|
// We will rebuild all events, except for draft comments, in buckets based
|
||||||
// on author and timestamp.
|
// on author and timestamp.
|
||||||
List<Event> events = Lists.newArrayList();
|
List<Event> events = new ArrayList<>();
|
||||||
Multimap<Account.Id, PatchLineCommentEvent> draftCommentEvents =
|
Multimap<Account.Id, PatchLineCommentEvent> draftCommentEvents =
|
||||||
ArrayListMultimap.create();
|
ArrayListMultimap.create();
|
||||||
|
|
||||||
|
@@ -17,7 +17,6 @@ package com.google.gerrit.server.plugins;
|
|||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.extensions.annotations.Export;
|
import com.google.gerrit.extensions.annotations.Export;
|
||||||
import com.google.gerrit.server.plugins.Plugin.ApiType;
|
import com.google.gerrit.server.plugins.Plugin.ApiType;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
@@ -26,6 +25,7 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.jar.Manifest;
|
import java.util.jar.Manifest;
|
||||||
@@ -85,7 +85,7 @@ public abstract class AbstractPreloadedPluginScanner implements
|
|||||||
ImmutableMap.builder();
|
ImmutableMap.builder();
|
||||||
|
|
||||||
for (Class<? extends Annotation> annotation : annotations) {
|
for (Class<? extends Annotation> annotation : annotations) {
|
||||||
Set<ExtensionMetaData> classMetaDataSet = Sets.newHashSet();
|
Set<ExtensionMetaData> classMetaDataSet = new HashSet<>();
|
||||||
result.put(annotation, classMetaDataSet);
|
result.put(annotation, classMetaDataSet);
|
||||||
|
|
||||||
for (Class<?> clazz : preloadedClasses) {
|
for (Class<?> clazz : preloadedClasses) {
|
||||||
|
@@ -20,7 +20,6 @@ import static com.google.gerrit.server.plugins.PluginGuiceEnvironment.is;
|
|||||||
|
|
||||||
import com.google.common.collect.LinkedListMultimap;
|
import com.google.common.collect.LinkedListMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.extensions.annotations.Export;
|
import com.google.gerrit.extensions.annotations.Export;
|
||||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||||
import com.google.gerrit.extensions.annotations.Listen;
|
import com.google.gerrit.extensions.annotations.Listen;
|
||||||
@@ -40,6 +39,7 @@ import java.io.IOException;
|
|||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ class AutoRegisterModules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AutoRegisterModules discover() throws InvalidPluginException {
|
AutoRegisterModules discover() throws InvalidPluginException {
|
||||||
sysSingletons = Sets.newHashSet();
|
sysSingletons = new HashSet<>();
|
||||||
sysListen = LinkedListMultimap.create();
|
sysListen = LinkedListMultimap.create();
|
||||||
initJs = null;
|
initJs = null;
|
||||||
|
|
||||||
|
@@ -27,7 +27,6 @@ import com.google.common.collect.Iterables;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
import org.eclipse.jgit.util.IO;
|
import org.eclipse.jgit.util.IO;
|
||||||
import org.objectweb.asm.AnnotationVisitor;
|
import org.objectweb.asm.AnnotationVisitor;
|
||||||
@@ -47,6 +46,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -77,10 +78,10 @@ public class JarScanner implements PluginContentScanner {
|
|||||||
public Map<Class<? extends Annotation>, Iterable<ExtensionMetaData>> scan(
|
public Map<Class<? extends Annotation>, Iterable<ExtensionMetaData>> scan(
|
||||||
String pluginName, Iterable<Class<? extends Annotation>> annotations)
|
String pluginName, Iterable<Class<? extends Annotation>> annotations)
|
||||||
throws InvalidPluginException {
|
throws InvalidPluginException {
|
||||||
Set<String> descriptors = Sets.newHashSet();
|
Set<String> descriptors = new HashSet<>();
|
||||||
Multimap<String, JarScanner.ClassData> rawMap = ArrayListMultimap.create();
|
Multimap<String, JarScanner.ClassData> rawMap = ArrayListMultimap.create();
|
||||||
Map<Class<? extends Annotation>, String> classObjToClassDescr =
|
Map<Class<? extends Annotation>, String> classObjToClassDescr =
|
||||||
Maps.newHashMap();
|
new HashMap<>();
|
||||||
|
|
||||||
for (Class<? extends Annotation> annotation : annotations) {
|
for (Class<? extends Annotation> annotation : annotations) {
|
||||||
String descriptor = Type.getType(annotation).getDescriptor();
|
String descriptor = Type.getType(annotation).getDescriptor();
|
||||||
|
@@ -16,7 +16,6 @@ package com.google.gerrit.server.plugins;
|
|||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.data.GlobalCapability;
|
import com.google.gerrit.common.data.GlobalCapability;
|
||||||
import com.google.gerrit.extensions.annotations.RequiresCapability;
|
import com.google.gerrit.extensions.annotations.RequiresCapability;
|
||||||
import com.google.gerrit.extensions.restapi.RestReadView;
|
import com.google.gerrit.extensions.restapi.RestReadView;
|
||||||
@@ -34,6 +33,7 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/** List the installed plugins. */
|
/** List the installed plugins. */
|
||||||
@RequiresCapability(GlobalCapability.VIEW_PLUGINS)
|
@RequiresCapability(GlobalCapability.VIEW_PLUGINS)
|
||||||
@@ -63,7 +63,7 @@ public class ListPlugins implements RestReadView<TopLevelResource> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (stdout == null) {
|
if (stdout == null) {
|
||||||
Map<String, PluginInfo> output = Maps.newTreeMap();
|
Map<String, PluginInfo> output = new TreeMap<>();
|
||||||
for (Plugin p : plugins) {
|
for (Plugin p : plugins) {
|
||||||
PluginInfo info = new PluginInfo(p);
|
PluginInfo info = new PluginInfo(p);
|
||||||
output.put(p.getName(), info);
|
output.put(p.getName(), info);
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.server.plugins;
|
package com.google.gerrit.server.plugins;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.common.Nullable;
|
import com.google.gerrit.common.Nullable;
|
||||||
import com.google.gerrit.extensions.registration.RegistrationHandle;
|
import com.google.gerrit.extensions.registration.RegistrationHandle;
|
||||||
import com.google.gerrit.extensions.registration.ReloadableRegistrationHandle;
|
import com.google.gerrit.extensions.registration.ReloadableRegistrationHandle;
|
||||||
@@ -26,6 +25,7 @@ import com.google.inject.Injector;
|
|||||||
import org.eclipse.jgit.internal.storage.file.FileSnapshot;
|
import org.eclipse.jgit.internal.storage.file.FileSnapshot;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.jar.Attributes;
|
import java.util.jar.Attributes;
|
||||||
@@ -146,7 +146,7 @@ public abstract class Plugin {
|
|||||||
if (manager != null) {
|
if (manager != null) {
|
||||||
if (handle instanceof ReloadableRegistrationHandle) {
|
if (handle instanceof ReloadableRegistrationHandle) {
|
||||||
if (reloadableHandles == null) {
|
if (reloadableHandles == null) {
|
||||||
reloadableHandles = Lists.newArrayList();
|
reloadableHandles = new ArrayList<>();
|
||||||
}
|
}
|
||||||
reloadableHandles.add((ReloadableRegistrationHandle<?>) handle);
|
reloadableHandles.add((ReloadableRegistrationHandle<?>) handle);
|
||||||
}
|
}
|
||||||
|
@@ -22,8 +22,6 @@ import static com.google.gerrit.extensions.registration.PrivateInternals_Dynamic
|
|||||||
import com.google.common.collect.LinkedListMultimap;
|
import com.google.common.collect.LinkedListMultimap;
|
||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.common.Nullable;
|
import com.google.gerrit.common.Nullable;
|
||||||
import com.google.gerrit.extensions.annotations.RootRelative;
|
import com.google.gerrit.extensions.annotations.RootRelative;
|
||||||
import com.google.gerrit.extensions.events.LifecycleListener;
|
import com.google.gerrit.extensions.events.LifecycleListener;
|
||||||
@@ -56,7 +54,9 @@ import java.lang.annotation.Annotation;
|
|||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -347,7 +347,7 @@ public class PluginGuiceEnvironment {
|
|||||||
PrivateInternals_DynamicMapImpl<Object> map =
|
PrivateInternals_DynamicMapImpl<Object> map =
|
||||||
(PrivateInternals_DynamicMapImpl<Object>) e.getValue();
|
(PrivateInternals_DynamicMapImpl<Object>) e.getValue();
|
||||||
|
|
||||||
Map<Annotation, ReloadableRegistrationHandle<?>> am = Maps.newHashMap();
|
Map<Annotation, ReloadableRegistrationHandle<?>> am = new HashMap<>();
|
||||||
for (ReloadableRegistrationHandle<?> h : oldHandles.get(type)) {
|
for (ReloadableRegistrationHandle<?> h : oldHandles.get(type)) {
|
||||||
Annotation a = h.getKey().getAnnotation();
|
Annotation a = h.getKey().getAnnotation();
|
||||||
if (a != null && !UNIQUE_ANNOTATION.isInstance(a)) {
|
if (a != null && !UNIQUE_ANNOTATION.isInstance(a)) {
|
||||||
@@ -402,7 +402,7 @@ public class PluginGuiceEnvironment {
|
|||||||
// Index all old handles that match this DynamicSet<T> keyed by
|
// Index all old handles that match this DynamicSet<T> keyed by
|
||||||
// annotations. Ignore the unique annotations, thereby favoring
|
// annotations. Ignore the unique annotations, thereby favoring
|
||||||
// the @Named annotations or some other non-unique naming.
|
// the @Named annotations or some other non-unique naming.
|
||||||
Map<Annotation, ReloadableRegistrationHandle<?>> am = Maps.newHashMap();
|
Map<Annotation, ReloadableRegistrationHandle<?>> am = new HashMap<>();
|
||||||
List<ReloadableRegistrationHandle<?>> old = oldHandles.get(type);
|
List<ReloadableRegistrationHandle<?>> old = oldHandles.get(type);
|
||||||
Iterator<ReloadableRegistrationHandle<?>> oi = old.iterator();
|
Iterator<ReloadableRegistrationHandle<?>> oi = old.iterator();
|
||||||
while (oi.hasNext()) {
|
while (oi.hasNext()) {
|
||||||
@@ -510,8 +510,8 @@ public class PluginGuiceEnvironment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Module copy(Injector src) {
|
private Module copy(Injector src) {
|
||||||
Set<TypeLiteral<?>> dynamicTypes = Sets.newHashSet();
|
Set<TypeLiteral<?>> dynamicTypes = new HashSet<>();
|
||||||
Set<TypeLiteral<?>> dynamicItemTypes = Sets.newHashSet();
|
Set<TypeLiteral<?>> dynamicItemTypes = new HashSet<>();
|
||||||
for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) {
|
for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) {
|
||||||
TypeLiteral<?> type = e.getKey().getTypeLiteral();
|
TypeLiteral<?> type = e.getKey().getTypeLiteral();
|
||||||
if (type.getRawType() == DynamicItem.class) {
|
if (type.getRawType() == DynamicItem.class) {
|
||||||
@@ -524,7 +524,7 @@ public class PluginGuiceEnvironment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<Key<?>, Binding<?>> bindings = Maps.newLinkedHashMap();
|
final Map<Key<?>, Binding<?>> bindings = new LinkedHashMap<>();
|
||||||
for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) {
|
for (Map.Entry<Key<?>, Binding<?>> e : src.getBindings().entrySet()) {
|
||||||
if (dynamicTypes.contains(e.getKey().getTypeLiteral())
|
if (dynamicTypes.contains(e.getKey().getTypeLiteral())
|
||||||
&& e.getKey().getAnnotation() != null) {
|
&& e.getKey().getAnnotation() != null) {
|
||||||
|
@@ -25,7 +25,6 @@ import com.google.common.collect.LinkedHashMultimap;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Queues;
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import com.google.gerrit.extensions.annotations.PluginName;
|
import com.google.gerrit.extensions.annotations.PluginName;
|
||||||
@@ -56,10 +55,12 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -114,8 +115,8 @@ public class PluginLoader implements LifecycleListener {
|
|||||||
pluginUserFactory = puf;
|
pluginUserFactory = puf;
|
||||||
running = Maps.newConcurrentMap();
|
running = Maps.newConcurrentMap();
|
||||||
disabled = Maps.newConcurrentMap();
|
disabled = Maps.newConcurrentMap();
|
||||||
broken = Maps.newHashMap();
|
broken = new HashMap<>();
|
||||||
toCleanup = Queues.newArrayDeque();
|
toCleanup = new ArrayDeque<>();
|
||||||
cleanupHandles = Maps.newConcurrentMap();
|
cleanupHandles = Maps.newConcurrentMap();
|
||||||
cleaner = pct;
|
cleaner = pct;
|
||||||
urlProvider = provider;
|
urlProvider = provider;
|
||||||
@@ -659,8 +660,8 @@ public class PluginLoader implements LifecycleListener {
|
|||||||
assert winner != null;
|
assert winner != null;
|
||||||
// Disable all loser plugins by renaming their file names to
|
// Disable all loser plugins by renaming their file names to
|
||||||
// "file.disabled" and replace the disabled files in the multimap.
|
// "file.disabled" and replace the disabled files in the multimap.
|
||||||
Collection<Path> elementsToRemove = Lists.newArrayList();
|
Collection<Path> elementsToRemove = new ArrayList<>();
|
||||||
Collection<Path> elementsToAdd = Lists.newArrayList();
|
Collection<Path> elementsToAdd = new ArrayList<>();
|
||||||
for (Path loser : Iterables.skip(enabled, 1)) {
|
for (Path loser : Iterables.skip(enabled, 1)) {
|
||||||
log.warn(String.format("Plugin <%s> was disabled, because"
|
log.warn(String.format("Plugin <%s> was disabled, because"
|
||||||
+ " another plugin <%s>"
|
+ " another plugin <%s>"
|
||||||
|
@@ -30,6 +30,8 @@ import org.eclipse.jgit.internal.storage.file.FileSnapshot;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.jar.Attributes;
|
import java.util.jar.Attributes;
|
||||||
import java.util.jar.Manifest;
|
import java.util.jar.Manifest;
|
||||||
@@ -198,7 +200,7 @@ public class ServerPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (env.hasSshModule()) {
|
if (env.hasSshModule()) {
|
||||||
List<Module> modules = Lists.newLinkedList();
|
List<Module> modules = new LinkedList<>();
|
||||||
if (getApiType() == ApiType.PLUGIN) {
|
if (getApiType() == ApiType.PLUGIN) {
|
||||||
modules.add(env.getSshModule());
|
modules.add(env.getSshModule());
|
||||||
}
|
}
|
||||||
@@ -214,7 +216,7 @@ public class ServerPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (env.hasHttpModule()) {
|
if (env.hasHttpModule()) {
|
||||||
List<Module> modules = Lists.newLinkedList();
|
List<Module> modules = new LinkedList<>();
|
||||||
if (getApiType() == ApiType.PLUGIN) {
|
if (getApiType() == ApiType.PLUGIN) {
|
||||||
modules.add(env.getHttpModule());
|
modules.add(env.getHttpModule());
|
||||||
}
|
}
|
||||||
@@ -279,7 +281,7 @@ public class ServerPlugin extends Plugin {
|
|||||||
if (serverManager != null) {
|
if (serverManager != null) {
|
||||||
if (handle instanceof ReloadableRegistrationHandle) {
|
if (handle instanceof ReloadableRegistrationHandle) {
|
||||||
if (reloadableHandles == null) {
|
if (reloadableHandles == null) {
|
||||||
reloadableHandles = Lists.newArrayList();
|
reloadableHandles = new ArrayList<>();
|
||||||
}
|
}
|
||||||
reloadableHandles.add((ReloadableRegistrationHandle<?>) handle);
|
reloadableHandles.add((ReloadableRegistrationHandle<?>) handle);
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@ package com.google.gerrit.server.project;
|
|||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.extensions.client.InheritableBoolean;
|
import com.google.gerrit.extensions.client.InheritableBoolean;
|
||||||
import com.google.gerrit.extensions.client.SubmitType;
|
import com.google.gerrit.extensions.client.SubmitType;
|
||||||
import com.google.gerrit.extensions.common.ActionInfo;
|
import com.google.gerrit.extensions.common.ActionInfo;
|
||||||
@@ -34,6 +33,7 @@ import com.google.gerrit.server.git.TransferConfig;
|
|||||||
import com.google.inject.util.Providers;
|
import com.google.inject.util.Providers;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
@@ -131,7 +131,7 @@ public class ConfigInfo {
|
|||||||
this.submitType = p.getSubmitType();
|
this.submitType = p.getSubmitType();
|
||||||
this.state = p.getState() != com.google.gerrit.extensions.client.ProjectState.ACTIVE ? p.getState() : null;
|
this.state = p.getState() != com.google.gerrit.extensions.client.ProjectState.ACTIVE ? p.getState() : null;
|
||||||
|
|
||||||
this.commentlinks = Maps.newLinkedHashMap();
|
this.commentlinks = new LinkedHashMap<>();
|
||||||
for (CommentLinkInfo cl : projectState.getCommentLinks()) {
|
for (CommentLinkInfo cl : projectState.getCommentLinks()) {
|
||||||
this.commentlinks.put(cl.name, cl);
|
this.commentlinks.put(cl.name, cl);
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ public class ConfigInfo {
|
|||||||
getPluginConfig(control.getProjectState(), pluginConfigEntries,
|
getPluginConfig(control.getProjectState(), pluginConfigEntries,
|
||||||
cfgFactory, allProjects);
|
cfgFactory, allProjects);
|
||||||
|
|
||||||
actions = Maps.newTreeMap();
|
actions = new TreeMap<>();
|
||||||
for (UiAction.Description d : UiActions.from(
|
for (UiAction.Description d : UiActions.from(
|
||||||
views, new ProjectResource(control),
|
views, new ProjectResource(control),
|
||||||
Providers.of(control.getUser()))) {
|
Providers.of(control.getUser()))) {
|
||||||
|
@@ -49,6 +49,7 @@ import org.eclipse.jgit.lib.ObjectId;
|
|||||||
import org.eclipse.jgit.lib.Repository;
|
import org.eclipse.jgit.lib.Repository;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -207,7 +208,7 @@ class DashboardsCollection implements
|
|||||||
Boolean isDefault;
|
Boolean isDefault;
|
||||||
|
|
||||||
String title;
|
String title;
|
||||||
List<Section> sections = Lists.newArrayList();
|
List<Section> sections = new ArrayList<>();
|
||||||
|
|
||||||
DashboardInfo(String ref, String name) {
|
DashboardInfo(String ref, String name) {
|
||||||
this.ref = ref;
|
this.ref = ref;
|
||||||
|
@@ -17,7 +17,6 @@ package com.google.gerrit.server.project;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.gerrit.common.data.AccessSection;
|
import com.google.gerrit.common.data.AccessSection;
|
||||||
import com.google.gerrit.common.data.Permission;
|
import com.google.gerrit.common.data.Permission;
|
||||||
import com.google.gerrit.common.data.PermissionRule;
|
import com.google.gerrit.common.data.PermissionRule;
|
||||||
@@ -48,6 +47,7 @@ import org.eclipse.jgit.errors.RepositoryNotFoundException;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -135,7 +135,7 @@ public class GetAccess implements RestReadView<ProjectResource> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
info.local = new HashMap<>();
|
info.local = new HashMap<>();
|
||||||
info.ownerOf = Sets.newHashSet();
|
info.ownerOf = new HashSet<>();
|
||||||
Map<AccountGroup.UUID, Boolean> visibleGroups = new HashMap<>();
|
Map<AccountGroup.UUID, Boolean> visibleGroups = new HashMap<>();
|
||||||
|
|
||||||
for (AccessSection section : config.getAccessSections()) {
|
for (AccessSection section : config.getAccessSections()) {
|
||||||
|
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.project;
|
package com.google.gerrit.server.project;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.extensions.common.ProjectInfo;
|
import com.google.gerrit.extensions.common.ProjectInfo;
|
||||||
import com.google.gerrit.extensions.restapi.RestReadView;
|
import com.google.gerrit.extensions.restapi.RestReadView;
|
||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
@@ -25,7 +23,9 @@ import com.google.inject.Inject;
|
|||||||
|
|
||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ public class ListChildProjects implements RestReadView<ProjectResource> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<ProjectInfo> getDirectChildProjects(Project.NameKey parent) {
|
private List<ProjectInfo> getDirectChildProjects(Project.NameKey parent) {
|
||||||
List<ProjectInfo> childProjects = Lists.newArrayList();
|
List<ProjectInfo> childProjects = new ArrayList<>();
|
||||||
for (Project.NameKey projectName : projectCache.all()) {
|
for (Project.NameKey projectName : projectCache.all()) {
|
||||||
ProjectState e = projectCache.get(projectName);
|
ProjectState e = projectCache.get(projectName);
|
||||||
if (e == null) {
|
if (e == null) {
|
||||||
@@ -80,7 +80,7 @@ public class ListChildProjects implements RestReadView<ProjectResource> {
|
|||||||
|
|
||||||
private List<ProjectInfo> getChildProjectsRecursively(Project.NameKey parent,
|
private List<ProjectInfo> getChildProjectsRecursively(Project.NameKey parent,
|
||||||
CurrentUser user) {
|
CurrentUser user) {
|
||||||
Map<Project.NameKey, ProjectNode> projects = Maps.newHashMap();
|
Map<Project.NameKey, ProjectNode> projects = new HashMap<>();
|
||||||
for (Project.NameKey name : projectCache.all()) {
|
for (Project.NameKey name : projectCache.all()) {
|
||||||
ProjectState p = projectCache.get(name);
|
ProjectState p = projectCache.get(name);
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
@@ -106,7 +106,7 @@ public class ListChildProjects implements RestReadView<ProjectResource> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<ProjectInfo> getChildProjectsRecursively(ProjectNode p) {
|
private List<ProjectInfo> getChildProjectsRecursively(ProjectNode p) {
|
||||||
List<ProjectInfo> allChildren = Lists.newArrayList();
|
List<ProjectInfo> allChildren = new ArrayList<>();
|
||||||
for (ProjectNode c : p.getChildren()) {
|
for (ProjectNode c : p.getChildren()) {
|
||||||
if (c.isVisible()) {
|
if (c.isVisible()) {
|
||||||
allChildren.add(json.format(c.getProject()));
|
allChildren.add(json.format(c.getProject()));
|
||||||
|
@@ -16,7 +16,6 @@ package com.google.gerrit.server.project;
|
|||||||
|
|
||||||
import static com.google.gerrit.reviewdb.client.RefNames.REFS_DASHBOARDS;
|
import static com.google.gerrit.reviewdb.client.RefNames.REFS_DASHBOARDS;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||||
import com.google.gerrit.extensions.restapi.RestReadView;
|
import com.google.gerrit.extensions.restapi.RestReadView;
|
||||||
import com.google.gerrit.reviewdb.client.Project;
|
import com.google.gerrit.reviewdb.client.Project;
|
||||||
@@ -37,6 +36,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
class ListDashboards implements RestReadView<ProjectResource> {
|
class ListDashboards implements RestReadView<ProjectResource> {
|
||||||
@@ -61,7 +61,7 @@ class ListDashboards implements RestReadView<ProjectResource> {
|
|||||||
return scan(resource.getControl(), project, true);
|
return scan(resource.getControl(), project, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<List<DashboardInfo>> all = Lists.newArrayList();
|
List<List<DashboardInfo>> all = new ArrayList<>();
|
||||||
boolean setDefault = true;
|
boolean setDefault = true;
|
||||||
for (ProjectState ps : ctl.getProjectState().tree()) {
|
for (ProjectState ps : ctl.getProjectState().tree()) {
|
||||||
ctl = ps.controlFor(ctl.getUser());
|
ctl = ps.controlFor(ctl.getUser());
|
||||||
@@ -85,7 +85,7 @@ class ListDashboards implements RestReadView<ProjectResource> {
|
|||||||
Project.NameKey projectName = ctl.getProject().getNameKey();
|
Project.NameKey projectName = ctl.getProject().getNameKey();
|
||||||
try (Repository git = gitManager.openRepository(projectName);
|
try (Repository git = gitManager.openRepository(projectName);
|
||||||
RevWalk rw = new RevWalk(git)) {
|
RevWalk rw = new RevWalk(git)) {
|
||||||
List<DashboardInfo> all = Lists.newArrayList();
|
List<DashboardInfo> all = new ArrayList<>();
|
||||||
for (Ref ref : git.getRefDatabase().getRefs(REFS_DASHBOARDS).values()) {
|
for (Ref ref : git.getRefDatabase().getRefs(REFS_DASHBOARDS).values()) {
|
||||||
if (ctl.controlForRef(ref.getName()).canRead()) {
|
if (ctl.controlForRef(ref.getName()).canRead()) {
|
||||||
all.addAll(scanDashboards(ctl.getProject(), git, rw, ref,
|
all.addAll(scanDashboards(ctl.getProject(), git, rw, ref,
|
||||||
@@ -101,7 +101,7 @@ class ListDashboards implements RestReadView<ProjectResource> {
|
|||||||
private List<DashboardInfo> scanDashboards(Project definingProject,
|
private List<DashboardInfo> scanDashboards(Project definingProject,
|
||||||
Repository git, RevWalk rw, Ref ref, String project, boolean setDefault)
|
Repository git, RevWalk rw, Ref ref, String project, boolean setDefault)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
List<DashboardInfo> list = Lists.newArrayList();
|
List<DashboardInfo> list = new ArrayList<>();
|
||||||
try (TreeWalk tw = new TreeWalk(rw.getObjectReader())) {
|
try (TreeWalk tw = new TreeWalk(rw.getObjectReader())) {
|
||||||
tw.addTree(rw.parseTree(ref.getObjectId()));
|
tw.addTree(rw.parseTree(ref.getObjectId()));
|
||||||
tw.setRecursive(true);
|
tw.setRecursive(true);
|
||||||
|
@@ -21,8 +21,6 @@ import com.google.common.base.Strings;
|
|||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.data.GroupReference;
|
import com.google.gerrit.common.data.GroupReference;
|
||||||
import com.google.gerrit.common.errors.NoSuchGroupException;
|
import com.google.gerrit.common.errors.NoSuchGroupException;
|
||||||
import com.google.gerrit.extensions.common.ProjectInfo;
|
import com.google.gerrit.extensions.common.ProjectInfo;
|
||||||
@@ -61,8 +59,11 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -179,7 +180,7 @@ public class ListProjects implements RestReadView<TopLevelResource> {
|
|||||||
this.groupUuid = groupUuid;
|
this.groupUuid = groupUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<String> showBranch = Lists.newArrayList();
|
private final List<String> showBranch = new ArrayList<>();
|
||||||
private boolean showTree;
|
private boolean showTree;
|
||||||
private FilterType type = FilterType.ALL;
|
private FilterType type = FilterType.ALL;
|
||||||
private boolean showDescription;
|
private boolean showDescription;
|
||||||
@@ -256,8 +257,8 @@ public class ListProjects implements RestReadView<TopLevelResource> {
|
|||||||
|
|
||||||
int foundIndex = 0;
|
int foundIndex = 0;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
TreeMap<String, ProjectInfo> output = Maps.newTreeMap();
|
TreeMap<String, ProjectInfo> output = new TreeMap<>();
|
||||||
Map<String, String> hiddenNames = Maps.newHashMap();
|
Map<String, String> hiddenNames = new HashMap<>();
|
||||||
Set<String> rejected = new HashSet<>();
|
Set<String> rejected = new HashSet<>();
|
||||||
|
|
||||||
final TreeMap<Project.NameKey, ProjectNode> treeMap = new TreeMap<>();
|
final TreeMap<Project.NameKey, ProjectNode> treeMap = new TreeMap<>();
|
||||||
@@ -357,7 +358,7 @@ public class ListProjects implements RestReadView<TopLevelResource> {
|
|||||||
Ref ref = refs.get(i);
|
Ref ref = refs.get(i);
|
||||||
if (ref != null && ref.getObjectId() != null) {
|
if (ref != null && ref.getObjectId() != null) {
|
||||||
if (info.branches == null) {
|
if (info.branches == null) {
|
||||||
info.branches = Maps.newLinkedHashMap();
|
info.branches = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
info.branches.put(showBranch.get(i), ref.getObjectId().name());
|
info.branches.put(showBranch.get(i), ref.getObjectId().name());
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
package com.google.gerrit.server.project;
|
package com.google.gerrit.server.project;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.gerrit.extensions.api.projects.TagInfo;
|
import com.google.gerrit.extensions.api.projects.TagInfo;
|
||||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||||
import com.google.gerrit.extensions.restapi.IdString;
|
import com.google.gerrit.extensions.restapi.IdString;
|
||||||
@@ -43,6 +42,7 @@ import org.eclipse.jgit.revwalk.RevWalk;
|
|||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -93,7 +93,7 @@ public class ListTags implements RestReadView<ProjectResource> {
|
|||||||
@Override
|
@Override
|
||||||
public List<TagInfo> apply(ProjectResource resource) throws IOException,
|
public List<TagInfo> apply(ProjectResource resource) throws IOException,
|
||||||
ResourceNotFoundException, BadRequestException {
|
ResourceNotFoundException, BadRequestException {
|
||||||
List<TagInfo> tags = Lists.newArrayList();
|
List<TagInfo> tags = new ArrayList<>();
|
||||||
|
|
||||||
try (Repository repo = getRepository(resource.getNameKey());
|
try (Repository repo = getRepository(resource.getNameKey());
|
||||||
RevWalk rw = new RevWalk(repo)) {
|
RevWalk rw = new RevWalk(repo)) {
|
||||||
|
@@ -35,6 +35,7 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -81,7 +82,7 @@ public class PermissionCollection {
|
|||||||
|
|
||||||
Collection<String> usernames = null;
|
Collection<String> usernames = null;
|
||||||
boolean perUser = false;
|
boolean perUser = false;
|
||||||
Map<AccessSection, Project.NameKey> sectionToProject = Maps.newLinkedHashMap();
|
Map<AccessSection, Project.NameKey> sectionToProject = new LinkedHashMap<>();
|
||||||
for (SectionMatcher sm : matcherList) {
|
for (SectionMatcher sm : matcherList) {
|
||||||
// If the matcher has to expand parameters and its prefix matches the
|
// If the matcher has to expand parameters and its prefix matches the
|
||||||
// reference there is a very good chance the reference is actually user
|
// reference there is a very good chance the reference is actually user
|
||||||
|
@@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -210,7 +211,7 @@ public class ProjectCacheImpl implements ProjectCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<AccountGroup.UUID> guessRelevantGroupUUIDs() {
|
public Set<AccountGroup.UUID> guessRelevantGroupUUIDs() {
|
||||||
Set<AccountGroup.UUID> groups = Sets.newHashSet();
|
Set<AccountGroup.UUID> groups = new HashSet<>();
|
||||||
for (Project.NameKey n : all()) {
|
for (Project.NameKey n : all()) {
|
||||||
ProjectState p = byName.getIfPresent(n.get());
|
ProjectState p = byName.getIfPresent(n.get());
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package com.google.gerrit.server.project;
|
package com.google.gerrit.server.project;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.gerrit.common.Nullable;
|
import com.google.gerrit.common.Nullable;
|
||||||
import com.google.gerrit.common.PageLinks;
|
import com.google.gerrit.common.PageLinks;
|
||||||
@@ -385,7 +384,7 @@ public class ProjectControl {
|
|||||||
}
|
}
|
||||||
final IdentifiedUser iUser = user.asIdentifiedUser();
|
final IdentifiedUser iUser = user.asIdentifiedUser();
|
||||||
|
|
||||||
List<AccountGroup.UUID> okGroupIds = Lists.newArrayList();
|
List<AccountGroup.UUID> okGroupIds = new ArrayList<>();
|
||||||
for (ContributorAgreement ca : contributorAgreements) {
|
for (ContributorAgreement ca : contributorAgreements) {
|
||||||
List<AccountGroup.UUID> groupIds;
|
List<AccountGroup.UUID> groupIds;
|
||||||
groupIds = okGroupIds;
|
groupIds = okGroupIds;
|
||||||
|
@@ -21,7 +21,6 @@ import com.google.common.base.Function;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gerrit.common.data.AccessSection;
|
import com.google.gerrit.common.data.AccessSection;
|
||||||
import com.google.gerrit.common.data.GroupReference;
|
import com.google.gerrit.common.data.GroupReference;
|
||||||
import com.google.gerrit.common.data.LabelType;
|
import com.google.gerrit.common.data.LabelType;
|
||||||
@@ -61,8 +60,10 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -126,7 +127,7 @@ public class ProjectState {
|
|||||||
this.rulesCache = rulesCache;
|
this.rulesCache = rulesCache;
|
||||||
this.commentLinks = commentLinks;
|
this.commentLinks = commentLinks;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.configs = Maps.newHashMap();
|
this.configs = new HashMap<>();
|
||||||
this.capabilities = isAllProjects
|
this.capabilities = isAllProjects
|
||||||
? new CapabilityCollection(config.getAccessSection(AccessSection.GLOBAL_CAPABILITIES))
|
? new CapabilityCollection(config.getAccessSection(AccessSection.GLOBAL_CAPABILITIES))
|
||||||
: null;
|
: null;
|
||||||
@@ -277,7 +278,7 @@ public class ProjectState {
|
|||||||
return getLocalAccessSections();
|
return getLocalAccessSections();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SectionMatcher> all = Lists.newArrayList();
|
List<SectionMatcher> all = new ArrayList<>();
|
||||||
for (ProjectState s : tree()) {
|
for (ProjectState s : tree()) {
|
||||||
all.addAll(s.getLocalAccessSections());
|
all.addAll(s.getLocalAccessSections());
|
||||||
}
|
}
|
||||||
@@ -423,7 +424,7 @@ public class ProjectState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public LabelTypes getLabelTypes() {
|
public LabelTypes getLabelTypes() {
|
||||||
Map<String, LabelType> types = Maps.newLinkedHashMap();
|
Map<String, LabelType> types = new LinkedHashMap<>();
|
||||||
for (ProjectState s : treeInOrder()) {
|
for (ProjectState s : treeInOrder()) {
|
||||||
for (LabelType type : s.getConfig().getLabelSections().values()) {
|
for (LabelType type : s.getConfig().getLabelSections().values()) {
|
||||||
String lower = type.getName().toLowerCase();
|
String lower = type.getName().toLowerCase();
|
||||||
@@ -443,7 +444,7 @@ public class ProjectState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<CommentLinkInfo> getCommentLinks() {
|
public List<CommentLinkInfo> getCommentLinks() {
|
||||||
Map<String, CommentLinkInfo> cls = Maps.newLinkedHashMap();
|
Map<String, CommentLinkInfo> cls = new LinkedHashMap<>();
|
||||||
for (CommentLinkInfo cl : commentLinks) {
|
for (CommentLinkInfo cl : commentLinks) {
|
||||||
cls.put(cl.name.toLowerCase(), cl);
|
cls.put(cl.name.toLowerCase(), cl);
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user