Class AnnotationHandler<B>


public class AnnotationHandler<B> extends ReferenceableHandler<B>
AnnotationHandler manages the storage and retrieval of metadata relating to annotations as defined in the Open Discovery Framework (ODF). It has both specific support for creating annotations from ODF annotation beans and generic support for retrieving annotations. The reason for this hybrid approach is that there are a huge range of annotation types in ODF and currently all OMASs that work with discovery metadata use the ODF beans on their API. Therefore, it makes sense to have support for these beans in a common location so that the implementation can be shared. Note: this handler only supports current effective time with lineage and deduplication set to false since this is all the current discovery use cases need.
  • Constructor Details

    • AnnotationHandler

      public AnnotationHandler(OpenMetadataAPIGenericConverter<B> converter, Class<B> beanClass, String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, RepositoryHandler repositoryHandler, OMRSRepositoryHelper repositoryHelper, String localServerUserId, OpenMetadataServerSecurityVerifier securityVerifier, List<String> supportedZones, List<String> defaultZones, List<String> publishZones, AuditLog auditLog)
      Construct the annotation handler with information needed to work with B objects.
      Parameters:
      converter - specific converter for this bean class
      beanClass - name of bean class that is represented by the generic class B
      serviceName - name of this service
      serverName - name of the local server
      invalidParameterHandler - handler for managing parameter errors
      repositoryHandler - manages calls to the repository services
      repositoryHelper - provides utilities for manipulating the repository services objects
      localServerUserId - userId for this server
      securityVerifier - open metadata security services verifier
      supportedZones - list of zones that the access service is allowed to serve B instances from.
      defaultZones - list of zones that the access service should set in all new B instances.
      publishZones - list of zones that the access service sets up in published B instances.
      auditLog - destination for audit log events.
  • Method Details

    • getTypesOfAnnotation

      public List<String> getTypesOfAnnotation()
      Return the annotation subtype names. These are derived from the types defined in the server.
      Returns:
      list of type names that are subtypes of annotation
    • getTypesOfAnnotationDescriptions

      public Map<String,String> getTypesOfAnnotationDescriptions()
      Return the list of annotation subtype names mapped to their descriptions.
      Returns:
      map of type names that are subtypes of asset to their description
    • addAnnotationToDiscoveryReport

      public String addAnnotationToDiscoveryReport(String userId, String discoveryReportGUID, Annotation annotation, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Add a new annotation to the annotation store as a top level annotation linked directly off of the report.
      Parameters:
      userId - identifier of calling user
      discoveryReportGUID - unique identifier of the discovery analysis report
      annotation - annotation object
      methodName - calling method
      Returns:
      unique identifier of new annotation
      Throws:
      InvalidParameterException - the annotation is invalid
      UserNotAuthorizedException - the user id not authorized to issue this request
      PropertyServerException - there was a problem retrieving adding the annotation to the annotation store.
    • addAnnotationToDataField

      public String addAnnotationToDataField(String userId, String parentDataFieldGUID, Annotation annotation, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Add a new annotation and link it to an existing data field.
      Parameters:
      userId - identifier of calling user
      parentDataFieldGUID - unique identifier of the data field that this new one is to be attached to
      annotation - data field object
      methodName - calling method
      Returns:
      unique identifier of new annotation
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user id not authorized to issue this request
      PropertyServerException - there was a problem saving data fields in the annotation store.
    • addAnnotationToAnnotation

      public String addAnnotationToAnnotation(String userId, String parentAnnotationGUID, Annotation annotation, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Add a new annotation and link it to an existing annotation.
      Parameters:
      userId - identifier of calling user
      parentAnnotationGUID - unique identifier of the annotation that this new one is to be attached to
      annotation - annotation object
      methodName - calling method
      Returns:
      unique identifier of the new annotation
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user id not authorized to issue this request
      PropertyServerException - there was a problem saving annotations in the annotation store.
    • updateAnnotation

      public void updateAnnotation(String userId, String annotationGUID, Annotation annotation, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Replace the current properties of an annotation.
      Parameters:
      userId - identifier of calling user
      annotationGUID - unique identifier
      annotation - new properties
      methodName - calling method
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user id not authorized to issue this request
      PropertyServerException - there was a problem updating the annotation in the annotation store.
    • addAnnotationReview

      public void addAnnotationReview(String userId, String annotationGUID, String annotationGUIDParameterName, int annotationStatus, Date reviewDate, String steward, String comment, String annotationReviewTypeGUID, String annotationReviewTypeName, Map<String,Object> extendedProperties, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Attach an annotation review to an annotation. The annotation status is stored in the link between the annotation and the annotation review. The rest of the properties are for the AnnotationReview entity.
      Parameters:
      userId - calling user
      annotationGUID - annotation to attach to
      annotationGUIDParameterName - parameter supplying annotationGUID
      annotationStatus - status of the annotation as a result of the review
      reviewDate - date of the review
      steward - steward who performed the review
      comment - comments from the steward
      annotationReviewTypeGUID - subtype of the annotation review (or null for standard type)
      annotationReviewTypeName - subtype of the annotation review (or null for standard type)
      extendedProperties - any additional properties from the subtype
      methodName - calling method
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user id not authorized to issue this request
      PropertyServerException - there was a problem updating the annotation in the annotation store.
    • deleteAnnotation

      public void deleteAnnotation(String userId, String annotationGUID, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Remove an annotation from the annotation store.
      Parameters:
      userId - identifier of calling user
      annotationGUID - unique identifier of the annotation
      methodName - calling method
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user id not authorized to issue this request
      PropertyServerException - there was a problem deleting the annotation from the annotation store.
    • getAnnotation

      public B getAnnotation(String userId, String annotationGUID, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve a single annotation by unique identifier. This call is typically used to retrieve the latest values for an annotation.
      Parameters:
      userId - identifier of calling user
      annotationGUID - unique identifier of the annotation
      methodName - calling method
      Returns:
      Annotation object
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem that occurred within the property server.
    • getDiscoveryReportAnnotations

      public List<B> getDiscoveryReportAnnotations(String userId, String discoveryReportGUID, int startingFrom, int pageSize, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Return the annotations linked direction to the report.
      Parameters:
      userId - identifier of calling user
      discoveryReportGUID - identifier of the discovery request.
      startingFrom - initial position in the stored list.
      pageSize - maximum number of definitions to return on this call.
      methodName - calling method
      Returns:
      list of annotations
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem that occurred within the property server.
    • getDiscoveryReportAnnotations

      public List<B> getDiscoveryReportAnnotations(String userId, String discoveryReportGUID, int annotationStatus, int startingFrom, int pageSize, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Return the annotations linked direction to the report.
      Parameters:
      userId - identifier of calling user
      discoveryReportGUID - identifier of the discovery request.
      annotationStatus - status of the desired annotations - null means all statuses.
      startingFrom - initial position in the stored list.
      pageSize - maximum number of definitions to return on this call.
      methodName - calling method
      Returns:
      list of annotations
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem that occurred within the property server.
    • getExtendedAnnotations

      public List<B> getExtendedAnnotations(String userId, String annotationGUID, int startingFrom, int pageSize, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Return any annotations attached to this annotation.
      Parameters:
      userId - identifier of calling user
      annotationGUID - anchor annotation
      startingFrom - starting position in the list
      pageSize - maximum number of annotations that can be returned.
      methodName - calling method
      Returns:
      list of Annotation objects
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem that occurred within the property server.
    • getExtendedAnnotations

      public List<B> getExtendedAnnotations(String userId, String annotationGUID, int annotationStatus, int startingFrom, int pageSize, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Return any annotations attached to this annotation.
      Parameters:
      userId - identifier of calling user
      annotationGUID - anchor annotation
      annotationStatus - status of the desired annotations - null means all statuses.
      startingFrom - starting position in the list
      pageSize - maximum number of annotations that can be returned.
      methodName - calling method
      Returns:
      list of Annotation objects
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
      UserNotAuthorizedException - user not authorized to issue this request.
      PropertyServerException - there was a problem that occurred within the property server.
    • getAnnotationsForAsset

      public List<B> getAnnotationsForAsset(String userId, String assetGUID, int startingFrom, int pageSize, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Return the list of annotations from previous runs of the discovery services that are set to reviewed, approved and/or actioned status that are returned from discovery reports that are not waiting or in progress.
      Parameters:
      userId - calling user
      assetGUID - unique identifier of the asset
      startingFrom - starting position in the list.
      pageSize - maximum number of elements that can be returned
      methodName - calling method
      Returns:
      list of annotation (or null if none are registered)
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user id not authorized to issue this request
      PropertyServerException - there was a problem retrieving annotations from the annotation store.
    • getAnnotationsForAssetByStatus

      public List<B> getAnnotationsForAssetByStatus(String userId, String assetGUID, int status, int startingFrom, int pageSize, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Return the list of annotations from previous runs of the discovery services that are set to a specific status.
      Parameters:
      userId - calling user
      assetGUID - unique identifier of the asset
      status - status value to use on the query
      startingFrom - starting position in the list.
      pageSize - maximum number of elements that can be returned
      methodName - calling method
      Returns:
      list of annotation (or null if none are registered)
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user id not authorized to issue this request
      PropertyServerException - there was a problem retrieving annotations from the annotation store.