Class DataEngineCommonHandler
java.lang.Object
org.odpi.openmetadata.accessservices.dataengine.server.handlers.DataEngineCommonHandler
DataEngineCommonHandler manages objects from the property server. It runs server-side in the DataEngine OMAS
and creates port entities with wire relationships through the OMRSRepositoryConnector.
-
Constructor Summary
ConstructorsConstructorDescriptionDataEngineCommonHandler
(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, OpenMetadataAPIGenericHandler<Referenceable> genericHandler, OMRSRepositoryHelper repositoryHelper, DataEngineRegistrationHandler dataEngineRegistrationHandler, ClockService clockService) Construct the handler information needed to interact with the repository services -
Method Summary
Modifier and TypeMethodDescriptionprotected EntityDetail
buildEntityDetail
(String entityGUID, InstanceProperties instanceProperties) Build an EntityDetail object based on the instance properties on an entity beanprotected Relationship
buildRelationship
(String entityGUID, InstanceProperties instanceProperties) Build an Relationship object based on the instance properties of a relationshipfindEntity
(String userId, String qualifiedName, String entityTypeName) Find out if the entity is already stored in the repository.protected Optional<Relationship>
findRelationship
(String userId, String firstGUID, String secondGUID, String firstEntityTypeName, String secondEntityTypeName, String relationshipTypeName) Find out if the relationship is already stored in the repository.protected Set<EntityDetail>
getEntitiesForRelationship
(String userId, String guid, String relationshipTypeName, String resultingElementTypeName, String entityTypeName) Return the set of entities at the other end of the requested relationship type.getEntityDetails
(String userId, String entityDetailGUID, String entityTypeName) Fetch the entity using the identifier and the type name.protected Optional<EntityDetail>
getEntityForRelationship
(String userId, String entityGUID, String relationshipTypeName, String entityTypeName) Return the entity at the other end of the requested relationship type.protected Date
getNow()
protected int
getOwnerTypeOrdinal
(OwnerType ownerType) Return the owner type ordinalprotected int
getSortOrder
(Attribute column) Return the ordinal for the order that the column is arranged inprotected void
removeEntity
(String userId, String entityGUID, String entityTypeName, String externalSourceName) Remove entityvoid
throwEntityNotDeletedException
(DataEngineErrorCode errorCode, String methodName, String... params) Thrown anEntityNotDeletedException
void
throwInvalidParameterException
(DataEngineErrorCode errorCode, String methodName, String... params) Thrown anInvalidParameterException
protected void
upsertExternalRelationship
(String userId, String firstGUID, String secondGUID, String relationshipTypeName, String firstEntityTypeName, String secondEntityTypeName, String externalSourceName, InstanceProperties relationshipProperties) Create or updates an external relationship between two entities.protected void
validateDeleteSemantic
(DeleteSemantic deleteSemantic, String methodName)
-
Constructor Details
-
DataEngineCommonHandler
public DataEngineCommonHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, OpenMetadataAPIGenericHandler<Referenceable> genericHandler, OMRSRepositoryHelper repositoryHelper, DataEngineRegistrationHandler dataEngineRegistrationHandler, ClockService clockService) Construct the handler information needed to interact with the repository services- Parameters:
serviceName
- name of this serviceserverName
- name of the local serverinvalidParameterHandler
- handler for managing parameter errorsgenericHandler
- manages calls to the repository servicesrepositoryHelper
- provides utilities for manipulating the repository services objectsdataEngineRegistrationHandler
- provides calls for retrieving external data engine guid
-
-
Method Details
-
buildEntityDetail
Build an EntityDetail object based on the instance properties on an entity bean- Parameters:
entityGUID
- unique identifier of entity to updateinstanceProperties
- the properties of the entity- Returns:
- an EntityDetail object containing the entity properties
-
buildRelationship
Build an Relationship object based on the instance properties of a relationship- Parameters:
entityGUID
- unique identifier of entity to updateinstanceProperties
- the properties of the relationship- Returns:
- an Relationship object containing the entity properties
-
findEntity
public Optional<EntityDetail> findEntity(String userId, String qualifiedName, String entityTypeName) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException Find out if the entity is already stored in the repository. It uses the fully qualified name to retrieve the entity- Parameters:
userId
- the name of the calling userqualifiedName
- the qualifiedName name of the entity to be searchedentityTypeName
- the type name of the entity- Returns:
- optional with entity details if found, empty optional if not found
- Throws:
InvalidParameterException
- the bean properties are invalidUserNotAuthorizedException
- user not authorized to issue this requestPropertyServerException
- problem accessing the property server
-
getEntityDetails
public Optional<EntityDetail> getEntityDetails(String userId, String entityDetailGUID, String entityTypeName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Fetch the entity using the identifier and the type name. It uses the unique identifier to retrieve the entity- Parameters:
userId
- the user identifierentityDetailGUID
- the entity unique identifierentityTypeName
- the entity type name- Returns:
- optional with entity details if found, empty optional if not found
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.UserNotAuthorizedException
- user not authorized to issue this request.PropertyServerException
- problem retrieving the entity.
-
upsertExternalRelationship
protected void upsertExternalRelationship(String userId, String firstGUID, String secondGUID, String relationshipTypeName, String firstEntityTypeName, String secondEntityTypeName, String externalSourceName, InstanceProperties relationshipProperties) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Create or updates an external relationship between two entities. Verifies that the relationship is not present before creating it. If the relationship is present, verifies the instanceProperties for the relationship to be updated.- Parameters:
userId
- the name of the calling userfirstGUID
- the unique identifier of the entity at first endsecondGUID
- the unique identifier of the entity at second endrelationshipTypeName
- type name for the relationship to createfirstEntityTypeName
- type name for the entity at first endsecondEntityTypeName
- type name for the entity at the second endexternalSourceName
- the unique name of the external sourcerelationshipProperties
- the properties for the relationship- Throws:
InvalidParameterException
- the bean properties are invalidUserNotAuthorizedException
- user not authorized to issue this requestPropertyServerException
- problem accessing the property server
-
findRelationship
protected Optional<Relationship> findRelationship(String userId, String firstGUID, String secondGUID, String firstEntityTypeName, String secondEntityTypeName, String relationshipTypeName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Find out if the relationship is already stored in the repository. It will search for relationships that have the source firstGUID and target secondGUID- Parameters:
userId
- the name of the calling userfirstGUID
- the unique identifier of the entity at first endsecondGUID
- the unique identifier of the entity at second endfirstEntityTypeName
- type name for the entity at first endsecondEntityTypeName
- type name for the entity at second endrelationshipTypeName
- type name for the relationship to create- Returns:
- The found relationship or an empty Optional
- Throws:
InvalidParameterException
- the bean properties are invalidUserNotAuthorizedException
- user not authorized to issue this requestPropertyServerException
- problem accessing the property server
-
removeEntity
protected void removeEntity(String userId, String entityGUID, String entityTypeName, String externalSourceName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Remove entity- Parameters:
userId
- the name of the calling userentityGUID
- the unique identifier of the port to be removedentityTypeName
- the type name of the entityexternalSourceName
- the external data engine- Throws:
InvalidParameterException
- the bean properties are invalidUserNotAuthorizedException
- user not authorized to issue this requestPropertyServerException
- problem accessing the property server
-
getOwnerTypeOrdinal
Return the owner type ordinal- Parameters:
ownerType
- OwnerType enum- Returns:
- DataItemSortOrder enum ordinal
-
getSortOrder
Return the ordinal for the order that the column is arranged in- Parameters:
column
- the column to- Returns:
- DataItemSortOrder enum ordinal
-
throwInvalidParameterException
public void throwInvalidParameterException(DataEngineErrorCode errorCode, String methodName, String... params) throws InvalidParameterException Thrown anInvalidParameterException
- Parameters:
errorCode
- error codemethodName
- calling methodparams
- additional params for error message- Throws:
InvalidParameterException
- Thrown anInvalidParameterException
with specific error code and message
-
throwEntityNotDeletedException
public void throwEntityNotDeletedException(DataEngineErrorCode errorCode, String methodName, String... params) throws EntityNotDeletedException Thrown anEntityNotDeletedException
- Parameters:
errorCode
- error codemethodName
- calling methodparams
- additional params for error message- Throws:
EntityNotDeletedException
- Thrown anEntityNotDeletedException
with specific error code and message
-
getEntitiesForRelationship
protected Set<EntityDetail> getEntitiesForRelationship(String userId, String guid, String relationshipTypeName, String resultingElementTypeName, String entityTypeName) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException Return the set of entities at the other end of the requested relationship type.- Parameters:
userId
- the name of the calling userguid
- starting entity's GUIDrelationshipTypeName
- type name for the relationship to followresultingElementTypeName
- resulting entity's type nameentityTypeName
- starting entity's type name- Returns:
- retrieved entities or empty set
- Throws:
InvalidParameterException
- the bean properties are invalidUserNotAuthorizedException
- user not authorized to issue this requestPropertyServerException
- problem accessing the property server
-
getEntityForRelationship
protected Optional<EntityDetail> getEntityForRelationship(String userId, String entityGUID, String relationshipTypeName, String entityTypeName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Return the entity at the other end of the requested relationship type.- Parameters:
userId
- the name of the calling userentityGUID
- the unique identifier of the starting entityrelationshipTypeName
- the relationship type nameentityTypeName
- the entity of the starting end type name- Returns:
- optional with entity details if found, empty optional if not found
- Throws:
InvalidParameterException
- the bean properties are invalidUserNotAuthorizedException
- user not authorized to issue this requestPropertyServerException
- problem accessing the property server
-
validateDeleteSemantic
protected void validateDeleteSemantic(DeleteSemantic deleteSemantic, String methodName) throws FunctionNotSupportedException - Throws:
FunctionNotSupportedException
-
getNow
- Returns:
- current date and time
-