Changeset 5066


Ignore:
Timestamp:
Aug 20, 2009, 8:04:57 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #108: Logging the change history of an item

Only log annotation changes if the parent item is loggable.

File:
1 edited

Legend:

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

    r5059 r5066  
    3232import net.sf.basedb.core.data.AnnotationTypeData;
    3333import net.sf.basedb.core.data.ChangeHistoryDetailData;
     34import net.sf.basedb.core.data.LoggableData;
    3435import net.sf.basedb.core.log.EntityDetails;
    3536import net.sf.basedb.core.log.ChangeType;
     
    9596    if (itemType == null) return;
    9697   
     98    Class parentClass = Item.fromValue(itemType).getDataClass();
     99    // If the parent item isn't implementing the LoggableData interface
     100    // we don't log the changes
     101    if (!LoggableData.class.isAssignableFrom(parentClass)) return;
     102   
    97103    // Get the id of the parent item
    98     String parentClass = Item.fromValue(itemType).getDataClass().getName();
    99104    Query q = logControl.createHqlQuery(
    100       PredefinedQuery.getQueryString("DBLOG_GET_ITEMID_WITH_ANNOTATION", parentClass));
     105      PredefinedQuery.getQueryString("DBLOG_GET_ITEMID_WITH_ANNOTATION", parentClass.getName()));
    101106    q.setInteger("annotationSetId", as.getId());
    102107    Integer parentId = (Integer)q.uniqueResult();
Note: See TracChangeset for help on using the changeset viewer.