Class FileAPI

java.lang.Object
de.xima.fc.api.ASubAPI
de.xima.fc.api.file.FileAPI

public class FileAPI extends ASubAPI
API class for interaction with files.
Author:
XIMA MEDIA GmbH
  • Constructor Details

    • FileAPI

      public FileAPI()
  • Method Details

    • getFileStream

      public <E extends IFileDataEntity<?>, T extends IFileProviding<?, E>> InputStream getFileStream(UserContext uc, T entity) throws FileNotFoundException
      Method for downloading a file by the Attachment ID.
      Parameters:
      uc - UserContext the user context in which the action is to be performed.
      entity - IFileDataEntity the searched file.
      Returns:
      InputStream on the searched file.
      Throws:
      FileNotFoundException - if the file operation couldn't executed successful and a error occurs.
      Since:
      2.4.3
    • getFileStream

      public <D extends IFileDataEntity<F>, F extends IKeyDependentFileEntity<E, D>, E extends IFileMapProviding<F, D>> InputStream getFileStream(UserContext uc, E entity, String fileKey)
      Returns the file data of a file belonging to the given entity with the given file key. If the file is not cache-able or not yet cached it will be read from the database otherwise it will be retrieved from the file cache.
      Type Parameters:
      E - file map providing base entity type
      D - file data entity type
      F - file entity type
      Parameters:
      uc - user context for database transactions.
      entity - that owns the file
      fileKey - key identifying the the file entity
      Returns:
      file data of the request file as an input stream.
      Since:
      8.0.0
    • getFileStreamFromFileEntity

      public <F extends IFileEntity<?, ?>> InputStream getFileStreamFromFileEntity(UserContext uc, F fileEntity)
      Returns the file data of the given file entity. If the file is not cache-able or not yet cached it will be read from the database otherwise it will be retrieved from the file cache.
      Type Parameters:
      F - file entity type
      Parameters:
      uc - user context for database transactions.
      fileEntity - that holds the file data
      Returns:
      file data of the request file as an input stream.
      Since:
      8.0.0
    • getFileEntityStream

      public <T extends IFileEntity<?, ?>> InputStream getFileEntityStream(UserContext uc, T fileEntity) throws FileNotFoundException
      Throws:
      FileNotFoundException
    • getFileData

      public <E extends IFileDataEntity<?>, T extends IFileProviding<?, E>> byte[] getFileData(UserContext uc, T entity) throws IOException
      Throws:
      IOException
    • getFileData

      public <D extends IFileDataEntity<F>, F extends IKeyDependentFileEntity<E, D>, E extends IFileMapProviding<F, D>> byte[] getFileData(UserContext uc, E entity, String fileKey)
      Returns the file data of a file belonging to the given entity with the given file key. If the file is not cache-able or not yet cached it will be read from the database otherwise it will be retrieved from the file cache.
      Type Parameters:
      E - file map providing base entity type
      D - file data entity type
      F - file entity type
      Parameters:
      uc - user context for database transactions.
      entity - that owns the file
      fileKey - key identifying the the file entity
      Returns:
      file data of the request file as a byte array.
      Since:
      8.0.0
    • getFileDataFromFileEntity

      public <F extends IFileEntity<?, ?>> byte[] getFileDataFromFileEntity(UserContext uc, F fileEntity)
      Returns the file data of the given file entity. If the file is not cache-able or not yet cached it will be read from the database otherwise it will be retrieved from the file cache.
      Type Parameters:
      F - file entity type
      Parameters:
      uc - user context for database transactions.
      fileEntity - that holds the file data
      Returns:
      file data of the request file as a byte array.
      Since:
      8.0.0
    • getFileEntityData

      public <T extends IFileEntity<?, ?>> byte[] getFileEntityData(UserContext uc, T fileEntity) throws IOException
      Throws:
      IOException
    • getUncachedFileData

      public <E extends IFileDataEntity<?>, T extends IFileProviding<?, E>> byte[] getUncachedFileData(UserContext uc, T entity)
    • getUncachedFileData

      public <D extends IFileDataEntity<F>, F extends IKeyDependentFileEntity<E, D>, E extends IFileMapProviding<F, D>> byte[] getUncachedFileData(UserContext uc, E entity, String fileKey)
      Returns the file data of a file belonging to the given entity with the given file key.
      Type Parameters:
      E - file map providing base entity type
      D - file data entity type
      F - file entity type
      Parameters:
      uc - user context for database transactions.
      entity - that owns the file
      fileKey - key identifying the the file entity
      Returns:
      file data of the request file as a byte array.
      Since:
      8.0.0
    • getUncachedFileEntityData

      public <T extends IFileEntity<?, ?>> byte[] getUncachedFileEntityData(UserContext uc, T fileEntity)
    • updateFileData

      public <E extends IFileDataEntity<?>, T extends IFileEntity<?, E>> T updateFileData(UserContext uc, T entity, byte[] data)