Package com.google.gerrit.common.data

Examples of com.google.gerrit.common.data.ApprovalTypes


      }
    } catch (OrmException e) {
      throw new ProvisionException("Cannot query approval categories", e);
    }

    return new ApprovalTypes(Collections.unmodifiableList(types));
  }
View Full Code Here


    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;
        }

        ApprovalType t = types.byId(a.getCategoryId());
        if (t == null) {
          continue;
        }

        StructureTerm labelTerm = new StructureTerm(
View Full Code Here

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

    PrologEnvironment env = (PrologEnvironment) engine.control;
    ApprovalTypes types = env.getInjector().getInstance(ApprovalTypes.class);

    List<ApprovalType> list = types.getApprovalTypes();
    Term head = Prolog.Nil;
    for (int idx = list.size() - 1; 0 <= idx; idx--) {
      head = new ListTerm(export(list.get(idx)), head);
    }
View Full Code Here

    message.setSpellCheck(true);
    mwrap.add(message);
  }

  private void initApprovals(final PatchSetPublishDetail r, final Panel body) {
    ApprovalTypes types = Gerrit.getConfig().getApprovalTypes();
    for (PermissionRange range : r.getLabels()) {
      ApprovalType type = types.byLabel(range.getLabel());
      if (type != null) {
        // Legacy type, use radio buttons.
        initApprovalType(r, body, type, range);
      } else {
        // TODO Newer style label.
View Full Code Here

public class GerritCommonTest extends PrologTestCase {
  @Override
  public void setUp() throws Exception {
    super.setUp();

    final ApprovalTypes types = new ApprovalTypes(Arrays.asList(
        codeReviewCategory(),
        verifiedCategory()
    ));

    load("gerrit", "gerrit_common_test.pl", new AbstractModule() {
View Full Code Here

TOP

Related Classes of com.google.gerrit.common.data.ApprovalTypes

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.