Interface DFSchemaDataProvider


  • public interface DFSchemaDataProvider
    The root object for providing data in DIF. Using this object you can get to data providers for entities and for relationships. This class is also used for creating new DFResultSets.
    • Field Detail

      • XATTR_TURN_INIT_LOAD

        static final java.lang.String XATTR_TURN_INIT_LOAD
        Property in schema schema for turning of initial data loading.
        See Also:
        Constant Field Values
    • Method Detail

      • getSchema

        DFSchema getSchema()
        Returns:
        the schema which this data provider belongs to
      • getEntityDataProvider

        DFEntityDataProvider getEntityDataProvider​(DFEntity entity)
        Parameters:
        entity - whose data we want to manipulate
        Returns:
        the EDP (entity data provider) for the specified entity.
      • getDataTreeDataProvider

        DFDataTreeDataProvider getDataTreeDataProvider​(DFDataTree dataTree)
        Gets DFDataTreeDataProvider for the specific data tree. This can be used for editing multiple rows in once or to performing update of relational data in the data tree.
        Parameters:
        dataTree - The data tree.
        Returns:
        The data provider.
        Since:
        15.7.27
      • getDefaultResultSet

        DFResultSet getDefaultResultSet​(DFDataTree dataTree,
                                        boolean showAll,
                                        com.im.commons.progress.DFEnvironmentRO env)
        Gets the DFResultSet for the given DFDataTree.

        Note: The default in the name of this method has historical reasons and should be ignored. Better name would be just getResultSet.

        Parameters:
        dataTree - The data tree
        showAll - If true result set will contain all IDs of the master entity, if false it will contain no rows. Important: This parameter has only reason when new result set is created during this call. If someone else has called this method for the same DFDataTree before it has no effect.
      • insert

        DFUpdateInfo insert​(DFInsertDescription data,
                            com.im.commons.progress.DFEnvironmentRO env)
        Inserts complex data into one or more entities. It is possible to specify values for different entities connected by relationships in order to satisfy integrity constraints.

        For simple insertions, use the DFEntityDataProvider. See DFInsertDescription documentation for more details

        Parameters:
        data - The instructions what to insert
        env - The environment
        Returns:
        information about the update
      • queryForIds

        java.util.List<? extends java.lang.Comparable<?>> queryForIds​(DFDataTree dataTree,
                                                                      DFTermExpression query,
                                                                      SortDirective sort,
                                                                      EarlyResultsConsumer consumer,
                                                                      com.im.commons.progress.DFEnvironmentRO env)
        Gets the IDs (primary key values) of the root entity of the provided data tree that matches the specified query.

        Some types of queries support reading of partials results (IDs) before the query is entirely processed. See the allied method for more details.

        Parameters:
        dataTree - The DFDataTree that allows the different fields to be resolved to formulate the query
        query - The query Elements can be from other entities in the DFDataTree, for empty query use DFTermExpression.ALL_DATA constant.
        sort - The sort directives
        consumer - Early results consumer provided by caller used by query engine to call back partial results. If it's null then no partial results are reported back.
        env - environment for reading data
        Returns:
        The values of the ID field of the entity that match the query
      • queryForIds

        java.util.List<? extends java.lang.Comparable<?>> queryForIds​(DFEntity entity,
                                                                      DFDataTree dataTree,
                                                                      DFTermExpression query,
                                                                      SortDirective sort,
                                                                      EarlyResultsConsumer consumer,
                                                                      com.im.commons.progress.DFEnvironmentRO env)
        Gets the IDs (primary key values) of the provided entity that matches the specified query.

        Some types of queries support reading of partials results (IDs) before the query is entirely processed. In such cases, an instance of EarlyResultsConsumer can be provided, which allows reading of partial results during a query execution. If query execution engine is unable to provide partial results for the given query, then the EarlyResultsConsumer.addNewResult(java.lang.Comparable<?>) is never called. Which types of queries support partial results is an implementation detail. Thus API client cannot rely on the early results functionality which serves as an optimization technique only.

        All query terms must be from the same data tree.

        Parameters:
        entity - the entity to be taken as root
        dataTree - The data tree that allows the different fields to be resolved to formulate the query
        query - The query Elements can be from other entities in the datatree, for empty query use DFTermExpression.ALL_DATA constant.
        sort - The sort directives
        consumer - Early results consumer provided by caller used by query engine to call back partial results. If it's null then no partial results are reported back.
        env - environment for reading data
        Returns:
        The values of the ID field of the entity that match the query
        Since:
        15.12.14 throws QueryExecutionException when there is something wrong with data retrieval. Before that such problems were only logged and swallowed.
      • queryForData

        @Deprecated
        com.google.common.collect.Table<java.lang.Comparable<?>,​java.lang.String,​java.lang.Object> queryForData​(DFDataTree.Vertex masterVertex,
                                                                                                                            java.util.List<? extends DFField> fields,
                                                                                                                            java.util.List<? extends java.lang.Comparable<?>> rowIds)
        Fetches fields values in records identified by rowIds. The masterVertex's entity ID field is queried for the rowIds to determine the records. The fields can belong to any entity that is reachable by 1:1 or N:1 relationship from the masterVertex's entity (transitively) and that belongs to the same datatree. Please note that the masterVertex can be any vertex within a datatree and not necessarily the datatree's root vertex.
        Parameters:
        masterVertex - The DFDataTree.Vertex to query for records. The rowIds are applied against its ID field.
        fields - The list of fields for which data are fetched.
        rowIds - The values of masterVertex's ID field. These IDs effectively determine what rows are fetched.
        Returns:
        The data table -- ordered pair of keys (row id, field id) mapped to a field value.
        Since:
        6.4
      • queryForData

        com.chemaxon.ijc.commons.datarequest.api.RelationalData queryForData​(DFDataTree.Vertex masterVertex,
                                                                             java.util.List<? extends java.lang.Comparable<?>> masterRowIds,
                                                                             java.util.List<? extends DFField> fields,
                                                                             com.im.commons.progress.DFEnvironmentRO env)
        Fetches fields values identified by rowIds. The masterVertex's entity ID field is queried for the rowIds to determine the records. The fields can belong to any entity that is reachable by 1:1 or N:1 relationship from the masterVertex's entity (transitively) and that belongs to the same datatree. Please note that the masterVertex can be any vertex within a datatree and not necessarily the datatree's root vertex.
        Parameters:
        masterVertex - The DFDataTree.Vertex to query for records. The rowIds are applied against its ID field.
        fields - The list of fields for which data are fetched.
        masterRowIds - The values of masterVertex's ID field. These IDs effectively determine what rows are fetched.
        env - environment used for progress reporting and cancelling the data fetching. Cancellation policy is up to the individual implementations.
        Returns:
        data for all requested fields
        Since:
        16.7.11