Last update: 2011-06-23

org.proteios.core.data
Class FileData

java.lang.Object
  extended by org.proteios.core.data.BasicData
      extended by org.proteios.core.data.OwnedData
          extended by org.proteios.core.data.SharedData
              extended by org.proteios.core.data.CommonData
                  extended by org.proteios.core.data.AnnotatedData
                      extended by org.proteios.core.data.FileData
All Implemented Interfaces:
AnnotatableData, CreationInterface, DiskConsumableData, IdentifiableData, NameableData, OwnableData, RemovableData, ShareableData

public class FileData
extends AnnotatedData
implements DiskConsumableData, CreationInterface

This class holds information about a file.

Version:
2.0
Author:
enell
See Also:
File
Last modified
$Date: 2009-11-06 12:30:35 +0100 (Fri, 06 Nov 2009) $
Hibernate: class
table="`Files`" lazy="true"

Field Summary
static int MAX_MIMETYPE_LENGTH
           
static int MAX_URI_LENGTH
           
 
Fields inherited from interface org.proteios.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.
 Set<BioMaterialData> getBioMaterials()
           
 long getCompressedSize()
          Get the size in bytes that this FileData object uses after compression.
 Date getCreated()
          Get the creation date and time
 DirectoryData getDirectory()
          Get the associated DirectoryData item.
 DiskUsageData getDiskUsage()
          Get the DiskUsageData that this item use.
 FileTypeData getFileType()
          Get the associated FileTypeData item.
 String getInternalName()
          Get the internal name associated with this file.
 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 getUniformResourceIdentifier()
          Get the URI of this file.
 boolean isCompressed()
          If the file is stored in a compressed format or not.
 void setAction(int action)
           
 void setBioMaterials(Set<BioMaterialData> bioMaterials)
           
 void setCompressed(boolean compressed)
          Set the flag indicating that the file is stored in a compressed format.
 void setCompressedSize(long compressedSize)
          Set the size in bytes that the file object uses after compression.
 void setCreated(Date created)
           
 void setDirectory(DirectoryData directory)
           
 void setFileType(FileTypeData fileType)
           
 void setInternalName(String internalName)
           
 void setLocation(int location)
           
 void setMd5(String md5)
           
 void setMimeType(String mimeType)
           
 void setSize(long size)
           
 void setUniformResourceIdentifier(String uniformResourceIdentifier)
          Set the URI of this file.
 
Methods inherited from class org.proteios.core.data.AnnotatedData
getAnnotationSet, setAnnotationSet
 
Methods inherited from class org.proteios.core.data.CommonData
getDescription, isRemoved, setDescription, setName, setRemoved
 
Methods inherited from class org.proteios.core.data.SharedData
getItemKey, getProjectKey, setItemKey, setProjectKey
 
Methods inherited from class org.proteios.core.data.OwnedData
getOwner, setOwner
 
Methods inherited from class org.proteios.core.data.BasicData
equals, getId, getVersion, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.proteios.core.data.OwnableData
getOwner, setOwner
 
Methods inherited from interface org.proteios.core.data.IdentifiableData
getId, getVersion
 

Field Detail

MAX_MIMETYPE_LENGTH

public static final int MAX_MIMETYPE_LENGTH
See Also:
Constant Field Values

MAX_URI_LENGTH

public static final int MAX_URI_LENGTH
See Also:
Constant Field Values
Constructor Detail

FileData

public FileData()
Method Detail

getCreated

public Date getCreated()
Description copied from interface: CreationInterface
Get the creation date and time

Specified by:
getCreated in interface CreationInterface

setCreated

public void setCreated(Date created)
Specified by:
setCreated in interface CreationInterface

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

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)

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"

setFileType

public void setFileType(FileTypeData fileType)

isCompressed

public boolean isCompressed()
If the file is stored in a compressed format or not.

Returns:
boolean Returns true if the file is stored in compressed format.
Hibernate: property
column="`compressed`" type="boolean" not-null="true"

setCompressed

public void setCompressed(boolean compressed)
Set the flag indicating that the file is stored in a compressed format.

Parameters:
compressed - boolean The the file is stored in a compressed format.

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()

Returns:
long The size in bytes of the compressed file.
Hibernate: property
column="`compressed_size`" type="long" not-null="true"

setCompressedSize

public void setCompressedSize(long compressedSize)
Set the size in bytes that the file object uses after compression.

Parameters:
compressedSize - long The size in bytes that the file object uses after compression.

getInternalName

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

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

setInternalName

public void setInternalName(String internalName)

getUniformResourceIdentifier

public String getUniformResourceIdentifier()
Get the URI of this file. This is only set in the database if the file is not found in the Proteios primary storage. That is internalName = null.

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

setUniformResourceIdentifier

public void setUniformResourceIdentifier(String uniformResourceIdentifier)
Set the URI of this file. This must only be set in the database if the file is not found in the Proteios primary storage. That is internalName = null.


getBioMaterials

public Set<BioMaterialData> getBioMaterials()
Returns:
Returns the bioMaterials. Empty Set if no bioMaterials
Hibernate: set
table="`BioMaterialFiles`" lazy="true"
Hibernate: collection-key
column="`file_id`"
Hibernate: collection-many-to-many
class="org.proteios.core.data.BioMaterialData" column="`biomaterial_id`"

setBioMaterials

public void setBioMaterials(Set<BioMaterialData> bioMaterials)

Last update: 2011-06-23