public interface Shareable extends Ownable
Shareable
item is an item which can be shared to
other User
:s, Group
:s and Project
:s. Sharing information
is stored in ItemKey
and ProjectKey
objects.
The ShareableUtil
class provides methods that includes data validation to make
it easy to implement this interface.
Reference implementation
public ItemKey getItemKey() throws PermissionDeniedException, BaseException { return getDbControl().getItem(ItemKey.class, getData().getItemKey()); } public void setItemKey(ItemKey itemKey) throws PermissionDeniedException { checkPermission(Permission.SET_PERMISSION); ShareableUtil.setItemKey(getData(), itemKey); } public ProjectKey getProjectKey() throws PermissionDeniedException, BaseException { return getDbControl().getItem(ProjectKey.class, getData().getProjectKey()); } public void setProjectKey(ProjectKey projectKey) throws PermissionDeniedException { checkPermission(Permission.SET_PERMISSION); ShareableUtil.setProjectKey(getData(), projectKey); } public boolean isShared() { return getData().getItemKey() != null || getData().getProjectKey() != null; }
SharedItem
,
ShareableUtil
Modifier and Type | Method and Description |
---|---|
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. |
boolean |
isShared()
Check if this item has been shared or not.
|
void |
setItemKey(ItemKey itemKey)
Set the
ItemKey for this item. |
void |
setProjectKey(ProjectKey projectKey)
Set the
ProjectKey for this item. |
getOwner, isOwner, setOwner, takeOwnership
getId, getType, getVersion
checkPermission, getPermissions, hasPermission
ItemKey getItemKey() throws PermissionDeniedException, BaseException
ItemKey
that is used to share this item to users
and groups.ItemKey
objectPermissionDeniedException
- If the logged in user doesn't
have read permission to the keyBaseException
- If there is another errorvoid setItemKey(ItemKey itemKey) throws PermissionDeniedException
ItemKey
for this item.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 itemProjectKey getProjectKey() throws PermissionDeniedException, BaseException
ProjectKey
that is used to share this item to projects.ProjectKey
objectPermissionDeniedException
- If the logged in user doesn't
have read permission to the keyBaseException
- If there is another errorvoid setProjectKey(ProjectKey projectKey) throws PermissionDeniedException
ProjectKey
for this item.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 itemboolean isShared()