Package net.sf.basedb.core
Class DiskUsage
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.DiskUsage
- All Implemented Interfaces:
AccessControlled
,Identifiable
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:
- Last modified
- $Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
Field Summary
Modifier and TypeFieldDescriptionprivate DiskConsumable
The item this diks usage information belongs to.static final Item
The type of item represented by this class. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
getBytes()
Get the number of bytes theDiskConsumable
item is using.(package private) DiskUsageData
getData()
Get theBasicData
object that holds all data for this item.getGroup()
Get the group that owns theDiskConsumable
item ornull
if ther is none.getItem()
Get the item this disk usage holds information forGet theItem
type of the item this annotation set belongs to.Get the location of theDiskConsumable
item.Get a query configured to retrieve disk usage for the specified user.Get theQuotaType
theDiskConsumable
item is using.static DiskUsageStatistics
getType()
Get the type of item represented by the object.getUser()
Get the user that owns theDiskConsumable
item.Get the item this disk usage information belongs to.(package private) void
initPermissions
(int granted, int denied) READ permission is granted if the logged in user is the owner of this disk usage.boolean
isUsed()
Check if this item is used by some other item.Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, validate
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
item
The item this diks usage information belongs to.
-
-
Constructor Details
-
DiskUsage
DiskUsage(DiskUsageData data) Create a newDiskUsage
item.- Parameters:
data
- The data class for this item.
-
-
Method Details
-
getQuery
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 returnedgroup
- The group to retrieve the disk usage for- Returns:
- An
ItemQuery
object
-
getStatistics
-
getData
DiskUsageData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this 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 theItem
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. If the subclass overrides this method it should propagate the call to the superclass, ie.super.isUsed()
, unless it has decided that the item is used by some other means. -
getUsingItems
Get the item this disk usage information belongs to.- Overrides:
getUsingItems
in classBasicItem
- Returns:
- A set containing proxies for the items, or an empty set if no items are using this item
- Since:
- 2.2, 2.13
- See Also:
-
initPermissions
READ permission is granted if the logged in user is the owner of this disk usage. All other permissions are denied.- Overrides:
initPermissions
in classBasicItem
- Parameters:
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass- Throws:
BaseException
- If the permissions couldn't be initialised
-
getItem
Get the item this disk usage holds information for- Returns:
- The
DiskConsumable
item - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the itemBaseException
- If there is another error- Since:
- 2.2
-
getItemType
Get theItem
type of the item this annotation set belongs to.- Since:
- 2.2
-
getQuotaType
Get theQuotaType
theDiskConsumable
item is using.- Returns:
- The @{QuotaType} associated with this
DiskUsage
item. - Throws:
BaseException
- If there is any error
-
getLocation
Get the location of theDiskConsumable
item.- Returns:
- The
Location
of thisDiskUsage
item.
-
getBytes
public long getBytes()Get the number of bytes theDiskConsumable
item is using.- Returns:
- The number of bytes of this
DiskUsage
item.
-
getUser
Get the user that owns theDiskConsumable
item.- Returns:
- The
user
- Throws:
BaseException
- If there is any error
-
getGroup
Get the group that owns theDiskConsumable
item ornull
if ther is none.- Returns:
- The
group
- Throws:
BaseException
- If there is any error
-