Last update: 2011-06-23

org.proteios.core
Class DiskUsage

java.lang.Object
  extended by org.proteios.core.BasicItem<DiskUsageData>
      extended by org.proteios.core.DiskUsage
All Implemented Interfaces:
AccessControlled, Identifiable

public class DiskUsage
extends BasicItem<DiskUsageData>

This class is used to represent the disk usage of DiskConsumable items. The creation, updating and deletion of items of this type is handled entirely by Base using the data package. For each DiskConsuming item there is a corresponding item of this type.

Version:
2.0
Author:
Enell, Nicklas
See Also:
DiskUsageData
Last modified
$Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $

Field Summary
static Item TYPE
          The type of item represented by this class.
 
Method Summary
 long getBytes()
          Get the number of bytes the DiskConsumable item is using.
 Group getGroup()
          Get the group that owns the DiskConsumable item or null if ther is none.
 Location getLocation()
          Get the location of the DiskConsumable item.
static ItemQuery<DiskUsage> getQuery(User user)
          Get a query configured to retrieve disk usage for the specified user.
 QuotaType getQuotaType()
          Get the QuotaType the DiskConsumable item is using.
 Item getType()
          Get the type of item represented by the object.
 User getUser()
          Get the user that owns the DiskConsumable item.
 boolean isUsed()
          Check if this item is used by some other item.
 
Methods inherited from class org.proteios.core.BasicItem
checkPermission, equals, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final Item TYPE
The type of item represented by this class.

See Also:
Item.DISKUSAGE, getType()
Method Detail

getQuery

public static ItemQuery<DiskUsage> getQuery(User user)
Get a query configured to retrieve disk usage for the specified user.

Parameters:
user - The user to retreive disk usage for, null is allowed if the logged in user has generic READ permission for disk usage in which case all items will be returned
Returns:
An ItemQuery object

getType

public Item getType()
Description copied from interface: Identifiable
Get the type of item represented by the object. The returned value is one of the values defined in the Item enumeration.

Returns:
A value indicating the type of item

isUsed

public boolean isUsed()
Description copied from class: BasicItem
Check if this item is used by some other item. With used we mean that another item is linking to this item in way that prevents this item from beeing deleted. Ie. if we tried to delete an item that is used, we would get a foreign key violation error from the database.

Specified by:
isUsed in class BasicItem<DiskUsageData>
Returns:
Allways return true. If the DiskUsage is created it is used.

getQuotaType

public QuotaType getQuotaType()
                       throws BaseException
Get the QuotaType the DiskConsumable item is using.

Returns:
The @{QuotaType} associated with this DiskUsage item.
Throws:
BaseException - If there is any error

getLocation

public Location getLocation()
Get the location of the DiskConsumable item.

Returns:
The Location of this DiskUsage item.

getBytes

public long getBytes()
Get the number of bytes the DiskConsumable item is using.

Returns:
The number of bytes of this DiskUsage item.

getUser

public User getUser()
             throws BaseException
Get the user that owns the DiskConsumable item.

Returns:
The user
Throws:
BaseException - If there is any error

getGroup

public Group getGroup()
               throws BaseException
Get the group that owns the DiskConsumable item or null if ther is none.

Returns:
The group
Throws:
BaseException - If there is any error

Last update: 2011-06-23