Package net.sf.basedb.core
Interface Shareable
- All Superinterfaces:
AccessControlled
,Identifiable
,Ownable
- All Known Implementing Classes:
AnnotatedItem
,AnnotationType
,AnnotationTypeCategory
,ArrayBatch
,ArrayDesign
,ArraySlide
,BioMaterial
,BioPlate
,BioPlateEvent
,BioSource
,Client
,CommonItem
,DerivedBioAssay
,Directory
,Experiment
,Extract
,File
,FileServer
,Formula
,Hardware
,ItemList
,Job
,JobAgent
,Kit
,MeasuredBioMaterial
,PermissionTemplate
,PhysicalBioAssay
,Plate
,PlateMapping
,PlateType
,PluginConfiguration
,PluginDefinition
,Protocol
,RawBioAssay
,ReporterCloneTemplate
,ReporterList
,Sample
,SharedItem
,Software
,Tag
An
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; }
- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2009-04-06 14:52:39 +0200 (må, 06 apr 2009) $
-
Method Summary
Modifier and TypeMethodDescriptionGet theItemKey
that is used to share this item to users and groups.Get theProjectKey
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 theItemKey
for this item.void
setProjectKey
(ProjectKey projectKey) Set theProjectKey
for this item.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
-
Method Details
-
getItemKey
Get theItemKey
that is used to share this item to users and groups.- 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
Set theItemKey
for this item.- 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
Get theProjectKey
that is used to share this item to projects.- 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
Set theProjectKey
for this item.- 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
-