From 48ed6da9565ea4757504590b0c16e16019f8a4f5 Mon Sep 17 00:00:00 2001 From: Holger Hagen <19706592+holgerhagen@users.noreply.github.com> Date: Tue, 5 Oct 2021 19:10:51 +0200 Subject: [PATCH] TSK-1746: removed hardcoded schema name in ConfigurationMapper. --- .../common/internal/ConfigurationMapper.java | 4 ++-- .../common/internal/TaskanaEngineImpl.java | 21 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/taskana-core/src/main/java/pro/taskana/common/internal/ConfigurationMapper.java b/lib/taskana-core/src/main/java/pro/taskana/common/internal/ConfigurationMapper.java index f7b7b6827..ae8d55ee8 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/common/internal/ConfigurationMapper.java +++ b/lib/taskana-core/src/main/java/pro/taskana/common/internal/ConfigurationMapper.java @@ -14,9 +14,9 @@ public interface ConfigurationMapper { @Insert("INSERT INTO CONFIGURATION(ENFORCE_SECURITY) VALUES (#{securityEnabled})") void setSecurityEnabled(@Param("securityEnabled") boolean securityEnabled); - @Select("SELECT CUSTOM_ATTRIBUTES FROM TASKANA.CONFIGURATION") + @Select("SELECT CUSTOM_ATTRIBUTES FROM CONFIGURATION") Map getAllCustomAttributes(); - @Update("UPDATE TASKANA.CONFIGURATION SET CUSTOM_ATTRIBUTES = #{customAttributes}") + @Update("UPDATE CONFIGURATION SET CUSTOM_ATTRIBUTES = #{customAttributes}") void setAllCustomAttributes(@Param("customAttributes") Map customAttributes); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/common/internal/TaskanaEngineImpl.java b/lib/taskana-core/src/main/java/pro/taskana/common/internal/TaskanaEngineImpl.java index 342763b55..0e1a70b92 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/common/internal/TaskanaEngineImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/common/internal/TaskanaEngineImpl.java @@ -86,7 +86,6 @@ public class TaskanaEngineImpl implements TaskanaEngine { private final WorkingDaysToDaysConverter workingDaysToDaysConverter; private final HistoryEventManager historyEventManager; private final CurrentUserContext currentUserContext; - private final ConfigurationServiceImpl configurationService; protected TaskanaEngineConfiguration taskanaEngineConfiguration; protected TransactionFactory transactionFactory; protected SqlSessionManager sessionManager; @@ -109,9 +108,7 @@ public class TaskanaEngineImpl implements TaskanaEngine { new CurrentUserContextImpl(TaskanaEngineConfiguration.shouldUseLowerCaseForAccessIds()); createTransactionFactory(taskanaEngineConfiguration.getUseManagedTransactions()); sessionManager = createSqlSessionManager(); - configurationService = - new ConfigurationServiceImpl( - internalTaskanaEngineImpl, sessionManager.getMapper(ConfigurationMapper.class)); + initializeDbSchema(taskanaEngineConfiguration); // IMPORTANT: SPI has to be initialized last (and in this order) in order @@ -134,6 +131,12 @@ public class TaskanaEngineImpl implements TaskanaEngine { return new TaskanaEngineImpl(taskanaEngineConfiguration, connectionManagementMode); } + @Override + public ConfigurationService getConfigurationService() { + return new ConfigurationServiceImpl( + internalTaskanaEngineImpl, sessionManager.getMapper(ConfigurationMapper.class)); + } + @Override public TaskService getTaskService() { return new TaskServiceImpl( @@ -187,11 +190,6 @@ public class TaskanaEngineImpl implements TaskanaEngine { internalTaskanaEngineImpl, sessionManager.getMapper(UserMapper.class)); } - @Override - public ConfigurationService getConfigurationService() { - return configurationService; - } - @Override public TaskanaEngineConfiguration getConfiguration() { return this.taskanaEngineConfiguration; @@ -369,8 +367,9 @@ public class TaskanaEngineImpl implements TaskanaEngine { "The Database Schema Version doesn't match the expected minimal version " + MINIMAL_TASKANA_SCHEMA_VERSION); } - configurationService.checkSecureAccess(taskanaEngineConfiguration.isSecurityEnabled()); - configurationService.setupDefaultCustomAttributes(); + ((ConfigurationServiceImpl) getConfigurationService()) + .checkSecureAccess(taskanaEngineConfiguration.isSecurityEnabled()); + ((ConfigurationServiceImpl) getConfigurationService()).setupDefaultCustomAttributes(); } /**