Package net.sf.basedb.core
Class OwnedItem
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.OwnedItem
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Ownable
- Direct Known Subclasses:
Project
,SharedItem
This class inherits from the
BasicItem
class and implements the Ownable
interface.
An Ownable
item is an item that has a
User
as its owner.- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2024-10-30 13:32:46 +0100 (Wed, 30 Oct 2024) $
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) OwnedData
getData()
Get theBasicData
object that holds all data for this item.getOwner()
Get theUser
that is the owner of the item.(package private) void
initPermissions
(int granted, int denied) If the logged in user is the owner of this item, DELETE, SET_OWNER and SET_PERMISSION permission is granted.boolean
isOwner()
Check if the logged in user is the owner of this item or not.(package private) void
onBeforeCommit
(Transactional.Action action) Overrides theBasicItem.onBeforeCommit(Transactional.Action)
method.void
Change the owner of the item.void
Take ownership of the item.Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, validate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getType, getVersion
-
Constructor Details
-
OwnedItem
OwnedItem(OwnedData ownedData)
-
-
Method Details
-
getData
OwnedData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item. -
getOwner
Description copied from interface:Ownable
Get theUser
that is the owner of the item.- Specified by:
getOwner
in interfaceOwnable
- Returns:
- The owner of the item
- Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the ownerBaseException
- If there is another error
-
setOwner
Description copied from interface:Ownable
Change the owner of the item.- Specified by:
setOwner
in interfaceOwnable
- Parameters:
owner
- The new owner of the item- Throws:
PermissionDeniedException
- If the logged in user doesn't have permission to change the owner on the itemInvalidDataException
- If the owner is null- See Also:
-
takeOwnership
Description copied from interface:Ownable
Take ownership of the item.- Specified by:
takeOwnership
in interfaceOwnable
- Throws:
PermissionDeniedException
- If the logged in user doesn't have permission to take ownership
-
isOwner
public boolean isOwner()Description copied from interface:Ownable
Check if the logged in user is the owner of this item or not. -
onBeforeCommit
Overrides theBasicItem.onBeforeCommit(Transactional.Action)
method. It sets the owner of the new item to the logged in user, unless it has already been specified.- Overrides:
onBeforeCommit
in classBasicItem
- Throws:
NotLoggedInException
- If no user is logged inBaseException
- If there is another error- See Also:
-
initPermissions
If the logged in user is the owner of this item, DELETE, SET_OWNER and SET_PERMISSION permission is granted.- 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
-