diff options
author | David Gageot <david@gageot.net> | 2012-07-09 16:00:49 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-07-10 08:50:59 +0200 |
commit | 9a1dfc90225636f980821a4c4be971035f0e6e05 (patch) | |
tree | f27949099ecbfb35d0a3322ebebc9c48ddf4ad9b /sonar-core/src | |
parent | 4bc518ebc8b51e8ee64d4bb3d86136a5b7d12043 (diff) | |
download | sonarqube-9a1dfc90225636f980821a4c4be971035f0e6e05.tar.gz sonarqube-9a1dfc90225636f980821a4c4be971035f0e6e05.zip |
SONAR-3437 Use MyBatis in batch mode
Diffstat (limited to 'sonar-core/src')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java index fc2c07a1821..73825c29e26 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java @@ -19,36 +19,54 @@ */ package org.sonar.core.persistence; -import org.sonar.api.database.model.MeasureDto; - -import org.sonar.api.database.model.MeasureModel; - -import org.sonar.api.database.model.MeasureModelMapper; - import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.apache.ibatis.builder.xml.XMLMapperBuilder; import org.apache.ibatis.logging.LogFactory; import org.apache.ibatis.mapping.Environment; -import org.apache.ibatis.session.*; +import org.apache.ibatis.session.Configuration; +import org.apache.ibatis.session.ExecutorType; +import org.apache.ibatis.session.SqlSession; +import org.apache.ibatis.session.SqlSessionFactory; +import org.apache.ibatis.session.SqlSessionFactoryBuilder; import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory; import org.slf4j.LoggerFactory; import org.sonar.api.BatchComponent; import org.sonar.api.ServerComponent; -import org.sonar.core.dashboard.*; +import org.sonar.api.database.model.MeasureDataDto; +import org.sonar.api.database.model.MeasureDto; +import org.sonar.api.database.model.MeasureModelMapper; +import org.sonar.core.dashboard.ActiveDashboardDto; +import org.sonar.core.dashboard.ActiveDashboardMapper; +import org.sonar.core.dashboard.DashboardDto; +import org.sonar.core.dashboard.DashboardMapper; +import org.sonar.core.dashboard.WidgetDto; +import org.sonar.core.dashboard.WidgetMapper; +import org.sonar.core.dashboard.WidgetPropertyDto; +import org.sonar.core.dashboard.WidgetPropertyMapper; import org.sonar.core.dependency.DependencyDto; import org.sonar.core.dependency.DependencyMapper; import org.sonar.core.dependency.ResourceSnapshotDto; import org.sonar.core.dependency.ResourceSnapshotMapper; import org.sonar.core.duplication.DuplicationMapper; import org.sonar.core.duplication.DuplicationUnitDto; -import org.sonar.core.filter.*; +import org.sonar.core.filter.CriterionDto; +import org.sonar.core.filter.CriterionMapper; +import org.sonar.core.filter.FilterColumnDto; +import org.sonar.core.filter.FilterColumnMapper; +import org.sonar.core.filter.FilterDto; +import org.sonar.core.filter.FilterMapper; import org.sonar.core.properties.PropertiesMapper; import org.sonar.core.properties.PropertyDto; import org.sonar.core.purge.PurgeMapper; import org.sonar.core.purge.PurgeVendorMapper; import org.sonar.core.purge.PurgeableSnapshotDto; -import org.sonar.core.resource.*; +import org.sonar.core.resource.ResourceDto; +import org.sonar.core.resource.ResourceIndexDto; +import org.sonar.core.resource.ResourceIndexerMapper; +import org.sonar.core.resource.ResourceKeyUpdaterMapper; +import org.sonar.core.resource.ResourceMapper; +import org.sonar.core.resource.SnapshotDto; import org.sonar.core.review.ReviewCommentDto; import org.sonar.core.review.ReviewCommentMapper; import org.sonar.core.review.ReviewDto; @@ -57,7 +75,14 @@ import org.sonar.core.rule.RuleDto; import org.sonar.core.rule.RuleMapper; import org.sonar.core.template.LoadedTemplateDto; import org.sonar.core.template.LoadedTemplateMapper; -import org.sonar.core.user.*; +import org.sonar.core.user.AuthorDto; +import org.sonar.core.user.AuthorMapper; +import org.sonar.core.user.GroupDto; +import org.sonar.core.user.GroupRoleDto; +import org.sonar.core.user.RoleMapper; +import org.sonar.core.user.UserDto; +import org.sonar.core.user.UserMapper; +import org.sonar.core.user.UserRoleDto; import java.io.InputStream; @@ -105,6 +130,7 @@ public class MyBatis implements BatchComponent, ServerComponent { loadAlias(conf, "Widget", WidgetDto.class); loadAlias(conf, "WidgetProperty", WidgetPropertyDto.class); loadAlias(conf, "MeasureDto", MeasureDto.class); + loadAlias(conf, "MeasureDataDto", MeasureDataDto.class); loadMapper(conf, ActiveDashboardMapper.class); loadMapper(conf, AuthorMapper.class); @@ -175,7 +201,7 @@ public class MyBatis implements BatchComponent, ServerComponent { private InputStream getPathToMapper(Class mapperClass) { InputStream input = getClass().getResourceAsStream( - "/" + StringUtils.replace(mapperClass.getName(), ".", "/") + "-" + database.getDialect().getId() + ".xml"); + "/" + StringUtils.replace(mapperClass.getName(), ".", "/") + "-" + database.getDialect().getId() + ".xml"); if (input == null) { input = getClass().getResourceAsStream("/" + StringUtils.replace(mapperClass.getName(), ".", "/") + ".xml"); } |