Class CommentHandler<B>


  • public class CommentHandler<B>
    extends ReferenceableHandler<B>
    CommentHandler manages Comment objects. It runs server-side in the OMAG Server Platform and retrieves Comment entities through the OMRSRepositoryConnector.
    • Constructor Detail

      • CommentHandler

        public CommentHandler​(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 handler information needed to interact with the repository services
        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 Asset instances from.
        defaultZones - list of zones that the access service should set in all new Asset instances.
        publishZones - list of zones that the access service sets up in published Asset instances.
        auditLog - destination for audit log events.
    • Method Detail

      • attachNewComment

        public String attachNewComment​(String userId,
                                       String externalSourceGUID,
                                       String externalSourceName,
                                       String anchorGUID,
                                       String parentGUID,
                                       String parentGUIDParameterName,
                                       int commentType,
                                       String commentText,
                                       boolean isPublic,
                                       String methodName)
                                throws InvalidParameterException,
                                       PropertyServerException,
                                       UserNotAuthorizedException
        Adds a comment and link it to the supplied parent entity.
        Parameters:
        userId - String - userId of user making request.
        externalSourceGUID - guid of the software server capability entity that represented the external source - null for local
        externalSourceName - name of the software server capability entity that represented the external source
        anchorGUID - head of the comment chain
        parentGUID - String - unique id for a referenceable entity that the comment is to be attached to.
        parentGUIDParameterName - name of parameter that supplied the entity's unique identifier.
        commentType - ordinal of comment enum.
        commentText - String - the text of the comment.
        isPublic - should this be visible to all or private to the caller
        methodName - calling method
        Returns:
        guid of new comment.
        Throws:
        InvalidParameterException - one of the parameters is null or invalid.
        PropertyServerException - There is a problem adding the asset properties to the property server.
        UserNotAuthorizedException - the requesting user is not authorized to issue this request.
      • updateComment

        public void updateComment​(String userId,
                                  String externalSourceGUID,
                                  String externalSourceName,
                                  String commentGUID,
                                  String commentGUIDParameterName,
                                  int commentType,
                                  String commentText,
                                  boolean isPublic,
                                  String methodName)
                           throws InvalidParameterException,
                                  PropertyServerException,
                                  UserNotAuthorizedException
        Update an existing comment.
        Parameters:
        userId - userId of user making request.
        externalSourceGUID - guid of the software server capability entity that represented the external source - null for local
        externalSourceName - name of the software server capability entity that represented the external source
        commentGUID - unique identifier for the comment to change
        commentGUIDParameterName - name of parameter for commentGUID
        commentType - type of comment enum.
        commentText - the text of the comment.
        isPublic - indicates whether the feedback should be shared or only be visible to the originating user
        methodName - calling method
        Throws:
        InvalidParameterException - one of the parameters is null or invalid.
        PropertyServerException - there is a problem adding the asset properties to the property server.
        UserNotAuthorizedException - the requesting user is not authorized to issue this request.
      • removeCommentFromElement

        public void removeCommentFromElement​(String userId,
                                             String externalSourceGUID,
                                             String externalSourceName,
                                             String commentGUID,
                                             String commentGUIDParameterName,
                                             String methodName)
                                      throws InvalidParameterException,
                                             PropertyServerException,
                                             UserNotAuthorizedException
        Removes a comment added to the parent by this user.
        Parameters:
        userId - userId of user making request.
        externalSourceGUID - guid of the software server capability entity that represented the external source - null for local
        externalSourceName - name of the software server capability entity that represented the external source
        commentGUIDParameterName - parameter supplying the
        commentGUID - unique identifier for the comment object.
        methodName - calling method
        Throws:
        InvalidParameterException - one of the parameters is null or invalid.
        PropertyServerException - there is a problem updating the asset properties in the property server.
        UserNotAuthorizedException - the user does not have permission to perform this request.
      • getComments

        public List<B> getComments​(String userId,
                                   String anchorGUID,
                                   String anchorGUIDParameterName,
                                   String elementGUID,
                                   String elementGUIDParameterName,
                                   String elementTypeName,
                                   List<String> serviceSupportedZones,
                                   int startingFrom,
                                   int pageSize,
                                   Date effectiveTime,
                                   String methodName)
                            throws InvalidParameterException,
                                   PropertyServerException,
                                   UserNotAuthorizedException
        Return the comments attached to an entity.
        Parameters:
        userId - calling user
        anchorGUID - expected anchorGUID for this element
        anchorGUIDParameterName - parameter supplying anchorGUID
        elementGUID - identifier for the entity that the comment is attached to
        elementGUIDParameterName - name of the parameter providing the element GUID
        elementTypeName - name of the type of the anchor entity
        serviceSupportedZones - supported zones for the particular service
        startingFrom - where to start from in the list
        pageSize - maximum number of results that can be returned
        effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
        methodName - calling method
        Returns:
        list of retrieved objects
        Throws:
        InvalidParameterException - the input properties are invalid
        UserNotAuthorizedException - user not authorized to issue this request
        PropertyServerException - problem accessing the property server
      • getComments

        public List<B> getComments​(String userId,
                                   String elementGUID,
                                   String elementGUIDParameterName,
                                   String elementTypeName,
                                   List<String> serviceSupportedZones,
                                   int startingFrom,
                                   int pageSize,
                                   Date effectiveTime,
                                   String methodName)
                            throws InvalidParameterException,
                                   PropertyServerException,
                                   UserNotAuthorizedException
        Return the comments attached to an entity. (No special security checking is required).
        Parameters:
        userId - calling user
        elementGUID - identifier for the entity that the comment is attached to
        elementGUIDParameterName - name of the parameter providing the element GUID
        elementTypeName - name of the type of the anchor entity
        serviceSupportedZones - supported zones for the particular service
        startingFrom - where to start from in the list
        pageSize - maximum number of results that can be returned
        effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
        methodName - calling method
        Returns:
        list of retrieved objects
        Throws:
        InvalidParameterException - the input properties are invalid
        UserNotAuthorizedException - user not authorized to issue this request
        PropertyServerException - problem accessing the property server
      • getComments

        public List<B> getComments​(String userId,
                                   String elementGUID,
                                   String elementGUIDParameterName,
                                   String elementTypeName,
                                   int startingFrom,
                                   int pageSize,
                                   Date effectiveTime,
                                   String methodName)
                            throws InvalidParameterException,
                                   PropertyServerException,
                                   UserNotAuthorizedException
        Return the comments attached to an anchor entity. (No special security checking is required).
        Parameters:
        userId - calling user
        elementGUID - identifier for the entity that the comment is attached to
        elementGUIDParameterName - name of the parameter providing the element GUID
        elementTypeName - name of the type of the anchor entity
        startingFrom - where to start from in the list
        pageSize - maximum number of results that can be returned
        effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
        methodName - calling method
        Returns:
        list of retrieved objects
        Throws:
        InvalidParameterException - the input properties are invalid
        UserNotAuthorizedException - user not authorized to issue this request
        PropertyServerException - problem accessing the property server