Package de.xima.fc.api.file
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 Summary
Constructors Constructor Description FileAPI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <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.<E extends IFileDataEntity<?>,T extends IFileProviding<?,E>>
byte[]getFileData(UserContext uc, T entity)
<F extends IFileEntity<?,?>>
byte[]getFileDataFromFileEntity(UserContext uc, F fileEntity)
Returns the file data of the given file entity.<T extends IFileEntity<?,?>>
byte[]getFileEntityData(UserContext uc, T fileEntity)
<T extends IFileEntity<?,?>>
InputStreamgetFileEntityStream(UserContext uc, T fileEntity)
<D extends IFileDataEntity<F>,F extends IKeyDependentFileEntity<E,D>,E extends IFileMapProviding<F,D>>
InputStreamgetFileStream(UserContext uc, E entity, String fileKey)
Returns the file data of a file belonging to the given entity with the given file key.<E extends IFileDataEntity<?>,T extends IFileProviding<?,E>>
InputStreamgetFileStream(UserContext uc, T entity)
Method for downloading a file by theAttachment
ID.<F extends IFileEntity<?,?>>
InputStreamgetFileStreamFromFileEntity(UserContext uc, F fileEntity)
Returns the file data of the given file entity.<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.<E extends IFileDataEntity<?>,T extends IFileProviding<?,E>>
byte[]getUncachedFileData(UserContext uc, T entity)
<T extends IFileEntity<?,?>>
byte[]getUncachedFileEntityData(UserContext uc, T fileEntity)
<E extends IFileDataEntity<?>,T extends IFileEntity<?,E>>
TupdateFileData(UserContext uc, T entity, byte[] data)
-
Methods inherited from class de.xima.fc.api.ASubAPI
getHandlerProvider
-
-
-
-
Method Detail
-
getFileStream
public <E extends IFileDataEntity<?>,T extends IFileProviding<?,E>> InputStream getFileStream(UserContext uc, T entity) throws FileNotFoundException
Method for downloading a file by theAttachment
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 typeD
- file data entity typeF
- file entity type- Parameters:
uc
- user context for database transactions.entity
- that owns the filefileKey
- 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 typeD
- file data entity typeF
- file entity type- Parameters:
uc
- user context for database transactions.entity
- that owns the filefileKey
- 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 typeD
- file data entity typeF
- file entity type- Parameters:
uc
- user context for database transactions.entity
- that owns the filefileKey
- 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)
-
-