public class AnnotationSnapshot
extends java.lang.Object
implements java.io.Serializable
IMPORTANT NOTE TO DEVELOPERS!!
Do not forget to synchronize all serialization code and to increment
the AnnotationSetSnapshot.FILE_VERSION
in case the number of variables
that needs serialization in this class or in the AnnotationSetSnapshot
changes.
Modifier and Type | Field and Description |
---|---|
private int |
annotationId |
private int |
annotationSetId |
private int |
annotationTypeId |
private boolean |
inherited |
private int |
itemId |
private Item |
itemType |
private static long |
serialVersionUID |
private java.util.List<? extends java.io.Serializable> |
values |
Constructor and Description |
---|
AnnotationSnapshot()
Create a new, empty annotation snapshot.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
deserializeObject(java.io.ObjectInputStream in) |
Annotation |
getAnnotation(DbControl dc)
Get the annotation this is a snapshot of.
|
int |
getAnnotationId()
Get the id of the annotation this is a snapshot of.
|
AnnotationSet |
getAnnotationSet(DbControl dc)
Get the annotation set this annotation belongs to.
|
int |
getAnnotationSetId()
Get the id of the annotation set this annotation belongs to.
|
AnnotationType |
getAnnotationType(DbControl dc)
Get the annotation type.
|
int |
getAnnotationTypeId()
Get the id of the annotation type.
|
Annotatable |
getItem(DbControl dc)
Get the item that this annotation belongs to.
|
int |
getItemId()
Get the id of the item this annotation belongs to.
|
Item |
getItemType()
Get the item type of the item this annotation belongs to.
|
java.util.List<? extends java.io.Serializable> |
getValues()
Get the annotation values.
|
java.util.List<? extends java.io.Serializable> |
getValues(UnitConverter converter,
Type valueType)
Get the annotations values, optionally converted to some specific unit
and type of values.
|
boolean |
hasPermission(DbControl dc,
Permission permission)
Check if the logged in user has the request permission on this annotation
or annotation set.
|
(package private) void |
initInherited(AnnotationData inherited)
Initialize the snapshot with information from the given
inherited annotation.
|
(package private) void |
initInherited(AnnotationSetData inherited)
Initialize the snapshot with information from the given
inherited annotation set.
|
(package private) void |
initInherited(AnnotationSnapshot primary)
Initializes this snapshot as an inherited annotation
with complete data from another primary annotation
snapshot.
|
(package private) void |
initPrimary(AnnotationData primary)
Initialize the snapshot with information from the given
primary annotation.
|
boolean |
isInherited()
Is this annotation a primary or inherited annotation?
|
private void |
readObject(java.io.ObjectInputStream in) |
(package private) void |
serializeObject(java.io.ObjectOutputStream out) |
(package private) void |
setItem(int itemId,
Item itemType) |
private void |
writeObject(java.io.ObjectOutputStream out) |
private static final long serialVersionUID
private transient boolean inherited
private transient int annotationId
private transient int annotationSetId
private transient int annotationTypeId
private transient java.util.List<? extends java.io.Serializable> values
private transient int itemId
private transient Item itemType
public AnnotationSnapshot()
void initPrimary(AnnotationData primary)
primary
- A primary annotationvoid initInherited(AnnotationData inherited)
inherited
- An inherited annotationvoid initInherited(AnnotationSetData inherited)
inherited
- An inherited annotation setvoid initInherited(AnnotationSnapshot primary)
primary
- A snapshot of a primary annotationpublic boolean isInherited()
public int getAnnotationId()
public Annotation getAnnotation(DbControl dc)
public boolean hasPermission(DbControl dc, Permission permission)
dc
- The DbControl to use for database accesspermission
- The requested permissionpublic int getAnnotationSetId()
public AnnotationSet getAnnotationSet(DbControl dc)
public int getAnnotationTypeId()
public AnnotationType getAnnotationType(DbControl dc)
public java.util.List<? extends java.io.Serializable> getValues()
SnapshotManager.findAnnotations(DbControl, AnnotationSetSnapshot, Filter, boolean)
public java.util.List<? extends java.io.Serializable> getValues(UnitConverter converter, Type valueType)
converter
- A converter for converting (numerical) values,
or null to not convert the valuesvalueType
- The return type of the converted values (ignored if
no converter is specified)public int getItemId()
SnapshotManager.findAnnotations(DbControl, AnnotationSetSnapshot, Filter, boolean)
public Annotatable getItem(DbControl dc)
public Item getItemType()
SnapshotManager.findAnnotations(DbControl, AnnotationSetSnapshot, Filter, boolean)
void setItem(int itemId, Item itemType)
void serializeObject(java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOException
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOException
void deserializeObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException