Class HandlerHelper


  • public class HandlerHelper
    extends Object
    The common handler provide common methods that is generic and reusable for other handlers.
    • Constructor Detail

      • HandlerHelper

        public HandlerHelper​(InvalidParameterHandler invalidParameterHandler,
                             OMRSRepositoryHelper repositoryHelper,
                             OpenMetadataAPIGenericHandler<GenericStub> genericHandler,
                             Converter converter,
                             AssetLineageTypesValidator assetLineageTypesValidator,
                             ClockService clockService)
        Construct the handler information needed to interact with the repository services
        Parameters:
        invalidParameterHandler - handler for invalid parameters
        repositoryHelper - helper used by the converters
        genericHandler - handler for calling the repository services
        converter - converter used for creating entities in Open Lineage format
        assetLineageTypesValidator - service for validating types
        clockService - clock service
    • Method Detail

      • getSearchPropertiesAfterUpdateTime

        public SearchProperties getSearchPropertiesAfterUpdateTime​(Long time)
        Create the search body for find entities searching entities updated after the given time
        Parameters:
        time - date in milliseconds after which the entities were updated
        Returns:
        the search properties having the condition updateTime greater than the provided time
      • buildContextForLineageClassifications

        public RelationshipsContext buildContextForLineageClassifications​(EntityDetail entityDetail)
        Builds the classification context for an entity
        Parameters:
        entityDetail - the entity for retrieving the classifications attached to it
        Returns:
        a set of GraphContext containing the lineage context for the classifications
      • addContextForRelationships

        protected EntityDetail addContextForRelationships​(String userId,
                                                          EntityDetail startEntity,
                                                          String relationshipTypeName,
                                                          Set<GraphContext> context)
                                                   throws OCFCheckedExceptionBase
        Adds the relationships context for an entity, based on the relationship type.
        Parameters:
        userId - the unique identifier for the user
        startEntity - the start entity for the relationships
        relationshipTypeName - the type of the relationship for which the context is built
        context - the context to be updated
        Throws:
        OCFCheckedExceptionBase - checked exception for reporting errors found when using OCF connectors
      • validateAsset

        public void validateAsset​(EntityDetail entityDetail,
                                  String methodName,
                                  List<String> supportedZones)
                           throws InvalidParameterException
        Validate asset's GUID and it being in the specific supported zones.
        Parameters:
        entityDetail - the entity detail
        methodName - the method name
        supportedZones - the supported zones
        Throws:
        InvalidParameterException - the invalid parameter exception
      • getLineageEntity

        public LineageEntity getLineageEntity​(EntityDetail entityDetail)
        Return the entity detail in open lineage format
        Parameters:
        entityDetail - the entity detail
        Returns:
        the entity detail in open lineage format
      • isDataStore

        public boolean isDataStore​(String serviceName,
                                   EntityDetail entityDetail)
        Verifies if the entity is of type DataStore or subtype
        Parameters:
        serviceName - the service name
        entityDetail - the entity detail
        Returns:
        true if the entity is of type Asset or subtype, false otherwise
      • isTable

        public boolean isTable​(String serviceName,
                               EntityDetail entityDetail)
        Verifies if the entity is of type RelationalTable or subtype
        Parameters:
        serviceName - the service name
        entityDetail - the entity detail
        Returns:
        true if the entity is of type RelationalTable or subtype, false otherwise
      • isSchemaAttribute

        public boolean isSchemaAttribute​(String serviceName,
                                         String typeName)
        Verifies if the entity is of type SchemaAttribute or subtype
        Parameters:
        serviceName - the service name
        typeName - type of the entity
        Returns:
        true if the entity is of type TabularColumn or subtype, false otherwise
      • isTopic

        public boolean isTopic​(String serviceName,
                               EntityDetail entityDetail)
        Verifies if the entity is of type Topic or subtype
        Parameters:
        serviceName - the service name
        entityDetail - the entity detail
        Returns:
        true if the entity is of type RelationalTable or subtype, false otherwise