Package pro.taskana.common.internal
Class TaskanaEngineImpl
java.lang.Object
pro.taskana.common.internal.TaskanaEngineImpl
- All Implemented Interfaces:
TaskanaEngine
This is the implementation of TaskanaEngine.
-
Nested Class Summary
Nested classes/interfaces inherited from interface pro.taskana.common.api.TaskanaEngine
TaskanaEngine.ConnectionManagementMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Connectionprotected TaskanaEngine.ConnectionManagementModeprotected org.apache.ibatis.session.SqlSessionManagerprotected final TaskanaConfigurationprotected org.apache.ibatis.transaction.TransactionFactoryFields inherited from interface pro.taskana.common.api.TaskanaEngine
MINIMAL_TASKANA_SCHEMA_VERSION -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTaskanaEngineImpl(TaskanaConfiguration taskanaConfiguration, TaskanaEngine.ConnectionManagementMode connectionManagementMode) -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckRoleMembership(TaskanaRole... roles) Checks whether current user is member of any of the specified TaskanaRoles.voidCloses the client's connection, sets it to null and switches to mode PARTICIPATE.protected org.apache.ibatis.session.SqlSessionManagerThis method creates the sqlSessionManager of myBatis.static TaskanaEnginecreateTaskanaEngine(TaskanaConfiguration taskanaConfiguration, TaskanaEngine.ConnectionManagementMode connectionManagementMode) Returns a ClassificationService initialized with the current TaskanaEngine.Returns the configuration of the TaskanaEngine.Returns a ConfigurationService initialized with the current TaskanaEngine.Returns the ConnectionManagementMode of the TaskanaEngine.pro.taskana.common.api.security.CurrentUserContextReturns the CurrentUserContext of the TaskanaEngine.Returns a JobService initialized with the current TaskanaEngine.Returns a MonitorService initialized with the current TaskanaEngine.Returns a TaskService initialized with the current TaskanaEngine.Returns a UserService initialized with the current TaskanaEngine.Returns a WorkbasketService initialized with the current TaskanaEngine.Returns the WorkingTimeCalculator of the TaskanaEngine.booleanChecks if the TaskanaHistory plugin is enabled.booleanisUserInRole(TaskanaRole... roles) Check whether the current user is member of one of the TaskanaRoles specified.<T> TrunAsAdmin(Supplier<T> supplier) Executes a givenSupplierwith admin privileges and thus skips further permission checks.voidsetConnection(Connection connection) Set theConnectionto be used by TASKANA in mode EXPLICIT.voidSets ConnectionManagementMode of the TaskanaEngine.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface pro.taskana.common.api.TaskanaEngine
runAsAdmin
-
Field Details
-
taskanaConfiguration
-
mode
-
transactionFactory
protected org.apache.ibatis.transaction.TransactionFactory transactionFactory -
sessionManager
protected org.apache.ibatis.session.SqlSessionManager sessionManager -
connection
-
-
Constructor Details
-
TaskanaEngineImpl
protected TaskanaEngineImpl(TaskanaConfiguration taskanaConfiguration, TaskanaEngine.ConnectionManagementMode connectionManagementMode) throws SQLException - Throws:
SQLException
-
-
Method Details
-
createTaskanaEngine
public static TaskanaEngine createTaskanaEngine(TaskanaConfiguration taskanaConfiguration, TaskanaEngine.ConnectionManagementMode connectionManagementMode) throws SQLException - Throws:
SQLException
-
getConfigurationService
Description copied from interface:TaskanaEngineReturns a ConfigurationService initialized with the current TaskanaEngine. The ConfigurationService can be used to manage custom configuration options.- Specified by:
getConfigurationServicein interfaceTaskanaEngine- Returns:
- an instance of ConfigurationService
-
getTaskService
Description copied from interface:TaskanaEngineReturns a TaskService initialized with the current TaskanaEngine. TaskService can be used for operations on all Tasks.- Specified by:
getTaskServicein interfaceTaskanaEngine- Returns:
- an instance of TaskService
-
getMonitorService
Description copied from interface:TaskanaEngineReturns a MonitorService initialized with the current TaskanaEngine. MonitorService can be used for monitoring Tasks.- Specified by:
getMonitorServicein interfaceTaskanaEngine- Returns:
- an instance of MonitorService
-
getWorkbasketService
Description copied from interface:TaskanaEngineReturns a WorkbasketService initialized with the current TaskanaEngine. The WorkbasketService can be used for operations on all Workbaskets.- Specified by:
getWorkbasketServicein interfaceTaskanaEngine- Returns:
- an instance of WorkbasketService
-
getClassificationService
Description copied from interface:TaskanaEngineReturns a ClassificationService initialized with the current TaskanaEngine. The ClassificationService can be used for operations on all Classifications.- Specified by:
getClassificationServicein interfaceTaskanaEngine- Returns:
- an instance of ClassificationService
-
getConnection
-
setConnection
Description copied from interface:TaskanaEngineSet theConnectionto be used by TASKANA in mode EXPLICIT. If this API is called, TASKANA uses theConnectionpassed by the client for all subsequent API calls until the client resets thisConnection. Control over commit and rollback of theConnectionis the responsibility of the client. In order to close theConnection,closeConnection()orsetConnection(null)has to be called.- Specified by:
setConnectionin interfaceTaskanaEngine- Parameters:
connection- - Thejava.sql.Connectionthat is controlled by the client- Throws:
SQLException- if a database access error occurs
-
getPriorityServiceManager
-
getJobService
Description copied from interface:TaskanaEngineReturns a JobService initialized with the current TaskanaEngine. The JobService can be used for all operations on TaskanaJobs.- Specified by:
getJobServicein interfaceTaskanaEngine- Returns:
- an instance of JobService
-
getUserService
Description copied from interface:TaskanaEngineReturns a UserService initialized with the current TaskanaEngine. The UserService can be used for all operations on Users.- Specified by:
getUserServicein interfaceTaskanaEngine- Returns:
- an instance of UserService
-
getJobScheduler
-
getConfiguration
Description copied from interface:TaskanaEngineReturns the configuration of the TaskanaEngine.- Specified by:
getConfigurationin interfaceTaskanaEngine- Returns:
- configuration
-
getWorkingTimeCalculator
Description copied from interface:TaskanaEngineReturns the WorkingTimeCalculator of the TaskanaEngine. The WorkingTimeCalculator is used to add or subtract working time from Instants according to a working time schedule or to calculate the working time between Instants.- Specified by:
getWorkingTimeCalculatorin interfaceTaskanaEngine- Returns:
- WorkingTimeCalculatorImpl
-
isHistoryEnabled
public boolean isHistoryEnabled()Description copied from interface:TaskanaEngineChecks if the TaskanaHistory plugin is enabled.- Specified by:
isHistoryEnabledin interfaceTaskanaEngine- Returns:
- true if the history is enabled; otherwise false
-
getConnectionManagementMode
Description copied from interface:TaskanaEngineReturns the ConnectionManagementMode of the TaskanaEngine.- Specified by:
getConnectionManagementModein interfaceTaskanaEngine- Returns:
- ConnectionManagementMode
-
setConnectionManagementMode
Description copied from interface:TaskanaEngineSets ConnectionManagementMode of the TaskanaEngine.- Specified by:
setConnectionManagementModein interfaceTaskanaEngine- Parameters:
mode- the valid values for the TaskanaEngine.ConnectionManagementMode are:- PARTICIPATE - taskana participates in global transaction; this is the default mode
- AUTOCOMMIT - taskana commits each API call separately
- EXPLICIT - commit processing is managed explicitly by the client
-
closeConnection
public void closeConnection()Description copied from interface:TaskanaEngineCloses the client's connection, sets it to null and switches to mode PARTICIPATE. Only applicable in mode EXPLICIT. Has the same effect assetConnection(null).- Specified by:
closeConnectionin interfaceTaskanaEngine
-
isUserInRole
Description copied from interface:TaskanaEngineCheck whether the current user is member of one of the TaskanaRoles specified.- Specified by:
isUserInRolein interfaceTaskanaEngine- Parameters:
roles- The TaskanaRoles that are checked for membership of the current user- Returns:
- true if the current user is a member of at least one of the specified TaskanaRole
-
checkRoleMembership
Description copied from interface:TaskanaEngineChecks whether current user is member of any of the specified TaskanaRoles.- Specified by:
checkRoleMembershipin interfaceTaskanaEngine- Parameters:
roles- The TaskanaRoles that are checked for membership of the current user- Throws:
NotAuthorizedException- If the current user is not member of any specified TaskanaRole
-
runAsAdmin
Description copied from interface:TaskanaEngineExecutes a givenSupplierwith admin privileges and thus skips further permission checks. With great power comes great responsibility.- Specified by:
runAsAdminin interfaceTaskanaEngine- Type Parameters:
T- defined with the return value of theSupplier- Parameters:
supplier- will be executed with admin privileges- Returns:
- output from
Supplier
-
getCurrentUserContext
public pro.taskana.common.api.security.CurrentUserContext getCurrentUserContext()Description copied from interface:TaskanaEngineReturns the CurrentUserContext of the TaskanaEngine.- Specified by:
getCurrentUserContextin interfaceTaskanaEngine- Returns:
- CurrentUserContext
-
createSqlSessionManager
protected org.apache.ibatis.session.SqlSessionManager createSqlSessionManager()This method creates the sqlSessionManager of myBatis. It integrates all the SQL mappers and sets the databaseId attribute.- Returns:
- a SqlSessionFactory
- Throws:
SystemException- when a connection to the database could not be opened.
-