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 Details

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

    • attachNewComment

      public String attachNewComment(String userId, String externalSourceGUID, String externalSourceName, String anchorGUID, String parentGUID, String parentGUIDParameterName, int commentType, String commentText, boolean isPublic, Date effectiveFrom, Date effectiveTo, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, 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 capability entity that represented the external source - null for local
      externalSourceName - name of the software 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
      effectiveFrom - the date when this element is active - null for active now
      effectiveTo - the date when this element becomes inactive - null for active until deleted
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      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.
    • attachNewComment

      public String attachNewComment(String userId, String externalSourceGUID, String externalSourceName, String anchorGUID, String parentGUID, String parentGUIDParameterName, String suppliedQualifiedName, int commentType, String commentText, boolean isPublic, Date effectiveFrom, Date effectiveTo, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, 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 capability entity that represented the external source - null for local
      externalSourceName - name of the software 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.
      suppliedQualifiedName - unique identifier for the comment
      commentType - ordinal of comment enum.
      commentText - String - the text of the comment.
      isPublic - should this be visible to all or private to the caller
      effectiveFrom - the date when this element is active - null for active now
      effectiveTo - the date when this element becomes inactive - null for active until deleted
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      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, String qualifiedName, int commentType, String commentText, boolean isPublic, boolean isMergeUpdate, Date effectiveFrom, Date effectiveTo, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException
      Update an existing comment.
      Parameters:
      userId - userId of user making request.
      externalSourceGUID - guid of the software capability entity that represented the external source - null for local
      externalSourceName - name of the software capability entity that represented the external source
      commentGUID - unique identifier for the comment to change
      commentGUIDParameterName - name of parameter for commentGUID
      qualifiedName - unique name of the comment
      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
      isMergeUpdate - should the new properties be merged with existing properties (true) or completely replace them (false)?
      effectiveFrom - the date when this element is active - null for active now
      effectiveTo - the date when this element becomes inactive - null for active until deleted
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      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, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, 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 capability entity that represented the external source - null for local
      externalSourceName - name of the software capability entity that represented the external source
      commentGUIDParameterName - parameter supplying the
      commentGUID - unique identifier for the comment object.
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      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.
    • setupAcceptedAnswer

      public void setupAcceptedAnswer(String userId, String externalSourceGUID, String externalSourceName, String questionCommentGUID, String questionCommentGUIDParameterName, String answerCommentGUID, String answerCommentGUIDParameterName, boolean isPublic, Date effectiveFrom, Date effectiveTo, Date effectiveTime, boolean forLineage, boolean forDuplicateProcessing, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Link a comment that contains the best answer to a question posed in another comment.
      Parameters:
      userId - calling user
      externalSourceGUID - guid of the software capability entity that represented the external source - null for local
      externalSourceName - name of the software capability entity that represented the external source
      questionCommentGUID - unique identifier of the comment containing the question
      questionCommentGUIDParameterName - parameter supplying questionCommentGUID
      answerCommentGUID - unique identifier of the comment containing the accepted answer
      answerCommentGUIDParameterName - parameter supplying the answerCommentGUID
      isPublic - who can retrieve the relationship
      effectiveFrom - the time that the relationship element must be effective from (null for any time, new Date() for now)
      effectiveTo - the time that the relationship must be effective to (null for any time, new Date() for now)
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      methodName - calling method
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user is not authorized to issue this request
      PropertyServerException - there is a problem reported in the open metadata server(s)
    • clearAcceptedAnswer

      public void clearAcceptedAnswer(String userId, String externalSourceGUID, String externalSourceName, String questionCommentGUID, String questionCommentGUIDParameterName, String answerCommentGUID, String answerCommentGUIDParameterName, Date effectiveTime, boolean forLineage, boolean forDuplicateProcessing, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Unlink a comment that contains an answer to a question posed in another comment.
      Parameters:
      userId - calling user
      externalSourceGUID - guid of the software capability entity that represented the external source - null for local
      externalSourceName - name of the software capability entity that represented the external source
      questionCommentGUID - unique identifier of the comment containing the question
      questionCommentGUIDParameterName - parameter supplying questionCommentGUID
      answerCommentGUID - unique identifier of the comment containing the accepted answer
      answerCommentGUIDParameterName - parameter supplying answerCommentGUID
      effectiveTime - the time that the retrieved elements must be effective for (null for any time, new Date() for now)
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      methodName - calling method
      Throws:
      InvalidParameterException - one of the parameters is invalid
      UserNotAuthorizedException - the user is not authorized to issue this request
      PropertyServerException - there is a problem reported in the open metadata server(s)
    • getComments

      public List<B> getComments(String userId, String anchorGUID, String anchorGUIDParameterName, String elementGUID, String elementGUIDParameterName, String elementTypeName, List<String> serviceSupportedZones, int startingFrom, int pageSize, boolean forLineage, boolean forDuplicateProcessing, 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
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      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, boolean forLineage, boolean forDuplicateProcessing, 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
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      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