public class AnnotationSnapshot extends Object implements 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 int |
unitId |
private List<? extends Serializable> |
values |
private Type |
valueType |
Constructor and Description |
---|
AnnotationSnapshot()
Create a new, empty annotation snapshot.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
deserializeObject(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.
|
Unit |
getUnit(DbControl dc)
Get the unit.
|
int |
getUnitId()
Get the id of the unit that the annotation values should
use when displayed.
|
List<? extends Serializable> |
getValues()
Get the annotation values.
|
List<? extends 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(ObjectInputStream in) |
(package private) void |
serializeObject(ObjectOutputStream out) |
(package private) void |
setItem(int itemId,
Item itemType) |
private void |
writeObject(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 int unitId
private transient Type valueType
private transient List<? extends 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 int getUnitId()
public Unit getUnit(DbControl dc)
public List<? extends Serializable> getValues()
SnapshotManager.findAnnotations(DbControl, AnnotationSetSnapshot, Filter, boolean)
public List<? extends Serializable> getValues(UnitConverter converter, Type valueType)
getUnit(DbControl)
:
this.getUnit(dc).getUnitConverter(this.getAnnotationType(dc).getDefaultUnit())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(ObjectOutputStream out) throws IOException
IOException
private void writeObject(ObjectOutputStream out) throws IOException
IOException
void deserializeObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException