Package com.collibra.dgc.core.api.component.instance

# Interface AttachmentApi

public interface AttachmentApi
Contains all api operations for handling attachments.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Attachment`
  `addAttachment(AddAttachmentRequest addAttachmentRequest)`
  Create a new attachment and persist it.
  `boolean`
  `exists(UUID attachmentId)`
  Returns true if an attachment with given ID exists.
  `PagedResponse<Attachment>`
  `findAttachments(FindAttachmentsRequest findAttachmentsRequest)`
  Finds the attachments according to the provided request.
  `Attachment`
  `getAttachment(UUID attachmentId)`
  Retrieve the attachment with the given id.
  `InputStream`
  `getAttachmentContent(UUID id)`
  Gets the content of the file contained by attachment identified by the given UUID.
  `void`
  `removeAttachment(UUID id)`
  Removes the attachment identified by the given UUID.

- ## Method Details

  - ### addAttachment

    Attachment addAttachment(AddAttachmentRequest addAttachmentRequest)
    Create a new attachment and persist it.
    Parameters:
      `addAttachmentRequest` - Contains all information to be able to create a new attachment.
    Returns:
      The created `Attachment`

  - ### getAttachment

    Attachment getAttachment(UUID attachmentId)
    Retrieve the attachment with the given id.
    Parameters:
      `attachmentId` - the attachment id
    Returns:
      the attachment

  - ### findAttachments

    @SecurityAuditMethod(resultFormatter=com.collibra.dgc.core.api.internal.security.audit.formatter.PagedResponseFormatter.class) PagedResponse<Attachment> findAttachments(FindAttachmentsRequest findAttachmentsRequest)
    Finds the attachments according to the provided request.
    Parameters:
      `findAttachmentsRequest` - the request
    Returns:
      the attachments

  - ### exists

    boolean exists(UUID attachmentId)
    Returns true if an attachment with given ID exists.
    Parameters:
      `attachmentId` - the ID of the attachment
    Returns:
      true if an attachment with given ID exists, `false` otherwise

  - ### removeAttachment

    void removeAttachment(UUID id)
    Removes the attachment identified by the given UUID.
    Parameters:
      `id` - the unique identifier of the attachment to delete

  - ### getAttachmentContent

    InputStream getAttachmentContent(UUID id)
    Gets the content of the file contained by attachment identified by the given UUID.
    Parameters:
      `id` - the UUID of the attachment
    Returns:
      the content as `InputStream`
    Throws:
      `ApiException` - in case no transaction is defined.