Class SubjectAreaTermHandler
-
Field Summary
Fields inherited from class org.odpi.openmetadata.accessservices.subjectarea.handlers.SubjectAreaHandler
genericHandler, invalidParameterHandler, mappersFactory, maxPageSize
-
Constructor Summary
ConstructorsConstructorDescriptionSubjectAreaTermHandler
(OpenMetadataAPIGenericHandler genericHandler, int maxPageSize) Construct the Subject Area Term Handler needed to operate within a single server instance. -
Method Summary
Modifier and TypeMethodDescriptioncreateTerm
(String userId, SubjectAreaRelationshipHandler relationshipHandler, Term suppliedTerm) Create a Term.deleteTerm
(String userId, String guid) Delete a Term instancefindTerm
(String userId, FindRequest findRequest, boolean exactValue, boolean ignoreCase) Find TermgetTermByGuid
(String userId, String guid) Get a term by guid.getTermCategories
(String userId, String guid, SubjectAreaCategoryHandler categoryHandler, Integer startingFrom, Integer pageSize) Get the Categories categorizing this Term.getTermRelationships
(String userId, String guid, FindRequest findRequest) Get Term relationshipsrestoreTerm
(String userId, String guid) Restore a TermupdateTerm
(String userId, String guid, Term suppliedTerm, SubjectAreaRelationshipHandler relationshipHandler, boolean isReplace) Update a Termprotected void
validateCategoriesDuringCreation
(String userId, String methodName, List<CategorySummary> suppliedCategories) This method validates that any Categories supplied to a Term create exist.Methods inherited from class org.odpi.openmetadata.accessservices.subjectarea.handlers.SubjectAreaHandler
convertOmrsToOmas, findNodes, getAllRelationshipForEntity, getAllRelationshipsForEntity, getMaxPageSize, getNodesFromEntityDetails, getRelationshipsForEntityByType, getRelationshipsFromRelationships, sanitiseFindRequest, sanitiseFindRequest, setNodeEffectivity, setRelationshipEffectivity, setUniqueQualifiedNameIfBlank, validateGlossarySummaryDuringCreation
-
Constructor Details
-
SubjectAreaTermHandler
Construct the Subject Area Term Handler needed to operate within a single server instance.- Parameters:
genericHandler
- generic handlermaxPageSize
- maximum page size
-
-
Method Details
-
createTerm
public SubjectAreaOMASAPIResponse<Term> createTerm(String userId, SubjectAreaRelationshipHandler relationshipHandler, Term suppliedTerm) Create a Term. There are specializations of terms that can also be created using this operation. To create a specialization, you should specify a nodeType other than Term in the supplied term.Terms with the same name can be confusing. Best practise is to createTerms that have unique names. This Create call does not police that term names are unique. So it is possible to create Terms with the same name as each other.
Valid nodeTypes for this request are:
- Taxonomy to create a Taxonomy
- CanonicalTerm to create a canonical term
- TaxonomyAndCanonicalTerm to create a term that is both a taxonomy and a canonical term
- Term to create a term that is not a taxonomy or a canonical term
- Parameters:
userId
- unique identifier for requesting user, under which the request is performedrelationshipHandler
- relationship handlersuppliedTerm
- Term to create- Returns:
- response, when successful contains the created term.
when not successful the following Exception responses can occur
- UserNotAuthorizedException the requesting user is not authorized to issue this request.
- MetadataServerUncontactableException not able to communicate with a Metadata respository service.
- InvalidParameterException one of the parameters is null or invalid.
- UnrecognizedGUIDException the supplied guid was not recognised.
- ClassificationException Error processing a classification.
- StatusNotSupportedException A status value is not supported.
-
validateCategoriesDuringCreation
protected void validateCategoriesDuringCreation(String userId, String methodName, List<CategorySummary> suppliedCategories) throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException, SubjectAreaCheckedException This method validates that any Categories supplied to a Term create exist.- Parameters:
userId
- userId under which the request is performedmethodName
- method making the callsuppliedCategories
- categories to validate.- 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
-
getTermByGuid
Get a term by guid.- Parameters:
userId
- unique identifier for requesting user, under which the request is performedguid
- guid of the term to get- Returns:
- response which when successful contains the term with the requested guid
when not successful the following Exception responses can occur
- UserNotAuthorizedException the requesting user is not authorized to issue this request.
- MetadataServerUncontactableException not able to communicate with a Metadata respository service.
- InvalidParameterException one of the parameters is null or invalid.
- UnrecognizedGUIDException the supplied guid was not recognised
-
findTerm
public SubjectAreaOMASAPIResponse<Term> findTerm(String userId, FindRequest findRequest, boolean exactValue, boolean ignoreCase) Find Term- Parameters:
userId
- unique identifier for requesting user, under which the request is performedfindRequest
-FindRequest
exactValue
- a boolean, which when set means that only exact matches will be returned, otherwise matches that start with the search criteria will be returned.ignoreCase
- a boolean, which when set means that case will be ignored, if not set that case will be respected- Returns:
- A list of Terms meeting the search Criteria
- UserNotAuthorizedException the requesting user is not authorized to issue this request.
- MetadataServerUncontactableException not able to communicate with a Metadata respository service.
- InvalidParameterException one of the parameters is null or invalid.
- FunctionNotSupportedException Function not supported this indicates that a find was issued but the repository does not implement find functionality in some way.
-
getTermRelationships
public SubjectAreaOMASAPIResponse<Relationship> getTermRelationships(String userId, String guid, FindRequest findRequest) Get Term relationships- Parameters:
userId
- unique identifier for requesting user, under which the request is performedguid
- guidfindRequest
-FindRequest
- Returns:
- the relationships associated with the requested Term guid
when not successful the following Exception responses can occur
- UserNotAuthorizedException the requesting user is not authorized to issue this request.
- InvalidParameterException one of the parameters is null or invalid.
- FunctionNotSupportedException Function not supported.
-
updateTerm
public SubjectAreaOMASAPIResponse<Term> updateTerm(String userId, String guid, Term suppliedTerm, SubjectAreaRelationshipHandler relationshipHandler, boolean isReplace) Update a TermIf the caller has chosen to incorporate the term name in their Term Terms or Categories qualified name, renaming the term will cause those qualified names to mismatch the Term name. If the caller has chosen to incorporate the term qualifiedName in their Term Terms or Categories qualified name, changing the qualified name of the term will cause those qualified names to mismatch the Term name. Status is not updated using this call. The Categories categorising this Term can be amended using this call; this means that the termCategorization relationships are removed and/or added in this call. For an update (rather than a replace) with no categories supplied, no changes are made to the termCategorizations; otherwise the supplied categorizing Categories will replace the existing ones.
- Parameters:
userId
- unique identifier for requesting user, under which the request is performedguid
- guid of the term to updatesuppliedTerm
- term to be updatedisReplace
- flag to indicate that this update is a replace. When not set only the supplied (non null) fields are updated.- Returns:
- a response which when successful contains the updated term
when not successful the following Exception responses can occur
- UnrecognizedGUIDException the supplied guid was not recognised
- UserNotAuthorizedException the requesting user is not authorized to issue this request.
- FunctionNotSupportedException Function not supported
- InvalidParameterException one of the parameters is null or invalid.
- MetadataServerUncontactableException not able to communicate with a Metadata repository service.
-
deleteTerm
Delete a Term instanceThe deletion of a term is only allowed if there is no term content (i.e. no terms or categories).
There are 2 types of deletion, a soft delete and a hard delete (also known as a purge). All repositories support hard deletes. Soft deletes support is optional.
A soft delete means that the term instance will exist in a deleted state in the repository after the delete operation. This means that it is possible to undo the delete. A hard delete means that the term will not exist after the operation.
- Parameters:
userId
- unique identifier for requesting user, under which the request is performedguid
- guid of the term to be deleted.- Returns:
- a void response
when not successful the following Exception responses can occur
- UnrecognizedGUIDException the supplied guid was not recognised
- UserNotAuthorizedException the requesting user is not authorized to issue this request.
- FunctionNotSupportedException Function not supported
- InvalidParameterException one of the parameters is null or invalid.
- MetadataServerUncontactableException not able to communicate with a Metadata respository service. There is a problem retrieving properties from the metadata repository.
- EntityNotDeletedException a soft delete was issued but the term was not deleted.
-
restoreTerm
Restore a TermRestore allows the deleted Term to be made active again. Restore allows deletes to be undone. Hard deletes are not stored in the repository so cannot be restored.
- Parameters:
userId
- unique identifier for requesting user, under which the request is performedguid
- guid of the term to restore- Returns:
- response which when successful contains the restored term
when not successful the following Exception responses can occur
- UnrecognizedGUIDException the supplied guid was not recognised
- UserNotAuthorizedException the requesting user is not authorized to issue this request.
- FunctionNotSupportedException Function not supported this indicates that a soft delete was issued but the repository does not support it.
- InvalidParameterException one of the parameters is null or invalid.
- MetadataServerUncontactableException not able to communicate with a Metadata respository service. There is a problem retrieving properties from the metadata repository.
-
getTermCategories
public SubjectAreaOMASAPIResponse<Category> getTermCategories(String userId, String guid, SubjectAreaCategoryHandler categoryHandler, Integer startingFrom, Integer pageSize) Get the Categories categorizing this Term. The server has a maximum page size defined, the number of Categories returned is limited by that maximum page size.- Parameters:
userId
- unique identifier for requesting user, under which the request is performedguid
- guid of the category to get termscategoryHandler
- category handlerstartingFrom
- the starting element number for this set of results. This is used when retrieving elementspageSize
- the maximum number of elements that can be returned on this request.- Returns:
- A list of categories categorizing this Term
when not successful the following Exception responses can occur
- UserNotAuthorizedException the requesting user is not authorized to issue this request.
- InvalidParameterException one of the parameters is null or invalid.
- PropertyServerException Property server exception.
-