Changeset 5056


Ignore:
Timestamp:
Aug 18, 2009, 2:09:01 PM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #108: Logging the change history of an item

  • Annotation logger can now handle updates as well, due to a new 'last update' field in the annotation table.
Location:
trunk/src/core/net/sf/basedb/core
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Annotation.java

    r4889 r5056  
    3232
    3333import java.util.ArrayList;
     34import java.util.Date;
    3435import java.util.List;
    3536import java.util.Collections;
     
    437438    }
    438439    getData().getValues().setSingleValue(Values.getDataValue(value));
     440    getData().setLastUpdate(new Date());
    439441  }
    440442
     
    495497    }
    496498    getData().getValues().replaceValues(Values.getDataValues(convertedValues));
     499    getData().setLastUpdate(new Date());
    497500  }
    498501
  • trunk/src/core/net/sf/basedb/core/AnnotationSet.java

    r5014 r5056  
    2424
    2525import java.util.Collections;
     26import java.util.Date;
    2627import java.util.LinkedList;
    2728import java.util.List;
     
    744745        AnnotationData from = entry.getValue();
    745746        to.getValues().replaceValues(from.getValues().getValues());
     747        to.setLastUpdate(new Date());
    746748      }
    747749    }
  • trunk/src/core/net/sf/basedb/core/Install.java

    r5043 r5056  
    114114    method.
    115115  */
    116   public static final int NEW_SCHEMA_VERSION = Integer.valueOf(73).intValue();
     116  public static final int NEW_SCHEMA_VERSION = Integer.valueOf(74).intValue();
    117117 
    118118  public static synchronized void createTables(boolean update, final ProgressReporter progress)
  • trunk/src/core/net/sf/basedb/core/Update.java

    r5038 r5056  
    3535import org.hibernate.mapping.Table;
    3636
     37import net.sf.basedb.core.data.AnnotationData;
    3738import net.sf.basedb.core.data.ArrayDesignData;
    3839import net.sf.basedb.core.data.ChangeHistoryData;
     
    823824    </td>
    824825  </tr>
     826  <tr>
     827    <td>74</td>
     828    <td>
     829      Added {@link AnnotationData#getLastUpdate()}.
     830      No special update is needed. Only increase the schema version.
     831    </td>
     832  </tr>
    825833  </table>
    826834
     
    11051113      }
    11061114     
    1107       // Schemaversion 61-73 only updates the version number
    1108       if (schemaVersion < 73)
    1109       {
    1110         if (progress != null) progress.display((int)(72*progress_factor), "--Updating schema version: " + schemaVersion + " -> 73...");
    1111         schemaVersion = setSchemaVersionInTransaction(session, 73);
     1115      // Schemaversion 61-74 only updates the version number
     1116      if (schemaVersion < 74)
     1117      {
     1118        if (progress != null) progress.display((int)(73*progress_factor), "--Updating schema version: " + schemaVersion + " -> 74...");
     1119        schemaVersion = setSchemaVersionInTransaction(session, 74);
    11121120      }
    11131121     
  • trunk/src/core/net/sf/basedb/core/data/AnnotationData.java

    r5054 r5056  
    2323package net.sf.basedb.core.data;
    2424
     25import java.util.Date;
    2526import java.util.Set;
    2627
     
    106107  }
    107108 
     109  private Date lastUpdate;
     110  /**
     111    Get the date and time the values in this annotation was last updated.
     112    @return A <code>Date</code> object, or null if not known
     113    @hibernate.property column="`last_update`" type="timestamp" not-null="false"
     114  */
     115  public Date getLastUpdate()
     116  {
     117    return lastUpdate;
     118  }
     119  public void setLastUpdate(Date lastUpdate)
     120  {
     121    this.lastUpdate = lastUpdate;
     122  }
     123 
    108124  private Set<AnnotationSetData> inheritingSets;
    109125  /**
  • trunk/src/core/net/sf/basedb/core/data/ParameterValueData.java

    r4889 r5056  
    9595  /**
    9696    Set values of this parameter.
     97    <p>
     98    NOTE! Used by Hibernate to initialize the object. Do not
     99    call {@link AnnotationData#setLastUpdate(java.util.Date)}!
    97100    @param values Collection of values.
    98101  */
     
    103106    values in the specified list. It is expected that
    104107    the list contains only objects of the correct type.
     108    <p>
     109    NOTE! When this method is called to set annotation values
     110    for an {@link AnnotationData}, don't forget to also update
     111    the last update timestamp: {@link AnnotationData#setLastUpdate(java.util.Date)}.
    105112  */
    106113  @SuppressWarnings("unchecked")
     
    115122    Replace the current list with a single new value.
    116123    It is expected that the value is of the correct type.
     124    <p>
     125    NOTE! When this method is called to set annotation values
     126    for an {@link AnnotationData}, don't forget to also update
     127    the last update timestamp: {@link AnnotationData#setLastUpdate(java.util.Date)}.
    117128  */
    118129  @SuppressWarnings("unchecked")
Note: See TracChangeset for help on using the changeset viewer.