Class CommentExchangeHandler

java.lang.Object
org.odpi.openmetadata.accessservices.assetmanager.handlers.CommentExchangeHandler

public class CommentExchangeHandler extends Object
CommentExchangeHandler is the server side handler for managing comments.
  • Field Details

  • Constructor Details

    • CommentExchangeHandler

      public CommentExchangeHandler(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 comment exchange handler with information needed to work with comment related objects for Asset Manager OMAS.
      Parameters:
      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 instances from.
      defaultZones - list of zones that the access service should set in all new instances.
      publishZones - list of zones that the access service sets up in published instances.
      auditLog - destination for audit log events.
  • Method Details

    • createComment

      public String createComment(String userId, String guid, String guidParameterName, MetadataCorrelationProperties correlationProperties, boolean isPublic, CommentProperties commentProperties, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Create a new comment.
      Parameters:
      userId - calling user
      guid - unique identifier of the element to attach the comment to
      guidParameterName - parameter for guid
      correlationProperties - properties to help with the mapping of the elements in the external asset manager and open metadata
      isPublic - is this visible to other people
      commentProperties - properties to store
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - when should the elements be effected for - null is anytime; new Date() is now
      methodName - calling method
      Returns:
      unique identifier of the new metadata element
      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)
    • updateComment

      public void updateComment(String userId, MetadataCorrelationProperties correlationProperties, String commentGUID, CommentProperties commentProperties, boolean isMergeUpdate, boolean isPublic, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Update the metadata element representing a comment.
      Parameters:
      userId - calling user
      correlationProperties - properties to help with the mapping of the elements in the external asset manager and open metadata
      commentGUID - unique identifier of the metadata element to update
      commentProperties - new properties for this element
      isMergeUpdate - should the properties be merged with the existing properties or completely over-write them
      isPublic - is this visible to other people
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - when should the elements be effected for - null is anytime; new Date() is now
      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)
    • removeComment

      public void removeComment(String userId, MetadataCorrelationProperties correlationProperties, String commentGUID, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Remove the metadata element representing a comment. This will delete the comment and all comment replies.
      Parameters:
      userId - calling user
      correlationProperties - properties to help with the mapping of the elements in the external asset manager and open metadata
      commentGUID - unique identifier of the metadata element to remove
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - optional date for effective time of the query. Null means any effective time
      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)
    • setupAcceptedAnswer

      public void setupAcceptedAnswer(String userId, String assetManagerGUID, String assetManagerName, String questionCommentGUID, String answerCommentGUID, boolean isPublic, Date effectiveFrom, Date effectiveTo, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, 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
      assetManagerGUID - unique identifier of software server capability representing the caller
      assetManagerName - unique name of software server capability representing the caller
      questionCommentGUID - unique identifier of the comment containing the question
      answerCommentGUID - unique identifier of the comment containing the accepted answer
      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)
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - optional date for effective time of the query. Null means any effective time
      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 assetManagerGUID, String assetManagerName, String questionCommentGUID, String answerCommentGUID, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Unlink a comment that contains an answer to a question posed in another comment.
      Parameters:
      userId - calling user
      assetManagerGUID - unique identifier of software server capability representing the caller
      assetManagerName - unique name of software server capability representing the caller
      questionCommentGUID - unique identifier of the comment containing the question
      answerCommentGUID - unique identifier of the comment containing the accepted answer
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - optional date for effective time of the query. Null means any effective time
      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)
    • findComments

      public List<CommentElement> findComments(String userId, String assetManagerGUID, String assetManagerName, String searchString, String searchStringParameterName, int startFrom, int pageSize, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the list of comment metadata elements that contain the search string. The search string is treated as a regular expression.
      Parameters:
      userId - calling user
      assetManagerGUID - unique identifier of software server capability representing the caller
      assetManagerName - unique name of software server capability representing the caller
      searchString - string to find in the properties
      searchStringParameterName - name of parameter for search string
      startFrom - paging start point
      pageSize - maximum 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 matching metadata elements
      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)
    • getAttachedComments

      public List<CommentElement> getAttachedComments(String userId, String assetManagerGUID, String assetManagerName, String elementGUID, String elementGUIDParameterName, int startFrom, int pageSize, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Return the comments attached to an element.
      Parameters:
      userId - calling user
      assetManagerGUID - unique identifier of software server capability representing the caller
      assetManagerName - unique name of software server capability representing the caller
      elementGUID - unique identifier for the element where the like is attached.
      elementGUIDParameterName - name of parameter for elementGUID
      startFrom - paging start point
      pageSize - maximum 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 matching metadata elements
      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)
    • getCommentByGUID

      public CommentElement getCommentByGUID(String userId, String assetManagerGUID, String assetManagerName, String commentGUID, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Retrieve the comment metadata element with the supplied unique identifier.
      Parameters:
      userId - calling user
      assetManagerGUID - unique identifier of software server capability representing the caller
      assetManagerName - unique name of software server capability representing the caller
      commentGUID - unique identifier of the requested metadata element
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - when should the elements be effected for - null is anytime; new Date() is now
      methodName - calling method
      Returns:
      matching metadata element
      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)
    • setElementAsDataField

      public void setElementAsDataField(String userId, MetadataCorrelationProperties correlationProperties, String elementGUID, DataFieldValuesProperties properties, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Classify the element to indicate that it describes a data field and supply properties that describe the characteristics of the data values found within.
      Parameters:
      userId - calling user
      correlationProperties - properties to help with the mapping of the elements in the external asset manager and open metadata
      elementGUID - unique identifier of the metadata element to update
      properties - characterizations of the data values stored in the data field
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - optional date for effective time of the query. Null means any effective time
      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)
    • clearElementAsDataField

      public void clearElementAsDataField(String userId, MetadataCorrelationProperties correlationProperties, String elementGUID, boolean forLineage, boolean forDuplicateProcessing, Date effectiveTime, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException
      Remove the data field designation from the element.
      Parameters:
      userId - calling user
      correlationProperties - properties to help with the mapping of the elements in the external asset manager and open metadata
      elementGUID - unique identifier of the metadata element to update
      forLineage - return elements marked with the Memento classification?
      forDuplicateProcessing - do not merge elements marked as duplicates?
      effectiveTime - optional date for effective time of the query. Null means any effective time
      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)