Interface DFRelationDataProvider

    • Method Detail

      • getLockable

        com.im.commons.progress.DFLockable getLockable()
      • getSchemaDataProvider

        DFSchemaDataProvider getSchemaDataProvider()
        Returns:
        The parent SchemaDataProvider
      • getRelationshipDir

        DFRelationship.Direction getRelationshipDir()
        Returns:
        The relationship direction the provider operates with
      • getRelatedIds

        java.util.List<? extends java.lang.Comparable<?>> getRelatedIds​(java.lang.Comparable<?> masterId,
                                                                        DFTermExpression filter,
                                                                        SortDirective sort)
        Retrieves a mapping from 'masterIds' of the DFRelationship.Direction.getSrcField() to their counterparts according to the relation.

        The returned IDs will respect the 'sort' SortDirective applied to the results from the destination field's entity.

        The method returns a Map keyed by "source" row IDs. Values are lists ordered according to the SortDirective that contain row IDs from the related entity.

        Parameters:
        masterId - field id from parent entity
        filter - is not implemented, just use null
        sort - sorting result
        Returns:
        The map from entity IDs to their related counterparts
      • addRelation

        void addRelation​(java.lang.Comparable<?> idMaster,
                         java.util.Set<? extends java.lang.Comparable<?>> idDetail,
                         com.im.commons.progress.DFEnvironmentRW env)
                  throws DFRelationDataException
        Establishes or changes relations between existing entities. Sets a relation between the 'idMaster' row and 'idDetail' rows.

        Note, however, that although the method is coded as it permits to associate multiple detail entities to the master, the actual DFRelationship.Direction.getType() may restrict the operation. For *_TO_ONE relationship types, the 'idDetail' must contain exactly one item.

        You may consider to use the DFRelationship provider for the 'one' side of the relationship to associate multiple items.

        Throws:
        DFRelationDataException
      • removeRelation

        void removeRelation​(java.lang.Comparable<?> idMaster,
                            java.util.Set<? extends java.lang.Comparable<?>> removeIDs,
                            com.im.commons.progress.DFEnvironmentRW env)
                     throws DFRelationDataException
        Breaks relations between 'idMaster' row in the master entity and 'removeIDs' rows of the detail entity. The meaning of 'master' changes with relationship type:

        Note, however, that although the method is coded as it permits to associate multiple detail entities to the master, the actual DFRelationship.Direction.getType() may restrict the operation. For *_TO_ONE relationship types, the 'idDetail' must contain exactly one item.

        You may consider to use the DFRelationship provider for the 'one' side of the relationship to break association to multiple items at once.

        Note that if the field that binds the relationship in the 'detail' entity is 'required', the method will throw a DFRelationDataException, informing you which field cannot be reset.

        Parameters:
        idMaster - The r ow ID in the "source" entity
        removeIDs - The r ow IDs in the "destination" entity
        env - The DFEnvironment.
        Throws:
        DFRelationDataException