Package com.google.gerrit.reviewdb.client

Examples of com.google.gerrit.reviewdb.client.Change$Key


    return id.equals(object.getId());
  }

  @Override
  public ResultSet<ChangeData> read() throws OrmException {
    Change c = db.get().changes().get(id);
    if (c != null) {
      return new ListResultSet<ChangeData>( //
          Collections.singletonList(new ChangeData(c)));
    } else {
      return new ListResultSet<ChangeData>(Collections.<ChangeData> emptyList());
View Full Code Here


    this.dbProvider = dbProvider;
  }

  @Override
  public boolean match(final ChangeData object) throws OrmException {
    Change change = object.change(dbProvider);
    if (change == null) {
      return false;
    }
    return getValue().equals(change.getDest().get());
  }
View Full Code Here

    return cut;
  }

  @Override
  public boolean match(final ChangeData object) throws OrmException {
    Change change = object.change(dbProvider);
    return change != null && change.getLastUpdatedOn().getTime() < cut;
  }
View Full Code Here

      try {
        final PatchSet.Id psId = change.currentPatchSetId();
        for (PatchSetAncestor a : db.patchSetAncestors().ancestorsOf(psId)) {
          for (PatchSet p :
              db.patchSets().byRevision(a.getAncestorRevision())) {
            Change c = db.changes().get(p.getId().getParentKey());
            ca.dependsOn.add(newDependsOn(c, p));
          }
        }

        final RevId revId = db.patchSets().get(psId).getRevision();
        for (PatchSetAncestor a : db.patchSetAncestors().descendantsOf(revId)) {
          final PatchSet p = db.patchSets().get(a.getPatchSet());
          final Change c = db.changes().get(p.getId().getParentKey());
          ca.neededBy.add(newNeededBy(c, p));
        }
      } finally {
        db.close();
      }
View Full Code Here

        patches = db.patchSets().byRevisionRange(id, id.max());
      }

      final Set<PatchSet.Id> matches = new HashSet<PatchSet.Id>();
      for (final PatchSet ps : patches) {
        final Change change = db.changes().get(ps.getId().getParentKey());
        if (inProject(change)) {
          matches.add(ps.getId());
        }
      }

      switch (matches.size()) {
        case 1:
          return matches;
        case 0:
          throw error("\"" + patchIdentity + "\" no such patch set");
        default:
          throw error("\"" + patchIdentity + "\" matches multiple patch sets");
      }
    }

    // By older style change,patchset?
    //
    if (patchIdentity.matches("^[1-9][0-9]*,[1-9][0-9]*$")) {
      final PatchSet.Id patchSetId;
      try {
        patchSetId = PatchSet.Id.parse(patchIdentity);
      } catch (IllegalArgumentException e) {
        throw error("\"" + patchIdentity + "\" is not a valid patch set");
      }
      if (db.patchSets().get(patchSetId) == null) {
        throw error("\"" + patchIdentity + "\" no such patch set");
      }
      if (projectControl != null) {
        final Change change = db.changes().get(patchSetId.getParentKey());
        if (!inProject(change)) {
          throw error("change " + change.getId() + " not in project "
              + projectControl.getProject().getName());
        }
      }
      return Collections.singleton(patchSetId);
    }
View Full Code Here

  @Override
  public Operation exec(Prolog engine) throws PrologException {
    engine.setB0();
    Term a1 = arg1.dereference();

    Change change = StoredValues.CHANGE.get(engine);
    Project.NameKey name = change.getProject();

    if (!a1.unify(SymbolTerm.create(name.get()), engine.trail)) {
      return engine.fail();
    }
    return cont;
View Full Code Here

  @Override
  public Operation exec(Prolog engine) throws PrologException {
    engine.setB0();
    Term a1 = arg1.dereference();

    Change change = StoredValues.CHANGE.get(engine);
    Branch.NameKey name = change.getDest();

    if (!a1.unify(SymbolTerm.create(name.get()), engine.trail)) {
      return engine.fail();
    }
    return cont;
View Full Code Here

        new Branch.NameKey(new Project.NameKey("source-project"),
            "refs/heads/master");

    final CodeReviewCommit codeReviewCommit =
        new CodeReviewCommit(sourceMergeTip.toObjectId());
    final Change submitedChange =
        new Change(new Change.Key(sourceMergeTip.toObjectId().getName()),
            new Change.Id(1), new Account.Id(1), sourceBranchNameKey);
    codeReviewCommit.change = submitedChange;

    final Map<Change.Id, CodeReviewCommit> mergedCommits =
        new HashMap<Change.Id, CodeReviewCommit>();
View Full Code Here

        new Branch.NameKey(new Project.NameKey("source-project"),
            "refs/heads/master");

    final CodeReviewCommit codeReviewCommit =
        new CodeReviewCommit(sourceMergeTip.toObjectId());
    final Change submitedChange =
        new Change(new Change.Key(sourceMergeTip.toObjectId().getName()),
            new Change.Id(1), new Account.Id(1), sourceBranchNameKey);
    codeReviewCommit.change = submitedChange;

    final Map<Change.Id, CodeReviewCommit> mergedCommits =
        new HashMap<Change.Id, CodeReviewCommit>();
View Full Code Here

      if ((updatedPatch != null) && (!updatedPatch.isDraft())) {
        published = true;
      }

      final Change change = db.changes().get(changeId);
      if (change.getStatus() == Change.Status.DRAFT) {
        final Change updatedChange = db.changes().atomicUpdate(changeId,
            new AtomicUpdate<Change>() {
          @Override
          public Change update(Change change) {
            if (change.getStatus() == Change.Status.DRAFT) {
              change.setStatus(Change.Status.NEW);
              ChangeUtil.updated(change);
              return change;
            } else {
              return null;
            }
          }
        });

        if ((updatedChange != null) &&
            (updatedChange.getStatus() == Change.Status.NEW)) {
          published = true;
        }
      }

      if (published) {
View Full Code Here

TOP

Related Classes of com.google.gerrit.reviewdb.client.Change$Key

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.