Class TbsDocument

java.lang.Object
se.idsec.signservice.integration.document.TbsDocument
All Implemented Interfaces:
Serializable, Extensible

public class TbsDocument extends Object implements Extensible, Serializable
Represents a document that is to be signed along with the per-document requirements and parameters.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
See Also:
  • Constructor Details

  • Method Details

    • setMimeType

      public void setMimeType(String mimeType)
      The MIME type of the document that is to be signed. See DocumentType for the supported types.
      Parameters:
      mimeType - the document MIME type
      See Also:
    • setMimeType

      public void setMimeType(DocumentType documentType)
      The document type of the document that is to be signed.
      Parameters:
      documentType - the document type
    • getExtension

      public Extension getExtension()
      Returns the extension parameters for the instance.
      Specified by:
      getExtension in interface Extensible
      Returns:
      the extension, or null if no extensions are set
    • setExtension

      public void setExtension(Extension extension)
      Assigns the extension parameters for the instance.
      Specified by:
      setExtension in interface Extensible
      Parameters:
      extension - the extension
    • builder

      public static TbsDocument.TbsDocumentBuilder builder()
    • toBuilder

      public TbsDocument.TbsDocumentBuilder toBuilder()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setId

      public void setId(String id)
      The unique ID for this document (within the current request). If not supplied, the SignService Integration Service will generate one.
      Parameters:
      id - unique ID for this document
    • getId

      public String getId()
      The unique ID for this document (within the current request). If not supplied, the SignService Integration Service will generate one.
      Returns:
      unique ID for this document, or null if none has been set
    • setContent

      public void setContent(String content)
      The Base64-encoded byte string that is the content of the document that is to be signed.
      Parameters:
      content - the document content (Base64-encoded)
    • getContent

      public String getContent()
      The Base64-encoded byte string that is the content of the document that is to be signed.
      Returns:
      the document content (Base64-encoded)
    • setContentReference

      public void setContentReference(String contentReference)
      A content reference may be used instead of supplying the actual content (setContent(String)). This is typically something that is useful when handling large documents. However, this feature is only useable if:
      • The SignService Integration Service profile is in "stateful mode", and,
      • the document has previously been cached by the SignService Integration Service.

      Typically, this is used if the SignService Integration Service is running as a standalone service. When using the API as an integrated Java library in the service it makes less sense.

      Parameters:
      contentReference - a reference to the content
    • getContentReference

      public String getContentReference()
      A content reference may be used instead of supplying the actual content (setContent(String)). This is typically something that is useful when handling large documents. However, this feature is only useable if:
      • The SignService Integration Service profile is in "stateful mode", and,
      • the document has previously been cached by the SignService Integration Service.

      Typically, this is used if the SignService Integration Service is running as a standalone service. When using the API as an integrated Java library in the service it makes less sense.

      Returns:
      a reference to the content or null
    • getMimeType

      public String getMimeType()
      The MIME type of the document that is to be signed. See DocumentType for the supported types.
      Returns:
      the MIME type
    • setProcessingRules

      public void setProcessingRules(String processingRules)
      Optional processing rules used by the sign service to process sign data.
      Parameters:
      processingRules - the processing rules
    • getProcessingRules

      public String getProcessingRules()
      Optional processing rules used by the sign service to process sign data.
      Returns:
      the processing rules identifier, or null if none has been set
    • setAdesRequirement

      public void setAdesRequirement(TbsDocument.EtsiAdesRequirement adesRequirement)
      Specifies of the resulting signature should use an ETSI AdES format.
      Parameters:
      adesRequirement - the AdES requirement
    • getAdesRequirement

      public TbsDocument.EtsiAdesRequirement getAdesRequirement()
      Specifies of the resulting signature should use an ETSI AdES format.
      Returns:
      the AdES requirement or null if no AdES requirement exists
    • setVisiblePdfSignatureRequirement

      public void setVisiblePdfSignatureRequirement(VisiblePdfSignatureRequirement visiblePdfSignatureRequirement)
      If the document that is to be signed is a PDF document, the sign requester may require the resulting PDF to have a "visible PDF signature". The VisiblePdfSignatureRequirement specifies how this visible indication should be included.

      Note that a signature policy may have a default visible PDF signature requirement configued, which means that the visiblePdfSignatureRequirement does not have to be assigned, unless the signature policy default should be overridden. For the special case where a signature policy has a default requirement configured, and the caller does not want a visible PDF signature to be included at all, an VisiblePdfSignatureRequirement instance with an extension VisiblePdfSignatureRequirement.NULL_INDICATOR_EXTENSION set to true should be assigned (see VisiblePdfSignatureRequirement.createNullVisiblePdfSignatureRequirement()).

      Parameters:
      visiblePdfSignatureRequirement - requirement for visible PDF signatures
    • getVisiblePdfSignatureRequirement

      public VisiblePdfSignatureRequirement getVisiblePdfSignatureRequirement()
      If the document that is to be signed is a PDF document, the sign requester may require the resulting PDF to have a "visible PDF signature". The VisiblePdfSignatureRequirement specifies how this visible indication should be included.

      Note that a signature policy may have a default visible PDF signature requirement configued, which means that the visiblePdfSignatureRequirement does not have to be assigned, unless the signature policy default should be overridden. For the special case where a signature policy has a default requirement configured, and the caller does not want a visible PDF signature to be included at all, an VisiblePdfSignatureRequirement instance with an extension VisiblePdfSignatureRequirement.NULL_INDICATOR_EXTENSION set to true should be assigned (see VisiblePdfSignatureRequirement.createNullVisiblePdfSignatureRequirement()).

      Returns:
      requirement for visible PDF signatures, or null