public abstract class SharedItem extends OwnedItem implements Shareable
OwnedItem
class and implements the Shareable
interface.
An Shareable
item is an item that can be
shared to User
:s, Group
:s and Project
:sShareable
Modifier and Type | Field and Description |
---|---|
private boolean |
itemKeySet |
private boolean |
projectKeySet |
Constructor and Description |
---|
SharedItem(SharedData sharedData) |
Modifier and Type | Method and Description |
---|---|
(package private) SharedData |
getData()
Get the
BasicData object that holds all data for this item. |
ItemKey |
getItemKey()
Get the
ItemKey that is used to share this item to users
and groups. |
ProjectKey |
getProjectKey()
Get the
ProjectKey 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 the
ItemKey for this item. |
void |
setProjectKey(ProjectKey projectKey)
Set the
ProjectKey for this item. |
getOwner, isOwner, setOwner, takeOwnership
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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getOwner, isOwner, setOwner, takeOwnership
getId, getType, getVersion
checkPermission, getPermissions, hasPermission
SharedItem(SharedData sharedData)
SharedData getData()
BasicItem
BasicData
object that holds all data for this item.public ItemKey getItemKey() throws PermissionDeniedException, BaseException
Shareable
ItemKey
that is used to share this item to users
and groups.getItemKey
in interface Shareable
ItemKey
objectPermissionDeniedException
- If the logged in user doesn't
have read permission to the keyBaseException
- If there is another errorpublic void setItemKey(ItemKey itemKey) throws PermissionDeniedException
Shareable
ItemKey
for this item.setItemKey
in interface Shareable
itemKey
- The new item key for the item, or null to stop
sharing this itemPermissionDeniedException
- If the logged in user doesn't
have permission to change the key on the itempublic ProjectKey getProjectKey() throws PermissionDeniedException, BaseException
Shareable
ProjectKey
that is used to share this item to projects.getProjectKey
in interface Shareable
ProjectKey
objectPermissionDeniedException
- If the logged in user doesn't
have read permission to the keyBaseException
- If there is another errorpublic void setProjectKey(ProjectKey projectKey) throws PermissionDeniedException
Shareable
ProjectKey
for this item.setProjectKey
in interface Shareable
projectKey
- The new project key for the item, or null to stop
sharing this itemPermissionDeniedException
- If the logged in user doesn't
have permission to change the key on the itempublic boolean isShared()
Shareable
void onBeforeCommit(Transactional.Action action) throws NotLoggedInException, BaseException
onBeforeCommit
in class OwnedItem
BaseException
- If there is another errorNotLoggedInException
- If no user is logged inTransactional
,
Developer documentation: Transactions,
Developer documentation: Coding rules and guidelines for item classesvoid initPermissions(int granted, int denied) throws BaseException
initPermissions
in class OwnedItem
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclassBaseException
- If the permissions couldn't be initialised