Package pro.taskana.common.api
Interface TaskanaEngine
- All Known Implementing Classes:
TaskanaEngineImpl
public interface TaskanaEngine
The TaskanaEngine represents an overall set of all needed services.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumConnection management mode. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic TaskanaEnginebuildTaskanaEngine(TaskanaConfiguration configuration) This method creates the TaskanaEngine with TaskanaEngine.ConnectionManagementMode.PARTICIPATE.static TaskanaEnginebuildTaskanaEngine(TaskanaConfiguration configuration, TaskanaEngine.ConnectionManagementMode connectionManagementMode) Builds an TaskanaEngine based on TaskanaConfiguration and SqlConnectionMode.static TaskanaEnginebuildTaskanaEngine(TaskanaConfiguration configuration, TaskanaEngine.ConnectionManagementMode connectionManagementMode, org.apache.ibatis.transaction.TransactionFactory transactionFactory) Builds an TaskanaEngine based on TaskanaConfiguration, SqlConnectionMode and TransactionFactory.voidcheckRoleMembership(TaskanaRole... roles) Checks whether current user is member of any of the specified TaskanaRoles.voidClears the cache of the underlying local SQL session.voidCloses the client's connection, sets it to null and switches to mode PARTICIPATE.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.default voidrunAsAdmin(Runnable runnable) Executes a givenRunnablewith admin privileges and thus skips further permission checks.<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.
-
Field Details
-
MINIMAL_TASKANA_SCHEMA_VERSION
- See Also:
-
-
Method Details
-
getTaskService
TaskService getTaskService()Returns a TaskService initialized with the current TaskanaEngine. TaskService can be used for operations on all Tasks.- Returns:
- an instance of TaskService
-
getMonitorService
MonitorService getMonitorService()Returns a MonitorService initialized with the current TaskanaEngine. MonitorService can be used for monitoring Tasks.- Returns:
- an instance of MonitorService
-
getWorkbasketService
WorkbasketService getWorkbasketService()Returns a WorkbasketService initialized with the current TaskanaEngine. The WorkbasketService can be used for operations on all Workbaskets.- Returns:
- an instance of WorkbasketService
-
getClassificationService
ClassificationService getClassificationService()Returns a ClassificationService initialized with the current TaskanaEngine. The ClassificationService can be used for operations on all Classifications.- Returns:
- an instance of ClassificationService
-
getJobService
JobService getJobService()Returns a JobService initialized with the current TaskanaEngine. The JobService can be used for all operations on TaskanaJobs.- Returns:
- an instance of JobService
-
getUserService
UserService getUserService()Returns a UserService initialized with the current TaskanaEngine. The UserService can be used for all operations on Users.- Returns:
- an instance of UserService
-
getConfigurationService
ConfigurationService getConfigurationService()Returns a ConfigurationService initialized with the current TaskanaEngine. The ConfigurationService can be used to manage custom configuration options.- Returns:
- an instance of ConfigurationService
-
getConfiguration
TaskanaConfiguration getConfiguration()Returns the configuration of the TaskanaEngine.- Returns:
- configuration
-
buildTaskanaEngine
This method creates the TaskanaEngine with TaskanaEngine.ConnectionManagementMode.PARTICIPATE. -
buildTaskanaEngine
static TaskanaEngine buildTaskanaEngine(TaskanaConfiguration configuration, TaskanaEngine.ConnectionManagementMode connectionManagementMode) throws SQLException Builds an TaskanaEngine based on TaskanaConfiguration and SqlConnectionMode.- Parameters:
configuration- complete taskanaConfig to build the engineconnectionManagementMode- connectionMode for the SqlSession- Returns:
- a TaskanaEngineImpl
- Throws:
SQLException- when the db schema could not be initialized
-
buildTaskanaEngine
static TaskanaEngine buildTaskanaEngine(TaskanaConfiguration configuration, TaskanaEngine.ConnectionManagementMode connectionManagementMode, org.apache.ibatis.transaction.TransactionFactory transactionFactory) throws SQLException Builds an TaskanaEngine based on TaskanaConfiguration, SqlConnectionMode and TransactionFactory.- Parameters:
configuration- complete taskanaConfig to build the engineconnectionManagementMode- connectionMode for the SqlSessiontransactionFactory- the TransactionFactory- Returns:
- a TaskanaEngineImpl
- Throws:
SQLException- when the db schema could not be initialized
-
getWorkingTimeCalculator
WorkingTimeCalculator getWorkingTimeCalculator()Returns 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.- Returns:
- WorkingTimeCalculatorImpl
-
isHistoryEnabled
boolean isHistoryEnabled()Checks if the TaskanaHistory plugin is enabled.- Returns:
- true if the history is enabled; otherwise false
-
getConnectionManagementMode
TaskanaEngine.ConnectionManagementMode getConnectionManagementMode()Returns the ConnectionManagementMode of the TaskanaEngine.- Returns:
- ConnectionManagementMode
-
setConnectionManagementMode
Sets ConnectionManagementMode of the TaskanaEngine.- 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
-
setConnection
Set 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.- Parameters:
connection- - Thejava.sql.Connectionthat is controlled by the client- Throws:
SQLException- if a database access error occurs
-
closeConnection
void closeConnection()Closes the client's connection, sets it to null and switches to mode PARTICIPATE. Only applicable in mode EXPLICIT. Has the same effect assetConnection(null). -
isUserInRole
Check whether the current user is member of one of the TaskanaRoles specified.- 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
Checks whether current user is member of any of the specified TaskanaRoles.- 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
Executes a givenSupplierwith admin privileges and thus skips further permission checks. With great power comes great responsibility.- Type Parameters:
T- defined with the return value of theSupplier- Parameters:
supplier- will be executed with admin privileges- Returns:
- output from
Supplier
-
runAsAdmin
Executes a givenRunnablewith admin privileges and thus skips further permission checks. With great power comes great responsibility.- See Also:
-
getCurrentUserContext
pro.taskana.common.api.security.CurrentUserContext getCurrentUserContext()Returns the CurrentUserContext of the TaskanaEngine.- Returns:
- CurrentUserContext
-
clearSqlSessionCache
void clearSqlSessionCache()Clears the cache of the underlying local SQL session.
-