Interface IFileDataPersistenceAdapter<PersistenceContext, Entity>

Type Parameters:
PersistenceContext - Type of the persistence context used for accessing the persistence layer.
Entity - Type of the entity containing the file data.
All Superinterfaces:
Serializable
All Known Subinterfaces:
IEntityFileSystemPersistenceAdapter<PersistenceContext, Entity, Scope>
All Known Implementing Classes:
FileEntityPersistenceAdapter, FileEntityViewPersistenceAdapter, FileProvidingEntityAdapter, FormThemeFileViewPersistenceAdapter

public interface IFileDataPersistenceAdapter<PersistenceContext, Entity> extends Serializable
A persistence adapter for entities that allows access to a binary file. Allows read and write access to the file data. All changes must be synchronized immediately with persistence layer.

Usually, a file is represented by a subtype of IFileEntity. Some entities have an additional wrapper, such as IFileProviding with a 1:1 relationship to a IFileEntity.

  • Method Details

    • openForRead

      InputStream openForRead(Supplier<PersistenceContext> persistenceContextFactory, Entity entity) throws IOException
      Opens an input stream to the content of a file entity.
      Parameters:
      persistenceContextFactory - Persistence context factory to use for accessing the persistence layer.
      entity - The entity to open.
      Returns:
      An input stream to the file content.
      Throws:
      IOException - If an error occurs while opening the file.
    • openForWrite

      OutputStream openForWrite(Supplier<PersistenceContext> persistenceContextFactory, Entity entity) throws IOException
      Opens an output stream for changing the content of a file entity. This should also update the file metadata, such as the user who last modified the file and the last modified time.
      Parameters:
      persistenceContextFactory - Persistence context factory to use for accessing the persistence layer.
      entity - The entity to open.
      Returns:
      An output stream to the file content.
      Throws:
      IOException - If an error occurs while opening the file.