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
public interface Shareable extends Ownable
AnShareable
item is an item which can be shared to otherUser
:s,Group
:s andProject
:s. Sharing information is stored inItemKey
andProjectKey
objects. TheShareableUtil
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:
SharedItem
,ShareableUtil
- Last modified
- $Date: 2009-04-06 14:52:39 +0200 (må, 06 apr 2009) $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ItemKey
getItemKey()
Get theItemKey
that is used to share this item to users and groups.ProjectKey
getProjectKey()
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 Detail
-
getItemKey
ItemKey getItemKey() throws PermissionDeniedException, BaseException
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
void setItemKey(ItemKey itemKey) throws PermissionDeniedException
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
ProjectKey getProjectKey() throws PermissionDeniedException, BaseException
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
void setProjectKey(ProjectKey projectKey) throws PermissionDeniedException
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
-
isShared
boolean isShared()
Check if this item has been shared or not.- Returns:
- TRUE if this item has been shared to a user, group or project
-
-