Changeset 6112


Ignore:
Timestamp:
Sep 10, 2012, 2:23:16 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1717: Annotation importer create annotation set even if there are no annotations for an item

This should fix the annotation import so that it doesn't create annotation sets when there are not annotation values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2-stable/src/plugins/core/net/sf/basedb/plugins/AnnotationFlatFileImporter.java

    r6060 r6112  
    13601360      if (values.size() == 0) return;
    13611361      int numAnnotations = 0;
    1362       AnnotationSet as = item.getAnnotationSet();
     1362      AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null;
    13631363      for (Map.Entry<AnnotationType, List<AnnotationValue>> entry : values.entrySet())
    13641364      {
     
    13671367        int size = newValues.size();
    13681368        int multiplicity = at.getMultiplicity();
    1369         boolean hasAnnotation = as.hasAnnotation(at);
     1369        boolean hasAnnotation = as != null && as.hasAnnotation(at);
    13701370        boolean merge = addToUnlimited && hasAnnotation && multiplicity == 0;
    13711371        boolean tooManyValues = multiplicity > 0 && size > multiplicity;
     
    13841384            if (!tooManyValues || failIfTooManyValues)
    13851385            {
     1386              if (as == null) as = item.getAnnotationSet();
    13861387              Annotation a = as.getAnnotation(at);
    13871388              List<Object> theValues = new ArrayList<Object>(newValues.size());
Note: See TracChangeset for help on using the changeset viewer.