Class DiskUsage

  • All Implemented Interfaces:
    AccessControlled, Identifiable

    public class DiskUsage
    extends BasicItem
    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: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
    • Constructor Detail

      • DiskUsage

        DiskUsage​(DiskUsageData data)
        Create a new DiskUsage item.
        Parameters:
        data - The data class for this item.
    • Method Detail

      • getQuery

        public static ItemQuery<DiskUsage> getQuery​(User user,
                                                    Group group)
        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
        group - The group to retrieve the disk usage for
        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. 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.
        Overrides:
        isUsed in class BasicItem
        Returns:
        Always return true. If the DiskUsage is created it is used.
        See Also:
        BasicItem.getUsingItems()
      • initPermissions

        void initPermissions​(int granted,
                             int denied)
                      throws BaseException
        READ permission is granted if the logged in user is the owner of this disk usage. All other permissions are denied.
        Overrides:
        initPermissions in class BasicItem
        Parameters:
        granted - Permissions that have been granted by the subclass
        denied - Permissions that have been denied by the subclass
        Throws:
        BaseException - If the permissions couldn't be initialised
      • getItemType

        public Item getItemType()
        Get the Item type of the item this annotation set belongs to.
        Since:
        2.2
      • getBytes

        public long getBytes()
        Get the number of bytes the DiskConsumable item is using.
        Returns:
        The number of bytes of this DiskUsage item.