Merge changes from topic "static-inputs-cleanup"
* changes: PutOwner: Move static Input to separate class in extension API DescriptionInput [projects]: Extend DescriptionInput from extension API PutDescription [group]: Reuse Input class from extension API PutDescription [change]: Move static Input to separate class in extension API PutTopic: Move static Input to separate class in extension API PutName [group]: Reuse NameInput from extension API PutName [account]: Move static Input to separate class in extension API PutUsername: Move static Input to separate class in extension API PutHttpPassword: Move static Input to separate class in extension API PostGpgKeys: Move static Input to separate class in extension API AddSshKey: Extract static Input to separate class in extension API Get rid of empty static Input classes
This commit is contained in:
@@ -18,13 +18,13 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||
import com.google.gerrit.acceptance.RestResponse;
|
||||
import com.google.gerrit.server.account.PutUsername;
|
||||
import com.google.gerrit.extensions.common.UsernameInput;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PutUsernameIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void set() throws Exception {
|
||||
PutUsername.Input in = new PutUsername.Input();
|
||||
UsernameInput in = new UsernameInput();
|
||||
in.username = "myUsername";
|
||||
RestResponse r =
|
||||
adminRestSession.put("/accounts/" + accountCreator.create().id.get() + "/username", in);
|
||||
@@ -34,7 +34,7 @@ public class PutUsernameIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void setExisting_Conflict() throws Exception {
|
||||
PutUsername.Input in = new PutUsername.Input();
|
||||
UsernameInput in = new UsernameInput();
|
||||
in.username = admin.username;
|
||||
adminRestSession
|
||||
.put("/accounts/" + accountCreator.create().id.get() + "/username", in)
|
||||
@@ -43,7 +43,7 @@ public class PutUsernameIT extends AbstractDaemonTest {
|
||||
|
||||
@Test
|
||||
public void setNew_MethodNotAllowed() throws Exception {
|
||||
PutUsername.Input in = new PutUsername.Input();
|
||||
UsernameInput in = new UsernameInput();
|
||||
in.username = "newUsername";
|
||||
adminRestSession.put("/accounts/" + admin.username + "/username", in).assertMethodNotAllowed();
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ import com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput;
|
||||
import com.google.gerrit.extensions.api.changes.ReviewInput.DraftHandling;
|
||||
import com.google.gerrit.extensions.client.Side;
|
||||
import com.google.gerrit.extensions.common.CommentInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
@@ -326,7 +327,7 @@ public class ChangeRebuilderIT extends AbstractDaemonTest {
|
||||
public void restApiNotFoundWhenNoteDbDisabled() throws Exception {
|
||||
PushOneCommit.Result r = createChange();
|
||||
exception.expect(ResourceNotFoundException.class);
|
||||
rebuildHandler.apply(parseChangeResource(r.getChangeId()), new Rebuild.Input());
|
||||
rebuildHandler.apply(parseChangeResource(r.getChangeId()), new Input());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -336,7 +337,7 @@ public class ChangeRebuilderIT extends AbstractDaemonTest {
|
||||
setNotesMigration(true, false);
|
||||
|
||||
checker.assertNoChangeRef(project, id);
|
||||
rebuildHandler.apply(parseChangeResource(r.getChangeId()), new Rebuild.Input());
|
||||
rebuildHandler.apply(parseChangeResource(r.getChangeId()), new Input());
|
||||
checker.checkChanges(id);
|
||||
}
|
||||
|
||||
|
@@ -14,9 +14,6 @@
|
||||
|
||||
package com.google.gerrit.extensions.api.projects;
|
||||
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
|
||||
public class DescriptionInput {
|
||||
@DefaultInput public String description;
|
||||
public class DescriptionInput extends com.google.gerrit.extensions.common.DescriptionInput {
|
||||
public String commitMessage;
|
||||
}
|
||||
|
@@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.common;
|
||||
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
|
||||
public class DescriptionInput {
|
||||
@DefaultInput public String description;
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GpgKeysInput {
|
||||
public List<String> add;
|
||||
public List<String> delete;
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.common;
|
||||
|
||||
public class HttpPasswordInput {
|
||||
public String httpPassword;
|
||||
public boolean generate;
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.common;
|
||||
|
||||
/** A generic empty input. */
|
||||
public class Input {
|
||||
public Input() {}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.common;
|
||||
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
|
||||
public class NameInput {
|
||||
@DefaultInput public String name;
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.common;
|
||||
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
|
||||
public class OwnerInput {
|
||||
@DefaultInput public String owner;
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.common;
|
||||
|
||||
import com.google.gerrit.extensions.restapi.RawInput;
|
||||
|
||||
public class SshKeyInput {
|
||||
public RawInput raw;
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.common;
|
||||
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
|
||||
public class TopicInput {
|
||||
@DefaultInput public String topic;
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.common;
|
||||
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
|
||||
public class UsernameInput {
|
||||
@DefaultInput public String username;
|
||||
}
|
@@ -16,6 +16,7 @@ package com.google.gerrit.gpg.api;
|
||||
|
||||
import com.google.gerrit.extensions.api.accounts.GpgKeyApi;
|
||||
import com.google.gerrit.extensions.common.GpgKeyInfo;
|
||||
import com.google.gerrit.extensions.common.GpgKeysInput;
|
||||
import com.google.gerrit.extensions.common.PushCertificateInfo;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
@@ -75,7 +76,7 @@ public class GpgApiAdapterImpl implements GpgApiAdapter {
|
||||
public Map<String, GpgKeyInfo> putGpgKeys(
|
||||
AccountResource account, List<String> add, List<String> delete)
|
||||
throws RestApiException, GpgException {
|
||||
PostGpgKeys.Input in = new PostGpgKeys.Input();
|
||||
GpgKeysInput in = new GpgKeysInput();
|
||||
in.add = add;
|
||||
in.delete = delete;
|
||||
try {
|
||||
|
@@ -16,6 +16,7 @@ package com.google.gerrit.gpg.api;
|
||||
|
||||
import com.google.gerrit.extensions.api.accounts.GpgKeyApi;
|
||||
import com.google.gerrit.extensions.common.GpgKeyInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.gpg.server.DeleteGpgKey;
|
||||
import com.google.gerrit.gpg.server.GpgKey;
|
||||
@@ -55,7 +56,7 @@ public class GpgKeyApiImpl implements GpgKeyApi {
|
||||
@Override
|
||||
public void delete() throws RestApiException {
|
||||
try {
|
||||
delete.apply(rsrc, new DeleteGpgKey.Input());
|
||||
delete.apply(rsrc, new Input());
|
||||
} catch (PGPException | OrmException | IOException | ConfigInvalidException e) {
|
||||
throw new RestApiException("Cannot delete GPG key", e);
|
||||
}
|
||||
|
@@ -18,11 +18,11 @@ import static com.google.gerrit.gpg.PublicKeyStore.keyIdToString;
|
||||
import static com.google.gerrit.server.account.externalids.ExternalId.SCHEME_GPGKEY;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.gpg.PublicKeyStore;
|
||||
import com.google.gerrit.gpg.server.DeleteGpgKey.Input;
|
||||
import com.google.gerrit.server.GerritPersonIdent;
|
||||
import com.google.gerrit.server.account.externalids.ExternalId;
|
||||
import com.google.gerrit.server.account.externalids.ExternalIdsUpdate;
|
||||
@@ -38,7 +38,6 @@ import org.eclipse.jgit.lib.PersonIdent;
|
||||
import org.eclipse.jgit.lib.RefUpdate;
|
||||
|
||||
public class DeleteGpgKey implements RestModifyView<GpgKey, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final Provider<PersonIdent> serverIdent;
|
||||
private final Provider<PublicKeyStore> storeProvider;
|
||||
|
@@ -29,6 +29,7 @@ import com.google.common.collect.Sets;
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.extensions.common.GpgKeyInfo;
|
||||
import com.google.gerrit.extensions.common.GpgKeysInput;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
@@ -38,7 +39,6 @@ import com.google.gerrit.gpg.Fingerprint;
|
||||
import com.google.gerrit.gpg.GerritPublicKeyChecker;
|
||||
import com.google.gerrit.gpg.PublicKeyChecker;
|
||||
import com.google.gerrit.gpg.PublicKeyStore;
|
||||
import com.google.gerrit.gpg.server.PostGpgKeys.Input;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.GerritPersonIdent;
|
||||
@@ -75,12 +75,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class PostGpgKeys implements RestModifyView<AccountResource, Input> {
|
||||
public static class Input {
|
||||
public List<String> add;
|
||||
public List<String> delete;
|
||||
}
|
||||
|
||||
public class PostGpgKeys implements RestModifyView<AccountResource, GpgKeysInput> {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final Provider<PersonIdent> serverIdent;
|
||||
private final Provider<CurrentUser> self;
|
||||
@@ -112,7 +107,7 @@ public class PostGpgKeys implements RestModifyView<AccountResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, GpgKeyInfo> apply(AccountResource rsrc, Input input)
|
||||
public Map<String, GpgKeyInfo> apply(AccountResource rsrc, GpgKeysInput input)
|
||||
throws ResourceNotFoundException, BadRequestException, ResourceConflictException,
|
||||
PGPException, OrmException, IOException, ConfigInvalidException {
|
||||
GpgKeys.checkVisible(self, rsrc);
|
||||
@@ -148,7 +143,8 @@ public class PostGpgKeys implements RestModifyView<AccountResource, Input> {
|
||||
}
|
||||
}
|
||||
|
||||
private Set<Fingerprint> readKeysToRemove(Input input, Collection<ExternalId> existingExtIds) {
|
||||
private Set<Fingerprint> readKeysToRemove(
|
||||
GpgKeysInput input, Collection<ExternalId> existingExtIds) {
|
||||
if (input.delete == null || input.delete.isEmpty()) {
|
||||
return ImmutableSet.of();
|
||||
}
|
||||
@@ -163,7 +159,7 @@ public class PostGpgKeys implements RestModifyView<AccountResource, Input> {
|
||||
return fingerprints;
|
||||
}
|
||||
|
||||
private List<PGPPublicKeyRing> readKeysToAdd(Input input, Set<Fingerprint> toRemove)
|
||||
private List<PGPPublicKeyRing> readKeysToAdd(GpgKeysInput input, Set<Fingerprint> toRemove)
|
||||
throws BadRequestException, IOException {
|
||||
if (input.add == null || input.add.isEmpty()) {
|
||||
return ImmutableList.of();
|
||||
|
@@ -20,6 +20,7 @@ import com.google.common.io.ByteSource;
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.common.errors.InvalidSshKeyException;
|
||||
import com.google.gerrit.extensions.common.SshKeyInfo;
|
||||
import com.google.gerrit.extensions.common.SshKeyInput;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.RawInput;
|
||||
@@ -28,7 +29,6 @@ import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.reviewdb.client.AccountSshKey;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.AddSshKey.Input;
|
||||
import com.google.gerrit.server.mail.send.AddKeySender;
|
||||
import com.google.gerrit.server.permissions.GlobalPermission;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
@@ -45,13 +45,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class AddSshKey implements RestModifyView<AccountResource, Input> {
|
||||
public class AddSshKey implements RestModifyView<AccountResource, SshKeyInput> {
|
||||
private static final Logger log = LoggerFactory.getLogger(AddSshKey.class);
|
||||
|
||||
public static class Input {
|
||||
public RawInput raw;
|
||||
}
|
||||
|
||||
private final Provider<CurrentUser> self;
|
||||
private final PermissionBackend permissionBackend;
|
||||
private final VersionedAuthorizedKeys.Accessor authorizedKeys;
|
||||
@@ -73,7 +69,7 @@ public class AddSshKey implements RestModifyView<AccountResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<SshKeyInfo> apply(AccountResource rsrc, Input input)
|
||||
public Response<SshKeyInfo> apply(AccountResource rsrc, SshKeyInput input)
|
||||
throws AuthException, BadRequestException, OrmException, IOException, ConfigInvalidException,
|
||||
PermissionBackendException {
|
||||
if (self.get() != rsrc.getUser()) {
|
||||
@@ -82,10 +78,10 @@ public class AddSshKey implements RestModifyView<AccountResource, Input> {
|
||||
return apply(rsrc.getUser(), input);
|
||||
}
|
||||
|
||||
public Response<SshKeyInfo> apply(IdentifiedUser user, Input input)
|
||||
public Response<SshKeyInfo> apply(IdentifiedUser user, SshKeyInput input)
|
||||
throws BadRequestException, IOException, ConfigInvalidException {
|
||||
if (input == null) {
|
||||
input = new Input();
|
||||
input = new SshKeyInput();
|
||||
}
|
||||
if (input.raw == null) {
|
||||
throw new BadRequestException("SSH public key missing");
|
||||
|
@@ -16,12 +16,12 @@ package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.gerrit.common.data.GlobalCapability;
|
||||
import com.google.gerrit.extensions.annotations.RequiresCapability;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.DeleteActive.Input;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
@@ -32,7 +32,6 @@ import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
@RequiresCapability(GlobalCapability.MODIFY_ACCOUNT)
|
||||
@Singleton
|
||||
public class DeleteActive implements RestModifyView<AccountResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final Provider<IdentifiedUser> self;
|
||||
private final SetInactiveFlag setInactiveFlag;
|
||||
|
@@ -17,6 +17,7 @@ package com.google.gerrit.server.account;
|
||||
import static java.util.stream.Collectors.toSet;
|
||||
|
||||
import com.google.gerrit.extensions.client.AccountFieldName;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
@@ -25,7 +26,6 @@ import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.DeleteEmail.Input;
|
||||
import com.google.gerrit.server.account.externalids.ExternalId;
|
||||
import com.google.gerrit.server.account.externalids.ExternalIds;
|
||||
import com.google.gerrit.server.permissions.GlobalPermission;
|
||||
@@ -41,7 +41,6 @@ import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
|
||||
@Singleton
|
||||
public class DeleteEmail implements RestModifyView<AccountResource.Email, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final Provider<CurrentUser> self;
|
||||
private final Realm realm;
|
||||
|
@@ -14,11 +14,11 @@
|
||||
|
||||
package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.account.DeleteSshKey.Input;
|
||||
import com.google.gerrit.server.permissions.GlobalPermission;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
@@ -33,7 +33,6 @@ import org.eclipse.jgit.errors.RepositoryNotFoundException;
|
||||
|
||||
@Singleton
|
||||
public class DeleteSshKey implements RestModifyView<AccountResource.SshKey, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final Provider<CurrentUser> self;
|
||||
private final PermissionBackend permissionBackend;
|
||||
|
@@ -14,11 +14,11 @@
|
||||
|
||||
package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.account.Index.Input;
|
||||
import com.google.gerrit.server.permissions.GlobalPermission;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
@@ -29,7 +29,6 @@ import java.io.IOException;
|
||||
|
||||
@Singleton
|
||||
public class Index implements RestModifyView<AccountResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final AccountCache accountCache;
|
||||
private final PermissionBackend permissionBackend;
|
||||
|
@@ -16,10 +16,10 @@ package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.gerrit.common.data.GlobalCapability;
|
||||
import com.google.gerrit.extensions.annotations.RequiresCapability;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.account.PutActive.Input;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
@@ -29,7 +29,6 @@ import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
@RequiresCapability(GlobalCapability.MODIFY_ACCOUNT)
|
||||
@Singleton
|
||||
public class PutActive implements RestModifyView<AccountResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final SetInactiveFlag setInactiveFlag;
|
||||
|
||||
|
@@ -17,6 +17,7 @@ package com.google.gerrit.server.account;
|
||||
import static com.google.gerrit.server.account.externalids.ExternalId.SCHEME_USERNAME;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.extensions.common.HttpPasswordInput;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
@@ -24,7 +25,6 @@ import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.PutHttpPassword.Input;
|
||||
import com.google.gerrit.server.account.externalids.ExternalId;
|
||||
import com.google.gerrit.server.account.externalids.ExternalIds;
|
||||
import com.google.gerrit.server.account.externalids.ExternalIdsUpdate;
|
||||
@@ -40,12 +40,7 @@ import java.security.SecureRandom;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
|
||||
public class PutHttpPassword implements RestModifyView<AccountResource, Input> {
|
||||
public static class Input {
|
||||
public String httpPassword;
|
||||
public boolean generate;
|
||||
}
|
||||
|
||||
public class PutHttpPassword implements RestModifyView<AccountResource, HttpPasswordInput> {
|
||||
private static final int LEN = 31;
|
||||
private static final SecureRandom rng;
|
||||
|
||||
@@ -75,7 +70,7 @@ public class PutHttpPassword implements RestModifyView<AccountResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<String> apply(AccountResource rsrc, Input input)
|
||||
public Response<String> apply(AccountResource rsrc, HttpPasswordInput input)
|
||||
throws AuthException, ResourceNotFoundException, ResourceConflictException, OrmException,
|
||||
IOException, ConfigInvalidException, PermissionBackendException {
|
||||
if (self.get() != rsrc.getUser()) {
|
||||
@@ -83,7 +78,7 @@ public class PutHttpPassword implements RestModifyView<AccountResource, Input> {
|
||||
}
|
||||
|
||||
if (input == null) {
|
||||
input = new Input();
|
||||
input = new HttpPasswordInput();
|
||||
}
|
||||
input.httpPassword = Strings.emptyToNull(input.httpPassword);
|
||||
|
||||
|
@@ -16,8 +16,8 @@ package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.extensions.client.AccountFieldName;
|
||||
import com.google.gerrit.extensions.common.NameInput;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
@@ -25,7 +25,6 @@ import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.PutName.Input;
|
||||
import com.google.gerrit.server.permissions.GlobalPermission;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
@@ -37,11 +36,7 @@ import java.io.IOException;
|
||||
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
|
||||
@Singleton
|
||||
public class PutName implements RestModifyView<AccountResource, Input> {
|
||||
public static class Input {
|
||||
@DefaultInput public String name;
|
||||
}
|
||||
|
||||
public class PutName implements RestModifyView<AccountResource, NameInput> {
|
||||
private final Provider<CurrentUser> self;
|
||||
private final Realm realm;
|
||||
private final PermissionBackend permissionBackend;
|
||||
@@ -60,7 +55,7 @@ public class PutName implements RestModifyView<AccountResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<String> apply(AccountResource rsrc, Input input)
|
||||
public Response<String> apply(AccountResource rsrc, NameInput input)
|
||||
throws AuthException, MethodNotAllowedException, ResourceNotFoundException, OrmException,
|
||||
IOException, PermissionBackendException, ConfigInvalidException {
|
||||
if (self.get() != rsrc.getUser()) {
|
||||
@@ -69,11 +64,11 @@ public class PutName implements RestModifyView<AccountResource, Input> {
|
||||
return apply(rsrc.getUser(), input);
|
||||
}
|
||||
|
||||
public Response<String> apply(IdentifiedUser user, Input input)
|
||||
public Response<String> apply(IdentifiedUser user, NameInput input)
|
||||
throws MethodNotAllowedException, ResourceNotFoundException, IOException,
|
||||
ConfigInvalidException {
|
||||
if (input == null) {
|
||||
input = new Input();
|
||||
input = new NameInput();
|
||||
}
|
||||
|
||||
if (!realm.allowsEdit(AccountFieldName.FULL_NAME)) {
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
@@ -21,7 +22,6 @@ import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.PutPreferred.Input;
|
||||
import com.google.gerrit.server.permissions.GlobalPermission;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
@@ -35,7 +35,6 @@ import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
|
||||
@Singleton
|
||||
public class PutPreferred implements RestModifyView<AccountResource.Email, Input> {
|
||||
static class Input {}
|
||||
|
||||
private final Provider<CurrentUser> self;
|
||||
private final PermissionBackend permissionBackend;
|
||||
|
@@ -16,14 +16,13 @@ package com.google.gerrit.server.account;
|
||||
|
||||
import com.google.gerrit.common.errors.NameAlreadyUsedException;
|
||||
import com.google.gerrit.extensions.client.AccountFieldName;
|
||||
import com.google.gerrit.extensions.common.UsernameInput;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.account.PutUsername.Input;
|
||||
import com.google.gerrit.server.permissions.GlobalPermission;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
@@ -35,11 +34,7 @@ import java.io.IOException;
|
||||
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
|
||||
@Singleton
|
||||
public class PutUsername implements RestModifyView<AccountResource, Input> {
|
||||
public static class Input {
|
||||
@DefaultInput public String username;
|
||||
}
|
||||
|
||||
public class PutUsername implements RestModifyView<AccountResource, UsernameInput> {
|
||||
private final Provider<CurrentUser> self;
|
||||
private final ChangeUserName.Factory changeUserNameFactory;
|
||||
private final PermissionBackend permissionBackend;
|
||||
@@ -58,7 +53,7 @@ public class PutUsername implements RestModifyView<AccountResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(AccountResource rsrc, Input input)
|
||||
public String apply(AccountResource rsrc, UsernameInput input)
|
||||
throws AuthException, MethodNotAllowedException, UnprocessableEntityException,
|
||||
ResourceConflictException, OrmException, IOException, ConfigInvalidException,
|
||||
PermissionBackendException {
|
||||
@@ -71,7 +66,7 @@ public class PutUsername implements RestModifyView<AccountResource, Input> {
|
||||
}
|
||||
|
||||
if (input == null) {
|
||||
input = new Input();
|
||||
input = new UsernameInput();
|
||||
}
|
||||
|
||||
try {
|
||||
|
@@ -34,7 +34,9 @@ import com.google.gerrit.extensions.common.ChangeInfo;
|
||||
import com.google.gerrit.extensions.common.EmailInfo;
|
||||
import com.google.gerrit.extensions.common.GpgKeyInfo;
|
||||
import com.google.gerrit.extensions.common.GroupInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.common.SshKeyInfo;
|
||||
import com.google.gerrit.extensions.common.SshKeyInput;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
@@ -219,9 +221,9 @@ public class AccountApiImpl implements AccountApi {
|
||||
public void setActive(boolean active) throws RestApiException {
|
||||
try {
|
||||
if (active) {
|
||||
putActive.apply(account, new PutActive.Input());
|
||||
putActive.apply(account, new Input());
|
||||
} else {
|
||||
deleteActive.apply(account, new DeleteActive.Input());
|
||||
deleteActive.apply(account, new Input());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Cannot set active", e);
|
||||
@@ -423,7 +425,7 @@ public class AccountApiImpl implements AccountApi {
|
||||
|
||||
@Override
|
||||
public SshKeyInfo addSshKey(String key) throws RestApiException {
|
||||
AddSshKey.Input in = new AddSshKey.Input();
|
||||
SshKeyInput in = new SshKeyInput();
|
||||
in.raw = RawInputUtil.create(key);
|
||||
try {
|
||||
return addSshKey.apply(account, in).value();
|
||||
@@ -490,7 +492,7 @@ public class AccountApiImpl implements AccountApi {
|
||||
@Override
|
||||
public void index() throws RestApiException {
|
||||
try {
|
||||
index.apply(account, new Index.Input());
|
||||
index.apply(account, new Input());
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Cannot index account", e);
|
||||
}
|
||||
|
@@ -41,10 +41,12 @@ import com.google.gerrit.extensions.common.ChangeInfo;
|
||||
import com.google.gerrit.extensions.common.CommentInfo;
|
||||
import com.google.gerrit.extensions.common.CommitMessageInput;
|
||||
import com.google.gerrit.extensions.common.EditInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.common.MergePatchSetInput;
|
||||
import com.google.gerrit.extensions.common.PureRevertInfo;
|
||||
import com.google.gerrit.extensions.common.RobotCommentInfo;
|
||||
import com.google.gerrit.extensions.common.SuggestedReviewerInfo;
|
||||
import com.google.gerrit.extensions.common.TopicInput;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
@@ -435,7 +437,7 @@ class ChangeApiImpl implements ChangeApi {
|
||||
|
||||
@Override
|
||||
public void topic(String topic) throws RestApiException {
|
||||
PutTopic.Input in = new PutTopic.Input();
|
||||
TopicInput in = new TopicInput();
|
||||
in.topic = topic;
|
||||
try {
|
||||
putTopic.apply(change, in);
|
||||
@@ -646,7 +648,7 @@ class ChangeApiImpl implements ChangeApi {
|
||||
@Override
|
||||
public void index() throws RestApiException {
|
||||
try {
|
||||
index.apply(change, new Index.Input());
|
||||
index.apply(change, new Input());
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Cannot index change", e);
|
||||
}
|
||||
@@ -658,9 +660,9 @@ class ChangeApiImpl implements ChangeApi {
|
||||
// StarredChangesUtil.
|
||||
try {
|
||||
if (ignore) {
|
||||
this.ignore.apply(change, new Ignore.Input());
|
||||
this.ignore.apply(change, new Input());
|
||||
} else {
|
||||
unignore.apply(change, new Unignore.Input());
|
||||
unignore.apply(change, new Input());
|
||||
}
|
||||
} catch (OrmException | IllegalLabelException e) {
|
||||
throw asRestApiException("Cannot ignore change", e);
|
||||
@@ -682,9 +684,9 @@ class ChangeApiImpl implements ChangeApi {
|
||||
// StarredChangesUtil.
|
||||
try {
|
||||
if (reviewed) {
|
||||
markAsReviewed.apply(change, new MarkAsReviewed.Input());
|
||||
markAsReviewed.apply(change, new Input());
|
||||
} else {
|
||||
markAsUnreviewed.apply(change, new MarkAsUnreviewed.Input());
|
||||
markAsUnreviewed.apply(change, new Input());
|
||||
}
|
||||
} catch (OrmException | IllegalLabelException e) {
|
||||
throw asRestApiException(
|
||||
|
@@ -19,6 +19,7 @@ import static com.google.gerrit.server.api.ApiUtil.asRestApiException;
|
||||
import com.google.gerrit.extensions.api.changes.ChangeEditApi;
|
||||
import com.google.gerrit.extensions.api.changes.PublishChangeEditInput;
|
||||
import com.google.gerrit.extensions.common.EditInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.BinaryResult;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
@@ -106,7 +107,7 @@ public class ChangeEditApiImpl implements ChangeEditApi {
|
||||
@Override
|
||||
public void delete() throws RestApiException {
|
||||
try {
|
||||
deleteChangeEdit.apply(changeResource, new DeleteChangeEdit.Input());
|
||||
deleteChangeEdit.apply(changeResource, new Input());
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Cannot delete change edit", e);
|
||||
}
|
||||
|
@@ -36,8 +36,10 @@ import com.google.gerrit.extensions.client.SubmitType;
|
||||
import com.google.gerrit.extensions.common.ActionInfo;
|
||||
import com.google.gerrit.extensions.common.CommentInfo;
|
||||
import com.google.gerrit.extensions.common.CommitInfo;
|
||||
import com.google.gerrit.extensions.common.DescriptionInput;
|
||||
import com.google.gerrit.extensions.common.EditInfo;
|
||||
import com.google.gerrit.extensions.common.FileInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.common.MergeableInfo;
|
||||
import com.google.gerrit.extensions.common.RobotCommentInfo;
|
||||
import com.google.gerrit.extensions.common.TestSubmitRuleInput;
|
||||
@@ -300,13 +302,13 @@ class RevisionApiImpl implements RevisionApi {
|
||||
@Override
|
||||
public void setReviewed(String path, boolean reviewed) throws RestApiException {
|
||||
try {
|
||||
RestModifyView<FileResource, Reviewed.Input> view;
|
||||
RestModifyView<FileResource, Input> view;
|
||||
if (reviewed) {
|
||||
view = putReviewed;
|
||||
} else {
|
||||
view = deleteReviewed;
|
||||
}
|
||||
view.apply(files.parse(revision, IdString.fromDecoded(path)), new Reviewed.Input());
|
||||
view.apply(files.parse(revision, IdString.fromDecoded(path)), new Input());
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Cannot update reviewed flag", e);
|
||||
}
|
||||
@@ -565,7 +567,7 @@ class RevisionApiImpl implements RevisionApi {
|
||||
|
||||
@Override
|
||||
public void description(String description) throws RestApiException {
|
||||
PutDescription.Input in = new PutDescription.Input();
|
||||
DescriptionInput in = new DescriptionInput();
|
||||
in.description = description;
|
||||
try {
|
||||
putDescription.apply(revision, in);
|
||||
|
@@ -18,9 +18,13 @@ import static com.google.gerrit.server.api.ApiUtil.asRestApiException;
|
||||
|
||||
import com.google.gerrit.extensions.api.groups.GroupApi;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
import com.google.gerrit.extensions.common.DescriptionInput;
|
||||
import com.google.gerrit.extensions.common.GroupAuditEventInfo;
|
||||
import com.google.gerrit.extensions.common.GroupInfo;
|
||||
import com.google.gerrit.extensions.common.GroupOptionsInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.common.NameInput;
|
||||
import com.google.gerrit.extensions.common.OwnerInput;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.server.group.AddMembers;
|
||||
import com.google.gerrit.server.group.AddSubgroups;
|
||||
@@ -138,7 +142,7 @@ class GroupApiImpl implements GroupApi {
|
||||
|
||||
@Override
|
||||
public void name(String name) throws RestApiException {
|
||||
PutName.Input in = new PutName.Input();
|
||||
NameInput in = new NameInput();
|
||||
in.name = name;
|
||||
try {
|
||||
putName.apply(rsrc, in);
|
||||
@@ -158,7 +162,7 @@ class GroupApiImpl implements GroupApi {
|
||||
|
||||
@Override
|
||||
public void owner(String owner) throws RestApiException {
|
||||
PutOwner.Input in = new PutOwner.Input();
|
||||
OwnerInput in = new OwnerInput();
|
||||
in.owner = owner;
|
||||
try {
|
||||
putOwner.apply(rsrc, in);
|
||||
@@ -174,7 +178,7 @@ class GroupApiImpl implements GroupApi {
|
||||
|
||||
@Override
|
||||
public void description(String description) throws RestApiException {
|
||||
PutDescription.Input in = new PutDescription.Input();
|
||||
DescriptionInput in = new DescriptionInput();
|
||||
in.description = description;
|
||||
try {
|
||||
putDescription.apply(rsrc, in);
|
||||
@@ -269,7 +273,7 @@ class GroupApiImpl implements GroupApi {
|
||||
@Override
|
||||
public void index() throws RestApiException {
|
||||
try {
|
||||
index.apply(rsrc, new Index.Input());
|
||||
index.apply(rsrc, new Input());
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Cannot index group", e);
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.server.api.plugins;
|
||||
|
||||
import com.google.gerrit.extensions.api.plugins.PluginApi;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.common.PluginInfo;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.server.plugins.DisablePlugin;
|
||||
@@ -57,16 +58,16 @@ public class PluginApiImpl implements PluginApi {
|
||||
|
||||
@Override
|
||||
public void enable() throws RestApiException {
|
||||
enable.apply(resource, new EnablePlugin.Input());
|
||||
enable.apply(resource, new Input());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() throws RestApiException {
|
||||
disable.apply(resource, new DisablePlugin.Input());
|
||||
disable.apply(resource, new Input());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() throws RestApiException {
|
||||
reload.apply(resource, new ReloadPlugin.Input());
|
||||
reload.apply(resource, new Input());
|
||||
}
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ import com.google.gerrit.extensions.api.projects.BranchApi;
|
||||
import com.google.gerrit.extensions.api.projects.BranchInfo;
|
||||
import com.google.gerrit.extensions.api.projects.BranchInput;
|
||||
import com.google.gerrit.extensions.api.projects.ReflogEntryInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.BinaryResult;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
@@ -98,7 +99,7 @@ public class BranchApiImpl implements BranchApi {
|
||||
@Override
|
||||
public void delete() throws RestApiException {
|
||||
try {
|
||||
deleteBranch.apply(resource(), new DeleteBranch.Input());
|
||||
deleteBranch.apply(resource(), new Input());
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Cannot delete branch", e);
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ import static com.google.gerrit.server.api.ApiUtil.asRestApiException;
|
||||
import com.google.gerrit.extensions.api.projects.TagApi;
|
||||
import com.google.gerrit.extensions.api.projects.TagInfo;
|
||||
import com.google.gerrit.extensions.api.projects.TagInput;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.server.project.CreateTag;
|
||||
@@ -81,7 +82,7 @@ public class TagApiImpl implements TagApi {
|
||||
@Override
|
||||
public void delete() throws RestApiException {
|
||||
try {
|
||||
deleteTag.apply(resource(), new DeleteTag.Input());
|
||||
deleteTag.apply(resource(), new Input());
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Cannot delete tag", e);
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ package com.google.gerrit.server.change;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.extensions.common.DiffWebLinkInfo;
|
||||
import com.google.gerrit.extensions.common.EditInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
import com.google.gerrit.extensions.restapi.AcceptsCreate;
|
||||
import com.google.gerrit.extensions.restapi.AcceptsDelete;
|
||||
@@ -159,8 +160,7 @@ public class ChangeEdits
|
||||
}
|
||||
}
|
||||
|
||||
public static class DeleteFile implements RestModifyView<ChangeResource, DeleteFile.Input> {
|
||||
public static class Input {}
|
||||
public static class DeleteFile implements RestModifyView<ChangeResource, Input> {
|
||||
|
||||
interface Factory {
|
||||
DeleteFile create(String path);
|
||||
@@ -176,7 +176,7 @@ public class ChangeEdits
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<?> apply(ChangeResource rsrc, DeleteFile.Input in)
|
||||
public Response<?> apply(ChangeResource rsrc, Input in)
|
||||
throws IOException, AuthException, ResourceConflictException, OrmException,
|
||||
PermissionBackendException {
|
||||
return deleteContent.apply(rsrc, path);
|
||||
@@ -342,9 +342,7 @@ public class ChangeEdits
|
||||
* restoring a file to its previous contents.
|
||||
*/
|
||||
@Singleton
|
||||
public static class DeleteContent
|
||||
implements RestModifyView<ChangeEditResource, DeleteContent.Input> {
|
||||
public static class Input {}
|
||||
public static class DeleteContent implements RestModifyView<ChangeEditResource, Input> {
|
||||
|
||||
private final ChangeEditModifier editModifier;
|
||||
private final GitRepositoryManager repositoryManager;
|
||||
@@ -356,7 +354,7 @@ public class ChangeEdits
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<?> apply(ChangeEditResource rsrc, DeleteContent.Input input)
|
||||
public Response<?> apply(ChangeEditResource rsrc, Input input)
|
||||
throws AuthException, ResourceConflictException, OrmException, IOException,
|
||||
PermissionBackendException {
|
||||
return apply(rsrc.getChangeResource(), rsrc.getPath());
|
||||
|
@@ -16,6 +16,7 @@ package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.gerrit.common.TimeUtil;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
@@ -25,7 +26,6 @@ import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.ChangeMessagesUtil;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.account.AccountLoader;
|
||||
import com.google.gerrit.server.change.DeleteAssignee.Input;
|
||||
import com.google.gerrit.server.extensions.events.AssigneeChanged;
|
||||
import com.google.gerrit.server.notedb.ChangeUpdate;
|
||||
import com.google.gerrit.server.permissions.ChangePermission;
|
||||
@@ -45,7 +45,6 @@ import com.google.inject.Singleton;
|
||||
@Singleton
|
||||
public class DeleteAssignee
|
||||
extends RetryingRestModifyView<ChangeResource, Input, Response<AccountInfo>> {
|
||||
public static class Input {}
|
||||
|
||||
private final ChangeMessagesUtil cmUtil;
|
||||
private final Provider<ReviewDb> db;
|
||||
|
@@ -17,13 +17,13 @@ package com.google.gerrit.server.change;
|
||||
import static com.google.gerrit.extensions.conditions.BooleanCondition.and;
|
||||
|
||||
import com.google.gerrit.common.TimeUtil;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.webui.UiAction;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.change.DeleteChange.Input;
|
||||
import com.google.gerrit.server.permissions.ChangePermission;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
@@ -39,7 +39,6 @@ import com.google.inject.Singleton;
|
||||
@Singleton
|
||||
public class DeleteChange extends RetryingRestModifyView<ChangeResource, Input, Response<?>>
|
||||
implements UiAction<ChangeResource> {
|
||||
public static class Input {}
|
||||
|
||||
private final Provider<ReviewDb> db;
|
||||
private final Provider<DeleteChangeOp> opProvider;
|
||||
|
@@ -14,11 +14,11 @@
|
||||
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.change.DeleteChangeEdit.Input;
|
||||
import com.google.gerrit.server.edit.ChangeEdit;
|
||||
import com.google.gerrit.server.edit.ChangeEditUtil;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
@@ -29,7 +29,6 @@ import java.util.Optional;
|
||||
|
||||
@Singleton
|
||||
public class DeleteChangeEdit implements RestModifyView<ChangeResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final ChangeEditUtil editUtil;
|
||||
|
||||
|
@@ -18,6 +18,7 @@ import static com.google.gerrit.server.CommentsUtil.setCommentRevId;
|
||||
|
||||
import com.google.gerrit.common.TimeUtil;
|
||||
import com.google.gerrit.extensions.common.CommentInfo;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
@@ -26,7 +27,6 @@ import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.CommentsUtil;
|
||||
import com.google.gerrit.server.PatchSetUtil;
|
||||
import com.google.gerrit.server.change.DeleteDraftComment.Input;
|
||||
import com.google.gerrit.server.patch.PatchListCache;
|
||||
import com.google.gerrit.server.update.BatchUpdate;
|
||||
import com.google.gerrit.server.update.BatchUpdateOp;
|
||||
@@ -44,7 +44,6 @@ import java.util.Optional;
|
||||
@Singleton
|
||||
public class DeleteDraftComment
|
||||
extends RetryingRestModifyView<DraftCommentResource, Input, Response<CommentInfo>> {
|
||||
static class Input {}
|
||||
|
||||
private final Provider<ReviewDb> db;
|
||||
private final CommentsUtil commentsUtil;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
@@ -30,12 +31,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class Ignore
|
||||
implements RestModifyView<ChangeResource, Ignore.Input>, UiAction<ChangeResource> {
|
||||
public class Ignore implements RestModifyView<ChangeResource, Input>, UiAction<ChangeResource> {
|
||||
private static final Logger log = LoggerFactory.getLogger(Ignore.class);
|
||||
|
||||
public static class Input {}
|
||||
|
||||
private final StarredChangesUtil stars;
|
||||
|
||||
@Inject
|
||||
|
@@ -14,11 +14,11 @@
|
||||
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.change.Index.Input;
|
||||
import com.google.gerrit.server.index.change.ChangeIndexer;
|
||||
import com.google.gerrit.server.permissions.GlobalPermission;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
@@ -34,7 +34,6 @@ import java.io.IOException;
|
||||
|
||||
@Singleton
|
||||
public class Index extends RetryingRestModifyView<ChangeResource, Input, Response<?>> {
|
||||
public static class Input {}
|
||||
|
||||
private final Provider<ReviewDb> db;
|
||||
private final PermissionBackend permissionBackend;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
@@ -31,11 +32,9 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class MarkAsReviewed
|
||||
implements RestModifyView<ChangeResource, MarkAsReviewed.Input>, UiAction<ChangeResource> {
|
||||
implements RestModifyView<ChangeResource, Input>, UiAction<ChangeResource> {
|
||||
private static final Logger log = LoggerFactory.getLogger(MarkAsReviewed.class);
|
||||
|
||||
public static class Input {}
|
||||
|
||||
private final Provider<ReviewDb> dbProvider;
|
||||
private final ChangeData.Factory changeDataFactory;
|
||||
private final StarredChangesUtil stars;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.extensions.webui.UiAction;
|
||||
@@ -30,11 +31,9 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class MarkAsUnreviewed
|
||||
implements RestModifyView<ChangeResource, MarkAsUnreviewed.Input>, UiAction<ChangeResource> {
|
||||
implements RestModifyView<ChangeResource, Input>, UiAction<ChangeResource> {
|
||||
private static final Logger log = LoggerFactory.getLogger(MarkAsUnreviewed.class);
|
||||
|
||||
public static class Input {}
|
||||
|
||||
private final Provider<ReviewDb> dbProvider;
|
||||
private final ChangeData.Factory changeDataFactory;
|
||||
private final StarredChangesUtil stars;
|
||||
|
@@ -16,7 +16,7 @@ package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.common.TimeUtil;
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
import com.google.gerrit.extensions.common.DescriptionInput;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.webui.UiAction;
|
||||
@@ -42,16 +42,12 @@ import java.util.Collections;
|
||||
|
||||
@Singleton
|
||||
public class PutDescription
|
||||
extends RetryingRestModifyView<RevisionResource, PutDescription.Input, Response<String>>
|
||||
extends RetryingRestModifyView<RevisionResource, DescriptionInput, Response<String>>
|
||||
implements UiAction<RevisionResource> {
|
||||
private final Provider<ReviewDb> dbProvider;
|
||||
private final ChangeMessagesUtil cmUtil;
|
||||
private final PatchSetUtil psUtil;
|
||||
|
||||
public static class Input {
|
||||
@DefaultInput public String description;
|
||||
}
|
||||
|
||||
@Inject
|
||||
PutDescription(
|
||||
Provider<ReviewDb> dbProvider,
|
||||
@@ -66,11 +62,11 @@ public class PutDescription
|
||||
|
||||
@Override
|
||||
protected Response<String> applyImpl(
|
||||
BatchUpdate.Factory updateFactory, RevisionResource rsrc, Input input)
|
||||
BatchUpdate.Factory updateFactory, RevisionResource rsrc, DescriptionInput input)
|
||||
throws UpdateException, RestApiException, PermissionBackendException {
|
||||
rsrc.permissions().check(ChangePermission.EDIT_DESCRIPTION);
|
||||
|
||||
Op op = new Op(input != null ? input : new Input(), rsrc.getPatchSet().getId());
|
||||
Op op = new Op(input != null ? input : new DescriptionInput(), rsrc.getPatchSet().getId());
|
||||
try (BatchUpdate u =
|
||||
updateFactory.create(
|
||||
dbProvider.get(), rsrc.getChange().getProject(), rsrc.getUser(), TimeUtil.nowTs())) {
|
||||
@@ -83,13 +79,13 @@ public class PutDescription
|
||||
}
|
||||
|
||||
private class Op implements BatchUpdateOp {
|
||||
private final Input input;
|
||||
private final DescriptionInput input;
|
||||
private final PatchSet.Id psId;
|
||||
|
||||
private String oldDescription;
|
||||
private String newDescription;
|
||||
|
||||
Op(Input input, PatchSet.Id psId) {
|
||||
Op(DescriptionInput input, PatchSet.Id psId) {
|
||||
this.input = input;
|
||||
this.psId = psId;
|
||||
}
|
||||
|
@@ -16,8 +16,8 @@ package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.common.TimeUtil;
|
||||
import com.google.gerrit.extensions.common.TopicInput;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.webui.UiAction;
|
||||
@@ -26,7 +26,6 @@ import com.google.gerrit.reviewdb.client.ChangeMessage;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.ChangeMessagesUtil;
|
||||
import com.google.gerrit.server.ChangeUtil;
|
||||
import com.google.gerrit.server.change.PutTopic.Input;
|
||||
import com.google.gerrit.server.extensions.events.TopicEdited;
|
||||
import com.google.gerrit.server.notedb.ChangeUpdate;
|
||||
import com.google.gerrit.server.permissions.ChangePermission;
|
||||
@@ -44,16 +43,12 @@ import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class PutTopic extends RetryingRestModifyView<ChangeResource, Input, Response<String>>
|
||||
public class PutTopic extends RetryingRestModifyView<ChangeResource, TopicInput, Response<String>>
|
||||
implements UiAction<ChangeResource> {
|
||||
private final Provider<ReviewDb> dbProvider;
|
||||
private final ChangeMessagesUtil cmUtil;
|
||||
private final TopicEdited topicEdited;
|
||||
|
||||
public static class Input {
|
||||
@DefaultInput public String topic;
|
||||
}
|
||||
|
||||
@Inject
|
||||
PutTopic(
|
||||
Provider<ReviewDb> dbProvider,
|
||||
@@ -68,7 +63,7 @@ public class PutTopic extends RetryingRestModifyView<ChangeResource, Input, Resp
|
||||
|
||||
@Override
|
||||
protected Response<String> applyImpl(
|
||||
BatchUpdate.Factory updateFactory, ChangeResource req, Input input)
|
||||
BatchUpdate.Factory updateFactory, ChangeResource req, TopicInput input)
|
||||
throws UpdateException, RestApiException, PermissionBackendException {
|
||||
req.permissions().check(ChangePermission.EDIT_TOPIC_NAME);
|
||||
|
||||
@@ -79,7 +74,7 @@ public class PutTopic extends RetryingRestModifyView<ChangeResource, Input, Resp
|
||||
String.format("topic length exceeds the limit (%s)", ChangeUtil.TOPIC_MAX_LENGTH));
|
||||
}
|
||||
|
||||
Op op = new Op(input != null ? input : new Input());
|
||||
Op op = new Op(input != null ? input : new TopicInput());
|
||||
try (BatchUpdate u =
|
||||
updateFactory.create(
|
||||
dbProvider.get(), req.getChange().getProject(), req.getUser(), TimeUtil.nowTs())) {
|
||||
@@ -90,13 +85,13 @@ public class PutTopic extends RetryingRestModifyView<ChangeResource, Input, Resp
|
||||
}
|
||||
|
||||
private class Op implements BatchUpdateOp {
|
||||
private final Input input;
|
||||
private final TopicInput input;
|
||||
|
||||
private Change change;
|
||||
private String oldTopicName;
|
||||
private String newTopicName;
|
||||
|
||||
Op(Input input) {
|
||||
Op(TopicInput input) {
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
import com.google.gerrit.extensions.restapi.AcceptsPost;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
@@ -68,8 +69,7 @@ public class RebaseChangeEdit
|
||||
}
|
||||
|
||||
@Singleton
|
||||
public static class Rebase implements RestModifyView<ChangeResource, Rebase.Input> {
|
||||
public static class Input {}
|
||||
public static class Rebase implements RestModifyView<ChangeResource, Input> {
|
||||
|
||||
private final GitRepositoryManager repositoryManager;
|
||||
private final ChangeEditModifier editModifier;
|
||||
@@ -81,7 +81,7 @@ public class RebaseChangeEdit
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<?> apply(ChangeResource rsrc, Rebase.Input in)
|
||||
public Response<?> apply(ChangeResource rsrc, Input in)
|
||||
throws AuthException, ResourceConflictException, IOException, OrmException,
|
||||
PermissionBackendException {
|
||||
Project.NameKey project = rsrc.getProject();
|
||||
|
@@ -16,6 +16,7 @@ package com.google.gerrit.server.change;
|
||||
|
||||
import static java.util.stream.Collectors.joining;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.BinaryResult;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
@@ -23,7 +24,6 @@ import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDbUtil;
|
||||
import com.google.gerrit.server.CommentsUtil;
|
||||
import com.google.gerrit.server.change.Rebuild.Input;
|
||||
import com.google.gerrit.server.notedb.ChangeBundle;
|
||||
import com.google.gerrit.server.notedb.ChangeBundleReader;
|
||||
import com.google.gerrit.server.notedb.ChangeNotes;
|
||||
@@ -40,7 +40,6 @@ import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
|
||||
@Singleton
|
||||
public class Rebuild implements RestModifyView<ChangeResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final Provider<ReviewDb> db;
|
||||
private final NotesMigration migration;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.registration.DynamicItem;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
@@ -22,7 +23,6 @@ import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
public class Reviewed {
|
||||
public static class Input {}
|
||||
|
||||
@Singleton
|
||||
public static class PutReviewed implements RestModifyView<FileResource, Input> {
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.extensions.webui.UiAction;
|
||||
@@ -26,12 +27,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class Unignore
|
||||
implements RestModifyView<ChangeResource, Unignore.Input>, UiAction<ChangeResource> {
|
||||
public class Unignore implements RestModifyView<ChangeResource, Input>, UiAction<ChangeResource> {
|
||||
private static final Logger log = LoggerFactory.getLogger(Unignore.class);
|
||||
|
||||
public static class Input {}
|
||||
|
||||
private final StarredChangesUtil stars;
|
||||
|
||||
@Inject
|
||||
|
@@ -19,16 +19,15 @@ import static com.google.gerrit.common.data.GlobalCapability.MAINTAIN_SERVER;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.RequiresAnyCapability;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.config.DeleteTask.Input;
|
||||
import com.google.gerrit.server.git.WorkQueue.Task;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
@RequiresAnyCapability({KILL_TASK, MAINTAIN_SERVER})
|
||||
public class DeleteTask implements RestModifyView<TaskResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
@Override
|
||||
public Response<?> apply(TaskResource rsrc, Input input) {
|
||||
|
@@ -18,11 +18,11 @@ import static com.google.gerrit.common.data.GlobalCapability.FLUSH_CACHES;
|
||||
import static com.google.gerrit.common.data.GlobalCapability.MAINTAIN_SERVER;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.RequiresAnyCapability;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.config.FlushCache.Input;
|
||||
import com.google.gerrit.server.permissions.GlobalPermission;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
@@ -33,7 +33,6 @@ import com.google.inject.Singleton;
|
||||
@RequiresAnyCapability({FLUSH_CACHES, MAINTAIN_SERVER})
|
||||
@Singleton
|
||||
public class FlushCache implements RestModifyView<CacheResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
public static final String WEB_SESSIONS = "web_sessions";
|
||||
|
||||
|
@@ -204,8 +204,7 @@ public class AddMembers implements RestModifyView<GroupResource, Input> {
|
||||
return result;
|
||||
}
|
||||
|
||||
static class PutMember implements RestModifyView<GroupResource, PutMember.Input> {
|
||||
static class Input {}
|
||||
static class PutMember implements RestModifyView<GroupResource, Input> {
|
||||
|
||||
private final AddMembers put;
|
||||
private final String id;
|
||||
@@ -216,7 +215,7 @@ public class AddMembers implements RestModifyView<GroupResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountInfo apply(GroupResource resource, PutMember.Input input)
|
||||
public AccountInfo apply(GroupResource resource, Input input)
|
||||
throws AuthException, MethodNotAllowedException, ResourceNotFoundException, OrmException,
|
||||
IOException, ConfigInvalidException {
|
||||
AddMembers.Input in = new AddMembers.Input();
|
||||
@@ -234,7 +233,7 @@ public class AddMembers implements RestModifyView<GroupResource, Input> {
|
||||
}
|
||||
|
||||
@Singleton
|
||||
static class UpdateMember implements RestModifyView<MemberResource, PutMember.Input> {
|
||||
static class UpdateMember implements RestModifyView<MemberResource, Input> {
|
||||
private final GetMember get;
|
||||
|
||||
@Inject
|
||||
@@ -243,7 +242,7 @@ public class AddMembers implements RestModifyView<GroupResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountInfo apply(MemberResource resource, PutMember.Input input) throws OrmException {
|
||||
public AccountInfo apply(MemberResource resource, Input input) throws OrmException {
|
||||
// Do nothing, the user is already a member.
|
||||
return get.apply(resource);
|
||||
}
|
||||
|
@@ -114,8 +114,7 @@ public class AddSubgroups implements RestModifyView<GroupResource, Input> {
|
||||
return result;
|
||||
}
|
||||
|
||||
static class PutSubgroup implements RestModifyView<GroupResource, PutSubgroup.Input> {
|
||||
static class Input {}
|
||||
static class PutSubgroup implements RestModifyView<GroupResource, Input> {
|
||||
|
||||
private final AddSubgroups addSubgroups;
|
||||
private final String id;
|
||||
@@ -144,7 +143,7 @@ public class AddSubgroups implements RestModifyView<GroupResource, Input> {
|
||||
}
|
||||
|
||||
@Singleton
|
||||
static class UpdateSubgroup implements RestModifyView<SubgroupResource, PutSubgroup.Input> {
|
||||
static class UpdateSubgroup implements RestModifyView<SubgroupResource, Input> {
|
||||
private final Provider<GetSubgroup> get;
|
||||
|
||||
@Inject
|
||||
@@ -153,7 +152,7 @@ public class AddSubgroups implements RestModifyView<GroupResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupInfo apply(SubgroupResource resource, PutSubgroup.Input input) throws OrmException {
|
||||
public GroupInfo apply(SubgroupResource resource, Input input) throws OrmException {
|
||||
// Do nothing, the group is already included.
|
||||
return get.get().apply(resource);
|
||||
}
|
||||
|
@@ -82,8 +82,7 @@ public class DeleteMembers implements RestModifyView<GroupResource, Input> {
|
||||
}
|
||||
|
||||
@Singleton
|
||||
static class DeleteMember implements RestModifyView<MemberResource, DeleteMember.Input> {
|
||||
static class Input {}
|
||||
static class DeleteMember implements RestModifyView<MemberResource, Input> {
|
||||
|
||||
private final Provider<DeleteMembers> delete;
|
||||
|
||||
|
@@ -82,8 +82,7 @@ public class DeleteSubgroups implements RestModifyView<GroupResource, Input> {
|
||||
}
|
||||
|
||||
@Singleton
|
||||
static class DeleteSubgroup implements RestModifyView<SubgroupResource, DeleteSubgroup.Input> {
|
||||
static class Input {}
|
||||
static class DeleteSubgroup implements RestModifyView<SubgroupResource, Input> {
|
||||
|
||||
private final Provider<DeleteSubgroups> delete;
|
||||
|
||||
|
@@ -14,13 +14,13 @@
|
||||
|
||||
package com.google.gerrit.server.group;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.server.account.GroupCache;
|
||||
import com.google.gerrit.server.group.Index.Input;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
@@ -28,7 +28,6 @@ import java.util.Optional;
|
||||
|
||||
@Singleton
|
||||
public class Index implements RestModifyView<GroupResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final GroupCache groupCache;
|
||||
|
||||
|
@@ -17,15 +17,14 @@ package com.google.gerrit.server.group;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.common.data.GroupDescription;
|
||||
import com.google.gerrit.common.errors.NoSuchGroupException;
|
||||
import com.google.gerrit.extensions.common.DescriptionInput;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.group.PutDescription.Input;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
@@ -34,11 +33,7 @@ import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
@Singleton
|
||||
public class PutDescription implements RestModifyView<GroupResource, Input> {
|
||||
public static class Input {
|
||||
@DefaultInput public String description;
|
||||
}
|
||||
|
||||
public class PutDescription implements RestModifyView<GroupResource, DescriptionInput> {
|
||||
private final Provider<ReviewDb> db;
|
||||
private final Provider<GroupsUpdate> groupsUpdateProvider;
|
||||
|
||||
@@ -50,11 +45,11 @@ public class PutDescription implements RestModifyView<GroupResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<String> apply(GroupResource resource, Input input)
|
||||
public Response<String> apply(GroupResource resource, DescriptionInput input)
|
||||
throws AuthException, MethodNotAllowedException, ResourceNotFoundException, OrmException,
|
||||
IOException {
|
||||
if (input == null) {
|
||||
input = new Input(); // Delete would set description to null.
|
||||
input = new DescriptionInput(); // Delete would set description to null.
|
||||
}
|
||||
|
||||
GroupDescription.Internal internalGroup =
|
||||
|
@@ -18,16 +18,15 @@ import com.google.common.base.Strings;
|
||||
import com.google.gerrit.common.data.GroupDescription;
|
||||
import com.google.gerrit.common.errors.NameAlreadyUsedException;
|
||||
import com.google.gerrit.common.errors.NoSuchGroupException;
|
||||
import com.google.gerrit.extensions.common.NameInput;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.group.PutName.Input;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
@@ -35,11 +34,7 @@ import com.google.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
|
||||
@Singleton
|
||||
public class PutName implements RestModifyView<GroupResource, Input> {
|
||||
public static class Input {
|
||||
@DefaultInput public String name;
|
||||
}
|
||||
|
||||
public class PutName implements RestModifyView<GroupResource, NameInput> {
|
||||
private final Provider<ReviewDb> db;
|
||||
private final Provider<GroupsUpdate> groupsUpdateProvider;
|
||||
|
||||
@@ -50,7 +45,7 @@ public class PutName implements RestModifyView<GroupResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(GroupResource rsrc, Input input)
|
||||
public String apply(GroupResource rsrc, NameInput input)
|
||||
throws MethodNotAllowedException, AuthException, BadRequestException,
|
||||
ResourceConflictException, ResourceNotFoundException, OrmException, IOException {
|
||||
GroupDescription.Internal internalGroup =
|
||||
|
@@ -18,16 +18,15 @@ import com.google.common.base.Strings;
|
||||
import com.google.gerrit.common.data.GroupDescription;
|
||||
import com.google.gerrit.common.errors.NoSuchGroupException;
|
||||
import com.google.gerrit.extensions.common.GroupInfo;
|
||||
import com.google.gerrit.extensions.common.OwnerInput;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.group.PutOwner.Input;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
@@ -35,11 +34,7 @@ import com.google.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
|
||||
@Singleton
|
||||
public class PutOwner implements RestModifyView<GroupResource, Input> {
|
||||
public static class Input {
|
||||
@DefaultInput public String owner;
|
||||
}
|
||||
|
||||
public class PutOwner implements RestModifyView<GroupResource, OwnerInput> {
|
||||
private final GroupsCollection groupsCollection;
|
||||
private final Provider<GroupsUpdate> groupsUpdateProvider;
|
||||
private final Provider<ReviewDb> db;
|
||||
@@ -58,7 +53,7 @@ public class PutOwner implements RestModifyView<GroupResource, Input> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupInfo apply(GroupResource resource, Input input)
|
||||
public GroupInfo apply(GroupResource resource, OwnerInput input)
|
||||
throws ResourceNotFoundException, MethodNotAllowedException, AuthException,
|
||||
BadRequestException, UnprocessableEntityException, OrmException, IOException {
|
||||
GroupDescription.Internal internalGroup =
|
||||
|
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.server.plugins;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.common.PluginInfo;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
@@ -22,14 +23,12 @@ import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.permissions.GlobalPermission;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
import com.google.gerrit.server.plugins.DisablePlugin.Input;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class DisablePlugin implements RestModifyView<PluginResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final PluginLoader loader;
|
||||
private final Provider<IdentifiedUser> user;
|
||||
|
@@ -17,11 +17,11 @@ package com.google.gerrit.server.plugins;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.gerrit.common.data.GlobalCapability;
|
||||
import com.google.gerrit.extensions.annotations.RequiresCapability;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.common.PluginInfo;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.plugins.EnablePlugin.Input;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import java.io.PrintWriter;
|
||||
@@ -30,7 +30,6 @@ import java.io.StringWriter;
|
||||
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
|
||||
@Singleton
|
||||
public class EnablePlugin implements RestModifyView<PluginResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final PluginLoader loader;
|
||||
|
||||
|
@@ -17,10 +17,10 @@ package com.google.gerrit.server.plugins;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.gerrit.common.data.GlobalCapability;
|
||||
import com.google.gerrit.extensions.annotations.RequiresCapability;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.common.PluginInfo;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.server.plugins.ReloadPlugin.Input;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import java.io.PrintWriter;
|
||||
@@ -29,7 +29,6 @@ import java.io.StringWriter;
|
||||
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
|
||||
@Singleton
|
||||
public class ReloadPlugin implements RestModifyView<PluginResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final PluginLoader loader;
|
||||
|
||||
|
@@ -16,6 +16,7 @@ package com.google.gerrit.server.project;
|
||||
|
||||
import static org.eclipse.jgit.lib.Constants.R_HEADS;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
@@ -24,7 +25,6 @@ import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.permissions.PermissionBackend;
|
||||
import com.google.gerrit.server.permissions.PermissionBackendException;
|
||||
import com.google.gerrit.server.permissions.RefPermission;
|
||||
import com.google.gerrit.server.project.DeleteBranch.Input;
|
||||
import com.google.gerrit.server.query.change.InternalChangeQuery;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
@@ -34,7 +34,6 @@ import java.io.IOException;
|
||||
|
||||
@Singleton
|
||||
public class DeleteBranch implements RestModifyView<BranchResource, Input> {
|
||||
public static class Input {}
|
||||
|
||||
private final Provider<InternalChangeQuery> queryProvider;
|
||||
private final DeleteRef.Factory deleteRefFactory;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.project;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
@@ -28,8 +29,7 @@ import com.google.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
|
||||
@Singleton
|
||||
public class DeleteTag implements RestModifyView<TagResource, DeleteTag.Input> {
|
||||
public static class Input {}
|
||||
public class DeleteTag implements RestModifyView<TagResource, Input> {
|
||||
|
||||
private final PermissionBackend permissionBackend;
|
||||
private final Provider<CurrentUser> user;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.sshd.commands;
|
||||
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.server.change.ChangeResource;
|
||||
import com.google.gerrit.server.change.Index;
|
||||
@@ -55,7 +56,7 @@ final class IndexChangesCommand extends SshCommand {
|
||||
boolean ok = true;
|
||||
for (ChangeResource rsrc : changes.values()) {
|
||||
try {
|
||||
index.apply(rsrc, new Index.Input());
|
||||
index.apply(rsrc, new Input());
|
||||
} catch (Exception e) {
|
||||
ok = false;
|
||||
writeError(
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.sshd.commands;
|
||||
|
||||
import com.google.gerrit.extensions.common.NameInput;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.restapi.TopLevelResource;
|
||||
@@ -48,7 +49,7 @@ public class RenameGroupCommand extends SshCommand {
|
||||
protected void run() throws Failure {
|
||||
try {
|
||||
GroupResource rsrc = groups.parse(TopLevelResource.INSTANCE, IdString.fromDecoded(groupName));
|
||||
PutName.Input input = new PutName.Input();
|
||||
NameInput input = new NameInput();
|
||||
input.name = newGroupName;
|
||||
putName.apply(rsrc, input);
|
||||
} catch (RestApiException | OrmException | IOException e) {
|
||||
|
@@ -23,7 +23,11 @@ import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.extensions.annotations.RequiresCapability;
|
||||
import com.google.gerrit.extensions.api.accounts.EmailInput;
|
||||
import com.google.gerrit.extensions.common.EmailInfo;
|
||||
import com.google.gerrit.extensions.common.HttpPasswordInput;
|
||||
import com.google.gerrit.extensions.common.Input;
|
||||
import com.google.gerrit.extensions.common.NameInput;
|
||||
import com.google.gerrit.extensions.common.SshKeyInfo;
|
||||
import com.google.gerrit.extensions.common.SshKeyInput;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
@@ -193,13 +197,13 @@ final class SetAccountCommand extends SshCommand {
|
||||
}
|
||||
|
||||
if (fullName != null) {
|
||||
PutName.Input in = new PutName.Input();
|
||||
NameInput in = new NameInput();
|
||||
in.name = fullName;
|
||||
putName.apply(rsrc, in);
|
||||
}
|
||||
|
||||
if (httpPassword != null || clearHttpPassword) {
|
||||
PutHttpPassword.Input in = new PutHttpPassword.Input();
|
||||
HttpPasswordInput in = new HttpPasswordInput();
|
||||
in.httpPassword = httpPassword;
|
||||
putHttpPassword.apply(rsrc, in);
|
||||
}
|
||||
@@ -232,7 +236,7 @@ final class SetAccountCommand extends SshCommand {
|
||||
throws RestApiException, OrmException, IOException, ConfigInvalidException,
|
||||
PermissionBackendException {
|
||||
for (String sshKey : sshKeys) {
|
||||
AddSshKey.Input in = new AddSshKey.Input();
|
||||
SshKeyInput in = new SshKeyInput();
|
||||
in.raw = RawInputUtil.create(sshKey.getBytes(UTF_8), "plain/text");
|
||||
addSshKey.apply(rsrc, in);
|
||||
}
|
||||
@@ -284,10 +288,10 @@ final class SetAccountCommand extends SshCommand {
|
||||
if (email.equals("ALL")) {
|
||||
List<EmailInfo> emails = getEmails.apply(rsrc);
|
||||
for (EmailInfo e : emails) {
|
||||
deleteEmail.apply(new AccountResource.Email(user, e.email), new DeleteEmail.Input());
|
||||
deleteEmail.apply(new AccountResource.Email(user, e.email), new Input());
|
||||
}
|
||||
} else {
|
||||
deleteEmail.apply(new AccountResource.Email(user, email), new DeleteEmail.Input());
|
||||
deleteEmail.apply(new AccountResource.Email(user, email), new Input());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user