All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.gerrit.reviewdb.server.DisallowReadFromChangesReviewDbWrapper Maven / Gradle / Ivy

There is a newer version: 3.10.0-rc4
Show newest version
// Copyright (C) 2016 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.reviewdb.server;

import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.ChangeMessage;
import com.google.gerrit.reviewdb.client.PatchLineComment;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.PatchSetApproval;
import com.google.gwtorm.server.OrmException;
import com.google.gwtorm.server.ResultSet;

public class DisallowReadFromChangesReviewDbWrapper extends ReviewDbWrapper {
  private static final String MSG = "This table has been migrated to NoteDb";

  private final Changes changes;
  private final PatchSetApprovals patchSetApprovals;
  private final ChangeMessages changeMessages;
  private final PatchSets patchSets;
  private final PatchLineComments patchComments;

  public DisallowReadFromChangesReviewDbWrapper(ReviewDb db) {
    super(db);
    changes = new Changes(delegate.changes());
    patchSetApprovals = new PatchSetApprovals(delegate.patchSetApprovals());
    changeMessages = new ChangeMessages(delegate.changeMessages());
    patchSets = new PatchSets(delegate.patchSets());
    patchComments = new PatchLineComments(delegate.patchComments());
  }

  @Override
  public ChangeAccess changes() {
    return changes;
  }

  @Override
  public PatchSetApprovalAccess patchSetApprovals() {
    return patchSetApprovals;
  }

  @Override
  public ChangeMessageAccess changeMessages() {
    return changeMessages;
  }

  @Override
  public PatchSetAccess patchSets() {
    return patchSets;
  }

  @Override
  public PatchLineCommentAccess patchComments() {
    return patchComments;
  }

  private static class Changes extends ChangeAccessWrapper {

    protected Changes(ChangeAccess delegate) {
      super(delegate);
    }

    @Override
    public ResultSet iterateAllEntities() {
      throw new UnsupportedOperationException(MSG);
    }

    @SuppressWarnings("deprecation")
    @Override
    public com.google.common.util.concurrent.CheckedFuture getAsync(
        Change.Id key) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet get(Iterable keys) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public Change get(Change.Id id) throws OrmException {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet all() throws OrmException {
      throw new UnsupportedOperationException(MSG);
    }
  }

  private static class PatchSetApprovals extends PatchSetApprovalAccessWrapper {
    PatchSetApprovals(PatchSetApprovalAccess delegate) {
      super(delegate);
    }

    @Override
    public ResultSet iterateAllEntities() {
      throw new UnsupportedOperationException(MSG);
    }

    @SuppressWarnings("deprecation")
    @Override
    public com.google.common.util.concurrent.CheckedFuture getAsync(
        PatchSetApproval.Key key) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet get(Iterable keys) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public PatchSetApproval get(PatchSetApproval.Key key) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet byChange(Change.Id id) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet byPatchSet(PatchSet.Id id) {
      throw new UnsupportedOperationException(MSG);
    }
  }

  private static class ChangeMessages extends ChangeMessageAccessWrapper {
    ChangeMessages(ChangeMessageAccess delegate) {
      super(delegate);
    }

    @Override
    public ResultSet iterateAllEntities() {
      throw new UnsupportedOperationException(MSG);
    }

    @SuppressWarnings("deprecation")
    @Override
    public com.google.common.util.concurrent.CheckedFuture getAsync(
        ChangeMessage.Key key) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet get(Iterable keys) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ChangeMessage get(ChangeMessage.Key id) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet byChange(Change.Id id) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet byPatchSet(PatchSet.Id id) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet all() {
      throw new UnsupportedOperationException(MSG);
    }
  }

  private static class PatchSets extends PatchSetAccessWrapper {
    PatchSets(PatchSetAccess delegate) {
      super(delegate);
    }

    @Override
    public ResultSet iterateAllEntities() {
      throw new UnsupportedOperationException(MSG);
    }

    @SuppressWarnings("deprecation")
    @Override
    public com.google.common.util.concurrent.CheckedFuture getAsync(
        PatchSet.Id key) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet get(Iterable keys) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public PatchSet get(PatchSet.Id id) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet byChange(Change.Id id) {
      throw new UnsupportedOperationException(MSG);
    }
  }

  private static class PatchLineComments extends PatchLineCommentAccessWrapper {
    PatchLineComments(PatchLineCommentAccess delegate) {
      super(delegate);
    }

    @Override
    public ResultSet iterateAllEntities() {
      throw new UnsupportedOperationException(MSG);
    }

    @SuppressWarnings("deprecation")
    @Override
    public com.google.common.util.concurrent.CheckedFuture getAsync(
        PatchLineComment.Key key) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet get(Iterable keys) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public PatchLineComment get(PatchLineComment.Key id) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet byChange(Change.Id id) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet byPatchSet(PatchSet.Id id) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet publishedByChangeFile(Change.Id id, String file) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet publishedByPatchSet(PatchSet.Id patchset) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet draftByPatchSetAuthor(
        PatchSet.Id patchset, Account.Id author) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet draftByChangeFileAuthor(
        Change.Id id, String file, Account.Id author) {
      throw new UnsupportedOperationException(MSG);
    }

    @Override
    public ResultSet draftByAuthor(Account.Id author) {
      throw new UnsupportedOperationException(MSG);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy