|
2.8.3: 2008-10-15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.basedb.core.BasicItem<AnnotationData>
net.sf.basedb.core.Annotation
public class Annotation
This class represents an annotation. Annotations are user-defined
properties that can be attached to Annotatable
items. They can be very useful in the filtering and analysis
process.
An annotation must have an AnnotationType
,
which controls the type of and how many values that can be attached
to an annotation.
Nested Class Summary | |
---|---|
private static class |
Annotation.QueryRuntimeFilterImpl
|
Field Summary | |
---|---|
private AnnotationSet |
annotationSet
|
private static QueryRuntimeFilter |
RUNTIME_FILTER
This filter gives everybody read permission to annotations. |
static Item |
TYPE
The type of item represented by this class. |
Constructor Summary | |
---|---|
Annotation(AnnotationData annotationData)
|
|
Annotation(AnnotationData annotationData,
AnnotationSet annotationSet)
|
Method Summary | |
---|---|
AnnotationSet |
getAnnotationSet()
Get the annotation set this annotation belongs to. |
AnnotationType |
getAnnotationType()
Get the annotation type of this annotation. |
static Annotation |
getById(DbControl dc,
int id)
Get an Annotation item when you know the id. |
(package private) static Annotation |
getNew(DbControl dc,
AnnotationType annotationType,
AnnotationSet annotationSet)
Create a new annotation. |
(package private) PluginPermission |
getPluginPermissions()
|
(package private) static ItemQuery<Annotation> |
getQuery()
Get a query configured to retrieve annotations. |
Item |
getType()
Get the type of item represented by the object. |
List<?> |
getValues()
Get the values this annotation contains. |
int |
getValuesVersion()
Get the version number of the item keeping the values. |
Type |
getValueType()
Get the value type for this annotation type. |
(package private) void |
initPermissions(int granted,
int denied)
READ permission is granted if the logged in user has READ permission on the associated item. |
void |
setValue(Object value)
Set the value of the annotation, replacing any previous values. |
void |
setValues(List<?> values)
Set the values of the annotation, replacing any previous values. |
Methods inherited from class net.sf.basedb.core.BasicItem |
---|
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, toString, toTransferable, validate |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Item TYPE
Item.ANNOTATION
,
getType()
private static final QueryRuntimeFilter RUNTIME_FILTER
private AnnotationSet annotationSet
Constructor Detail |
---|
Annotation(AnnotationData annotationData)
Annotation(AnnotationData annotationData, AnnotationSet annotationSet)
Method Detail |
---|
static Annotation getNew(DbControl dc, AnnotationType annotationType, AnnotationSet annotationSet) throws BaseException
dc
- The DbControl objectannotationType
- The annotation type of the new annotationannotationSet
- The annotation set of the new annotation
BaseException
AnnotationSet.getAnnotation(AnnotationType)
public static Annotation getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
Annotation
item when you know the id.
dc
- The DbControl
which will be used for
permission checking and database access.id
- The id of the item to load
Annotation
item
ItemNotFoundException
- If an item with the specified
id is not found
PermissionDeniedException
- If the logged in user doesn't
have read permission to the item
BaseException
- If there is another errorstatic ItemQuery<Annotation> getQuery()
ItemQuery
objectpublic Item getType()
Identifiable
Item
enumeration.
void initPermissions(int granted, int denied) throws BaseException
initPermissions
in class BasicItem<AnnotationData>
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass
BaseException
- If the permissions couldn't be initialisedPluginPermission getPluginPermissions()
getPluginPermissions
in class BasicItem<AnnotationData>
public AnnotationSet getAnnotationSet() throws PermissionDeniedException, BaseException
AnnotationSet
PermissionDeniedException
- If the logged in user doesn't have
read permission for the annotation set (should never happen)
BaseException
- If anything else goes wrong when getting the annotation set.public AnnotationType getAnnotationType() throws PermissionDeniedException, BaseException
AnnotationType
PermissionDeniedException
- If the logged in user doesn't have
read permission for the annotation type
BaseException
- If anything else goes wrong when getting the annotation type.public Type getValueType()
public List<?> getValues() throws BaseException
Type
appropriate for the given annotation type, ie. Integer object
for an integer annotation type. All objects in the list are of the same type.
BaseException
- If there is an errorAnnotationType.getValueType()
public int getValuesVersion()
public void setValue(Object value) throws PermissionDeniedException, InvalidDataException, BaseException
value
- The new value
PermissionDeniedException
- If the logged in user doesn't have
write permission for the annotation or read permission for the annotation
type
InvalidDataException
- If the value isn't a valid value for the
annotation type, see AnnotationType.validateAnnotationValue(Object)
BaseException
- If there is another errorpublic void setValues(List<?> values) throws PermissionDeniedException, InvalidDataException, BaseException
values
- A list containing the new values
PermissionDeniedException
- If the logged in user doesn't have
write permission for the annotation or read permission for the annotation
type
InvalidDataException
- If the number of values are too many according
to the AnnotationType.getMultiplicity()
setting any of the values
isn't a valid value for the annotation type, see
AnnotationType.validateAnnotationValue(Object)
BaseException
- If there is another error
|
2.8.3: 2008-10-15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |