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.
    • Constructor Detail

      • 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 Detail

      • 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
      • 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.
      • 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 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.