Package com.google.gerrit.reviewdb.server

Examples of com.google.gerrit.reviewdb.server.ReviewDb


    Term a1 = arg1.dereference();

    Term listHead = Prolog.Nil;
    try {
      PrologEnvironment env = (PrologEnvironment) engine.control;
      ReviewDb db = StoredValues.REVIEW_DB.get(engine);
      PatchSet patchSet = StoredValues.PATCH_SET.get(engine);
      ChangeData cd = StoredValues.CHANGE_DATA.getOrNull(engine);
      ApprovalTypes types = env.getInjector().getInstance(ApprovalTypes.class);

      Iterable<PatchSetApproval> approvals;
      if (cd != null) {
        approvals = cd.currentApprovals(Providers.of(db));
      } else {
        approvals = db.patchSetApprovals().byPatchSet(patchSet.getId());
      }

      for (PatchSetApproval a : approvals) {
        if (a.getValue() == 0) {
          continue;
View Full Code Here


      this.schema = schema;
    }

    @Override
    public Iterable<SshKeyCacheEntry> load(String username) throws Exception {
      final ReviewDb db = schema.open();
      try {
        final AccountExternalId.Key key =
            new AccountExternalId.Key(SCHEME_USERNAME, username);
        final AccountExternalId user = db.accountExternalIds().get(key);
        if (user == null) {
          return NO_SUCH_USER;
        }

        final List<SshKeyCacheEntry> kl = new ArrayList<SshKeyCacheEntry>(4);
        for (AccountSshKey k : db.accountSshKeys().byAccount(
            user.getAccountId())) {
          if (k.isValid()) {
            add(db, kl, k);
          }
        }
        if (kl.isEmpty()) {
          return NO_KEYS;
        }
        return Collections.unmodifiableList(kl);
      } finally {
        db.close();
      }
    }
View Full Code Here

    if (idTerm.isInteger()) {
      Map<Account.Id, IdentifiedUser> cache = StoredValues.USERS.get(engine);
      Account.Id accountId = new Account.Id(((IntegerTerm) idTerm).intValue());
      user = cache.get(accountId);
      if (user == null) {
        ReviewDb db = StoredValues.REVIEW_DB.getOrNull(engine);
        IdentifiedUser.GenericFactory userFactory = userFactory(engine);
        IdentifiedUser who;
        if (db != null) {
          who = userFactory.create(Providers.of(db), accountId);
        } else {
View Full Code Here

  }

  public void run() {
    final HashSet<Branch.NameKey> pending = new HashSet<Branch.NameKey>();
    try {
      final ReviewDb c = schema.open();
      try {
        for (final Change change : c.changes().allSubmitted()) {
          pending.add(change.getDest());
        }
      } finally {
        c.close();
      }
    } catch (OrmException e) {
      log.error("Cannot reload MergeQueue", e);
    }
View Full Code Here

      this.schema = schema;
    }

    @Override
    public Optional<Account.Id> load(String username) throws Exception {
      final ReviewDb db = schema.open();
      try {
        final AccountExternalId extId =
            db.accountExternalIds().get(
                new AccountExternalId.Key(SCHEME_GERRIT, username));
        if (extId != null) {
          return Optional.of(extId.getAccountId());
        }
        return Optional.absent();
      } finally {
        db.close();
      }
    }
View Full Code Here

TOP

Related Classes of com.google.gerrit.reviewdb.server.ReviewDb

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.