Package com.google.gerrit.common.data

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


        if (CRVW.equals(a.getCategoryId())) {
          tag = "Reviewed-by";
        } else if (VRIF.equals(a.getCategoryId())) {
          tag = "Tested-by";
        } else {
          final ApprovalType at =
              approvalTypes.byId(a.getCategoryId());
          if (at == null) {
            // A deprecated/deleted approval type, ignore it.
            continue;
          }
          tag = at.getCategory().getName().replace(' ', '-');
        }

        if (!contains(footers, new FooterKey(tag), identbuf.toString())) {
          msgbuf.append(tag);
          msgbuf.append(": ");
View Full Code Here


            if (range != null) {
              if (!allowed.contains(range)) {
                allowed.add(range);
              }

              ApprovalType at = approvalTypes.byLabel(lbl.label);
              if (at == null || at.getMax().getValue() == range.getMax()) {
                canMakeOk = true;
              }
            }

            switch (lbl.status) {
View Full Code Here

      missing.setVisible(!reportedMissing.isEmpty());

    } else {
      for (ApprovalDetail ad : approvals) {
        for (PatchSetApproval psa : ad.getPatchSetApprovals()) {
          ApprovalType legacyType = types.byId(psa.getCategoryId());
          if (legacyType == null) {
            continue;
          }
          String labelName = legacyType.getCategory().getLabelName();
          if (psa.getValue() != 0 ) {
            if (psa.getValue() == legacyType.getMax().getValue()) {
              ad.approved(labelName);
            } else if (psa.getValue() == legacyType.getMin().getValue()) {
              ad.rejected(labelName);
            }
          }
          if (!columns.contains(labelName)) {
            columns.add(labelName);
          }
        }
        Collections.sort(columns, new Comparator<String>() {
          @Override
          public int compare(String o1, String o2) {
            ApprovalType a = types.byLabel(o1);
            ApprovalType b = types.byLabel(o2);
            int cmp = 0;
            if (a != null && b != null) {
              cmp = a.getCategory().getPosition() - b.getCategory().getPosition();
            }
            if (cmp == 0) {
              cmp = o1.compareTo(o2);
            }
            return cmp;
View Full Code Here

      } else if (ad.isApproved(labelName)) {
        table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck()));

      } else {
        ApprovalType legacyType = types.byLabel(labelName);
        if (legacyType == null) {
          table.clearCell(row, col);
          col++;
          continue;
        }

        PatchSetApproval ca = ad.getPatchSetApproval(legacyType.getCategory().getId());
        if (ca == null || ca.getValue() == 0) {
          table.clearCell(row, col);
          col++;
          continue;
        }
View Full Code Here

    for (Map.Entry<String, LabelInfo> e : labels.entrySet()) {
      if (e.getValue().approved != null || e.getValue().rejected != null) {
        continue;
      }

      ApprovalType type = approvalTypes.byLabel(e.getKey());
      if (type == null || type.getMin() == null || type.getMax() == null) {
        // Unknown or misconfigured type can't have intermediate scores.
        continue;
      }

      short min = type.getMin().getValue();
      short max = type.getMax().getValue();
      if (-1 <= min && max <= 1) {
        // Types with a range of -1..+1 can't have intermediate scores.
        continue;
      }

      if (approvals == null) {
        approvals = cd.currentApprovals(db);
      }
      for (PatchSetApproval psa : approvals) {
        short val = psa.getValue();
        if (val != 0 && min < val && val < max
            && psa.getCategoryId().equals(type.getCategory().getId())) {
          if (0 < val) {
            e.getValue().recommended = asAccountAttribute(psa.getAccountId());
            e.getValue().value = val != 1 ? val : null;
          } else {
            e.getValue().disliked = asAccountAttribute(psa.getAccountId());
View Full Code Here

    a.type = approval.getCategoryId().get();
    a.value = Short.toString(approval.getValue());
    a.by = asAccountAttribute(approval.getAccountId());
    a.grantedOn = approval.getGranted().getTime() / 1000L;

    ApprovalType at = approvalTypes.byId(approval.getCategoryId());
    if (at != null) {
      a.description = at.getCategory().getName();
    }
    return a;
  }
View Full Code Here

      final ReviewDb db = schema.open();
      try {
        for (final ApprovalCategory c : db.approvalCategories().all()) {
          final List<ApprovalCategoryValue> values =
              db.approvalCategoryValues().byCategory(c.getId()).toList();
          types.add(new ApprovalType(c, values));
        }
      } finally {
        db.close();
      }
    } catch (OrmException e) {
View Full Code Here

     */
    private ApprovalAttribute getApprovalAttribute(
            Entry<ApprovalCategory.Id, ApprovalCategoryValue.Id> approval) {
        ApprovalAttribute a = new ApprovalAttribute();
        a.type = approval.getKey().get();
        ApprovalType at = approvalTypes.byId(approval.getKey());
        if (at != null) {
          a.description = at.getCategory().getName();
        }
        a.value = Short.toString(approval.getValue().get());
        return a;
    }
View Full Code Here

      for (PatchSetApproval a : approvals) {
        if (a.getValue() == 0) {
          continue;
        }

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

        StructureTerm labelTerm = new StructureTerm(
            sym_label,
            SymbolTerm.intern(t.getCategory().getLabelName()),
            new IntegerTerm(a.getValue()));

        StructureTerm userTerm = new StructureTerm(
            sym_user,
            new IntegerTerm(a.getAccountId().get()));
View Full Code Here

  }

  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

TOP

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

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.