TSK-1746: removed hardcoded schema name in ConfigurationMapper.

This commit is contained in:
Holger Hagen 2021-10-05 19:10:51 +02:00 committed by holgerhagen
parent 331bf2998b
commit 48ed6da956
2 changed files with 12 additions and 13 deletions

View File

@ -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<String, Object> getAllCustomAttributes();
@Update("UPDATE TASKANA.CONFIGURATION SET CUSTOM_ATTRIBUTES = #{customAttributes}")
@Update("UPDATE CONFIGURATION SET CUSTOM_ATTRIBUTES = #{customAttributes}")
void setAllCustomAttributes(@Param("customAttributes") Map<String, ?> customAttributes);
}

View File

@ -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();
}
/**