Interface DataSourceService

    • Method Detail

      • getTemplate

        Template getTemplate()
        Returns:
        the Template used to render the data source
      • getDataSourceProperties

        List<DataSourceProperty> getDataSourceProperties​(Map<String,​Object> parameters)
        Create the properties used in the template.
        Parameters:
        parameters - parameters used for this request
        Returns:
        the list of DataSourceProperty instances to use in the template
      • fetch

        String fetch​(Map<String,​String> parameters)
        Execute a query request and return the result as a json string.
        Parameters:
        parameters - the parameters often coming from the HTTP request
        Returns:
        the json result string
      • remove

        String remove​(Map<String,​String> parameters)
        Execute a delete action. The id of the deleted record is present in the parameters.
        Parameters:
        parameters - the parameters often coming from the HTTP request
        Returns:
        the result message as a json string
      • add

        String add​(Map<String,​String> parameters,
                   String content)
        Execute an insert action.
        Parameters:
        parameters - the parameters often coming from the HTTP request
        content - , the request content, is assumed to be a json string
        Returns:
        the result message as a json string
      • update

        String update​(Map<String,​String> parameters,
                      String content)
        Execute an update action.
        Parameters:
        parameters - the parameters often coming from the HTTP request
        content - , the request content, is assumed to be a json string
        Returns:
        the result message as a json string
      • getName

        String getName()
        The name of this service, in the default implementation this is the entityname of the Entity to get/insert/update/delete.
        Returns:
        the name of the service
      • setName

        void setName​(String name)
      • getDataUrl

        String getDataUrl()
      • setDataUrl

        void setDataUrl​(String dataUrl)
      • getEntity

        Entity getEntity()
      • setEntity

        void setEntity​(Entity entity)
      • checkFetchDatasourceAccess

        void checkFetchDatasourceAccess​(Map<String,​String> parameter)
                                 throws OBSecurityException
        This method allows to implement a security access to a DataSource when it is used fetch() method. It can be overridden in specific DataSources to apply a particular security mechanism.
        Throws:
        OBSecurityException - is thrown if current role does not have access.
      • checkEditDatasourceAccess

        void checkEditDatasourceAccess​(Map<String,​String> parameter)
                                throws OBSecurityException
        This method allows to implement a security access to a DataSource when it is used add(), update() or remove() methods. It can be overridden in specific DataSources to apply a particular security mechanism.
        Throws:
        OBSecurityException - is thrown if current role does not have access.
      • getWhereClause

        String getWhereClause()
      • setWhereClause

        void setWhereClause​(String whereClause)
      • getDataSource

        DataSource getDataSource()
        This method allows to implement a security access to a DataSource when it is used add(), update() or remove() methods. It can be overridden in specific DataSources to apply a particular security mechanism.
        Returns:
        the data source read from the database. Note: can be null for data sources which are created in-memory on request.
      • setDataSource

        void setDataSource​(DataSource dataSource)
        Passes in the data source read from the database. Is the place to initialize the data in the service class
        Parameters:
        dataSource - the data source read from the database.