Package org.digidoc4j.impl.asic
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.digidoc4j.Container
Container.DocumentType
-
Constructor Summary
ConstructorsConstructorDescriptionAsicContainer
(InputStream stream, String containerType) Deprecated.Deprecated for removal.AsicContainer
(InputStream stream, Configuration configuration, String containerType) Deprecated.Deprecated for removal.AsicContainer
(String containerPath, String containerType) Deprecated.Deprecated for removal.AsicContainer
(String containerPath, Configuration configuration, String containerType) Deprecated.Deprecated for removal.AsicContainer
(AsicParseResult containerParseResult, Configuration configuration, String containerType) Deprecated.Deprecated for removal. -
Method Summary
Modifier and TypeMethodDescriptionaddDataFile
(File file, String mimeType) Adds a data file from the file system to the container.addDataFile
(InputStream inputStream, String fileName, String mimeType) Adds a data file from the input stream (i.e. the date file content can be read from the internal memory buffer).addDataFile
(String path, String mimeType) Adds a data file from the file system to the container.void
addDataFile
(DataFile dataFile) Adds the specified data file to the container.void
addSignature
(Signature signature) Adds a new signature to the container.void
extendSignatureProfile
(SignatureProfile profile) Extends profile of all signatures to SignatureProfilevoid
extendSignatureProfile
(SignatureProfile profile, List<Signature> signaturesToExtend) Extends profile of selected signatures to SignatureProfileGets ConfigurationReturns the list of data files in the container.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.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.Returns the list of signatures in the container.getType()
Returns the type of the container.boolean
Deprecated.Deprecated for removalvoid
removeDataFile
(DataFile file) Removes the data file from the container.void
removeSignature
(Signature signature) Removes the signature from the containersaveAsFile
(String filePath) Saves the container to the specified location.Saves the container as a stream.void
Deprecated.Deprecated for removal.validate()
Validate containervalidateAt
(Date validationTime) Validate container against the specified validation time.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.digidoc4j.Container
addTimestamp, getTimestamps, getTimeStampToken, removeTimestamp, save, setTimeStampToken
-
Constructor Details
-
AsicContainer
Deprecated.Deprecated for removal. UseContainerOpener.open(String)
orContainerBuilder.fromExistingFile(String)
instead.ASicContainer constructor- Parameters:
containerPath
- pathcontainerType
- type
-
AsicContainer
@Deprecated public AsicContainer(String containerPath, Configuration configuration, String containerType) Deprecated.Deprecated for removal. UseContainerOpener.open(String, Configuration)
orContainerBuilder.fromExistingFile(String)
instead.ASicContainer constructor- Parameters:
containerPath
- pathconfiguration
- configurationcontainerType
- type
-
AsicContainer
Deprecated.Deprecated for removal. UseContainerOpener.open(InputStream, Configuration)
orContainerBuilder.fromStream(InputStream)
instead.ASicContainer constructor- Parameters:
stream
- input streamcontainerType
- type
-
AsicContainer
@Deprecated public AsicContainer(InputStream stream, Configuration configuration, String containerType) Deprecated.Deprecated for removal. UseContainerOpener.open(InputStream, Configuration)
orContainerBuilder.fromStream(InputStream)
instead.ASicContainer constructor- Parameters:
stream
- input streamconfiguration
- configurationcontainerType
- type
-
AsicContainer
@Deprecated public AsicContainer(AsicParseResult containerParseResult, Configuration configuration, String containerType) Deprecated.Deprecated for removal. UseAsicContainer(AsicParseResult, Configuration)
instead.ASicContainer constructor- Parameters:
containerParseResult
- container parsed resultconfiguration
- configurationcontainerType
- container type
-
-
Method Details
-
validate
Description copied from interface:Container
Validate container -
validateAt
Description copied from interface:org.digidoc4j.impl.ValidatableContainer
Validate container against the specified validation time.- Specified by:
validateAt
in interfaceorg.digidoc4j.impl.ValidatableContainer
- Parameters:
validationTime
- validation time- Returns:
- container validation result
-
saveAsFile
Description copied from interface:Container
Saves the container to the specified location.- Specified by:
saveAsFile
in interfaceContainer
- Parameters:
filePath
- file name and path.
-
getConfiguration
Description copied from interface:Container
Gets Configuration- Specified by:
getConfiguration
in interfaceContainer
- Returns:
- Configuration
-
saveAsStream
Description copied from interface:Container
Saves the container as a stream.- Specified by:
saveAsStream
in interfaceContainer
- Returns:
- stream of the container.
-
setType
Deprecated.Deprecated for removal. Use appropriate constructor instead.Sets container type.- Parameters:
containerType
- container type
-
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. -
getDataFiles
Description copied from interface:Container
Returns the list of data files in the container.- Specified by:
getDataFiles
in interfaceContainer
- Returns:
- list of data files in the container
-
addDataFile
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 interfaceContainer
- Parameters:
path
- data file to be added to the containermimeType
- MIME type of the data file, for example 'text/plain' or 'application/msword'- Returns:
- data file
-
addDataFile
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 interfaceContainer
- Parameters:
inputStream
- input stream from where data is readfileName
- data file name in the containermimeType
- MIME type of the data file, for example 'text/plain' or 'application/msword'- Returns:
- data file
-
addDataFile
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 interfaceContainer
- Parameters:
file
- data file to be added to the containermimeType
- MIME type of the data file, for example 'text/plain' or 'application/msword'- Returns:
- data file
-
addDataFile
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 interfaceContainer
- Parameters:
dataFile
- data file to be added to the container
-
addSignature
Description copied from interface:Container
Adds a new signature to the container.- Specified by:
addSignature
in interfaceContainer
- Parameters:
signature
- signature to be added.
-
isTimestampTokenDefined
Deprecated.Deprecated for removalChecks if timestamp token is defined- Returns:
true
if timestamp token is defined, otherwisefalse
-
extendSignatureProfile
Description copied from interface:Container
Extends profile of all signatures to SignatureProfile- Specified by:
extendSignatureProfile
in interfaceContainer
- Parameters:
profile
- signature profile- See Also:
-
extendSignatureProfile
Description copied from interface:Container
Extends profile of selected signatures to SignatureProfile- Specified by:
extendSignatureProfile
in interfaceContainer
- Parameters:
profile
- signature profilesignaturesToExtend
- signatures selected for extension- See Also:
-
getExtensionValidationErrors
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 profilesignaturesToExtend
- 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
Description copied from interface:Container
Removes the signature from the container- Specified by:
removeSignature
in interfaceContainer
- Parameters:
signature
- signature to be removed.
-
removeDataFile
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 interfaceContainer
- Parameters:
file
- data file to be removed from the container.
-
getSignatures
Description copied from interface:Container
Returns the list of signatures in the container.- Specified by:
getSignatures
in interfaceContainer
- Returns:
- list of signatures in the container
-
getContainerParseResult
-