Class DataEngineCommonHandler
- java.lang.Object
-
- org.odpi.openmetadata.accessservices.dataengine.server.handlers.DataEngineCommonHandler
-
public class DataEngineCommonHandler extends Object
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
Constructors Constructor Description DataEngineCommonHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, DataEngineRegistrationHandler dataEngineRegistrationHandler)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 EntityDetailbuildEntityDetail(String entityGUID, InstanceProperties instanceProperties)Build an EntityDetail object based on the instance properties on an entity beanprotected RelationshipbuildRelationship(String entityGUID, InstanceProperties instanceProperties)Build an Relationship object based on the instance properties of a relationshipprotected StringcreateExternalEntity(String userId, InstanceProperties instanceProperties, InstanceStatus instanceStatus, String entityTypeName, String externalSourceName)Create a new entity from an external source with the specified instance statusOptional<EntityDetail>findEntity(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 relationshipTypeName)Find out if the relationship is already stored in the repository.protected Set<EntityDetail>getEntitiesForRelationship(String userId, String guid, String relationshipTypeName, String entityTypeName)Return the set of entities at the other end of the requested relationship type.Optional<EntityDetail>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 intgetOwnerTypeOrdinal(OwnerType ownerType)Return the owner type ordinalprotected intgetSortOrder(Attribute column)Return the ordinal for the order that the column is arranged inprotected voidremoveEntity(String userId, String entityGUID, String entityTypeName, String externalSourceName)Remove entityvoidthrowEntityNotDeletedException(DataEngineErrorCode errorCode, String methodName, String... params)voidthrowInvalidParameterException(DataEngineErrorCode errorCode, String methodName, String... params)protected voidupdateEntity(String userId, String entityGUID, InstanceProperties instanceProperties, String entityTypeName, String externalSourceName)Update an existing entityprotected voidupsertExternalRelationship(String userId, String firstGUID, String secondGUID, String relationshipTypeName, String firstEntityTypeName, String externalSourceName, InstanceProperties relationshipProperties)Create or updates an external relationship between two entities.protected voidvalidateDeleteSemantic(DeleteSemantic deleteSemantic, String methodName)
-
-
-
Constructor Detail
-
DataEngineCommonHandler
public DataEngineCommonHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, DataEngineRegistrationHandler dataEngineRegistrationHandler)
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 errorsrepositoryHandler- manages calls to the repository servicesrepositoryHelper- provides utilities for manipulating the repository services objectsdataEngineRegistrationHandler- provides calls for retrieving external data engine guid
-
-
Method Detail
-
createExternalEntity
protected String createExternalEntity(String userId, InstanceProperties instanceProperties, InstanceStatus instanceStatus, String entityTypeName, String externalSourceName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
Create a new entity from an external source with the specified instance status- Parameters:
userId- the name of the calling userinstanceProperties- the properties of the entityinstanceStatus- initial status (needs to be valid for type)entityTypeName- name of the entity's typeexternalSourceName- the unique name of the external source- Returns:
- unique identifier of the process in the repository
- Throws:
InvalidParameterException- the bean properties are invalidUserNotAuthorizedException- user not authorized to issue this requestPropertyServerException- problem accessing the property server
-
updateEntity
protected void updateEntity(String userId, String entityGUID, InstanceProperties instanceProperties, String entityTypeName, String externalSourceName) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException
Update an existing entity- Parameters:
userId- the name of the calling userentityGUID- unique identifier of entity to updateinstanceProperties- the properties of the entityentityTypeName- name of the entity's typeexternalSourceName- the external data engine- Throws:
UserNotAuthorizedException- user not authorized to issue this requestPropertyServerException- problem accessing the property serverInvalidParameterException- the bean properties are invalid
-
buildEntityDetail
protected EntityDetail buildEntityDetail(String entityGUID, InstanceProperties instanceProperties)
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
protected Relationship buildRelationship(String entityGUID, InstanceProperties instanceProperties)
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 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 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 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 endrelationshipTypeName- type name for the relationship to createfirstEntityTypeName- type name for the entity at first end- 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
protected int getOwnerTypeOrdinal(OwnerType ownerType)
Return the owner type ordinal- Parameters:
ownerType- OwnerType enum- Returns:
- DataItemSortOrder enum ordinal
-
getSortOrder
protected int getSortOrder(Attribute column)
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
- Throws:
InvalidParameterException
-
throwEntityNotDeletedException
public void throwEntityNotDeletedException(DataEngineErrorCode errorCode, String methodName, String... params) throws EntityNotDeletedException
- Throws:
EntityNotDeletedException
-
getEntitiesForRelationship
protected Set<EntityDetail> getEntitiesForRelationship(String userId, String guid, String relationshipTypeName, 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 followentityTypeName- 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
-
-