diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2012-01-24 14:40:27 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2012-01-24 14:41:22 +0100 |
commit | 4eab0b33d1e3df3669b8ee55cebe43e3244aa2d1 (patch) | |
tree | c33bebdba41dc74ec4ba6f9d5f0499d4852ca2b9 /plugins/sonar-cpd-plugin/src/main | |
parent | 2480541720256002f5402ebb004c85034fb9f2de (diff) | |
download | sonarqube-4eab0b33d1e3df3669b8ee55cebe43e3244aa2d1.tar.gz sonarqube-4eab0b33d1e3df3669b8ee55cebe43e3244aa2d1.zip |
Move some purge tasks to MyBatis
SONAR-2754 add the parameter sonar.dbcleaner.cleanDirectoryHistory
SONAR-2757 remove fullscan requests on the table SNAPSHOTS
Diffstat (limited to 'plugins/sonar-cpd-plugin/src/main')
-rw-r--r-- | plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/index/DbDuplicationsIndex.java | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/index/DbDuplicationsIndex.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/index/DbDuplicationsIndex.java index 5409e979a24..6e9f3e43f68 100644 --- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/index/DbDuplicationsIndex.java +++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/index/DbDuplicationsIndex.java @@ -19,22 +19,21 @@ */ package org.sonar.plugins.cpd.index; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import org.sonar.api.database.model.Snapshot; import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; import org.sonar.batch.index.ResourcePersister; -import org.sonar.duplications.block.Block; -import org.sonar.duplications.block.ByteArray; import org.sonar.core.duplication.DuplicationDao; import org.sonar.core.duplication.DuplicationUnitDto; +import org.sonar.duplications.block.Block; +import org.sonar.duplications.block.ByteArray; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; public class DbDuplicationsIndex { @@ -55,16 +54,6 @@ public class DbDuplicationsIndex { this.lastSnapshotId = lastSnapshot == null ? null : lastSnapshot.getId(); } - /** - * For tests. - */ - DbDuplicationsIndex(DuplicationDao dao, ResourcePersister resourcePersister, Integer currentProjectSnapshotId, Integer prevSnapshotId) { - this.dao = dao; - this.resourcePersister = resourcePersister; - this.currentProjectSnapshotId = currentProjectSnapshotId; - this.lastSnapshotId = prevSnapshotId; - } - int getSnapshotIdFor(Resource resource) { return resourcePersister.getSnapshotOrFail(resource).getId(); } @@ -110,12 +99,12 @@ public class DbDuplicationsIndex { List<DuplicationUnitDto> units = Lists.newArrayList(); for (Block block : blocks) { DuplicationUnitDto unit = new DuplicationUnitDto( - currentProjectSnapshotId, - resourceSnapshotId, - block.getBlockHash().toString(), - block.getIndexInFile(), - block.getFirstLineNumber(), - block.getLastLineNumber()); + currentProjectSnapshotId, + resourceSnapshotId, + block.getBlockHash().toString(), + block.getIndexInFile(), + block.getFirstLineNumber(), + block.getLastLineNumber()); units.add(unit); } |