diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-12-31 09:49:44 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-12-31 09:49:44 +0100 |
commit | 41b110181e9d459451a85dc6fa3be4a8b497ea6b (patch) | |
tree | 26b88a9f538509e7dbe7066ec7042e02a0b04f7a /sonar-core/src | |
parent | 981885cad7f17858718c7e905868befc568e9f8f (diff) | |
download | sonarqube-41b110181e9d459451a85dc6fa3be4a8b497ea6b.tar.gz sonarqube-41b110181e9d459451a85dc6fa3be4a8b497ea6b.zip |
Fix some quality flaws
Diffstat (limited to 'sonar-core/src')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java | 10 | ||||
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerQuery.java (renamed from sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerFilter.java) | 21 |
2 files changed, 17 insertions, 14 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java index 8e737501011..37fc1dc8783 100644 --- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java +++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java @@ -69,7 +69,7 @@ public class ResourceIndexerDao { final SqlSession session = mybatis.openSession(ExecutorType.BATCH); try { final ResourceIndexerMapper mapper = session.getMapper(ResourceIndexerMapper.class); - session.select("selectRootProjectIds", /* workaround to get booleans */ResourceIndexerFilter.create(), new ResultHandler() { + session.select("selectRootProjectIds", /* workaround to get booleans */ResourceIndexerQuery.create(), new ResultHandler() { public void handleResult(ResultContext context) { Integer rootProjectId = (Integer) context.getResultObject(); doIndexProject(rootProjectId, session, mapper); @@ -85,13 +85,13 @@ public class ResourceIndexerDao { private void doIndexProject(int rootProjectId, SqlSession session, final ResourceIndexerMapper mapper) { // non indexed resources - ResourceIndexerFilter filter = ResourceIndexerFilter.create() + ResourceIndexerQuery query = ResourceIndexerQuery.create() .setNonIndexedOnly(true) .setQualifiers(NOT_RENAMABLE_QUALIFIERS) .setScopes(NOT_RENAMABLE_SCOPES) .setRootProjectId(rootProjectId); - session.select("selectResources", filter, new ResultHandler() { + session.select("selectResources", query, new ResultHandler() { public void handleResult(ResultContext context) { ResourceDto resource = (ResourceDto) context.getResultObject(); doIndex(resource, mapper); @@ -100,13 +100,13 @@ public class ResourceIndexerDao { // some resources can be renamed, so index must be regenerated // -> delete existing rows and create them again - filter = ResourceIndexerFilter.create() + query = ResourceIndexerQuery.create() .setNonIndexedOnly(false) .setQualifiers(RENAMABLE_QUALIFIERS) .setScopes(RENAMABLE_SCOPES) .setRootProjectId(rootProjectId); - session.select("selectResources", filter, new ResultHandler() { + session.select("selectResources", query, new ResultHandler() { public void handleResult(ResultContext context) { ResourceDto resource = (ResourceDto) context.getResultObject(); diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerFilter.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerQuery.java index a8a823078db..4c45f846f83 100644 --- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerFilter.java +++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerQuery.java @@ -19,18 +19,21 @@ */ package org.sonar.core.resource; -public final class ResourceIndexerFilter { - private boolean _true = true; +final class ResourceIndexerQuery { + // Workaround to inject booleans into mybatis mappers. It avoids declaring mappers + // dedicated to Oracle and SQLServer + public final boolean _true = true; //NOSONAR + private Integer rootProjectId = null; private String[] scopes = null; private String[] qualifiers = null; private boolean nonIndexedOnly=false; - private ResourceIndexerFilter() { + private ResourceIndexerQuery() { } - public static ResourceIndexerFilter create() { - return new ResourceIndexerFilter(); + public static ResourceIndexerQuery create() { + return new ResourceIndexerQuery(); } public String[] getScopes() { @@ -41,12 +44,12 @@ public final class ResourceIndexerFilter { return qualifiers; } - public ResourceIndexerFilter setScopes(String[] scopes) { + public ResourceIndexerQuery setScopes(String[] scopes) { this.scopes = scopes; return this; } - public ResourceIndexerFilter setQualifiers(String[] qualifiers) { + public ResourceIndexerQuery setQualifiers(String[] qualifiers) { this.qualifiers = qualifiers; return this; } @@ -55,7 +58,7 @@ public final class ResourceIndexerFilter { return rootProjectId; } - public ResourceIndexerFilter setRootProjectId(Integer i) { + public ResourceIndexerQuery setRootProjectId(Integer i) { this.rootProjectId = i; return this; } @@ -64,7 +67,7 @@ public final class ResourceIndexerFilter { return nonIndexedOnly; } - public ResourceIndexerFilter setNonIndexedOnly(boolean b) { + public ResourceIndexerQuery setNonIndexedOnly(boolean b) { this.nonIndexedOnly = b; return this; } |