Class DDocContainer

java.lang.Object
org.digidoc4j.impl.ddoc.DDocContainer
All Implemented Interfaces:
Serializable, Container

public class DDocContainer extends Object implements Container
Offers functionality for handling DDoc containers.
See Also:
  • Constructor Details

    • DDocContainer

      public DDocContainer(DDocFacade ddoc4jFacade)
      DDocContainer constructor.
      Parameters:
      ddoc4jFacade -
  • Method Details

    • addDataFile

      public DataFile addDataFile(String path, String mimeType)
      Description copied from interface: Container
      Adds a data file from the file system to the container.

      Note: Data files can be added to a container only after all signatures have been removed.

      Specified by:
      addDataFile in interface Container
      Parameters:
      path - data file to be added to the container
      mimeType - MIME type of the data file, for example 'text/plain' or 'application/msword'
      Returns:
      data file
    • addDataFile

      public DataFile addDataFile(InputStream is, String fileName, String mimeType)
      Description copied from interface: Container
      Adds a data file from the input stream (i.e. the date file content can be read from the internal memory buffer).

      Note: Data files can be added to a container only after all signatures have been removed.

      Specified by:
      addDataFile in interface Container
      Parameters:
      is - input stream from where data is read
      fileName - data file name in the container
      mimeType - MIME type of the data file, for example 'text/plain' or 'application/msword'
      Returns:
      data file
    • addDataFile

      public DataFile addDataFile(File file, String mimeType)
      Description copied from interface: Container
      Adds a data file from the file system to the container.

      Note: Data files can be added to a container only after all signatures have been removed.

      Specified by:
      addDataFile in interface Container
      Parameters:
      file - data file to be added to the container
      mimeType - MIME type of the data file, for example 'text/plain' or 'application/msword'
      Returns:
      data file
    • addDataFile

      public void addDataFile(DataFile dataFile)
      Description copied from interface: Container
      Adds the specified data file to the container.

      Note: Data files can be added to a container only after all signatures have been removed.

      Specified by:
      addDataFile in interface Container
      Parameters:
      dataFile - data file to be added to the container
    • addSignature

      public void addSignature(Signature signature)
      Description copied from interface: Container
      Adds a new signature to the container.
      Specified by:
      addSignature in interface Container
      Parameters:
      signature - signature to be added.
    • getDataFiles

      public List<DataFile> getDataFiles()
      Description copied from interface: Container
      Returns the list of data files in the container.
      Specified by:
      getDataFiles in interface Container
      Returns:
      list of data files in the container
    • getType

      public String getType()
      Returns container type "DDOC"
      Specified by:
      getType in interface Container
      Returns:
      type of the container
    • getSignatures

      public List<Signature> getSignatures()
      Description copied from interface: Container
      Returns the list of signatures in the container.
      Specified by:
      getSignatures in interface Container
      Returns:
      list of signatures in the container
    • removeDataFile

      public void removeDataFile(DataFile file)
      Description copied from interface: Container
      Removes the data file from the container.

      Note: Data files can be removed from a container only after all signatures have been removed.

      Specified by:
      removeDataFile in interface Container
      Parameters:
      file - data file to be removed from the container.
    • removeSignature

      public void removeSignature(Signature signature)
      Description copied from interface: Container
      Removes the signature from the container
      Specified by:
      removeSignature in interface Container
      Parameters:
      signature - signature to be removed.
    • extendSignatureProfile

      public void extendSignatureProfile(SignatureProfile profile)
      Description copied from interface: Container
      Extends profile of all signatures to SignatureProfile
      Specified by:
      extendSignatureProfile in interface Container
      Parameters:
      profile - signature profile
      See Also:
    • extendSignatureProfile

      public void extendSignatureProfile(SignatureProfile profile, List<Signature> signaturesToExtend)
      Description copied from interface: Container
      Extends profile of selected signatures to SignatureProfile
      Specified by:
      extendSignatureProfile in interface Container
      Parameters:
      profile - signature profile
      signaturesToExtend - signatures selected for extension
      See Also:
    • saveAsFile

      public File saveAsFile(String fileName)
      Description copied from interface: Container
      Saves the container to the specified location.
      Specified by:
      saveAsFile in interface Container
      Parameters:
      fileName - file name and path.
    • saveAsStream

      public InputStream saveAsStream()
      Description copied from interface: Container
      Saves the container as a stream.
      Specified by:
      saveAsStream in interface Container
      Returns:
      stream of the container.
    • validate

      public ContainerValidationResult validate()
      Description copied from interface: Container
      Validate container
      Specified by:
      validate in interface Container
      Returns:
      validation result
    • addTimestamp

      public void addTimestamp(Timestamp timestamp)
      Description copied from interface: Container
      Adds a new timestamp token covering the contents of this container.
      Specified by:
      addTimestamp in interface Container
      Parameters:
      timestamp - timestamp to add to this container
    • removeTimestamp

      public void removeTimestamp(Timestamp timestamp)
      Description copied from interface: Container
      Removes the specified timestamp token from this container.

      Note: A timestamp token can be removed from a container only if the container does not contain any other timestamp tokens that cover the timestamp token to be removed.

      Specified by:
      removeTimestamp in interface Container
      Parameters:
      timestamp - timestamp token to remove from this container
    • setTimeStampToken

      @Deprecated public void setTimeStampToken(DataFile timeStampToken)
      Deprecated.
      Description copied from interface: Container
      Adds timestamp token
      Specified by:
      setTimeStampToken in interface Container
      Parameters:
      timeStampToken - timestamp token
    • getTimeStampToken

      @Deprecated public DataFile getTimeStampToken()
      Deprecated.
      Description copied from interface: Container
      Returns timestamp token
      Specified by:
      getTimeStampToken in interface Container
      Returns:
      TimestampToken
    • getConfiguration

      public Configuration getConfiguration()
      Description copied from interface: Container
      Gets Configuration
      Specified by:
      getConfiguration in interface Container
      Returns:
      Configuration
    • save

      public void save(OutputStream out)
      Saves the container to the java.io.OutputStream.
      Specified by:
      save in interface Container
      Parameters:
      out - output stream.
      See Also:
    • getDDoc4JFacade

      public DDocFacade getDDoc4JFacade()
      This method returns Returns DDocFacade. DDocFacade for handling data files and signatures in a container.
      Returns:
      DDocFacade.
    • getFormat

      public String getFormat()
      Returns ddoc format
      Returns:
      format as string