Interface KadaiEngine

All Known Implementing Classes:
KadaiEngineImpl

public interface KadaiEngine
The KadaiEngine represents an overall set of all needed services.
  • Field Details

  • Method Details

    • buildKadaiEngine

      static KadaiEngine buildKadaiEngine(KadaiConfiguration configuration) throws SQLException
      Throws:
      SQLException
      See Also:
    • buildKadaiEngine

      static KadaiEngine buildKadaiEngine(KadaiConfiguration configuration, KadaiEngine.ConnectionManagementMode connectionManagementMode) throws SQLException
      Builds an KadaiEngine based on KadaiConfiguration and SqlConnectionMode.
      Parameters:
      configuration - complete kadaiConfig to build the engine
      connectionManagementMode - connectionMode for the SqlSession
      Returns:
      a KadaiEngineImpl
      Throws:
      SQLException - when the db schema could not be initialized
    • buildKadaiEngine

      static KadaiEngine buildKadaiEngine(KadaiConfiguration configuration, KadaiEngine.ConnectionManagementMode connectionManagementMode, org.apache.ibatis.transaction.TransactionFactory transactionFactory) throws SQLException
      Builds an KadaiEngine based on KadaiConfiguration, SqlConnectionMode and TransactionFactory.
      Parameters:
      configuration - complete kadaiConfig to build the engine
      connectionManagementMode - connectionMode for the SqlSession
      transactionFactory - the TransactionFactory
      Returns:
      a KadaiEngineImpl
      Throws:
      SQLException - when the db schema could not be initialized
    • getTaskService

      TaskService getTaskService()
      Returns a TaskService initialized with the current KadaiEngine. TaskService can be used for operations on all Tasks.
      Returns:
      an instance of TaskService
    • getMonitorService

      MonitorService getMonitorService()
      Returns a MonitorService initialized with the current KadaiEngine. MonitorService can be used for monitoring Tasks.
      Returns:
      an instance of MonitorService
    • getWorkbasketService

      WorkbasketService getWorkbasketService()
      Returns a WorkbasketService initialized with the current KadaiEngine. 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 KadaiEngine. 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 KadaiEngine. The JobService can be used for all operations on KadaiJobs.
      Returns:
      an instance of JobService
    • getUserService

      UserService getUserService()
      Returns a UserService initialized with the current KadaiEngine. 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 KadaiEngine. The ConfigurationService can be used to manage custom configuration options.
      Returns:
      an instance of ConfigurationService
    • getConfiguration

      KadaiConfiguration getConfiguration()
      Returns the configuration of the KadaiEngine.
      Returns:
      configuration
    • getWorkingTimeCalculator

      io.kadai.common.api.WorkingTimeCalculator getWorkingTimeCalculator()
      Returns the WorkingTimeCalculator of the KadaiEngine. 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 KadaiHistory plugin is enabled.
      Returns:
      true if the history is enabled; otherwise false
    • getConnectionManagementMode

      KadaiEngine.ConnectionManagementMode getConnectionManagementMode()
      Returns the ConnectionManagementMode of the KadaiEngine.
      Returns:
      ConnectionManagementMode
    • setConnectionManagementMode

      void setConnectionManagementMode(KadaiEngine.ConnectionManagementMode mode)
      Sets ConnectionManagementMode of the KadaiEngine.
      Parameters:
      mode - the valid values for the KadaiEngine.ConnectionManagementMode are:
      • PARTICIPATE - kadai participates in global transaction; this is the default mode
      • AUTOCOMMIT - kadai 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 KADAI in mode EXPLICIT. If this API is called, KADAI 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(io.kadai.common.api.KadaiRole... roles)
      Check whether the current user is member of one of the KadaiRoles specified.
      Parameters:
      roles - The KadaiRoles 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 KadaiRole
    • checkRoleMembership

      void checkRoleMembership(io.kadai.common.api.KadaiRole... roles) throws io.kadai.common.api.exceptions.NotAuthorizedException
      Checks whether current user is member of any of the specified KadaiRoles.
      Parameters:
      roles - The KadaiRoles that are checked for membership of the current user
      Throws:
      io.kadai.common.api.exceptions.NotAuthorizedException - If the current user is not member of any specified KadaiRole
    • runAsAdmin

      <T> T runAsAdmin(Supplier<T> supplier)
      Executes a given Supplier with admin privileges and thus skips further permission checks. With great power comes great responsibility.
      Type Parameters:
      T - defined with the return value of the Supplier
      Parameters:
      supplier - will be executed with admin privileges
      Returns:
      output from Supplier
    • runAsAdmin

      default void runAsAdmin(Runnable runnable)
      Executes a given Runnable with admin privileges and thus skips further permission checks. With great power comes great responsibility.
      See Also:
    • getCurrentUserContext

      io.kadai.common.api.security.CurrentUserContext getCurrentUserContext()
      Returns the CurrentUserContext of the KadaiEngine.
      Returns:
      CurrentUserContext
    • clearSqlSessionCache

      void clearSqlSessionCache()
      Clears the cache of the underlying local SQL session.