Package net.sf.basedb.core.data
Class FileData
- All Implemented Interfaces:
AnnotatableData
,DiskConsumableData
,IdentifiableData
,LoggableData
,NameableData
,OwnableData
,RemovableData
,ShareableData
,SubtypableData
public class FileData
extends AnnotatedData
implements DiskConsumableData, LoggableData, SubtypableData
This class holds information about a file.
- Version:
- 2.0
- Author:
- enell
- See Also:
- Last modified
- $Date: 2020-10-20 08:09:37 +0200 (Tue, 20 Oct 2020) $
- Hibernate: class
- table="`Files`" lazy="true"
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
private boolean
private long
private DirectoryData
private DiskUsageData
private FileServerData
private String
private Date
private int
static final int
static final int
static final int
private String
private String
private long
private ItemSubtypeData
private String
private boolean
Fields inherited from interface net.sf.basedb.core.data.NameableData
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the character set used in this file (for text-files only).long
Get the size in bytes that thisFileData
object uses after compression.Get the associatedDirectoryData
item.Get theDiskUsageData
that this item use.Get the associatedFileServerData
item.Get the internal name accosiated with this file.Get the subtype of the item.Get the date and time the actual file data was last updated.int
Get theLocation
of thisFileData
getMd5()
Get the MD5 hash of the file contents.Get the mime type of thisFileData
item.getName()
Get the name of the item.long
getSize()
Get the size in bytes for thisFileData
object.getUrl()
Get the URL to the file.boolean
If the file is stored in a compressed format or not.boolean
If the actual file contents should be write protected or not.void
setCharacterSet
(String charset) void
setCompressed
(boolean compressed) void
setCompressedSize
(long compressedSize) void
setDirectory
(DirectoryData directory) (package private) void
setDiskUsage
(DiskUsageData diskUsage) void
setFileServer
(FileServerData fileServer) void
setInternalName
(String internalName) void
setItemSubtype
(ItemSubtypeData subtype) Set the subtype of the item.void
setLastUpdate
(Date lastUpdate) void
setLocation
(int location) void
void
setMimeType
(String mimeType) void
setSize
(long size) void
void
setWriteProtected
(boolean writeProtected) Methods inherited from class net.sf.basedb.core.data.AnnotatedData
getAnnotations, getAnnotationSet, setAnnotations, setAnnotationSet
Methods inherited from class net.sf.basedb.core.data.CommonData
getDescription, getRemovedBy, setDescription, setName, setRemovedBy
Methods inherited from class net.sf.basedb.core.data.SharedData
getItemKey, getProjectKey, setItemKey, setProjectKey
Methods inherited from class net.sf.basedb.core.data.BasicData
equals, getId, getVersion, hashCode, setId, setVersion, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.data.IdentifiableData
getId, getVersion
Methods inherited from interface net.sf.basedb.core.data.OwnableData
getOwner, setOwner
-
Field Details
-
diskUsage
-
subtype
-
size
private long size -
md5
-
location
private int location -
mimeType
-
MAX_MIMETYPE_LENGTH
public static final int MAX_MIMETYPE_LENGTH- See Also:
-
charset
-
MAX_CHARSET_LENGTH
public static final int MAX_CHARSET_LENGTH- See Also:
-
directory
-
writeProtected
private boolean writeProtected -
lastUpdate
-
compressed
private boolean compressed -
compressedSize
private long compressedSize -
internalName
-
url
-
MAX_URL_LENGTH
public static final int MAX_URL_LENGTH- See Also:
-
fileServer
-
-
Constructor Details
-
FileData
public FileData()
-
-
Method Details
-
getName
Get the name of the item.- Specified by:
getName
in interfaceNameableData
- Overrides:
getName
in classCommonData
- Returns:
- A
String
with the name of the item - Hibernate: property
- type="string"
- Hibernate: column
- name="`name`" length="255" not-null="true" index="name_idx" unique-key="File_uniquefile"
-
getDiskUsage
Description copied from interface:DiskConsumableData
Get theDiskUsageData
that this item use.- Specified by:
getDiskUsage
in interfaceDiskConsumableData
-
setDiskUsage
-
getItemSubtype
Description copied from interface:SubtypableData
Get the subtype of the item.- Specified by:
getItemSubtype
in interfaceSubtypableData
-
setItemSubtype
Description copied from interface:SubtypableData
Set the subtype of the item.- Specified by:
setItemSubtype
in interfaceSubtypableData
-
getSize
public long getSize()Get the size in bytes for thisFileData
object.- Hibernate: property
- column="`size`" type="long" not-null="true"
-
setSize
public void setSize(long size) -
getMd5
Get the MD5 hash of the file contents. It is always returned as a string with 32 hexadecimal characters.- Hibernate: property
- column="`md5`" type="string" length="32" not-null="false"
-
setMd5
-
getLocation
public int getLocation()Get theLocation
of thisFileData
- Hibernate: property
- column="`location`" type="int" not-null="true"
-
setLocation
public void setLocation(int location) -
getMimeType
Get the mime type of thisFileData
item.- Hibernate: property
- column="`mimetype`" type="string" length="255"
-
setMimeType
-
getCharacterSet
Get the character set used in this file (for text-files only).- Since:
- 2.9
- Hibernate: property
- column="`charset`" type="string" length="255"
-
setCharacterSet
- Since:
- 2.9
-
getDirectory
Get the associatedDirectoryData
item.- Hibernate: column
- name="`directory_id`" not-null="true" unique-key="File_uniquefile"
- Hibernate: many-to-one
- outer-join="false"
-
setDirectory
-
isWriteProtected
public boolean isWriteProtected()If the actual file contents should be write protected or not.- Since:
- 2.4
- Hibernate: property
- column="`write_protected`" type="boolean" not-null="true"
-
setWriteProtected
public void setWriteProtected(boolean writeProtected) -
getLastUpdate
Get the date and time the actual file data was last updated.- Returns:
- A
Date
object, or null if no file has been uploaded - Since:
- 2.4
- Hibernate: property
- column="`last_update`" type="timestamp" not-null="false"
-
setLastUpdate
-
isCompressed
public boolean isCompressed()If the file is stored in a compressed format or not.- Since:
- 2.5
- Hibernate: property
- column="`compressed`" type="boolean" not-null="true"
-
setCompressed
public void setCompressed(boolean compressed) -
getCompressedSize
public long getCompressedSize()Get the size in bytes that thisFileData
object uses after compression. If the file is not compressed, this value is the same asgetSize()
- Hibernate: property
- column="`compressed_size`" type="long" not-null="true"
-
setCompressedSize
public void setCompressedSize(long compressedSize) -
getInternalName
Get the internal name accosiated with this file.- Hibernate: property
- column="`internalname'" type="string" length="255" not-null="false"
-
setInternalName
-
getUrl
Get the URL to the file. This property is only set/valid for files that are stored externally (location=EXTERNAL).- Since:
- 2.16
- Hibernate: property
- column="`url`" type="text" not-null="false"
-
setUrl
-
getFileServer
Get the associatedFileServerData
item. This property is only set/valid for files that are stored externally (location=EXTERNAL).- Since:
- 2.16
- Hibernate: many-to-one
- column="`fileserver_id`" not-null="false" outer-join="false"
-
setFileServer
-