Class AssetConsumerRESTServices

java.lang.Object
org.odpi.openmetadata.accessservices.assetconsumer.server.AssetConsumerRESTServices

public class AssetConsumerRESTServices extends Object
The AssetConsumerRESTServices provides the server-side implementation of the Asset Consumer Open Metadata Assess Service (OMAS). This interface provides connections to assets and APIs for adding feedback on the asset.
  • Constructor Details

    • AssetConsumerRESTServices

      public AssetConsumerRESTServices()
      Default constructor
  • Method Details

    • getOutTopicConnection

      public OCFConnectionResponse getOutTopicConnection(String serverName, String userId, String callerId)
      Return the connection object for the Discovery Engine OMAS's out topic.
      Parameters:
      serverName - name of the service to route the request to.
      userId - identifier of calling user.
      callerId - unique identifier of the caller
      Returns:
      connection object for the out topic or InvalidParameterException one of the parameters is null or invalid or UserNotAuthorizedException user not authorized to issue this request or PropertyServerException problem retrieving the discovery engine definition.
    • getAssetForConnectionName

      public GUIDResponse getAssetForConnectionName(String serverName, String userId, String connectionName)
      Returns the unique identifier for the asset connected to the connection.
      Parameters:
      serverName - name of the server instances for this request
      userId - the userId of the requesting user.
      connectionName - unique name for the connection.
      Returns:
      unique identifier of asset or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem retrieving the connected asset properties from the property server or UnrecognizedConnectionGUIDException - the supplied GUID is not recognized by the property server or NoConnectedAssetException - there is no asset associated with this connection or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • getAssetGraph

      public AssetGraphResponse getAssetGraph(String serverName, String userId, String assetGUID, int startFrom, int pageSize)
      Return all the elements that are anchored to an asset plus relationships between these elements and to other elements.
      Parameters:
      serverName - name of the server instances for this request
      userId - the userId of the requesting user
      assetGUID - unique identifier for the asset
      startFrom - starting element (used in paging through large result sets)
      pageSize - maximum number of results to return
      Returns:
      graph of elements or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem retrieving the connected asset properties from the property server or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • getAssetLineageGraph

      public AssetLineageGraphResponse getAssetLineageGraph(String serverName, String userId, String assetGUID, List<String> relationshipTypes, int startFrom, int pageSize)
      Return all the elements that are linked to an asset using lineage relationships. The relationships are retrieved both from the asset, and the anchored schema elements
      Parameters:
      serverName - name of the server instances for this request
      userId - the userId of the requesting user
      assetGUID - unique identifier for the asset
      relationshipTypes - list of relationship type names to use in the search
      startFrom - starting element (used in paging through large result sets)
      pageSize - maximum number of results to return
      Returns:
      graph of elements or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem retrieving the connected asset properties from the property server or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • findAssetsInDomain

      public AssetSearchMatchesListResponse findAssetsInDomain(String serverName, String userId, SearchStringRequestBody requestBody, int startFrom, int pageSize)
      Return a list of assets with the requested search string in their name, qualified name or description. The search string is interpreted as a regular expression (RegEx).
      Parameters:
      serverName - name of the server instances for this request
      userId - calling user
      requestBody - string to search for in text
      startFrom - starting element (used in paging through large result sets)
      pageSize - maximum number of results to return
      Returns:
      list of results for assets that match the search string or InvalidParameterException the searchString is invalid or PropertyServerException there is a problem access in the property server or UserNotAuthorizedException the user does not have access to the properties
    • findAssets

      public GUIDListResponse findAssets(String serverName, String userId, SearchStringRequestBody requestBody, int startFrom, int pageSize)
      Return a list of assets with the requested search string in their name, qualified name or description. The search string is interpreted as a regular expression (RegEx).
      Parameters:
      serverName - name of the server instances for this request
      userId - calling user
      requestBody - string to search for in text
      startFrom - starting element (used in paging through large result sets)
      pageSize - maximum number of results to return
      Returns:
      list of unique identifiers for assets that match the search string or InvalidParameterException the searchString is invalid or PropertyServerException there is a problem access in the property server or UserNotAuthorizedException the user does not have access to the properties
    • getAssetsByName

      public GUIDListResponse getAssetsByName(String serverName, String userId, NameRequestBody requestBody, int startFrom, int pageSize)
      Return a list of assets with the requested name. This is an exact match search.
      Parameters:
      serverName - name of the server instances for this request
      userId - calling user
      requestBody - name to search for
      startFrom - starting element (used in paging through large result sets)
      pageSize - maximum number of results to return
      Returns:
      list of unique identifiers for Assets with the requested name or InvalidParameterException the name is invalid or PropertyServerException there is a problem access in the property server or UserNotAuthorizedException the user does not have access to the properties
    • getAssetsByMetadataCollectionId

      public AssetsResponse getAssetsByMetadataCollectionId(String serverName, String userId, String metadataCollectionId, int startFrom, int pageSize, NameRequestBody requestBody)
      Return a list of assets that come from the requested metadata collection.
      Parameters:
      serverName - name of the server instances for this request
      userId - calling user
      metadataCollectionId - guid to search for
      startFrom - starting element (used in paging through large result sets)
      pageSize - maximum number of results to return
      requestBody - optional type name to restrict search by
      Returns:
      list of unique identifiers for Assets with the requested name or InvalidParameterException the name is invalid or PropertyServerException there is a problem access in the property server or UserNotAuthorizedException the user does not have access to the properties
    • addRatingToAsset

      public VoidResponse addRatingToAsset(String serverName, String userId, String guid, RatingRequestBody requestBody)
      Adds a star rating and optional review text to the asset. If the user has already attached a rating then the original one is over-ridden.
      Parameters:
      serverName - name of the server instances for this request
      userId - String - userId of user making request.
      guid - String - unique id for the asset.
      requestBody - containing the StarRating and user review of referenceable (probably asset).
      Returns:
      void or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem adding the asset properties to the metadata repository or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • removeRatingFromAsset

      public VoidResponse removeRatingFromAsset(String serverName, String userId, String guid, NullRequestBody requestBody)
      Removes a star rating that was added to the asset by this user.
      Parameters:
      serverName - name of the server instances for this request
      userId - String - userId of user making request.
      guid - String - unique id for the rating object
      requestBody - null request body needed to satisfy the HTTP Post request
      Returns:
      void or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem updating the asset properties in the metadata repository or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • addLikeToAsset

      public VoidResponse addLikeToAsset(String serverName, String userId, String guid, FeedbackRequestBody requestBody)
      Adds a "LikeProperties" to the asset.
      Parameters:
      serverName - name of the server instances for this request
      userId - String - userId of user making request.
      guid - String - unique id for the asset.
      requestBody - feedback request body .
      Returns:
      void or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem adding the asset properties to the metadata repository or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • removeLikeFromAsset

      public VoidResponse removeLikeFromAsset(String serverName, String userId, String guid, NullRequestBody requestBody)
      Removes a "LikeProperties" added to the asset by this user.
      Parameters:
      serverName - name of the server instances for this request
      userId - String - userId of user making request.
      guid - String - unique id for the like object
      requestBody - null request body needed to satisfy the HTTP Post request
      Returns:
      void or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem updating the asset properties in the metadata repository or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • addCommentToAsset

      public GUIDResponse addCommentToAsset(String serverName, String userId, String guid, CommentRequestBody requestBody)
      Adds a comment to the asset.
      Parameters:
      serverName - name of the server instances for this request
      userId - String - userId of user making request.
      guid - String - unique id for the asset.
      requestBody - containing type of comment enum and the text of the comment.
      Returns:
      guid for new comment object or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem adding the asset properties to the metadata repository or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • addCommentReply

      public GUIDResponse addCommentReply(String serverName, String userId, String assetGUID, String commentGUID, CommentRequestBody requestBody)
      Adds a reply to a comment.
      Parameters:
      serverName - name of the server instances for this request
      userId - String - userId of user making request.
      assetGUID - String - unique id of asset that this chain of comments is linked.
      commentGUID - String - unique id for an existing comment. Used to add a reply to a comment.
      requestBody - containing type of comment enum and the text of the comment.
      Returns:
      guid for new comment object or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem adding the asset properties to the metadata repository or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • updateComment

      public VoidResponse updateComment(String serverName, String userId, String assetGUID, String commentGUID, CommentRequestBody requestBody)
      Update an existing comment.
      Parameters:
      serverName - name of the server instances for this request.
      userId - userId of user making request.
      assetGUID - unique identifier for the asset that the comment is attached to (directly or indirectly).
      commentGUID - unique identifier for the comment to change.
      requestBody - containing type of comment enum and the text of the comment.
      Returns:
      void or InvalidParameterException one of the parameters is null or invalid. PropertyServerException There is a problem updating the asset properties in the metadata repository. UserNotAuthorizedException the requesting user is not authorized to issue this request.
    • removeCommentFromAsset

      public VoidResponse removeCommentFromAsset(String serverName, String userId, String assetGUID, String commentGUID, NullRequestBody requestBody)
      Removes a comment added to the asset by this user.
      Parameters:
      serverName - name of the server instances for this request
      userId - String - userId of user making request.
      assetGUID - String - unique id for the asset object
      commentGUID - String - unique id for the comment object
      requestBody - null request body needed to satisfy the HTTP Post request
      Returns:
      void or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem updating the asset properties in the metadata repository or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • getMeaning

      public MeaningResponse getMeaning(String serverName, String userId, String guid)
      Return the full definition (meaning) of a term using the unique identifier of the glossary term.
      Parameters:
      serverName - name of the server instances for this request
      userId - userId of the user making the request.
      guid - unique identifier of the meaning.
      Returns:
      glossary term object or InvalidParameterException the userId is null or invalid or NoProfileForUserException the user does not have a profile or PropertyServerException there is a problem retrieving information from the property server(s) or UserNotAuthorizedException the requesting user is not authorized to issue this request.
    • getMeaningByName

      public MeaningsResponse getMeaningByName(String serverName, String userId, NameRequestBody requestBody, int startFrom, int pageSize)
      Return the full definition (meaning) of the terms exactly matching the supplied name.
      Parameters:
      serverName - name of the server instances for this request
      userId - the name of the calling user.
      requestBody - name of term.
      startFrom - index of the list to start from (0 for start)
      pageSize - maximum number of elements to return.
      Returns:
      list of glossary terms or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • findMeanings

      public MeaningsResponse findMeanings(String serverName, String userId, SearchStringRequestBody requestBody, int startFrom, int pageSize)
      Return the full definition (meaning) of the terms matching the supplied name.
      Parameters:
      serverName - name of the server instances for this request
      userId - the name of the calling user.
      requestBody - name of term. This may include wild card characters.
      startFrom - index of the list to start from (0 for start)
      pageSize - maximum number of elements to return.
      Returns:
      list of glossary terms or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • getAssetsByMeaning

      public GUIDListResponse getAssetsByMeaning(String serverName, String userId, String termGUID, int startFrom, int pageSize)
      Return the list of unique identifiers for assets that are linked to a specific (meaning) either directly or via fields in the schema.
      Parameters:
      serverName - name of the server instances for this request
      userId - the name of the calling user.
      termGUID - unique identifier of term.
      startFrom - index of the list to start from (0 for start)
      pageSize - maximum number of elements to return.
      Returns:
      asset guid list or InvalidParameterException the userId is null or invalid or PropertyServerException there is a problem retrieving information from the property server(s) or UserNotAuthorizedException the requesting user is not authorized to issue this request.
    • addLogMessageToAsset

      public VoidResponse addLogMessageToAsset(String serverName, String userId, String guid, LogRecordRequestBody requestBody)
      Creates an Audit log record for the asset. This log record is stored in the Asset's Audit Log.
      Parameters:
      serverName - name of the server instances for this request
      userId - String - userId of user making request.
      guid - String - unique id for the asset.
      requestBody - containing: connectorInstanceId (String - (optional) id of connector in use (if any)), connectionName (String - (optional) name of the connection (extracted from the connector)), connectorType (String - (optional) type of connector in use (if any)), contextId (String - (optional) function name, or processId of the activity that the caller is performing), message (log record content).
      Returns:
      void or InvalidParameterException - one of the parameters is null or invalid or PropertyServerException - there is a problem adding the log message to the audit log for this asset or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • createTag

      public GUIDResponse createTag(String serverName, String userId, InformalTagProperties requestBody)
      Creates a new informal tag and returns the unique identifier for it.
      Parameters:
      serverName - name of the server instances for this request
      userId - userId of user making request
      requestBody - contains the name of the tag and (optional) description of the tag
      Returns:
      guid for new tag or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • updateTagDescription

      public VoidResponse updateTagDescription(String serverName, String userId, String tagGUID, TagUpdateRequestBody requestBody)
      Updates the description of an existing tag (either private or public).
      Parameters:
      serverName - name of the server instances for this request
      userId - userId of user making request.
      tagGUID - unique id for the tag.
      requestBody - contains the name of the tag and (optional) description of the tag.
      Returns:
      void or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • deleteTag

      public VoidResponse deleteTag(String serverName, String userId, String tagGUID, NullRequestBody requestBody)
      Removes a tag from the repository. All the relationships to referenceables are lost.
      Parameters:
      serverName - name of the server instances for this request
      userId - userId of user making request.
      tagGUID - unique id for the tag.
      requestBody - null request body.
      Returns:
      void or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • getTag

      public InformalTagResponse getTag(String serverName, String userId, String guid)
      Return the tag for the supplied unique identifier (guid).
      Parameters:
      serverName - name of the server instances for this request
      userId - userId of the user making the request.
      guid - unique identifier of the tag.
      Returns:
      Tag object or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • getTagsByName

      public InformalTagsResponse getTagsByName(String serverName, String userId, NameRequestBody requestBody, int startFrom, int pageSize)
      Return the list of tags exactly matching the supplied name.
      Parameters:
      serverName - name of the server instances for this request
      userId - the name of the calling user.
      requestBody - name of tag.
      startFrom - index of the list to start from (0 for start)
      pageSize - maximum number of elements to return.
      Returns:
      tag list or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • getMyTagsByName

      public InformalTagsResponse getMyTagsByName(String serverName, String userId, NameRequestBody requestBody, int startFrom, int pageSize)
      Return the list of the calling user's private tags exactly matching the supplied name.
      Parameters:
      serverName - name of the server instances for this request
      userId - the name of the calling user.
      requestBody - name of tag.
      startFrom - index of the list to start from (0 for start)
      pageSize - maximum number of elements to return.
      Returns:
      tag list or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • findTags

      public InformalTagsResponse findTags(String serverName, String userId, SearchStringRequestBody requestBody, int startFrom, int pageSize)
      Return the list of tags containing the supplied string in either the name or description.
      Parameters:
      serverName - name of the server instances for this request
      userId - the name of the calling user.
      requestBody - name of tag. This may include wild card characters.
      startFrom - index of the list to start from (0 for start)
      pageSize - maximum number of elements to return.
      Returns:
      tag list or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • findMyTags

      public InformalTagsResponse findMyTags(String serverName, String userId, SearchStringRequestBody requestBody, int startFrom, int pageSize)
      Return the list of the calling user's private tags containing the supplied string in either the name or description.
      Parameters:
      serverName - name of the server instances for this request
      userId - the name of the calling user.
      requestBody - name of tag. This may include wild card characters.
      startFrom - index of the list to start from (0 for start)
      pageSize - maximum number of elements to return.
      Returns:
      tag list or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • addTagToAsset

      public VoidResponse addTagToAsset(String serverName, String userId, String assetGUID, String tagGUID, FeedbackRequestBody requestBody)
      Adds a tag (either private of public) to an asset.
      Parameters:
      serverName - name of the server instances for this request
      userId - userId of user making request.
      assetGUID - unique id for the asset.
      tagGUID - unique id of the tag.
      requestBody - feedback request body.
      Returns:
      void or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • addTagToElement

      public VoidResponse addTagToElement(String serverName, String userId, String elementGUID, String tagGUID, FeedbackRequestBody requestBody)
      Adds a tag (either private of public) to an element attached to an asset - such as schema element, glossary term, ...
      Parameters:
      serverName - name of the server instances for this request
      userId - userId of user making request.
      elementGUID - unique id for the element.
      tagGUID - unique id of the tag.
      requestBody - feedback request body.
      Returns:
      void or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • removeTagFromAsset

      public VoidResponse removeTagFromAsset(String serverName, String userId, String assetGUID, String tagGUID, NullRequestBody requestBody)
      Removes a tag from the asset that was added by this user.
      Parameters:
      serverName - name of the server instances for this request
      userId - userId of user making request.
      assetGUID - unique id for the asset.
      tagGUID - unique id for the tag.
      requestBody - null request body needed for correct protocol exchange.
      Returns:
      void or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • removeTagFromElement

      public VoidResponse removeTagFromElement(String serverName, String userId, String elementGUID, String tagGUID, NullRequestBody requestBody)
      Removes a tag from an element attached to an asset - such as schema element, glossary term, ... that was added by this user.
      Parameters:
      serverName - name of the server instances for this request
      userId - userId of user making request.
      elementGUID - unique id for the element.
      tagGUID - unique id for the tag.
      requestBody - null request body needed for correct protocol exchange.
      Returns:
      void or InvalidParameterException - one of the parameters is invalid or PropertyServerException - there is a problem retrieving information from the property server(s) or UserNotAuthorizedException - the requesting user is not authorized to issue this request.
    • getAssetsByTag

      public GUIDListResponse getAssetsByTag(String serverName, String userId, String tagGUID, int startFrom, int pageSize)
      Return the list of unique identifiers for assets that are linked to a specific tag either directly, or via one of its schema elements.
      Parameters:
      serverName - name of the server instances for this request
      userId - the name of the calling user.
      tagGUID - unique identifier of tag.
      startFrom - index of the list to start from (0 for start)
      pageSize - maximum number of elements to return.
      Returns:
      asset guid list or InvalidParameterException the userId is null or invalid or PropertyServerException there is a problem retrieving information from the property server(s) or UserNotAuthorizedException the requesting user is not authorized to issue this request.