Changes between Initial Version and Version 1 of Ticket #1992


Ignore:
Timestamp:
Mar 14, 2016, 11:33:20 AM (6 years ago)
Author:
Nicklas Nordborg
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1992 – Description

    initial v1  
    22
    33On the other hand, trying to set an existing annotation to null will throw an exception (as expected).
     4
     5The code for creating the empty annotations go something like this (assuming that we have an annotatable item and an annotation type):
     6{{{
     7Annotatable item = ...
     8AnnotationType at = ...
     9AnnotationSet as = item.getAnnotationSet();
     10Annotation a = as.getAnnotation(at); // <-The empty annotation is created here
     11
     12// a.setValue(aValue) must be called to create a non-empty annotation
     13
     14dc.commit(); // <- We must check that annotation values has been set here
     15}}}
     16
     17The annotation information is spread out over multiple database tables. If the `Annotation.setValue()` method is called to set the annotation, here is what happens:
     18
     19 * An entry in the `Annotations` table is created
     20 * An entry in the `ParameterValues` table is created
     21 * An entry in the actual data table is created. The actual table depends on the data type. For example `StringValues` for string annotations or `IntegerValues` for integer annotations.
     22
     23If the `Annotation.setValue()` method is not called only the first two entries are created but not the third. This can result in some strange behavior in other places since if an annotation entry exists it is expected to have at least one value.