diff options
author | Eric Hartmann <hartmann.eric@gmail.com> | 2017-06-27 12:02:33 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-07-11 15:07:33 +0200 |
commit | 1aa12c9a77e72810645b1526440cbd18b21e02e8 (patch) | |
tree | f326c75f3b4b18181d93a288604908c1833db4f1 | |
parent | 8e94530f0560b53230626d3a8e222d7052654d3a (diff) | |
download | sonarqube-1aa12c9a77e72810645b1526440cbd18b21e02e8.tar.gz sonarqube-1aa12c9a77e72810645b1526440cbd18b21e02e8.zip |
SONAR-9535 Upgrade to MyBatis 3.4.4
73 files changed, 124 insertions, 117 deletions
@@ -804,7 +804,7 @@ <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> - <version>3.2.7</version> + <version>3.4.4</version> </dependency> <dependency> <groupId>org.nanohttpd</groupId> diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DbSessionImpl.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DbSessionImpl.java index 3e1fa8d2daf..d87c2ecb240 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/DbSessionImpl.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DbSessionImpl.java @@ -22,6 +22,7 @@ package org.sonar.db; import java.sql.Connection; import java.util.List; import java.util.Map; +import org.apache.ibatis.cursor.Cursor; import org.apache.ibatis.executor.BatchResult; import org.apache.ibatis.session.Configuration; import org.apache.ibatis.session.ResultHandler; @@ -52,6 +53,21 @@ public class DbSessionImpl implements DbSession { */ @Override + public <T> Cursor<T> selectCursor(String statement) { + return session.selectCursor(statement); + } + + @Override + public <T> Cursor<T> selectCursor(String statement, Object parameter) { + return session.selectCursor(statement, parameter); + } + + @Override + public <T> Cursor<T> selectCursor(String statement, Object parameter, RowBounds rowBounds) { + return session.selectCursor(statement, parameter, rowBounds); + } + + @Override public <T> T selectOne(String statement) { return session.selectOne(statement); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DelegatingDbSession.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DelegatingDbSession.java index d065f42262f..a08c5891be9 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/DelegatingDbSession.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DelegatingDbSession.java @@ -22,12 +22,12 @@ package org.sonar.db; import java.sql.Connection; import java.util.List; import java.util.Map; +import org.apache.ibatis.cursor.Cursor; import org.apache.ibatis.executor.BatchResult; import org.apache.ibatis.session.Configuration; import org.apache.ibatis.session.ResultHandler; import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.SqlSession; -import org.sonar.db.DbSession; /** * A wrapper of a {@link DbSession} instance which does not call the wrapped {@link DbSession}'s @@ -57,6 +57,22 @@ abstract class DelegatingDbSession implements DbSession { /////////////////////// // overridden with NO change of behavior /////////////////////// + + @Override + public <T> Cursor<T> selectCursor(String statement) { + return delegate.selectCursor(statement); + } + + @Override + public <T> Cursor<T> selectCursor(String statement, Object parameter) { + return delegate.selectCursor(statement, parameter); + } + + @Override + public <T> Cursor<T> selectCursor(String statement, Object parameter, RowBounds rowBounds) { + return delegate.selectCursor(statement, parameter, rowBounds); + } + @Override public <T> T selectOne(String statement) { return delegate.selectOne(statement); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatisConfBuilder.java b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatisConfBuilder.java index 2dd2f2918cf..cc34ad55b91 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatisConfBuilder.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatisConfBuilder.java @@ -21,7 +21,6 @@ package org.sonar.db; import com.google.common.io.Closeables; import java.io.InputStream; -import org.apache.ibatis.builder.xml.XMLMapperBuilder; import org.apache.ibatis.mapping.Environment; import org.apache.ibatis.session.Configuration; import org.apache.ibatis.session.LocalCacheScope; @@ -34,10 +33,10 @@ import org.sonar.db.dialect.Dialect; import static com.google.common.base.Preconditions.checkArgument; import static java.lang.String.format; -public final class MyBatisConfBuilder { +class MyBatisConfBuilder { private final Configuration conf; - public MyBatisConfBuilder(Database database) { + MyBatisConfBuilder(Database database) { this.conf = new Configuration(); this.conf.setEnvironment(new Environment("production", createTransactionFactory(), database.getDataSource())); this.conf.setUseGeneratedKeys(true); @@ -51,26 +50,11 @@ public final class MyBatisConfBuilder { this.conf.setLocalCacheScope(LocalCacheScope.STATEMENT); } - public void loadAlias(String alias, Class dtoClass) { + void loadAlias(String alias, Class dtoClass) { conf.getTypeAliasRegistry().registerAlias(alias, dtoClass); } - public void loadMapper(String mapperName) { - String configFile = configFilePath(mapperName); - InputStream input = null; - try { - input = getClass().getResourceAsStream(configFile); - checkArgument(input != null, format("Can not find mapper XML file %s", configFile)); - new XMLMapperBuilder(input, conf, mapperName, conf.getSqlFragments()).parse(); - loadAndConfigureLogger(mapperName); - } catch (Exception e) { - throw new IllegalArgumentException("Unable to load mapper " + mapperName, e); - } finally { - Closeables.closeQuietly(input); - } - } - - public void loadMapper(Class mapperClass) { + void loadMapper(Class mapperClass) { String configFile = configFilePath(mapperClass); InputStream input = null; try { @@ -98,7 +82,7 @@ public final class MyBatisConfBuilder { Loggers.get(mapperName).setLevel(LoggerLevel.INFO); } - public void loadMappers(Class<?>... mapperClasses) { + void loadMappers(Class<?>... mapperClasses) { for (Class mapperClass : mapperClasses) { loadMapper(mapperClass); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java index a56ebd4883f..f23f1fe91a8 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java @@ -279,7 +279,7 @@ public class ComponentDao implements Dao { * @param projectUuid the project uuid, which is selected with all of its children * @param handler the action to be applied to every result */ - public void selectForIndexing(DbSession session, @Nullable String projectUuid, ResultHandler handler) { + public void selectForIndexing(DbSession session, @Nullable String projectUuid, ResultHandler<ComponentDto> handler) { requireNonNull(handler); mapper(session).selectForIndexing(projectUuid, handler); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java index 319d594dc83..0cfc494d2dd 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentMapper.java @@ -130,7 +130,7 @@ public interface ComponentMapper { List<ComponentDto> selectProjectsByNameQuery(@Param("nameQuery") @Nullable String nameQuery, @Param("includeModules") boolean includeModules); - void selectForIndexing(@Param("projectUuid") @Nullable String projectUuid, ResultHandler handler); + void selectForIndexing(@Param("projectUuid") @Nullable String projectUuid, ResultHandler<ComponentDto> handler); void insert(ComponentDto componentDto); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java index 58934e4d50f..d1102b487af 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueMapper.java @@ -28,7 +28,7 @@ public interface IssueMapper { IssueDto selectByKey(String key); - void selectNonClosedByComponentUuid(@Param("componentUuid") String componentUuid, ResultHandler resultHandler); + void selectNonClosedByComponentUuid(@Param("componentUuid") String componentUuid, ResultHandler<IssueDto> resultHandler); Set<String> selectComponentUuidsOfOpenIssuesForProjectUuid(String projectUuid); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/MeasureDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/measure/MeasureDao.java index 72d7c5460fb..419c4cd74e5 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/MeasureDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/measure/MeasureDao.java @@ -78,7 +78,7 @@ public class MeasureDao implements Dao { return mapper(dbSession).selectByQueryOnSingleComponent(query); } - public void selectTreeByQuery(DbSession dbSession, ComponentDto baseComponent, MeasureTreeQuery query, ResultHandler resultHandler) { + public void selectTreeByQuery(DbSession dbSession, ComponentDto baseComponent, MeasureTreeQuery query, ResultHandler<MeasureDto> resultHandler) { if (query.returnsEmpty()) { return; } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/MeasureMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/measure/MeasureMapper.java index 34257e6b173..4250ac4f067 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/MeasureMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/measure/MeasureMapper.java @@ -33,7 +33,7 @@ public interface MeasureMapper { List<MeasureDto> selectByQueryOnSingleComponent(@Param("query") MeasureQuery query); void selectTreeByQuery(@Param("query") MeasureTreeQuery measureQuery, @Param("baseUuid") String baseUuid, @Param("baseUuidPath") String baseUuidPath, - ResultHandler resultHandler); + ResultHandler<MeasureDto> resultHandler); List<PastMeasureDto> selectPastMeasuresOnSingleAnalysis(@Param("componentUuid") String componentUuid, @Param("analysisUuid") String analysisUuid, diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateDao.java index 67c0b009b5a..78024495484 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateDao.java @@ -115,7 +115,7 @@ public class PermissionTemplateDao implements Dao { /** * Each row returns a #{@link CountPerProjectPermission} */ - public void usersCountByTemplateIdAndPermission(DbSession dbSession, List<Long> templateIds, ResultHandler resultHandler) { + public void usersCountByTemplateIdAndPermission(DbSession dbSession, List<Long> templateIds, ResultHandler<CountByTemplateAndPermissionDto> resultHandler) { Map<String, Object> parameters = new HashMap<>(1); executeLargeInputsWithoutOutput( @@ -129,7 +129,7 @@ public class PermissionTemplateDao implements Dao { /** * Each row returns a #{@link CountPerProjectPermission} */ - public void groupsCountByTemplateIdAndPermission(DbSession dbSession, List<Long> templateIds, ResultHandler resultHandler) { + public void groupsCountByTemplateIdAndPermission(DbSession dbSession, List<Long> templateIds, ResultHandler<CountByTemplateAndPermissionDto> resultHandler) { Map<String, Object> parameters = new HashMap<>(2); parameters.put(ANYONE_GROUP_PARAMETER, ANYONE); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateMapper.java index 4c2735b377e..a65dc665e3c 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/permission/template/PermissionTemplateMapper.java @@ -80,9 +80,9 @@ public interface PermissionTemplateMapper { List<PermissionTemplateDto> selectAll(@Param("organizationUuid") String organizationUuid, @Nullable @Param("upperCaseNameLikeSql") String upperCaseNameLikeSql); - void usersCountByTemplateIdAndPermission(Map<String, Object> parameters, ResultHandler resultHandler); + void usersCountByTemplateIdAndPermission(Map<String, Object> parameters, ResultHandler<CountByTemplateAndPermissionDto> resultHandler); - void groupsCountByTemplateIdAndPermission(Map<String, Object> parameters, ResultHandler resultHandler); + void groupsCountByTemplateIdAndPermission(Map<String, Object> parameters, ResultHandler<CountByTemplateAndPermissionDto> resultHandler); List<String> selectPotentialPermissionsByUserIdAndTemplateId(@Param("userId") @Nullable Integer currentUserId, @Param("templateId") long templateId); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java index b19f4ee848f..7cef39132d8 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java @@ -174,7 +174,7 @@ public class ActiveRuleDao implements Dao { public void scrollAllForIndexing(DbSession dbSession, Consumer<IndexedActiveRuleDto> consumer) { mapper(dbSession).scrollAllForIndexing(context -> { - IndexedActiveRuleDto dto = (IndexedActiveRuleDto) context.getResultObject(); + IndexedActiveRuleDto dto = context.getResultObject(); consumer.accept(dto); }); } @@ -184,14 +184,14 @@ public class ActiveRuleDao implements Dao { executeLargeInputsWithoutOutput(ids, pageOfIds -> mapper .scrollByIdsForIndexing(pageOfIds, context -> { - IndexedActiveRuleDto dto = (IndexedActiveRuleDto) context.getResultObject(); + IndexedActiveRuleDto dto = context.getResultObject(); consumer.accept(dto); })); } public void scrollByRuleProfileForIndexing(DbSession dbSession, String ruleProfileUuid, Consumer<IndexedActiveRuleDto> consumer) { mapper(dbSession).scrollByRuleProfileUuidForIndexing(ruleProfileUuid, context -> { - IndexedActiveRuleDto dto = (IndexedActiveRuleDto) context.getResultObject(); + IndexedActiveRuleDto dto = context.getResultObject(); consumer.accept(dto); }); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleMapper.java index 2821d3ae0c8..985c5625840 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleMapper.java @@ -74,9 +74,9 @@ public interface ActiveRuleMapper { List<KeyLongValue> countActiveRulesByQuery(@Param("organizationUuid") String organizationUuid, @Param("profileUuids") List<String> profileUuids, @Nullable @Param("ruleStatus") RuleStatus ruleStatus, @Param("inheritance") String inheritance); - void scrollAllForIndexing(ResultHandler handler); + void scrollAllForIndexing(ResultHandler<IndexedActiveRuleDto> handler); - void scrollByIdsForIndexing(@Param("ids") Collection<Long> ids, ResultHandler handler); + void scrollByIdsForIndexing(@Param("ids") Collection<Long> ids, ResultHandler<IndexedActiveRuleDto> handler); - void scrollByRuleProfileUuidForIndexing(@Param("ruleProfileUuid") String ruleProfileUuid, ResultHandler handler); + void scrollByRuleProfileUuidForIndexing(@Param("ruleProfileUuid") String ruleProfileUuid, ResultHandler<IndexedActiveRuleDto> handler); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java index 1af37e8cfd2..289c7ce9343 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleDao.java @@ -105,7 +105,7 @@ public class RuleDao implements Dao { return executeLargeInputs(keys, mapper(session)::selectDefinitionByKeys); } - public void selectEnabled(DbSession session, ResultHandler resultHandler) { + public void selectEnabled(DbSession session, ResultHandler<RuleDefinitionDto> resultHandler) { mapper(session).selectEnabled(resultHandler); } @@ -163,7 +163,7 @@ public class RuleDao implements Dao { public void scrollIndexingRuleExtensions(DbSession dbSession, Consumer<RuleExtensionForIndexingDto> consumer) { mapper(dbSession).scrollIndexingRuleExtensions(context -> { - RuleExtensionForIndexingDto dto = (RuleExtensionForIndexingDto) context.getResultObject(); + RuleExtensionForIndexingDto dto = context.getResultObject(); consumer.accept(dto); }); } @@ -179,7 +179,7 @@ public class RuleDao implements Dao { public void scrollIndexingRules(DbSession dbSession, Consumer<RuleForIndexingDto> consumer) { mapper(dbSession).scrollIndexingRules(context -> { - RuleForIndexingDto dto = (RuleForIndexingDto) context.getResultObject(); + RuleForIndexingDto dto = context.getResultObject(); consumer.accept(dto); }); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleMapper.java index 350bd23b3e3..770fb8764d4 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleMapper.java @@ -32,7 +32,7 @@ public interface RuleMapper { List<RuleDefinitionDto> selectAllDefinitions(); - void selectEnabled(ResultHandler resultHandler); + void selectEnabled(ResultHandler<RuleDefinitionDto> resultHandler); RuleDto selectById(@Param("organizationUuid") String organizationUuid, @Param("id") long id); @@ -52,11 +52,11 @@ public interface RuleMapper { List<RuleDefinitionDto> selectDefinitionByKeys(@Param("ruleKeys") List<RuleKey> keys); - void scrollIndexingRules(ResultHandler handler); + void scrollIndexingRules(ResultHandler<RuleForIndexingDto> handler); List<RuleForIndexingDto> selectIndexingRulesByKeys(@Param("ruleKeys") List<RuleKey> keys); - void scrollIndexingRuleExtensions(ResultHandler handler); + void scrollIndexingRuleExtensions(ResultHandler<RuleExtensionForIndexingDto> handler); List<RuleExtensionForIndexingDto> selectIndexingRuleExtensionsByIds(@Param("ruleExtensionIds") List<RuleExtensionId> ruleExtensionIds); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDao.java index ef7c49d07de..49a6bd9eff6 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserDao.java @@ -161,7 +161,7 @@ public class UserDao implements Dao { public void scrollAll(DbSession dbSession, Consumer<UserDto> consumer) { mapper(dbSession).scrollAll(context -> { - UserDto user = (UserDto) context.getResultObject(); + UserDto user = context.getResultObject(); consumer.accept(user); }); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserMapper.java index e2938d4a776..a894164aa04 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/user/UserMapper.java @@ -52,7 +52,7 @@ public interface UserMapper { List<UserDto> selectByIds(@Param("ids") List<Integer> ids); - void scrollAll(ResultHandler handler); + void scrollAll(ResultHandler<UserDto> handler); long countByEmail(String email); diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/IsAliveMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/IsAliveMapper.xml index c26b5961f8a..ac854b2f237 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/IsAliveMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/IsAliveMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.IsAliveMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml index 4722e7be458..59f459c8df3 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.ce.CeActivityMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml index d8d38a0cb01..8259043c4e0 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.ce.CeQueueMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeScannerContextMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeScannerContextMapper.xml index f7f3ff50e94..a89db6814e8 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeScannerContextMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeScannerContextMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.ce.CeScannerContextMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeTaskInputMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeTaskInputMapper.xml index 141055f933c..5db0cfce471 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeTaskInputMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/ce/CeTaskInputMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.ce.CeTaskInputMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml index 4514ad12014..b47e6f46b44 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.component.ComponentKeyUpdaterMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml index 1b9ba17cba6..cbc4412649e 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.component.ComponentLinkMapper"> <sql id="componentLinkColumns"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml index 5fa30ba8f39..2138cca83cd 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.component.ComponentMapper"> <sql id="componentColumns"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ResourceMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ResourceMapper.xml index b736637bd9f..2ef477b7975 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ResourceMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ResourceMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.component.ResourceMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/SnapshotMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/SnapshotMapper.xml index 4e00d6ac39c..5d2a0a478d6 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/SnapshotMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/SnapshotMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.component.SnapshotMapper"> <sql id="snapshotColumns"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/duplication/DuplicationMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/duplication/DuplicationMapper.xml index 6249a27e77f..21135fa3248 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/duplication/DuplicationMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/duplication/DuplicationMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.duplication.DuplicationMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/event/EventMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/event/EventMapper.xml index 236fd25ae4a..bb7623140a1 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/event/EventMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/event/EventMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.event.EventMapper"> <sql id="eventColumns"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueChangeMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueChangeMapper.xml index 04a9104f5f0..46a732b0719 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueChangeMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueChangeMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.issue.IssueChangeMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml index c1d551b8e26..2b7fe7599d8 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.issue.IssueMapper"> @@ -150,7 +150,7 @@ where i.kee=#{kee,jdbcType=VARCHAR} </select> - <select id="selectNonClosedByComponentUuid" parameterType="String" resultType="Issue"> + <select id="selectNonClosedByComponentUuid" parameterType="String" resultType="Issue" fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY"> select <include refid="issueColumns"/> from issues i diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/loadedtemplate/LoadedTemplateMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/loadedtemplate/LoadedTemplateMapper.xml index 09ba1c86d4c..935dee74972 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/loadedtemplate/LoadedTemplateMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/loadedtemplate/LoadedTemplateMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.loadedtemplate.LoadedTemplateMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/MeasureMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/MeasureMapper.xml index 857510f8678..860b4e73f47 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/MeasureMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/MeasureMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.measure.MeasureMapper"> @@ -89,7 +89,7 @@ </choose> </sql> - <select id="selectTreeByQuery" parameterType="map" resultType="Measure"> + <select id="selectTreeByQuery" parameterType="map" resultType="Measure" fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY"> select <include refid="measureColumns"/> from project_measures pm inner join snapshots analysis on analysis.uuid = pm.analysis_uuid inner join projects p on p.project_uuid=analysis.component_uuid and p.uuid=pm.component_uuid diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/custom/CustomMeasureMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/custom/CustomMeasureMapper.xml index 69cc9001983..8735cb8dea5 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/custom/CustomMeasureMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/custom/CustomMeasureMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.measure.custom.CustomMeasureMapper"> <sql id="selectColumns"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/metric/MetricMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/metric/MetricMapper.xml index cbc008ad818..8cc33774736 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/metric/MetricMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/metric/MetricMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.metric.MetricMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/notification/NotificationQueueMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/notification/NotificationQueueMapper.xml index 06658f6bf2a..6ee671feb62 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/notification/NotificationQueueMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/notification/NotificationQueueMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.notification.NotificationQueueMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMapper.xml index 1405be36d54..457d2639594 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.organization.OrganizationMapper"> <sql id="selectColumns"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMemberMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMemberMapper.xml index 618a3726d3c..49ca6e65af5 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMemberMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/organization/OrganizationMemberMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.organization.OrganizationMemberMapper"> <sql id="selectColumns"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/AuthorizationMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/AuthorizationMapper.xml index 76dd716a1f5..52248d4b65f 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/AuthorizationMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/AuthorizationMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.permission.AuthorizationMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/GroupPermissionMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/GroupPermissionMapper.xml index 74e031b602b..2a27739d4c6 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/GroupPermissionMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/GroupPermissionMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.permission.GroupPermissionMapper"> @@ -182,7 +182,7 @@ ) </select> - <insert id="insert" parameterType="GroupPermission" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="GroupPermission" keyColumn="id" useGeneratedKeys="false" keyProperty="id"> insert into group_roles ( organization_uuid, group_id, diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml index 4c2b0c2a719..3ed9dccb9ee 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/UserPermissionMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.permission.UserPermissionMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateCharacteristicMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateCharacteristicMapper.xml index c065eeb92bd..6f020e31f85 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateCharacteristicMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateCharacteristicMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.permission.template.PermissionTemplateCharacteristicMapper"> <sql id="columns"> ptc.id, diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml index 76ab1fa9de3..992246f97ac 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/permission/template/PermissionTemplateMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.permission.template.PermissionTemplateMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/property/InternalPropertiesMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/property/InternalPropertiesMapper.xml index 2431e1b5514..7c0ddfcd318 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/property/InternalPropertiesMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/property/InternalPropertiesMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.property.InternalPropertiesMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml index 6dd2435d0b8..26dca324c56 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/property/PropertiesMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.property.PropertiesMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml index dee0337d1ad..c78741c94cc 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.purge.PurgeMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml index 1254dda2303..74c2111e8ef 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.qualitygate.ProjectQgateAssociationMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateConditionMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateConditionMapper.xml index 1d305087cf8..b34a4f243f1 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateConditionMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateConditionMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.qualitygate.QualityGateConditionMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateMapper.xml index 64d2e58efb4..0dfb59d5d08 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualitygate/QualityGateMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.qualitygate.QualityGateMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml index 5965b14ebde..2240344cda0 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/ActiveRuleMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.qualityprofile.ActiveRuleMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/DefaultQProfileMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/DefaultQProfileMapper.xml index 60c6d8cc2ac..81c5b96fef7 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/DefaultQProfileMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/DefaultQProfileMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.qualityprofile.DefaultQProfileMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QProfileChangeMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QProfileChangeMapper.xml index 172b7c9a8ea..684354d2b4b 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QProfileChangeMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QProfileChangeMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.qualityprofile.QProfileChangeMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QualityProfileMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QualityProfileMapper.xml index 4d75daa1067..1e3276715be 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QualityProfileMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/qualityprofile/QualityProfileMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.qualityprofile.QualityProfileMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml index 222fea7a639..5178e00e2da 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.rule.RuleMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleRepositoryMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleRepositoryMapper.xml index ab85f1002c9..1e9ad4f9889 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleRepositoryMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleRepositoryMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.rule.RuleRepositoryMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/schemamigration/SchemaMigrationMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/schemamigration/SchemaMigrationMapper.xml index efe2333954b..f9b4f2e1ba2 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/schemamigration/SchemaMigrationMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/schemamigration/SchemaMigrationMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.schemamigration.SchemaMigrationMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/source/FileSourceMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/source/FileSourceMapper.xml index aae3d21df1d..f8f9c6498f7 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/source/FileSourceMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/source/FileSourceMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.source.FileSourceMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/GroupMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/GroupMapper.xml index 89fcbc40313..d9d5850eb24 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/GroupMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/GroupMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.user.GroupMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/GroupMembershipMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/GroupMembershipMapper.xml index 5297c4959d9..cb73ce51188 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/GroupMembershipMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/GroupMembershipMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.user.GroupMembershipMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/RoleMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/RoleMapper.xml index 7ce32c4118d..28d06b6c651 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/RoleMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/RoleMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.user.RoleMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserGroupMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserGroupMapper.xml index 3e66bc07892..1f7a7ac7d41 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserGroupMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserGroupMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.user.UserGroupMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserMapper.xml index 9dddabd501d..9e4c671343e 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.user.UserMapper"> diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserTokenMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserTokenMapper.xml index 81e30144887..5ffa6465199 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserTokenMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/UserTokenMapper.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.user.UserTokenMapper"> @@ -10,7 +10,7 @@ t.created_at as "createdAt" </sql> - <insert id="insert" parameterType="UserToken" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="UserToken" keyColumn="id" useGeneratedKeys="false" keyProperty="id"> insert into user_tokens ( login, name, diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/webhook/WebhookDeliveryMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/webhook/WebhookDeliveryMapper.xml index dc178b7d4d1..2f9c957753e 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/webhook/WebhookDeliveryMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/webhook/WebhookDeliveryMapper.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd"> <mapper namespace="org.sonar.db.webhook.WebhookDeliveryMapper"> diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java index 2efdcfc3629..ee6b738ce57 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java @@ -27,8 +27,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import javax.annotation.Nullable; -import org.apache.ibatis.session.ResultContext; -import org.apache.ibatis.session.ResultHandler; import org.apache.ibatis.session.RowBounds; import org.assertj.core.api.ListAssert; import org.junit.Rule; @@ -670,13 +668,7 @@ public class ComponentDaoTest { db.prepareDbUnit(getClass(), "selectForIndexing.xml"); List<ComponentDto> components = new ArrayList<>(); - underTest.selectForIndexing(dbSession, projectUuid, new ResultHandler() { - - @Override - public void handleResult(ResultContext context) { - components.add((ComponentDto) context.getResultObject()); - } - }); + underTest.selectForIndexing(dbSession, projectUuid, context -> components.add(context.getResultObject())); return assertThat(components).extracting(ComponentDto::uuid); } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/MeasureDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/measure/MeasureDaoTest.java index 3e5bcfe2499..68b25cb340a 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/MeasureDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/measure/MeasureDaoTest.java @@ -390,7 +390,7 @@ public class MeasureDaoTest { private void verifyMeasures(ComponentDto baseComponent, MeasureTreeQuery.Builder measureQuery, String... expectedIds) { List<MeasureDto> measures = new ArrayList<>(); - underTest.selectTreeByQuery(db.getSession(), baseComponent, measureQuery.build(), result -> measures.add((MeasureDto) result.getResultObject())); + underTest.selectTreeByQuery(db.getSession(), baseComponent, measureQuery.build(), result -> measures.add(result.getResultObject())); assertThat(measures).extracting(MeasureDto::getData).containsOnly(expectedIds); } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java index 878c6160d2f..9aac144c842 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java @@ -296,7 +296,7 @@ public class PermissionTemplateDaoTest { final List<CountByTemplateAndPermissionDto> result = new ArrayList<>(); underTest.groupsCountByTemplateIdAndPermission(dbSession, asList(template1.getId(), template2.getId(), template3.getId()), - context -> result.add((CountByTemplateAndPermissionDto) context.getResultObject())); + context -> result.add(context.getResultObject())); assertThat(result).extracting(CountByTemplateAndPermissionDto::getPermission, CountByTemplateAndPermissionDto::getTemplateId, CountByTemplateAndPermissionDto::getCount) .containsOnly(tuple(ADMIN, template1.getId(), 1), tuple(CODEVIEWER, template1.getId(), 4), tuple(ADMIN, template2.getId(), 1)); @@ -321,7 +321,7 @@ public class PermissionTemplateDaoTest { final List<CountByTemplateAndPermissionDto> result = new ArrayList<>(); underTest.usersCountByTemplateIdAndPermission(dbSession, asList(template1.getId(), template2.getId(), template3.getId()), - context -> result.add((CountByTemplateAndPermissionDto) context.getResultObject())); + context -> result.add(context.getResultObject())); assertThat(result).hasSize(3); assertThat(result).extracting("permission").containsOnly(ADMIN, USER); assertThat(result).extracting("templateId").containsOnly(template1.getId(), template2.getId()); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java index ea1f43510e2..3e6e0614bf4 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java @@ -269,7 +269,7 @@ public class RuleDaoTest { db.prepareDbUnit(getClass(), "selectEnabled.xml"); final List<RuleDefinitionDto> rules = new ArrayList<>(); - ResultHandler resultHandler = resultContext -> rules.add((RuleDefinitionDto) resultContext.getResultObject()); + ResultHandler<RuleDefinitionDto> resultHandler = resultContext -> rules.add(resultContext.getResultObject()); underTest.selectEnabled(db.getSession(), resultHandler); assertThat(rules.size()).isEqualTo(1); diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/index/ComponentIndexer.java b/server/sonar-server/src/main/java/org/sonar/server/component/index/ComponentIndexer.java index d845806e06b..2f02c9871fc 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/index/ComponentIndexer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/index/ComponentIndexer.java @@ -95,7 +95,7 @@ public class ComponentIndexer implements ProjectIndexer, NeedAuthorizationIndexe try (DbSession dbSession = dbClient.openSession(false)) { dbClient.componentDao() .selectForIndexing(dbSession, projectUuid, context -> { - ComponentDto dto = (ComponentDto) context.getResultObject(); + ComponentDto dto = context.getResultObject(); bulk.add(newIndexRequest(toDocument(dto))); }); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/BaseIssuesLoader.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/BaseIssuesLoader.java index e7803b4f9b8..93404c0b81e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/BaseIssuesLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/issue/BaseIssuesLoader.java @@ -27,7 +27,6 @@ import org.sonar.api.rule.RuleStatus; import org.sonar.core.issue.DefaultIssue; import org.sonar.db.DbClient; import org.sonar.db.DbSession; -import org.sonar.db.issue.IssueDto; import org.sonar.db.issue.IssueMapper; import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolder; import org.sonar.server.computation.task.projectanalysis.qualityprofile.ActiveRulesHolder; @@ -55,7 +54,7 @@ public class BaseIssuesLoader { try (DbSession dbSession = dbClient.openSession(false)) { List<DefaultIssue> result = new ArrayList<>(); dbSession.getMapper(IssueMapper.class).selectNonClosedByComponentUuid(componentUuid, resultContext -> { - DefaultIssue issue = ((IssueDto) resultContext.getResultObject()).toDefaultIssue(); + DefaultIssue issue = (resultContext.getResultObject()).toDefaultIssue(); // TODO this field should be set outside this class if (!isActive(issue.ruleKey()) || ruleRepository.getByKey(issue.ruleKey()).getStatus() == RuleStatus.REMOVED) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java index 0001da86d57..1eb6457d052 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java @@ -193,7 +193,7 @@ public class ComponentTreeDataLoader { Table<String, MetricDto, Measure> measuresByComponentUuidAndMetric = HashBasedTable.create(components.size(), metrics.size()); dbClient.measureDao().selectTreeByQuery(dbSession, baseComponent, measureQuery, result -> { - MeasureDto measureDto = (MeasureDto) result.getResultObject(); + MeasureDto measureDto = result.getResultObject(); measuresByComponentUuidAndMetric.put( measureDto.getComponentUuid(), metricsById.get(measureDto.getMetricId()), diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesDataLoader.java b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesDataLoader.java index e80d99ad268..20cc847c804 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesDataLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/permission/ws/template/SearchTemplatesDataLoader.java @@ -71,7 +71,7 @@ public class SearchTemplatesDataLoader { final Table<Long, String, Integer> userCountByTemplateIdAndPermission = TreeBasedTable.create(); dbClient.permissionTemplateDao().usersCountByTemplateIdAndPermission(dbSession, templateIds, context -> { - CountByTemplateAndPermissionDto row = (CountByTemplateAndPermissionDto) context.getResultObject(); + CountByTemplateAndPermissionDto row = context.getResultObject(); userCountByTemplateIdAndPermission.put(row.getTemplateId(), row.getPermission(), row.getCount()); }); @@ -82,7 +82,7 @@ public class SearchTemplatesDataLoader { final Table<Long, String, Integer> userCountByTemplateIdAndPermission = TreeBasedTable.create(); dbClient.permissionTemplateDao().groupsCountByTemplateIdAndPermission(dbSession, templateIds, context -> { - CountByTemplateAndPermissionDto row = (CountByTemplateAndPermissionDto) context.getResultObject(); + CountByTemplateAndPermissionDto row = context.getResultObject(); userCountByTemplateIdAndPermission.put(row.getTemplateId(), row.getPermission(), row.getCount()); }); diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ListAction.java b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ListAction.java index 4d324d580ee..86f5be32ce5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ListAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/ws/ListAction.java @@ -55,7 +55,7 @@ public class ListAction implements RulesWsAction { final ListResponse.Rule.Builder ruleBuilder = ListResponse.Rule.newBuilder(); try (DbSession dbSession = dbClient.openSession(false)) { dbClient.ruleDao().selectEnabled(dbSession, resultContext -> { - RuleDefinitionDto dto = (RuleDefinitionDto) resultContext.getResultObject(); + RuleDefinitionDto dto = resultContext.getResultObject(); ruleBuilder .clear() .setRepository(dto.getRepositoryKey()) |