Class SubjectAreaTermHandler


  • public class SubjectAreaTermHandler
    extends SubjectAreaHandler
    SubjectAreaTermHandler manages Term objects from the property server. It runs server-side in the subject Area OMAS and retrieves entities and relationships through the OMRSRepositoryConnector.
    • Constructor Detail

      • SubjectAreaTermHandler

        public SubjectAreaTermHandler​(OpenMetadataAPIGenericHandler genericHandler,
                                      int maxPageSize)
        Construct the Subject Area Term Handler needed to operate within a single server instance.
        Parameters:
        genericHandler - generic handler
        maxPageSize - maximum page size
    • Method Detail

      • 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 performed
        relationshipHandler - relationship handler
        suppliedTerm - 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.
      • getTermByGuid

        public SubjectAreaOMASAPIResponse<Term> getTermByGuid​(String userId,
                                                              String guid)
        Get a term by guid.
        Parameters:
        userId - unique identifier for requesting user, under which the request is performed
        guid - 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 performed
        findRequest - 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 performed
        guid - guid
        findRequest - 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 Term

        If 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 performed
        guid - guid of the term to update
        suppliedTerm - term to be updated
        isReplace - 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

        public SubjectAreaOMASAPIResponse<Term> deleteTerm​(String userId,
                                                           String guid)
        Delete a Term instance

        The 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 performed
        guid - 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

        public SubjectAreaOMASAPIResponse<Term> restoreTerm​(String userId,
                                                            String guid)
        Restore a Term

        Restore 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 performed
        guid - 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 performed
        guid - guid of the category to get terms
        categoryHandler - category handler
        startingFrom - the starting element number for this set of results. This is used when retrieving elements
        pageSize - 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.