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 | Class and Description |
---|---|
(package private) static class |
AnnotationSnapshot.AnnotationTypeComparator
Comparator implementation for sorting snapshots
by name of annotation type.
|
Modifier and Type | Field and Description |
---|---|
private int |
annotationId |
private int |
annotationSetId |
private int |
annotationTypeId |
private AnnotationSnapshot |
inheritedFrom |
private int |
inheritedFromId |
private int |
inheritedFromSetId |
private int |
itemId |
private Item |
itemType |
private long |
lastUpdate |
private static long |
serialVersionUID |
private Annotation.Source |
source |
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) |
Unit |
getActualUnit(DbControl dc)
Get the unit that is most relevant for this annotation.
|
List<? extends Serializable> |
getActualValues()
Get the annotation values that are most relevant for this annotation.
|
List<? extends Serializable> |
getActualValues(UnitConverter converter,
Type valueType)
Get the annotations values, optionally converted to some specific unit
and type of values.
|
Annotation |
getAnnotation(DbControl dc)
Deprecated.
In 3.6, use
getThisAnnotation(DbControl)
or getInheritedAnnotation(DbControl) instead |
int |
getAnnotationId()
Deprecated.
In 3.6, use
getThisAnnotationId() or getInheritedAnnotationId() instead |
AnnotationSet |
getAnnotationSet(DbControl dc)
Deprecated.
In 3.6, use
getThisAnnotationSet(DbControl)
or getInheritedAnnotationSet(DbControl) instead |
int |
getAnnotationSetId()
Deprecated.
In 3.6, use
getThisAnnotationSetId()
or getInheritedAnnotationSetId() instead |
AnnotationType |
getAnnotationType(DbControl dc)
Get the annotation type.
|
int |
getAnnotationTypeId()
Get the id of the annotation type.
|
Annotation |
getInheritedAnnotation(DbControl dc)
Get the parent annotation this annotation is inherited from.
|
int |
getInheritedAnnotationId()
Get the ID of the annotation this annotation is inherited from.
|
AnnotationSet |
getInheritedAnnotationSet(DbControl dc)
Get the annotation set this annotation is inherited from.
|
int |
getInheritedAnnotationSetId()
Get the ID of the annotation set this annotation is inherited from.
|
AnnotationSnapshot |
getInheritedFrom()
Get a snapshot for the annotation this is inherited from.
|
Annotatable |
getItem(DbControl dc)
Deprecated.
In 3.6, use
getThisItem(DbControl) or
getInheritedFrom() .getThisItem(DbControl) instead |
int |
getItemId()
Deprecated.
In 3.6, use
getThisItemId() or
getInheritedFrom() .getThisItemId() instead |
Item |
getItemType()
Deprecated.
In 3.6, use
getThisItemType() or
getInheritedFrom() .getThisItemType() instead |
Annotation.Source |
getSource()
Get the source of the annotation.
|
Annotation |
getThisAnnotation(DbControl dc)
Get the annotation this is a snapshot of.
|
int |
getThisAnnotationId()
Get the id of the annotation this is a snapshot of.
|
AnnotationSet |
getThisAnnotationSet(DbControl dc)
Get the annotation set this annotation belongs to.
|
int |
getThisAnnotationSetId()
Get the id of the annotation set this is a snapshot of.
|
Annotatable |
getThisItem(DbControl dc)
Get the item that this annotation belongs to.
|
int |
getThisItemId()
Get the id of the item this annotation belongs to.
|
Item |
getThisItemType()
Get the item type of the item this annotation belongs to.
|
Date |
getThisLastUpdate()
Get the date+time this annotation was last updated.
|
Unit |
getThisUnit(DbControl dc)
Get the unit the annotatation values should use for display.
|
int |
getThisUnitId()
Get the id of the unit that the annotation values should
use when displayed.
|
List<? extends Serializable> |
getThisValues()
Get the annotation values for this annotation.
|
Unit |
getUnit(DbControl dc)
Deprecated.
In 3.6, use
getThisUnit(DbControl) or
getActualUnit(DbControl) instead |
int |
getUnitId()
Deprecated.
In 3.6, use
getThisUnitId() or
getInheritedFrom() .getThisUnitId() instead |
List<? extends Serializable> |
getValues()
Deprecated.
In 3.6, use
getActualValues() or getThisValues() instead |
List<? extends Serializable> |
getValues(UnitConverter converter,
Type valueType)
Deprecated.
In 3.6, use
getActualValues(UnitConverter, Type) instead |
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 |
init(AnnotationData a)
Initialize the snapshot with information from the given annotation.
|
boolean |
isInherited()
Deprecated.
In 3.6, use
getSource() instead |
boolean |
isUpToDate()
A primary or inherited annotation is always up-to-date.
|
private void |
readObject(ObjectInputStream in) |
(package private) void |
serializeObject(ObjectOutputStream out) |
(package private) void |
setInheritedFrom(AnnotationSnapshot inheritedFrom)
Set the primary annotation for an inherited annotation.
|
(package private) void |
setItem(int itemId,
Item itemType) |
static Comparator<AnnotationSnapshot> |
sortByAnnotationType(DbControl dc)
Create a comparator for sorting annotation snapshots by the name
of the annotation type.
|
private void |
writeObject(ObjectOutputStream out) |
private static final long serialVersionUID
private transient Annotation.Source source
private transient int annotationId
private transient int annotationSetId
private transient int annotationTypeId
private transient int inheritedFromId
private transient int inheritedFromSetId
private transient int unitId
private transient Type valueType
private transient long lastUpdate
private transient List<? extends Serializable> values
private transient int itemId
private transient Item itemType
private transient AnnotationSnapshot inheritedFrom
public AnnotationSnapshot()
public static Comparator<AnnotationSnapshot> sortByAnnotationType(DbControl dc)
void init(AnnotationData a)
a
- An annotation@Deprecated public boolean isInherited()
getSource()
insteadpublic Annotation.Source getSource()
@Deprecated public int getAnnotationId()
getThisAnnotationId()
or getInheritedAnnotationId()
insteadgetThisAnnotationId()
for
primary and cloned annotations with missing parent, and
getInheritedAnnotationId()
for inherited
and cloned annotations.public int getThisAnnotationId()
public int getInheritedAnnotationId()
@Deprecated public Annotation getAnnotation(DbControl dc)
getThisAnnotation(DbControl)
or getInheritedAnnotation(DbControl)
insteadgetAnnotationId()
.public Annotation getThisAnnotation(DbControl dc)
public Annotation getInheritedAnnotation(DbControl dc)
public boolean hasPermission(DbControl dc, Permission permission)
dc
- The DbControl to use for database accesspermission
- The requested permission@Deprecated public int getAnnotationSetId()
getThisAnnotationSetId()
or getInheritedAnnotationSetId()
insteadgetThisAnnotationSetId()
for
primary and cloned annotations, and
getInheritedAnnotationSetId()
for inherited
annotations.public int getThisAnnotationSetId()
public int getInheritedAnnotationSetId()
@Deprecated public AnnotationSet getAnnotationSet(DbControl dc)
getThisAnnotationSet(DbControl)
or getInheritedAnnotationSet(DbControl)
insteadpublic AnnotationSet getThisAnnotationSet(DbControl dc)
public AnnotationSet getInheritedAnnotationSet(DbControl dc)
public int getAnnotationTypeId()
public AnnotationType getAnnotationType(DbControl dc)
public AnnotationSnapshot getInheritedFrom()
SnapshotManager.findAnnotations(DbControl, AnnotationSetSnapshot, Filter, boolean)
but may be missing for cloned annotations if the parent has been deleted.@Deprecated public int getUnitId()
getThisUnitId()
or
getInheritedFrom()
.getThisUnitId() insteadpublic int getThisUnitId()
@Deprecated public Unit getUnit(DbControl dc)
getThisUnit(DbControl)
or
getActualUnit(DbControl)
insteadpublic Unit getThisUnit(DbControl dc)
getActualUnit(DbControl)
or getInheritedFrom()
.getThisUnit() to get
the unit also for inherited annotations.public Unit getActualUnit(DbControl dc)
@Deprecated public List<? extends Serializable> getValues()
getActualValues()
or getThisValues()
insteadpublic List<? extends Serializable> getThisValues()
getActualValues()
or getInheritedFrom()
.getThisValues() to get values also for inherited
annotations.public List<? extends Serializable> getActualValues()
@Deprecated public List<? extends Serializable> getValues(UnitConverter converter, Type valueType)
getActualValues(UnitConverter, Type)
insteadgetUnit(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 List<? extends Serializable> getActualValues(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 Date getThisLastUpdate()
public boolean isUpToDate()
@Deprecated public int getItemId()
getThisItemId()
or
getInheritedFrom()
.getThisItemId() insteadpublic int getThisItemId()
SnapshotManager.findAnnotations(DbControl, AnnotationSetSnapshot, Filter, boolean)
@Deprecated public Annotatable getItem(DbControl dc)
getThisItem(DbControl)
or
getInheritedFrom()
.getThisItem(DbControl) insteadpublic Annotatable getThisItem(DbControl dc)
@Deprecated public Item getItemType()
getThisItemType()
or
getInheritedFrom()
.getThisItemType() insteadpublic Item getThisItemType()
SnapshotManager.findAnnotations(DbControl, AnnotationSetSnapshot, Filter, boolean)
void setItem(int itemId, Item itemType)
void setInheritedFrom(AnnotationSnapshot inheritedFrom)
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