コード例 #1
0
  private void saveAndAggregate(Component component, Path<LastCommit> path) {
    long maxDate = path.current().getDate();
    if (maxDate > 0L) {
      measureRepository.add(
          component, lastCommitDateMetric, Measure.newMeasureBuilder().create(maxDate));

      if (!path.isRoot()) {
        path.parent().addDate(maxDate);
      }
    }
  }
コード例 #2
0
 private void addNewMeasure(
     Component component, String metricKey, Formula formula, Counter counter) {
   // no new measure can be created by formulas for PROJECT_VIEW components, their measures are the
   // copy
   if (component.getType() == Component.Type.PROJECT_VIEW) {
     return;
   }
   Metric metric = metricRepository.getByKey(metricKey);
   Optional<Measure> measure =
       formula.createMeasure(counter, new CreateMeasureContextImpl(component, metric));
   if (measure.isPresent()) {
     measureRepository.add(component, metric, measure.get());
   }
 }