From 9324c65fc550b13cb5593f2f958e34d246f7c42b Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Wed, 28 Aug 2013 14:49:38 +0200 Subject: Fix quality flaws --- .../src/main/java/org/sonar/batch/ProjectConfigurator.java | 3 ++- .../org/sonar/batch/index/DefaultResourcePersister.java | 13 +++++-------- .../main/java/org/sonar/batch/index/MeasurePersister.java | 3 ++- .../main/java/org/sonar/batch/phases/UpdateStatusJob.java | 4 +++- 4 files changed, 12 insertions(+), 11 deletions(-) (limited to 'sonar-batch') diff --git a/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java b/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java index b7c83521e58..027191be7df 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java +++ b/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java @@ -71,7 +71,8 @@ public class ProjectConfigurator implements BatchComponent { checkCurrentAnalysisIsTheLatestOne(project.getKey(), analysisDate); project - .setConfiguration(new PropertiesConfiguration()) // will be populated by ProjectSettings + // will be populated by ProjectSettings + .setConfiguration(new PropertiesConfiguration()) .setAnalysisDate(analysisDate) .setAnalysisVersion(loadAnalysisVersion()) .setAnalysisType(loadAnalysisType()); diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java index 15b0933f77c..636122f849a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java @@ -25,12 +25,7 @@ import org.apache.commons.lang.StringUtils; import org.sonar.api.database.DatabaseSession; import org.sonar.api.database.model.ResourceModel; import org.sonar.api.database.model.Snapshot; -import org.sonar.api.resources.Library; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.Qualifiers; -import org.sonar.api.resources.Resource; -import org.sonar.api.resources.ResourceUtils; -import org.sonar.api.resources.Scopes; +import org.sonar.api.resources.*; import org.sonar.api.security.ResourcePermissions; import org.sonar.api.utils.SonarException; @@ -79,7 +74,8 @@ public final class DefaultResourcePersister implements ResourcePersister { project.setEffectiveKey(project.getKey()); ResourceModel model = findOrCreateModel(project); - model.setLanguageKey(project.getLanguageKey());// ugly, only for projects + // ugly, only for projects + model.setLanguageKey(project.getLanguageKey()); // For views if (project instanceof ResourceCopy) { @@ -162,7 +158,8 @@ public final class DefaultResourcePersister implements ResourcePersister { private Snapshot persistLibrary(Project project, Library library) { ResourceModel model = findOrCreateModel(library); model = session.save(model); - library.setId(model.getId()); // TODO to be removed + // TODO to be removed + library.setId(model.getId()); library.setEffectiveKey(library.getKey()); Snapshot snapshot = findLibrarySnapshot(model.getId(), library.getVersion()); diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/MeasurePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/MeasurePersister.java index aadca4bbd76..50493b4c410 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/MeasurePersister.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/MeasurePersister.java @@ -130,7 +130,8 @@ public final class MeasurePersister { private MeasureModel model(Measure measure) { MeasureModel model = new MeasureModel(); - model.setMetricId(measure.getMetric().getId()); // we assume that the index has updated the metric + // we assume that the index has updated the metric + model.setMetricId(measure.getMetric().getId()); model.setDescription(measure.getDescription()); model.setData(measure.getData()); model.setAlertStatus(measure.getAlertStatus()); diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/UpdateStatusJob.java b/sonar-batch/src/main/java/org/sonar/batch/phases/UpdateStatusJob.java index 02056e53899..f25f92de517 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/UpdateStatusJob.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/UpdateStatusJob.java @@ -33,13 +33,15 @@ import org.sonar.batch.bootstrap.ServerClient; import org.sonar.batch.index.ResourcePersister; import javax.persistence.Query; + import java.util.List; public class UpdateStatusJob implements BatchComponent { private DatabaseSession session; private ServerClient server; - private Snapshot snapshot; // TODO remove this component + // TODO remove this component + private Snapshot snapshot; private ResourcePersister resourcePersister; private Settings settings; private Project project; -- cgit v1.2.3