Changeset 6968


Ignore:
Timestamp:
Oct 2, 2015, 11:36:10 AM (6 years ago)
Author:
Nicklas Nordborg
Message:

References #1941: Store experimental factor values as part experiments

The annotation logger implementation did not handle inherited annotations correctly when logging of old property valus had been enabled (NullPointerException when trying to get the values).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/log/db/AnnotationLogger.java

    r6875 r6968  
    2525import org.hibernate.Query;
    2626
     27import net.sf.basedb.core.Annotation;
    2728import net.sf.basedb.core.Item;
    2829import net.sf.basedb.core.LogControl;
     
    3435import net.sf.basedb.core.data.ChangeHistoryDetailData;
    3536import net.sf.basedb.core.data.LoggableData;
     37import net.sf.basedb.core.data.ParameterValueData;
    3638import net.sf.basedb.core.log.ChangeType;
    3739import net.sf.basedb.core.log.EntityDetails;
    3840import net.sf.basedb.core.log.EntityLogger;
    3941import net.sf.basedb.core.log.LogManager;
     42import net.sf.basedb.core.plugin.ParameterValues;
    4043import net.sf.basedb.util.Values;
    4144import net.sf.basedb.util.formatter.Formatter;
     
    139142    change.setItemId(parentId);
    140143    change.setItemType(parentType);
    141     change.setChangeInfo("Annotation["+annotationType+"]");
     144    Annotation.Source source = Annotation.Source.values()[annotation.getSource()];
     145    if (source == Annotation.Source.CLONED)
     146    {
     147      change.setChangeInfo("ClonedAnnotation["+annotationType+"]");
     148    }
     149    else if (source == Annotation.Source.INHERITED)
     150    {
     151      change.setChangeInfo("InheritedAnnotation["+annotationType+"]");
     152    }
     153    else
     154    {
     155      change.setChangeInfo("Annotation["+annotationType+"]");
     156    }
    142157    if (factory.isLoggingOldPropertyValues() && !disableLogOfValues)
    143158    {
     
    151166        f = EntityDetails.DATETIME_FORMAT;
    152167      }
    153       String newValues = Values.getString(annotation.getValues().getValues(), ", ", true, f);
    154       String oldValues = Values.getString(annotation.getValues().getOldValues(), ", ", true, f);
    155       change.setNewValue(newValues.length() == 0 ? null : newValues);
    156       change.setOldValue(oldValues.length() == 0 ? null : oldValues);
     168      ParameterValueData<?> values = annotation.getValues();
     169      if (values != null)
     170      {
     171        String newValues = Values.getString(values.getValues(), ", ", true, f);
     172        String oldValues = Values.getString(values.getOldValues(), ", ", true, f);
     173        change.setNewValue(newValues.length() == 0 ? null : newValues);
     174        change.setOldValue(oldValues.length() == 0 ? null : oldValues);
     175      }
    157176    }
    158177    ((DbLogManager)logManager).logChangeDetails(change, details);
Note: See TracChangeset for help on using the changeset viewer.