Class HandlerHelper
- java.lang.Object
-
- org.odpi.openmetadata.accessservices.assetlineage.handlers.HandlerHelper
-
public class HandlerHelper extends Object
The common handler provide common methods that is generic and reusable for other handlers.
-
-
Constructor Summary
Constructors Constructor Description HandlerHelper(InvalidParameterHandler invalidParameterHandler, OMRSRepositoryHelper repositoryHelper, RepositoryHandler repositoryHandler, Converter converter, Set<String> lineageClassificationTypes)Construct the handler information needed to interact with the repository services
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected EntityDetailaddContextForRelationships(String userId, EntityDetail startEntity, String relationshipTypeName, Set<GraphContext> context)Adds the relationships context for an entity, based on the relationship type.RelationshipsContextbuildContextForLineageClassifications(EntityDetail entityDetail)Builds the classification context for an entityRelationshipsContextbuildContextForRelationships(String userId, String entityGUID, List<Relationship> relationships)Builds the relationships context for an entityOptional<List<EntityDetail>>findEntitiesByType(String userId, String entityTypeName, SearchProperties searchProperties, FindEntitiesParameters findEntitiesParameters)Retrieves a list of entities based on the search criteria passedEntityDetailgetEntityDetails(String userId, String entityDetailGUID, String entityTypeName)Fetch the entity using the identifier and the type nameLineageEntitygetLineageEntity(EntityDetail entityDetail)Return the entity detail in open lineage formatSearchPropertiesgetSearchPropertiesAfterUpdateTime(Long time)Creat the search body for find entities searching entities updated after the given timebooleanisDataStore(String serviceName, EntityDetail entityDetail)Verifies if the entity is of type DataStore or subtypebooleanisTable(String serviceName, EntityDetail entityDetail)Verifies if the entity is of type RelationalTable or subtypebooleanisTableOrDataStore(String serviceName, EntityDetail entityDetail)Verifies if the entity is of type RelationalTable, DataStore or subtypebooleanisTabularColumn(String serviceName, String typeName)Verifies if the entity is of type TabularColumn or subtypevoidvalidateAsset(EntityDetail entityDetail, String methodName, List<String> supportedZones)Validate asset's GUID and it being in the specific supported zones.
-
-
-
Constructor Detail
-
HandlerHelper
public HandlerHelper(InvalidParameterHandler invalidParameterHandler, OMRSRepositoryHelper repositoryHelper, RepositoryHandler repositoryHandler, Converter converter, Set<String> lineageClassificationTypes)
Construct the handler information needed to interact with the repository services- Parameters:
invalidParameterHandler- handler for invalid parametersrepositoryHelper- helper used by the convertersrepositoryHandler- handler for calling the repository services
-
-
Method Detail
-
getEntityDetails
public EntityDetail getEntityDetails(String userId, String entityDetailGUID, String entityTypeName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
Fetch the entity using the identifier and the type name- Parameters:
userId- the user identifierentityDetailGUID- the entity identifierentityTypeName- the entity type name- Returns:
- the entity
- Throws:
InvalidParameterException- one of the parameters is null or invalid.UserNotAuthorizedException- user not authorized to issue this request.PropertyServerException- problem retrieving the entity.
-
findEntitiesByType
public Optional<List<EntityDetail>> findEntitiesByType(String userId, String entityTypeName, SearchProperties searchProperties, FindEntitiesParameters findEntitiesParameters) throws UserNotAuthorizedException, PropertyServerException
Retrieves a list of entities based on the search criteria passed- Parameters:
userId- the user identityTypeName- the name of the entity typesearchProperties- searchProperties used in the filteringfindEntitiesParameters- filtering used to reduce the scope of the search- Returns:
- Optional container for collection of EntityDetails (if any) matching the supplied parameters.
- Throws:
UserNotAuthorizedException- the user is not authorized to make this request.PropertyServerException- something went wrong with the REST call stack.
-
getSearchPropertiesAfterUpdateTime
public SearchProperties getSearchPropertiesAfterUpdateTime(Long time)
Creat 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
-
buildContextForRelationships
public RelationshipsContext buildContextForRelationships(String userId, String entityGUID, List<Relationship> relationships) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException
Builds the relationships context for an entity- Parameters:
userId- the unique identifier for the userentityGUID- the guid of the entityrelationships- the list of relationships for which the context is built- Returns:
- a set of
GraphContextcontaining the lineage context for the relationships - Throws:
InvalidParameterException- the invalid parameter exceptionPropertyServerException- the property server exceptionUserNotAuthorizedException- the user not authorized exception
-
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
GraphContextcontaining 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 userstartEntity- the start entity for the relationshipsrelationshipTypeName- the type of the relationship for which the context is builtcontext- 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 detailmethodName- the method namesupportedZones- 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
-
isTableOrDataStore
public boolean isTableOrDataStore(String serviceName, EntityDetail entityDetail)
Verifies if the entity is of type RelationalTable, DataStore or subtype- Parameters:
serviceName- the service nameentityDetail- the entity detail- Returns:
- true if the entity is of type RelationalTable, Asset or subtype, false otherwise
-
isDataStore
public boolean isDataStore(String serviceName, EntityDetail entityDetail)
Verifies if the entity is of type DataStore or subtype- Parameters:
serviceName- the service nameentityDetail- 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 nameentityDetail- the entity detail- Returns:
- true if the entity is of type RelationalTable or subtype, false otherwise
-
-