2.17.2: 2011-06-17

net.sf.basedb.core
Enum Location

java.lang.Object
  extended by java.lang.Enum<Location>
      extended by net.sf.basedb.core.Location
All Implemented Interfaces:
Serializable, Comparable<Location>

public enum Location
extends Enum<Location>

This enumeration defines constants that are used to specify different file storage locations.

Version:
2.0
Author:
enell
Last modified
$Date: 2010-04-29 10:06:05 +0200 (Thu, 29 Apr 2010) $

Enum Constant Summary
EXTERNAL
          The item is stored externally.
OFFLINE
          The item is offline and doesn't use any quota.
PRIMARY
          The item is stored in primary storage.
SECONDARY
          The item is stored in secondary storage.
 
Field Summary
private  String displayValue
          Returned by the toString method.
private  boolean downloadable
          If the file can be downloaded from this location.
private  boolean quotaLimited
          If this location is limited by quota.
private  int value
          The integer value of this location.
private static Map<Integer,Location> valueMapping
          Maps an integer to a location.
 
Method Summary
static Location fromValue(int value)
          Get the Location object when you know the integer code.
 int getValue()
          Get the integer value that is used when storing an location to the database.
 boolean isDownloadable()
          A flag indicating if a file that is stored at this location can be downloaded by a call to File.getDownloadStream(long) or File.download(java.io.OutputStream, long).
 boolean isQuotaLimited()
          A flag indicating if a file that is stored at this location should be included in quota limit.
 String toString()
           
static Location valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Location[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

OFFLINE

public static final Location OFFLINE
The item is offline and doesn't use any quota.


PRIMARY

public static final Location PRIMARY
The item is stored in primary storage.


SECONDARY

public static final Location SECONDARY
The item is stored in secondary storage. Note! This type of storage may not be available on all servers.


EXTERNAL

public static final Location EXTERNAL
The item is stored externally. Some information like size, md5, etc. may not be available.

Since:
2.16
Field Detail

valueMapping

private static final Map<Integer,Location> valueMapping
Maps an integer to a location.


value

private final int value
The integer value of this location.


displayValue

private final String displayValue
Returned by the toString method.


downloadable

private final boolean downloadable
If the file can be downloaded from this location.


quotaLimited

private final boolean quotaLimited
If this location is limited by quota.

Method Detail

values

public static Location[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Location c : Location.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Location valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

toString

public String toString()
Overrides:
toString in class Enum<Location>

fromValue

public static Location fromValue(int value)
Get the Location object when you know the integer code.

Parameters:
value - The integer value.
Returns:
The location for the integer value.

getValue

public int getValue()
Get the integer value that is used when storing an location to the database.

Returns:
The integer value for this location.

isDownloadable

public boolean isDownloadable()
A flag indicating if a file that is stored at this location can be downloaded by a call to File.getDownloadStream(long) or File.download(java.io.OutputStream, long).

Returns:
TRUE if the file can downloaded, FALSE if not
Since:
2.16

isQuotaLimited

public boolean isQuotaLimited()
A flag indicating if a file that is stored at this location should be included in quota limit.

Returns:
TRUE if this location is quota limited, FALSE otherwise
Since:
2.16

2.17.2: 2011-06-17