Changes between Initial Version and Version 1 of Ticket #1992

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


  • Ticket #1992 – Description

    initial v1  
    33On the other hand, trying to set an existing annotation to null will throw an exception (as expected).
     5The code for creating the empty annotations go something like this (assuming that we have an annotatable item and an annotation type):
     7Annotatable item = ...
     8AnnotationType at = ...
     9AnnotationSet as = item.getAnnotationSet();
     10Annotation a = as.getAnnotation(at); // <-The empty annotation is created here
     12// a.setValue(aValue) must be called to create a non-empty annotation
     14dc.commit(); // <- We must check that annotation values has been set here
     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:
     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.
     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.