Package pro.taskana.common.api
Interface TaskanaEngine
-
- All Known Implementing Classes:
TaskanaEngineImpl
public interface TaskanaEngineThe TaskanaEngine represents an overall set of all needed services.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTaskanaEngine.ConnectionManagementModeConnection management mode.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcheckRoleMembership(TaskanaRole... roles)Checks whether current user is member of any of the specified roles.voidcloseConnection()Closes the client's connection, sets it to null and switches to mode PARTICIPATE.ClassificationServicegetClassificationService()The ClassificationService can be used for operations on all Categories.TaskanaEngineConfigurationgetConfiguration()The Taskana configuration.pro.taskana.common.api.security.CurrentUserContextgetCurrentUserContext()Returns the CurrentUserContext class.JobServicegetJobService()The JobService can be user for all job operations.MonitorServicegetMonitorService()The MonitorService can be used for monitoring Tasks.TaskServicegetTaskService()The TaskService can be used for operations on all Tasks.WorkbasketServicegetWorkbasketService()The WorkbasketService can be used for operations on all Workbaskets.WorkingDaysToDaysConvertergetWorkingDaysToDaysConverter()The WorkingDaysToDaysConverter used to compute holidays.booleanisHistoryEnabled()Checks if the history plugin is enabled.booleanisUserInRole(TaskanaRole... roles)check whether the current user is member of one of the roles specified.<T> TrunAsAdmin(Supplier<T> supplier)This method is supposed to skip further permission checks if we are already in a secured environment.voidsetConnection(Connection connection)Set the connection to be used by taskana in mode CONNECTION_MANAGED_EXTERNALLY.voidsetConnectionManagementMode(TaskanaEngine.ConnectionManagementMode mode)sets the connection management mode.
-
-
-
Method Detail
-
getTaskService
TaskService getTaskService()
The TaskService can be used for operations on all Tasks.- Returns:
- the TaskService
-
getMonitorService
MonitorService getMonitorService()
The MonitorService can be used for monitoring Tasks.- Returns:
- the MonitorService
-
getWorkbasketService
WorkbasketService getWorkbasketService()
The WorkbasketService can be used for operations on all Workbaskets.- Returns:
- the WorbasketService
-
getClassificationService
ClassificationService getClassificationService()
The ClassificationService can be used for operations on all Categories.- Returns:
- the ClassificationService
-
getJobService
JobService getJobService()
The JobService can be user for all job operations.- Returns:
- the JobService
-
getConfiguration
TaskanaEngineConfiguration getConfiguration()
The Taskana configuration.- Returns:
- the TaskanaConfiguration
-
getWorkingDaysToDaysConverter
WorkingDaysToDaysConverter getWorkingDaysToDaysConverter()
The WorkingDaysToDaysConverter used to compute holidays.- Returns:
- the converter
-
isHistoryEnabled
boolean isHistoryEnabled()
Checks if the history plugin is enabled.- Returns:
- true if the history is enabled. Otherwise false.
-
setConnectionManagementMode
void setConnectionManagementMode(TaskanaEngine.ConnectionManagementMode mode)
sets the connection management mode.- Parameters:
mode- the connection management mode Valid values 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
void setConnection(Connection connection) throws SQLException
Set the connection to be used by taskana in mode CONNECTION_MANAGED_EXTERNALLY. If this Api is called, taskana uses the connection passed by the client for all subsequent API calls until the client resets this connection. Control over commit and rollback of the connection is the responsibility of the client. In order to close the connection, closeConnection() or setConnection(null) has to be called.- Parameters:
connection- - The java.sql.Connection that 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 as setConnection(null).
-
isUserInRole
boolean isUserInRole(TaskanaRole... roles)
check whether the current user is member of one of the roles specified.- Parameters:
roles- The roles 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 groups
-
checkRoleMembership
void checkRoleMembership(TaskanaRole... roles) throws NotAuthorizedException
Checks whether current user is member of any of the specified roles.- Parameters:
roles- The roles that are checked for membership of the current user- Throws:
NotAuthorizedException- If the current user is not member of any specified role
-
runAsAdmin
<T> T runAsAdmin(Supplier<T> supplier)
This method is supposed to skip further permission checks if we are already in a secured environment. With great power comes great responsibility.- Type Parameters:
T- defined with the supplier return value- Parameters:
supplier- will be executed with admin privileges- Returns:
- output from supplier
-
getCurrentUserContext
pro.taskana.common.api.security.CurrentUserContext getCurrentUserContext()
Returns the CurrentUserContext class.- Returns:
- the CurrentUserContext
-
-