aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/main/java/org/sonar
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-06-10 09:51:24 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-06-10 09:51:24 +0200
commitfb72da37f25c49ca70518082ed70a8a1af4866b8 (patch)
tree3d1faca3373179a3fe829858b79e1433f4f1de01 /sonar-batch/src/main/java/org/sonar
parentd62c3a4e2b0fc74ad5041963da90c294080c05b8 (diff)
downloadsonarqube-fb72da37f25c49ca70518082ed70a8a1af4866b8.tar.gz
sonarqube-fb72da37f25c49ca70518082ed70a8a1af4866b8.zip
Temporarily remove custom measures from batch
They are being moved to Compute Engine.
Diffstat (limited to 'sonar-batch/src/main/java/org/sonar')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/compute/ManualMeasureDecorator.java79
2 files changed, 0 insertions, 81 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java
index 1773cd1e7a6..34235ba135b 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchComponents.java
@@ -35,7 +35,6 @@ import org.sonar.batch.compute.ItBranchCoverageDecorator;
import org.sonar.batch.compute.ItCoverageDecorator;
import org.sonar.batch.compute.ItLineCoverageDecorator;
import org.sonar.batch.compute.LineCoverageDecorator;
-import org.sonar.batch.compute.ManualMeasureDecorator;
import org.sonar.batch.compute.NewCoverageAggregator;
import org.sonar.batch.compute.NewCoverageFileAnalyzer;
import org.sonar.batch.compute.NewItCoverageFileAnalyzer;
@@ -132,7 +131,6 @@ public class BatchComponents {
CommentDensityDecorator.class,
DirectoriesDecorator.class,
FilesDecorator.class,
- ManualMeasureDecorator.class,
VariationDecorator.class,
TimeMachineConfigurationPersister.class,
NewCoverageFileAnalyzer.class,
diff --git a/sonar-batch/src/main/java/org/sonar/batch/compute/ManualMeasureDecorator.java b/sonar-batch/src/main/java/org/sonar/batch/compute/ManualMeasureDecorator.java
deleted file mode 100644
index 94346b30b8f..00000000000
--- a/sonar-batch/src/main/java/org/sonar/batch/compute/ManualMeasureDecorator.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.batch.compute;
-
-import java.util.List;
-import org.sonar.api.batch.Decorator;
-import org.sonar.api.batch.DecoratorContext;
-import org.sonar.api.batch.Phase;
-import org.sonar.api.batch.RequiresDB;
-import org.sonar.api.database.DatabaseSession;
-import org.sonar.api.measures.Measure;
-import org.sonar.api.measures.Metric;
-import org.sonar.api.measures.MetricFinder;
-import org.sonar.api.resources.Project;
-import org.sonar.api.resources.Resource;
-import org.sonar.jpa.entity.ManualMeasure;
-
-import static com.google.common.base.Preconditions.checkState;
-
-@Phase(name = Phase.Name.PRE)
-@RequiresDB
-public class ManualMeasureDecorator implements Decorator {
-
- private DatabaseSession session;
- private MetricFinder metricFinder;
-
- public ManualMeasureDecorator(DatabaseSession session, MetricFinder metricFinder) {
- this.session = session;
- this.metricFinder = metricFinder;
- }
-
- @Override
- public boolean shouldExecuteOnProject(Project project) {
- return true;
- }
-
- @Override
- public void decorate(Resource resource, DecoratorContext context) {
- if (resource.getId() != null) {
- List<ManualMeasure> manualMeasures = session.getResults(ManualMeasure.class, "resourceId", resource.getId());
- for (ManualMeasure manualMeasure : manualMeasures) {
- context.saveMeasure(copy(manualMeasure));
- }
- }
- }
-
- private Measure copy(ManualMeasure manualMeasure) {
- Metric metric = metricFinder.findById(manualMeasure.getMetricId());
- checkState(metric != null, "Unable to find manual metric with id: " + manualMeasure.getMetricId());
-
- Measure measure = new Measure(metric);
- measure.setValue(manualMeasure.getValue(), 5);
- measure.setData(manualMeasure.getTextValue());
- measure.setDescription(manualMeasure.getDescription());
- return measure;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName();
- }
-}