Package org.cyclos.impl.storage
Interface StoredFileHandler
-
public interface StoredFileHandlerHandler used to manageStoredFileentities and its content.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanSKIP_LOCKThis is used only in some main files to avoid lock issuesstatic StringSKIP_LOCK_PROPERTYSystem property name forSKIP_LOCK
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcopy(StoredFile source, StoredFile target)Copies the source's attributes and content to target.com.querydsl.core.types.dsl.BooleanExpressioncustomFieldEquals(com.querydsl.core.types.EntityPath<?> sf, CustomField<?,?,?> customField)Returns a query predicate that any property of type CustomField points to the given custom field<T extends StoredFile>
Tfind(Class<T> clazz, long id)Finds aStoredFilein the catalog, if found returns the StoredFile with the specified id.
This method doesn't check if the related content is present through theStoredFileContentManagerbyte[]getBytes(StoredFile storedFile)Returns the content of the specifiedStoredFileas bytesSerializableInputStreamgetContent(StoredFile storedFile)Opens an input stream to allow read the content of the specifiedStoredFile.
It is caller's responsibility to close the stream after read.Set<String>getStorageDirectories()Returns the set of directory names available for store an individual document or a custom field of type image/file configured in the cyclos.properties only if the underlyingStoredFileContentManagerimplementation support store files in a specific directory other than the default.static Set<String>getStorageDirectories(CyclosProperties cyclosProperties)Retrieves the storage directories list from the cyclos.proeprties file.StringgetStorageDirectory(StoredFile storedFile)Returns the storage directory, if any, for those cases where a custom storage directory can be specified (individual documents, image/file custom fields).booleanisStoredOnDB()Returns whether the underlying storage for files is databasevoidmove(StoredFile source, StoredFile target)Moves the source's attributes and content to target REMOVING the source.voidremove(long id)Remove the stored file and its content.voidsave(StoredFile storedFile, SerializableInputStream in)Saves (create/update) a stored file reading its content from the specified stream.
This method closes the providedSerializableInputStreamafter the method has completed.booleansupportStorageDirectories()Returns true if the underlyingStoredFileContentManagerimplementation support store files in a specific directory other than the default
-
-
-
Field Detail
-
SKIP_LOCK_PROPERTY
static final String SKIP_LOCK_PROPERTY
System property name forSKIP_LOCK- See Also:
- Constant Field Values
-
SKIP_LOCK
static final boolean SKIP_LOCK
This is used only in some main files to avoid lock issues
-
-
Method Detail
-
getStorageDirectories
static Set<String> getStorageDirectories(CyclosProperties cyclosProperties)
Retrieves the storage directories list from the cyclos.proeprties file.
-
copy
void copy(StoredFile source, StoredFile target) throws StoredFileException
Copies the source's attributes and content to target.- Throws:
StoredFileException
-
customFieldEquals
com.querydsl.core.types.dsl.BooleanExpression customFieldEquals(com.querydsl.core.types.EntityPath<?> sf, CustomField<?,?,?> customField)Returns a query predicate that any property of type CustomField points to the given custom field
-
find
<T extends StoredFile> T find(Class<T> clazz, long id) throws StoredFileException, EntityNotFoundException
Finds aStoredFilein the catalog, if found returns the StoredFile with the specified id.
This method doesn't check if the related content is present through theStoredFileContentManager- Throws:
EntityNotFoundException- if a stored file was not found.StoredFileException
-
getBytes
byte[] getBytes(StoredFile storedFile) throws StoredFileException, EntityNotFoundException
Returns the content of the specifiedStoredFileas bytes
-
getContent
SerializableInputStream getContent(StoredFile storedFile) throws StoredFileException, EntityNotFoundException
Opens an input stream to allow read the content of the specifiedStoredFile.
It is caller's responsibility to close the stream after read.
-
getStorageDirectories
Set<String> getStorageDirectories()
Returns the set of directory names available for store an individual document or a custom field of type image/file configured in the cyclos.properties only if the underlyingStoredFileContentManagerimplementation support store files in a specific directory other than the default. Otherwise returns an empty Set.
-
getStorageDirectory
String getStorageDirectory(StoredFile storedFile)
Returns the storage directory, if any, for those cases where a custom storage directory can be specified (individual documents, image/file custom fields). Otherwise it returns null.
-
isStoredOnDB
boolean isStoredOnDB()
Returns whether the underlying storage for files is database
-
move
void move(StoredFile source, StoredFile target) throws StoredFileException
Moves the source's attributes and content to target REMOVING the source.- Throws:
StoredFileException
-
remove
void remove(long id) throws StoredFileException, EntityNotFoundExceptionRemove the stored file and its content.
-
save
void save(StoredFile storedFile, SerializableInputStream in) throws StoredFileException
Saves (create/update) a stored file reading its content from the specified stream.
This method closes the providedSerializableInputStreamafter the method has completed.- Throws:
StoredFileException
-
supportStorageDirectories
boolean supportStorageDirectories()
Returns true if the underlyingStoredFileContentManagerimplementation support store files in a specific directory other than the default
-
-