Class SubjectAreaHandler
java.lang.Object
org.odpi.openmetadata.accessservices.subjectarea.handlers.SubjectAreaHandler
- Direct Known Subclasses:
SubjectAreaCategoryHandler
,SubjectAreaConfigHandler
,SubjectAreaGlossaryHandler
,SubjectAreaGraphHandler
,SubjectAreaProjectHandler
,SubjectAreaRelationshipHandler
,SubjectAreaTermHandler
SubjectAreaProjectHandler manages Project objects from the property server. It runs server-side in the subject Area
OMAS and retrieves entities and relationships through the OMRSRepositoryConnector.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final OpenMetadataAPIGenericHandler
protected InvalidParameterHandler
protected final MappersFactory
protected final int
-
Constructor Summary
ConstructorsConstructorDescriptionSubjectAreaHandler
(OpenMetadataAPIGenericHandler genericHandler, int maxPageSize) Construct the Subject Area Handler needed to operate within a single server instance. -
Method Summary
Modifier and TypeMethodDescription<R extends InstanceHeader,
T extends OmasObject>
List<T>convertOmrsToOmas
(Collection<R> list, Class<? extends Mapper> mapperInterface) findNodes
(String userId, String typeEntityName, String typeEntityGuid, FindRequest findRequest, boolean exactValue, boolean ignoreCase, Class<? extends INodeMapper<T>> mapperClass, String methodName) getAllRelationshipForEntity
(String restAPIName, String userId, String entityGuid, FindRequest findRequest, String entityTypeName) Get the relationships keyed off an entity guid.getAllRelationshipsForEntity
(String methodName, String userId, String guid, FindRequest findRequest, String entityTypeName) Get All relationships for Nodeint
getNodesFromEntityDetails
(Collection<EntityDetail> entityDetails) getRelationshipsForEntityByType
(String restAPIName, String userId, String entityGuid, FindRequest findRequest, String entityTypeName, String attachmentRelationshipTypeGUID, String attachmentRelationshipTypeName, String attachmentEntityTypeName) Get the relationships keyed off an entity guid.getRelationshipsFromRelationships
(Collection<Relationship> relationships) protected String
sanitiseFindRequest
(String searchCriteria, boolean exactValue, boolean ignoreCase) protected FindRequest
sanitiseFindRequest
(FindRequest findRequest, boolean exactValue, boolean ignoreCase) Take a FindRequest and sanitise it.protected void
setNodeEffectivity
(String userId, Node node, String methodName, String guid, String typeGUID, String typeName) Set the effectivity to and from dates date for a Nodeprotected void
setRelationshipEffectivity
(String userId, Node node, String methodName, String relationshipGUID, String typeGUID, String typeName) Set the effectivity to and from dates date for a Relationshipprotected void
Set unique qualifiedName into the supplied Node.protected String
validateGlossarySummaryDuringCreation
(String userId, String methodName, GlossarySummary suppliedGlossary) This method validated for creation.
-
Field Details
-
mappersFactory
-
genericHandler
-
maxPageSize
protected final int maxPageSize -
invalidParameterHandler
-
-
Constructor Details
-
SubjectAreaHandler
Construct the Subject Area Handler needed to operate within a single server instance.- Parameters:
genericHandler
- generic handlermaxPageSize
- maximum page size
-
-
Method Details
-
getMaxPageSize
public int getMaxPageSize() -
sanitiseFindRequest
-
sanitiseFindRequest
protected FindRequest sanitiseFindRequest(FindRequest findRequest, boolean exactValue, boolean ignoreCase) Take a FindRequest and sanitise it. The FindRequest from the user could contain a regex expression which would cause the regex engine to loop. to avoid this, we turn what the user has given us into a literal and then use the exactValue and ignoreCase flags to add to the regular expression in a controlled way.- Parameters:
findRequest
- supplied find request - that contains the search criteriaexactValue
- flag indicating that exact value mathcing should be doneignoreCase
- flag indicating that case should be ignored- Returns:
- sanitised find request
-
findNodes
protected <T extends Node> List<T> findNodes(String userId, String typeEntityName, String typeEntityGuid, FindRequest findRequest, boolean exactValue, boolean ignoreCase, Class<? extends INodeMapper<T>> mapperClass, String methodName) throws PropertyServerException, UserNotAuthorizedException, InvalidParameterException -
getAllRelationshipsForEntity
public SubjectAreaOMASAPIResponse<Relationship> getAllRelationshipsForEntity(String methodName, String userId, String guid, FindRequest findRequest, String entityTypeName) Get All relationships for Node- Parameters:
methodName
- name of the method being called.userId
- unique identifier for requesting user, under which the request is performedguid
- guidfindRequest
-FindRequest
entityTypeName
- typpe name of the starting entity- Returns:
- the relationships associated with the requested guid
-
getAllRelationshipForEntity
public List<Relationship> getAllRelationshipForEntity(String restAPIName, String userId, String entityGuid, FindRequest findRequest, String entityTypeName) throws SubjectAreaCheckedException, PropertyServerException, UserNotAuthorizedException, InvalidParameterException Get the relationships keyed off an entity guid.- Parameters:
restAPIName
- rest API nameuserId
- user identityentityGuid
- globally unique identifierfindRequest
-FindRequest
entityTypeName
- type name of the starting entity- Returns:
List<Relationship>
- Throws:
PropertyServerException
- something went wrong with the REST call stack.UserNotAuthorizedException
- the requesting user is not authorized to issue this request.SubjectAreaCheckedException
- standard exception Subject Area OMAS servicesInvalidParameterException
-
getRelationshipsForEntityByType
public List<Relationship> getRelationshipsForEntityByType(String restAPIName, String userId, String entityGuid, FindRequest findRequest, String entityTypeName, String attachmentRelationshipTypeGUID, String attachmentRelationshipTypeName, String attachmentEntityTypeName) throws SubjectAreaCheckedException, PropertyServerException, UserNotAuthorizedException, InvalidParameterException Get the relationships keyed off an entity guid.- Parameters:
restAPIName
- rest API nameuserId
- user identityentityGuid
- globally unique identifierfindRequest
-FindRequest
entityTypeName
- type name of the starting entityattachmentRelationshipTypeGUID
- attachment relationship type guidattachmentRelationshipTypeName
- attachment relationship type nameattachmentEntityTypeName
- attached entity type name- Returns:
List<Relationship>
- Throws:
PropertyServerException
- something went wrong with the REST call stack.UserNotAuthorizedException
- the requesting user is not authorized to issue this request.SubjectAreaCheckedException
- standard exception Subject Area OMAS servicesInvalidParameterException
-
getRelationshipsFromRelationships
-
getNodesFromEntityDetails
-
convertOmrsToOmas
public <R extends InstanceHeader,T extends OmasObject> List<T> convertOmrsToOmas(Collection<R> list, Class<? extends Mapper> mapperInterface) -
validateGlossarySummaryDuringCreation
protected String validateGlossarySummaryDuringCreation(String userId, String methodName, GlossarySummary suppliedGlossary) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException, SubjectAreaCheckedException This method validated for creation.- Parameters:
userId
- userId under which the request is performedmethodName
- method making the callsuppliedGlossary
- glossary to validate against.- Returns:
- SubjectAreaOMASAPIResponse this response is of type ResponseCategory.Category.Glossary if successful, otherwise there is an error response.
- Throws:
PropertyServerException
- something went wrong with the REST call stack.UserNotAuthorizedException
- the requesting user is not authorized to issue this request.InvalidParameterException
- one of the parameters is null or invalidSubjectAreaCheckedException
- standard exception Subject Area OMAS services
-
setUniqueQualifiedNameIfBlank
Set unique qualifiedName into the supplied Node. The qualified name needs to be unique and is supplied on an addnEtity omrs call. Prior to the add, we do not know the guid of the entity. We do not want to add an entity, then immediately update it; as these changes to entity identity would be propagated across the cohort. So we set the qualified name by concatinating the supplied seed, an @ symbol and a newly generated UUID. The assumption is that this method is supplied a node that contains a name.- Parameters:
node
- Node to set the unique qualified name into
-
setNodeEffectivity
protected void setNodeEffectivity(String userId, Node node, String methodName, String guid, String typeGUID, String typeName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Set the effectivity to and from dates date for a Node- Parameters:
userId
- calling usernode
- node to update with effectivity dates if requiredmethodName
- name of the calling methodguid
- guid of the Bean to updatetypeGUID
- the guid of the associated typetypeName
- the name of the associated type- Throws:
InvalidParameterException
- invalid parameterPropertyServerException
- there is a problem with the repositoriesUserNotAuthorizedException
- the user is not allowed to update the security tags
-
setRelationshipEffectivity
protected void setRelationshipEffectivity(String userId, Node node, String methodName, String relationshipGUID, String typeGUID, String typeName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Set the effectivity to and from dates date for a Relationship- Parameters:
userId
- calling usernode
- node to take the effectivity dates frommethodName
- name of the calling methodrelationshipGUID
- relationshipGUID of the Relationship to updatetypeGUID
- the relationshipGUID of the associated typetypeName
- the name of the associated type- Throws:
InvalidParameterException
- invalid parameterPropertyServerException
- there is a problem with the repositoriesUserNotAuthorizedException
- the user is not allowed to update the security tags
-