Class AsicContainer

java.lang.Object
org.digidoc4j.impl.asic.AsicContainer
All Implemented Interfaces:
Serializable, Container, org.digidoc4j.impl.ValidatableContainer
Direct Known Subclasses:
AsicEContainer, AsicSContainer

public abstract class AsicContainer extends Object implements Container, org.digidoc4j.impl.ValidatableContainer
Created by Andrei on 7.11.2017.
See Also:
  • Constructor Details

  • Method Details

    • validate

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

      public ContainerValidationResult validateAt(Date validationTime)
      Description copied from interface: org.digidoc4j.impl.ValidatableContainer
      Validate container against the specified validation time.
      Specified by:
      validateAt in interface org.digidoc4j.impl.ValidatableContainer
      Parameters:
      validationTime - validation time
      Returns:
      container validation result
    • saveAsFile

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

      public Configuration getConfiguration()
      Description copied from interface: Container
      Gets Configuration
      Specified by:
      getConfiguration in interface Container
      Returns:
      Configuration
    • 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.
    • setType

      @Deprecated public void setType(String containerType)
      Deprecated.
      Deprecated for removal. Use appropriate constructor instead.
      Sets container type.
      Parameters:
      containerType - container type
    • getType

      public String getType()
      Description copied from interface: Container
      Returns the type of the container. The known container types are the following: Custom implementations of this interface may return other custom types.
      Specified by:
      getType in interface Container
      Returns:
      type of the container
    • 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
    • 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 inputStream, 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:
      inputStream - 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.
    • isTimestampTokenDefined

      @Deprecated public boolean isTimestampTokenDefined()
      Deprecated.
      Deprecated for removal
      Checks if timestamp token is defined
      Returns:
      true if timestamp token is defined, otherwise false
    • 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:
    • getExtensionValidationErrors

      public Map<String,DigiDoc4JException> getExtensionValidationErrors(SignatureProfile targetProfile)
      Checks whether all the signatures in the container can be extended to target profile and returns the map with the unique ID-s of the signatures that cannot be extended.
      Parameters:
      targetProfile - target profile
      Returns:
      map of uniqueId->exception pairs for the signatures that cannot be extended to target profile
    • getExtensionValidationErrors

      public Map<String,DigiDoc4JException> getExtensionValidationErrors(SignatureProfile targetProfile, List<Signature> signaturesToExtend)
      Checks whether the selected signatures in the container can be extended to target profile and returns the map with the unique ID-s of the signatures that cannot be extended, together with exceptions wrapped into DigiDoc4JException.
      Parameters:
      targetProfile - target profile
      signaturesToExtend - signatures selected for extension
      Returns:
      map of uniqueId->exception pairs for the signatures that cannot be extended to target profile. In case of a successful validation, the map is empty.
    • 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.
    • 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.
    • 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
    • getContainerParseResult

      public AsicParseResult getContainerParseResult()