Package net.sf.basedb.core
Class SharedItem
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.OwnedItem
net.sf.basedb.core.SharedItem
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Ownable
,Shareable
- Direct Known Subclasses:
CommonItem
,Directory
This class inherits from the
OwnedItem
class and implements the Shareable
interface.
An Shareable
item is an item that can be
shared to User
:s, Group
:s and Project
:s- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2015-04-20 11:08:18 +0200 (må, 20 apr 2015) $
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) SharedData
getData()
Get theBasicData
object that holds all data for this item.Get theItemKey
that is used to share this item to users and groups.Get theProjectKey
that is used to share this item to projects.(package private) void
initPermissions
(int granted, int denied) Grant permissions according to the item and project keys.boolean
isShared()
Check if this item has been shared or not.(package private) void
onBeforeCommit
(Transactional.Action action) If a project is active, automatically share the new item according to the settings of that project, unless a project or item key has been explicitely set (including null).void
setItemKey
(ItemKey itemKey) Set theItemKey
for this item.void
setProjectKey
(ProjectKey projectKey) Set theProjectKey
for this item.Methods inherited from class net.sf.basedb.core.OwnedItem
getOwner, isOwner, setOwner, takeOwnership
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
Methods inherited from interface net.sf.basedb.core.Ownable
getOwner, isOwner, setOwner, takeOwnership
-
Field Details
-
projectKeySet
private boolean projectKeySet -
itemKeySet
private boolean itemKeySet
-
-
Constructor Details
-
Method Details
-
getData
SharedData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item. -
getItemKey
Description copied from interface:Shareable
Get theItemKey
that is used to share this item to users and groups.- Specified by:
getItemKey
in interfaceShareable
- Returns:
- The
ItemKey
object - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the keyBaseException
- If there is another error
-
setItemKey
Description copied from interface:Shareable
Set theItemKey
for this item.- Specified by:
setItemKey
in interfaceShareable
- Parameters:
itemKey
- The new item key for the item, or null to stop sharing this item- Throws:
PermissionDeniedException
- If the logged in user doesn't have permission to change the key on the item
-
getProjectKey
Description copied from interface:Shareable
Get theProjectKey
that is used to share this item to projects.- Specified by:
getProjectKey
in interfaceShareable
- Returns:
- The
ProjectKey
object - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the keyBaseException
- If there is another error
-
setProjectKey
Description copied from interface:Shareable
Set theProjectKey
for this item.- Specified by:
setProjectKey
in interfaceShareable
- Parameters:
projectKey
- The new project key for the item, or null to stop sharing this item- Throws:
PermissionDeniedException
- If the logged in user doesn't have permission to change the key on the item
-
onBeforeCommit
If a project is active, automatically share the new item according to the settings of that project, unless a project or item key has been explicitely set (including null).- Overrides:
onBeforeCommit
in classOwnedItem
- Throws:
BaseException
- If there is another errorNotLoggedInException
- If no user is logged in- See Also:
-
initPermissions
Grant permissions according to the item and project keys.- Overrides:
initPermissions
in classOwnedItem
- 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
-