Interface DocumentService

All Superinterfaces:
Service

public interface DocumentService extends Service
Provides methods to update and delete documents. You can only update the latest version of a document.
  • Method Details

    • newDocumentVersion

      @Deprecated DocumentVersion newDocumentVersion(String documentVersionId)
      Deprecated.
      as of 19R3.5, replaced by newVersionWithId(String)
      Instantiates a DocumentVersion and sets the ID, major version, and minor version. Use this method to create an instance of an existing version of a document for updating or deleting. While you can delete any document version, you can only update the latest version of a document. If you want to update a document, we recommend newDocumentWithId(String).

      Parameters:
      documentVersionId - the document ID, major version, and minor version, in the format id_major_minor. For example, 951_0_1.
      Returns:
      a data-holder for an existing version of a document
    • newDocumentWithId

      DocumentVersion newDocumentWithId(String docId)
      Instantiates a DocumentVersion with the given id and sets the version to the latest version of the document.

      Use this method to create an instance of the latest version of an existing document. You can then update or delete this document version.

      Parameters:
      docId - the document ID
      Returns:
      a data-holder for the latest version of an existing document
    • saveDocumentVersions

      SaveDocumentVersionsResponse saveDocumentVersions(List<DocumentVersion> documentVersions)
      Save the specified DocumentVersions. After updating the latest version of a document, use this method to save the document.

      This saves the DocumentVersions regardless of the current user's access to that DocumentVersion.

      The total number of DocumentVersions in the input list cannot exceed 500.

      This is an all-or-nothing operation. If one or more documents fail to save, users see an error message and the operation is rolled back.

      Parameters:
      documentVersions - List of DocumentVersions to save
      Returns:
      the response of the save process. See SaveDocumentVersionsResponse for more information.
    • deleteDocumentVersions

      DeleteDocumentVersionsResponse deleteDocumentVersions(List<DocumentVersion> documentVersions)
      Delete the specified List of DocumentVersions.

      A delete can be either a single version delete or document delete. If an input DocumentVersion has no major version and no minor version, that's an indication this is a complete document delete. If the input DocumentVersion has a major and minor version, that's an indication this is a document version delete.

      This is an all-or-nothing operation. If one or more documents fail to delete, users see an error message and the operation is rolled back.

      Parameters:
      documentVersions - List of DocumentVersions to delete
      Returns:
      the response of the delete process. See DeleteDocumentVersionsResponse for more information.
    • newVersionWithId

      DocumentVersion newVersionWithId(String documentVersionId)
      Instantiates a DocumentVersion and sets the ID, major version, and minor version. Use this method to create an instance of an existing version of a document for updating or deleting. While you can delete any document version, you can only update the latest version of a document.

      To update a document, we recommend using newDocumentWithId(String).

      Parameters:
      documentVersionId - the document ID, major version, and minor version, in the format id_major_minor. For example, 951_0_1.
      Returns:
      a data-holder for an existing version of a document
    • newDocument

      DocumentVersion newDocument()
      Instantiates a new, empty DocumentVersion. Use this method to create an instance of a new document and its first version.
      Returns:
      a data-holder for a new document
    • newVersion

      DocumentVersion newVersion(String docId)
      Instantiates a DocumentVersion and sets the document ID. Use this method to create a new version for an existing document. Existing documents can be identified by the docId.
      Parameters:
      docId - the ID of the existing document
      Returns:
      a data-holder for a new version of an existing document
    • newDocumentSourceFileReference

      DocumentSourceFileReference newDocumentSourceFileReference(ConnectionContext connectionContext, String documentVersionId)
      Instantiates a DocumentSourceFileReference and sets the ID, major and minor version.
      Parameters:
      connectionContext - contains contextual connection information
      documentVersionId - the document ID, major version, and minor version, in the format id_major_minor. For example, 951_0_1.
      Returns:
      a data-holder for a source file DocumentSourceFileReference
    • newDocumentRenditionFileReference

      DocumentRenditionFileReference newDocumentRenditionFileReference(ConnectionContext connectionContext, String documentVersionId, String renditionTypeName)
      Instantiates a DocumentRenditionFileReference and sets the rendition type, ID, major and minor version.
      Parameters:
      connectionContext - contains contextual connection information
      documentVersionId - the document ID, major version, and minor version, in the format id_major_minor. For example, 951_0_1.
      renditionTypeName - name of rendition type
      Returns:
      a data-holder for a rendition file DocumentRenditionFileReference
    • newDocumentAttachmentFileReference

      DocumentAttachmentFileReference newDocumentAttachmentFileReference(ConnectionContext connectionContext, String attachmentId)
      Instantiates a DocumentAttachmentFileReference and sets the ID.
      Parameters:
      connectionContext - contains contextual connection information
      attachmentId - the attachment ID. For example, 952.
      Returns:
      a data-holder for an attachment file DocumentAttachmentFileReference
    • newDocumentAttachment

      DocumentAttachment newDocumentAttachment(FileReference fileReference, String docId)
      Instantiates a DocumentAttachment and sets docId and fileReference.
      Parameters:
      fileReference - file reference pointing to the original file
      docId - ID of the document which the attachment is associate with
      Returns:
      instantiated DocumentAttachment
    • newDocumentRendition

      DocumentRendition newDocumentRendition(FileReference fileReference, String docVersion, String renditionTypeName)
      Instantiates a DocumentRendition and sets docId and fileReference.
      Parameters:
      fileReference - file reference pointing to the original file
      docVersion - version of the document which the rendition is associate with. For example, 1_0_1.
      renditionTypeName - rendition type name of the new rendition
      Returns:
      instantiated DocumentRendition
    • createDocuments

      SaveDocumentVersionsResponse createDocuments(List<DocumentVersion> documentVersions)
      Creates new documents. After constructing the first version of the new documents, use this method to save the new documents and first version. This is an all-or-nothing operation. If one or more documents fail to save, users see an error message and the operation rolls back.
      Parameters:
      documentVersions - list of DocumentVersions to create
      Returns:
      the response of the save process. See SaveDocumentVersionsResponse for more information.
    • migrateDocumentVersions

      SaveDocumentVersionsResponse migrateDocumentVersions(List<DocumentVersion> documentVersions)
      Creates new document-versions for existing documents. After constructing the new versions of existing documents, use this method to create them. This is an all-or-nothing operation. If one or more documents fail to save, users see an error message and the operation rolls back.
      Parameters:
      documentVersions - list of DocumentVersions to create
      Returns:
      the response of the save process. See SaveDocumentVersionsResponse for more information.
    • createAttachments

      SaveDocumentVersionsResponse createAttachments(List<? extends SharedAttachment> sharedAttachments)
      Creates new attachment- or attachment-versions for a document or an object record. After constructing the new attachments, use this method to create them. This is an all-or-nothing operation. If one or more attachment versions fail to save, users see an error message and the operation rolls back.
      Parameters:
      sharedAttachments - list of SharedAttachment or its subclasses to create
      Returns:
      the response of the save process. See SaveDocumentVersionsResponse for more information.
    • createRenditions

      SaveDocumentVersionsResponse createRenditions(List<DocumentRendition> documentRenditions)
      Creates new renditions for a document. After constructing the new renditions, use this method to create them. This is an all-or-nothing operation. If one or more renditions fail to save, users see an error message and the operation rolls back.
      Parameters:
      documentRenditions - list of DocumentRendition to create
      Returns:
      the response of the save process. See SaveDocumentVersionsResponse for more information.