Package net.sf.basedb.core.snapshot
Class AnnotationSetSnapshot
java.lang.Object
net.sf.basedb.core.snapshot.AnnotationSetSnapshot
- All Implemented Interfaces:
Serializable
A snapshot of an annotation set that is used to store
information as a file. This will make it quicker to load
annotation values than if we have to do it from the database
each time. The snapshot will store information about:
- The item the annotation set is linked to
- The primary annotations (including their values)
- Unit the values should be displayed in (values are always stored in the unit of the annotation type)
- Inherited annotations (not including the values)
- Inherited annotation sets (not including the values)
IMPORTANT NOTE TO DEVELOPERS!!
Do not forget to synchronize all serialization code and to increment
the FILE_VERSION
in case the number of variables that needs
serialization in this class or in the AnnotationSnapshot
changes.
- Version:
- 2.14
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2019-02-27 14:18:43 +0100 (ons, 27 feb. 2019) $
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
Comparator for sorting annotation snapshots so that project-specific annotations appear before default annotations. -
Field Summary
Modifier and TypeFieldDescriptionprivate List<AnnotationSnapshot>
private int
private long
static final int
The version number for the file format in use when serializing this data.private int
private Item
private static final long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) List<AnnotationSnapshot>
Get a list with the all annotations in this snapshot.Get the annotation set this is a snapshot of.int
Get the id of the annotation set this is a snapshot of.Get item the annotations belong to.int
Get the ID of the item the annotations in this snapshot belong to.Get the item type of the item the annotations in this snapshot belong to.int
getSize()
Get the number of annotations.Get the date and time this snapshot was created.void
init
(AnnotationSetData set) Initialise the snapshot with data from the given annotation set, including values for all primary annotations and information about inherited annotations.private void
private void
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
FILE_VERSION
public static final int FILE_VERSIONThe version number for the file format in use when serializing this data. If the format changes in an incompatible way, this number must be increased. This will make sure that the old files are not used and that new files are generated instead. -
created
private transient long created -
annotationSetId
private transient int annotationSetId -
itemId
private transient int itemId -
itemType
-
annotations
-
-
Constructor Details
-
AnnotationSetSnapshot
public AnnotationSetSnapshot()Creates a new, empty snapshot.
-
-
Method Details
-
init
Initialise the snapshot with data from the given annotation set, including values for all primary annotations and information about inherited annotations. -
getSnapshotDate
Get the date and time this snapshot was created. -
getItemId
public int getItemId()Get the ID of the item the annotations in this snapshot belong to. -
getItem
Get item the annotations belong to.- Parameters:
dc
- A DbControl to use for database access
-
getItemType
Get the item type of the item the annotations in this snapshot belong to. -
getSize
public int getSize()Get the number of annotations. -
getAnnotations
List<AnnotationSnapshot> getAnnotations()Get a list with the all annotations in this snapshot. -
getAnnotationSetId
public int getAnnotationSetId()Get the id of the annotation set this is a snapshot of. -
getAnnotationSet
Get the annotation set this is a snapshot of. -
writeObject
- Throws:
IOException
-
readObject
- Throws:
IOException
ClassNotFoundException
-