2.17.2: 2011-06-17

net.sf.basedb.core
Interface Shareable

All Superinterfaces:
AccessControlled, Identifiable, Ownable
All Known Implementing Classes:
AnnotatedItem, AnnotationType, AnnotationTypeCategory, ArrayBatch, ArrayDesign, ArraySlide, BioMaterial, BioMaterialList, BioPlate, BioPlateEvent, BioSource, Client, CommonItem, Directory, Experiment, Extract, File, FileServer, Formula, Hardware, Hybridization, JobAgent, Label, LabeledExtract, MeasuredBioMaterial, PermissionTemplate, Plate, PlateMapping, PlateType, PluginConfiguration, PluginDefinition, Protocol, RawBioAssay, ReporterList, Sample, Scan, SharedItem, Software

public interface Shareable
extends Ownable

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:
SharedItem, ShareableUtil
Last modified
$Date: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Method Summary
 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.
 
Methods inherited from interface net.sf.basedb.core.Ownable
getOwner, isOwner, setOwner, takeOwnership
 
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getType, getVersion
 
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
 

Method Detail

getItemKey

ItemKey getItemKey()
                   throws PermissionDeniedException,
                          BaseException
Get the ItemKey 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 key
BaseException - If there is another error

setItemKey

void setItemKey(ItemKey itemKey)
                throws PermissionDeniedException
Set the ItemKey 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 the ProjectKey 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 key
BaseException - If there is another error

setProjectKey

void setProjectKey(ProjectKey projectKey)
                   throws PermissionDeniedException
Set the ProjectKey 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

2.17.2: 2011-06-17