2.17.2: 2011-06-17

net.sf.basedb.core.data
Class FileData

java.lang.Object
  extended by net.sf.basedb.core.data.BasicData
      extended by net.sf.basedb.core.data.OwnedData
          extended by net.sf.basedb.core.data.SharedData
              extended by net.sf.basedb.core.data.CommonData
                  extended by net.sf.basedb.core.data.FileData
All Implemented Interfaces:
DiskConsumableData, IdentifiableData, LoggableData, NameableData, OwnableData, RemovableData, ShareableData

public class FileData
extends CommonData
implements DiskConsumableData, LoggableData

This class holds information about a file.

Version:
2.0
Author:
enell
See Also:
File, File and directory overview
Last modified
$Date: 2010-06-11 14:10:11 +0200 (Fri, 11 Jun 2010) $
Hibernate: class
table="`Files`" lazy="true"

Field Summary
private  int action
           
private  String charset
           
private  boolean compressed
           
private  long compressedSize
           
private  DirectoryData directory
           
private  DiskUsageData diskUsage
           
private  FileServerData fileServer
           
private  FileTypeData fileType
           
private  String internalName
           
private  Date lastUpdate
           
private  int location
           
static int MAX_CHARSET_LENGTH
           
static int MAX_MIMETYPE_LENGTH
           
static int MAX_URL_LENGTH
           
private  String md5
           
private  String mimeType
           
private  long size
           
private  String url
           
private  boolean writeProtected
           
 
Fields inherited from interface net.sf.basedb.core.data.NameableData
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
 
Constructor Summary
FileData()
           
 
Method Summary
 int getAction()
          Get the value of the action variable for this FileData object.
 String getCharacterSet()
          Get the character set used in this file (for text-files only).
 long getCompressedSize()
          Get the size in bytes that this FileData object uses after compression.
 DirectoryData getDirectory()
          Get the associated DirectoryData item.
 DiskUsageData getDiskUsage()
          Get the DiskUsageData that this item use.
 FileServerData getFileServer()
          Get the associated FileServerData item.
 FileTypeData getFileType()
          Get the associated FileTypeData item.
 String getInternalName()
          Get the internal name accosiated with this file.
 Date getLastUpdate()
          Get the date and time the actual file data was last updated.
 int getLocation()
          Get the Location of this FileData
 String getMd5()
          Get the MD5 hash of the file contents.
 String getMimeType()
          Get the mime type of this FileData item.
 String getName()
          Get the name of the item.
 long getSize()
          Get the size in bytes for this FileData object.
 String getUrl()
          Get the URL to the file.
 boolean isCompressed()
          If the file is stored in a compressed format or not.
 boolean isWriteProtected()
          If the actual file contents should be write protected or not.
 void setAction(int action)
           
 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 setFileType(FileTypeData fileType)
           
 void setInternalName(String internalName)
           
 void setLastUpdate(Date lastUpdate)
           
 void setLocation(int location)
           
 void setMd5(String md5)
           
 void setMimeType(String mimeType)
           
 void setSize(long size)
           
 void setUrl(String url)
           
 void setWriteProtected(boolean writeProtected)
           
 
Methods inherited from class net.sf.basedb.core.data.CommonData
getDescription, isRemoved, setDescription, setName, setRemoved
 
Methods inherited from class net.sf.basedb.core.data.SharedData
getItemKey, getProjectKey, setItemKey, setProjectKey
 
Methods inherited from class net.sf.basedb.core.data.OwnedData
getOwner, setOwner
 
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.OwnableData
getOwner, setOwner
 
Methods inherited from interface net.sf.basedb.core.data.IdentifiableData
getId, getVersion
 

Field Detail

diskUsage

private DiskUsageData diskUsage

size

private long size

md5

private String md5

action

private int action

location

private int location

mimeType

private String mimeType

MAX_MIMETYPE_LENGTH

public static final int MAX_MIMETYPE_LENGTH
See Also:
Constant Field Values

charset

private String charset

MAX_CHARSET_LENGTH

public static final int MAX_CHARSET_LENGTH
See Also:
Constant Field Values

directory

private DirectoryData directory

fileType

private FileTypeData fileType

writeProtected

private boolean writeProtected

lastUpdate

private Date lastUpdate

compressed

private boolean compressed

compressedSize

private long compressedSize

internalName

private String internalName

url

private String url

MAX_URL_LENGTH

public static final int MAX_URL_LENGTH
See Also:
Constant Field Values

fileServer

private FileServerData fileServer
Constructor Detail

FileData

public FileData()
Method Detail

getName

public String getName()
Get the name of the item.

Specified by:
getName in interface NameableData
Overrides:
getName in class CommonData
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="uniquefile"

getDiskUsage

public DiskUsageData getDiskUsage()
Description copied from interface: DiskConsumableData
Get the DiskUsageData that this item use.

Specified by:
getDiskUsage in interface DiskConsumableData

setDiskUsage

void setDiskUsage(DiskUsageData diskUsage)

getSize

public long getSize()
Get the size in bytes for this FileData object.

Hibernate: property
column="`size`" type="long" not-null="true"

setSize

public void setSize(long size)

getMd5

public String 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

public void setMd5(String md5)

getAction

public int getAction()
Get the value of the action variable for this FileData object.

Hibernate: property
column="`action`" type="int" not-null="true"

setAction

public void setAction(int action)

getLocation

public int getLocation()
Get the Location of this FileData

Hibernate: property
column="`location`" type="int" not-null="true"

setLocation

public void setLocation(int location)

getMimeType

public String getMimeType()
Get the mime type of this FileData item.

Hibernate: property
column="`mimetype`" type="string" length="255"

setMimeType

public void setMimeType(String mimeType)

getCharacterSet

public String 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

public void setCharacterSet(String charset)
Since:
2.9

getDirectory

public DirectoryData getDirectory()
Get the associated DirectoryData item.

Hibernate: column
name="`directory_id`" not-null="true" unique-key="uniquefile"
Hibernate: many-to-one
outer-join="false"

setDirectory

public void setDirectory(DirectoryData directory)

getFileType

public FileTypeData getFileType()
Get the associated FileTypeData item.

Hibernate: many-to-one
column="`filetype_id`" not-null="false" outer-join="false"

setFileType

public void setFileType(FileTypeData fileType)

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

public Date 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

public void setLastUpdate(Date lastUpdate)

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 this FileData object uses after compression. If the file is not compressed, this value is the same as getSize()

Hibernate: property
column="`compressed_size`" type="long" not-null="true"

setCompressedSize

public void setCompressedSize(long compressedSize)

getInternalName

public String getInternalName()
Get the internal name accosiated with this file.

Hibernate: property
column="`internalname'" type="string" length="255" not-null="false"

setInternalName

public void setInternalName(String internalName)

getUrl

public String 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

public void setUrl(String url)

getFileServer

public FileServerData getFileServer()
Get the associated FileServerData 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

public void setFileServer(FileServerData fileServer)

2.17.2: 2011-06-17