Interface DataSourceService


public interface DataSourceService
Author:
RafaƂ Nowacki 2017-10-27
  • Method Details

    • getDataSource

      DataSourceInstance getDataSource(String declarationId)
      Returns data source implementation.
      Parameters:
      declarationId -
    • addDeclaration

      void addDeclaration(DataSourceDeclaration declaration)
      Add declaration to database.
      Parameters:
      declaration -
      Throws:
      DataSourceValidateException
    • updateDeclaration

      void updateDeclaration(DataSourceDeclaration declaration)
      Update existing declaration in database.
      Parameters:
      declaration - Data source declaration id
      Throws:
      DataSourceValidateException
    • removeDeclaration

      void removeDeclaration(DataSourceDeclaration declaration)
      Remove existing declaration from database.
      Parameters:
      declaration -
    • getDeclaration

      DataSourceDeclaration getDeclaration(String declarationId)
      Returns declaration from database with given declarationId or null if declaration doesn't exist.
      Parameters:
      declarationId - Declaration id.
    • getDeclarations

      List<DataSourceDeclaration> getDeclarations()
      Returns all declarations from database.
    • getDeclarations

      List<DataSourceDeclaration> getDeclarations(String type)
      Returns all declaration of given type.
      Parameters:
      type - Type of data source.
    • getDeclarations

      List<DataSourceDeclaration> getDeclarations(@Nullable String type, @Nullable DataSourceScope scope)
      Returns declarations of given type that may be used in the given scope. Does not check a user.
      Parameters:
      type - Type of data source or null for every type.
      scope - Scope the declaration may be used in or null when the scope is not checked.
    • getDeclarations

      CountedResult<DataSourceDeclaration> getDeclarations(Pagination pagination)
      Returns all declarations from database.
      Parameters:
      pagination - Data for pagination results
    • getDeclarations

      CountedResult<DataSourceDeclaration> getDeclarations(HibernateFilter filters, Pagination pagination)
      Returns all declarations from database.
      Parameters:
      filters - Filters to restrict results
      pagination - Data for pagination results
    • getDeclarations

      CountedResult<DataSourceDeclaration> getDeclarations(HibernateFilter filters, Pagination pagination, @Nullable DataSourceScope scope)
      Returns declarations matching the filters that may be selected in the given scope. The scope is checked only when the data source permissions feature is enabled. When that feature is enabled, a user who is not an administrator also needs USE. Loading a declaration in order to execute it does not use this method.
      Parameters:
      filters - Filters to restrict results
      pagination - Data for pagination results
      scope - Scope the declaration may be used in or null when the scope is not checked
    • invalidateDatasource

      void invalidateDatasource(String dataSourceType)
      Ivalidates all declarations of datasource with specified type
      Parameters:
      dataSourceType - datasource id
    • getChooserValues

      List<String> getChooserValues(String datasourceId, String outputParameterId, String value)
      Returns distinct string values from the selected output parameter of a data source declaration.
      Parameters:
      datasourceId - Data source declaration id.
      outputParameterId - Output parameter id.
      value - Optional filter value passed to the value input parameter.
    • assertCanExecute

      void assertCanExecute(String dataSourceId)
      Requires the current user to be allowed to execute the data source. Does nothing when UserContext is not active, when the data source permissions feature is off, when the user is an administrator, when the id is blank, when access control is off, or when the declaration is not stored.
      Parameters:
      dataSourceId - Data source declaration id.
      Throws:
      DataSourceAccessDeniedException - when the current user may not execute the data source