org.sonar.api.measures.Metric.setUserManaged()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中org.sonar.api.measures.Metric.setUserManaged()方法的一些代码示例,展示了Metric.setUserManaged()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metric.setUserManaged()方法的具体详情如下:
包路径:org.sonar.api.measures.Metric
类名称:Metric
方法名:setUserManaged

Metric.setUserManaged介绍

[英]Sets whether the metric is managed by users ("manual metric")
[中]

代码示例

代码示例来源:origin: SonarSource/sonarqube

private void loadFromPaginatedWs(List<Metric> metrics) throws IOException {
 int page = 1;
 WsMetricsResponse response;
 do {
  GetRequest getRequest = new GetRequest(METRICS_SEARCH_URL + page);
  try (Reader reader = wsClient.call(getRequest).contentReader()) {
   response = GsonHelper.create().fromJson(reader, WsMetricsResponse.class);
   for (WsMetric metric : response.metrics) {
    metrics.add(new Metric.Builder(metric.getKey(), metric.getName(), ValueType.valueOf(metric.getType()))
     .create()
     .setDirection(metric.getDirection())
     .setQualitative(metric.isQualitative())
     .setUserManaged(metric.isCustom())
     .setDescription(metric.getDescription())
     .setId(metric.getId()));
   }
  }
  page++;
 } while (response.getP() < (response.getTotal() / response.getPs() + 1));
}

代码示例来源:origin: SonarSource/sonarqube

@Override
 public Metric apply(@Nonnull MetricDto dto) {
  Metric<Serializable> metric = new Metric<>();
  metric.setId(dto.getId());
  metric.setKey(dto.getKey());
  metric.setDescription(dto.getDescription());
  metric.setName(dto.getShortName());
  metric.setBestValue(dto.getBestValue());
  metric.setDomain(dto.getDomain());
  metric.setEnabled(dto.isEnabled());
  metric.setDirection(dto.getDirection());
  metric.setHidden(dto.isHidden());
  metric.setQualitative(dto.isQualitative());
  metric.setType(Metric.ValueType.valueOf(dto.getValueType()));
  metric.setOptimizedBestValue(dto.isOptimizedBestValue());
  metric.setUserManaged(dto.isUserManaged());
  metric.setWorstValue(dto.getWorstValue());
  return metric;
 }
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-scanner-engine

private void loadFromPaginatedWs(List<Metric> metrics) throws IOException {
 int page = 1;
 WsMetricsResponse response;
 do {
  GetRequest getRequest = new GetRequest(METRICS_SEARCH_URL + page);
  try (Reader reader = wsClient.call(getRequest).contentReader()) {
   response = GsonHelper.create().fromJson(reader, WsMetricsResponse.class);
   for (WsMetric metric : response.metrics) {
    metrics.add(new Metric.Builder(metric.getKey(), metric.getName(), ValueType.valueOf(metric.getType()))
     .create()
     .setDirection(metric.getDirection())
     .setQualitative(metric.isQualitative())
     .setUserManaged(metric.isCustom())
     .setDescription(metric.getDescription())
     .setId(metric.getId()));
   }
  }
  page++;
 } while (response.getP() < (response.getTotal() / response.getPs() + 1));
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

public DeprecatedMetricFinder(GlobalRepositories globalReferentials) {
 for (org.sonar.batch.protocol.input.Metric metric : globalReferentials.metrics()) {
  Metric hibernateMetric = new org.sonar.api.measures.Metric.Builder(metric.key(), metric.name(), ValueType.valueOf(metric.valueType()))
   .create()
   .setDirection(metric.direction())
   .setQualitative(metric.isQualitative())
   .setUserManaged(metric.isUserManaged())
   .setDescription(metric.description())
   .setOptimizedBestValue(metric.isOptimizedBestValue())
   .setBestValue(metric.bestValue())
   .setWorstValue(metric.worstValue())
   .setId(metric.id());
  metricsByKey.put(metric.key(), hibernateMetric);
  metricsById.put(metric.id(), new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), ValueType.valueOf(metric.valueType())).create().setId(metric.id()));
 }
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-batch

public DeprecatedMetricFinder(GlobalRepositories globalReferentials) {
 for (org.sonar.batch.protocol.input.Metric metric : globalReferentials.metrics()) {
  Metric hibernateMetric = new org.sonar.api.measures.Metric.Builder(metric.key(), metric.name(), ValueType.valueOf(metric.valueType()))
   .create()
   .setDirection(metric.direction())
   .setQualitative(metric.isQualitative())
   .setUserManaged(metric.isUserManaged())
   .setDescription(metric.description())
   .setOptimizedBestValue(metric.isOptimizedBestValue())
   .setBestValue(metric.bestValue())
   .setWorstValue(metric.worstValue())
   .setId(metric.id());
  metricsByKey.put(metric.key(), hibernateMetric);
  metricsById.put(metric.id(), new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), ValueType.valueOf(metric.valueType())).create().setId(metric.id()));
 }
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-server

@Override
 public Metric apply(@Nonnull MetricDto dto) {
  Metric<Serializable> metric = new Metric<>();
  metric.setId(dto.getId());
  metric.setKey(dto.getKey());
  metric.setDescription(dto.getDescription());
  metric.setName(dto.getShortName());
  metric.setBestValue(dto.getBestValue());
  metric.setDomain(dto.getDomain());
  metric.setEnabled(dto.isEnabled());
  metric.setDirection(dto.getDirection());
  metric.setHidden(dto.isHidden());
  metric.setQualitative(dto.isQualitative());
  metric.setType(Metric.ValueType.valueOf(dto.getValueType()));
  metric.setOptimizedBestValue(dto.isOptimizedBestValue());
  metric.setUserManaged(dto.isUserManaged());
  metric.setWorstValue(dto.getWorstValue());
  return metric;
 }
}

相关文章