Opened 14 years ago

Closed 13 years ago

Last modified 12 years ago

#966 closed enhancement (duplicate)

Registered and possibly last updated – add to all/most items

Reported by: Johan Vallon-Christersson Owned by: Johan Vallon-Christersson
Priority: critical Milestone:
Component: core Version:
Keywords: Cc:


Some items, such as Samples, have a Registered property, i.e., the date at which the item was entered in BASE2.

It would be useful to add this property to all (or most) items in BASE, e.g., biosource, scan, raw bioassay.

Other items, such as reporters, also have a last updated property and this should also be considered to be a general property for items in BASE.

Typical user scenarios include wanting to rapidly find the latest items, i.e., the ones that were most recently added to BASE (or edited).

Change History (10)

comment:1 Changed 14 years ago by Nicklas Nordborg

Type: defectenhancement

comment:2 Changed 14 years ago by Nicklas Nordborg

This ticket is a bit related to #108. In fact, both can be solved at the same time. The only difference is the level of logging. Just logging the last updated time may seem easier but it is not. First, consider the following code snippet:

DbControl dc = ...
Sample s1 = Sample.getById(dc, id1);
Sample s2 = Sample.getById(dc, id2);
s2.setName("A new name");

The logical thing to happen is that the 's2', but not the 's1' sample should have it's last-modified time updated. The problem is that there is no place in the BASE core were we can detect if an item has been changed or not. So, either both samples get their last-modified time updated or none of them do. The solution to this is to go deeper down and hook into Hibernate. Hibernate does know that only 's2' has been updated it is possible to hook our own code onto Hibernate and change the last-modified time there.

Second, what should be counted as updating an item? Obviously, changing the name qualifies. What about the following scenarios?

  1. Creating an extract from it, which may modify the remaining quantity of the sample
  2. Adding or modifying an annotation

In the first case, there is an actual modification in the sample's table. Our Hibernate hook would detect this and update the last-modified time of the sample. In the second case, nothing happens to samples table at all. Annotations are stored in different tables and to get to them you have to follow four levels of links (for example, Sample -> AnnotationSet? -> Annotation -> StringValues?). Our Hibernate hook will only detect a change in the StringValues? part, and maybe in the Annotation part if it was a new annotation. At the level of the hook there is no way to go backwards to update the last-modified time of the sample. If that is desired, there must be code placed elsewhere that detects this and takes some action. Right now I have no idea what that place should be, or if it exists or not.

Also note that the above is only an example, there are other similar parent-child relationships between other items in BASE. For example for Experiments -> BioAssaySets?.

comment:3 in reply to:  2 Changed 14 years ago by Johan Vallon-Christersson

As the 'registered' property and 'last updated' property can be considered two different things, perhaps these two enhancements should be separated into two different tickets. Especially as adding last updated information seems to be more complicated to implement.

For the typical user, having information about when items were registered would by itself constitute a great enhancement.

comment:4 Changed 14 years ago by Nicklas Nordborg

The 'registered' property would be easier. This could be hooked into the DbControl?.saveItem() method, or BasicItem?.onBeforeCommit(). Another option is to see if we can use the built-in Hibernate 'timestamp' type, but I am not clear if we can use it since we already have a 'version' property. From the Hibernate documentation it looks like the timestamp and version can't be used at the same time. A third option may be to implement it is a custom datatype. See

comment:5 Changed 14 years ago by Jari Häkkinen

Milestone: BASE 2.8
Owner: changed from everyone to Johan Vallon-Christersson

This ticket should be split to a registered ticket and last updated ticket. Affected items hould be listed instead of specified as all/most items.

comment:6 Changed 14 years ago by Jari Häkkinen

Priority: majorcritical

comment:7 Changed 13 years ago by Nicklas Nordborg

Milestone: BASE 2.8BASE 2.x+

Not enough time to fix this before the 2.8 release.

comment:8 in reply to:  6 Changed 13 years ago by Johan Vallon-Christersson

List of items that would benefit from having registered as a property available in ticket:1166

comment:9 Changed 13 years ago by Nicklas Nordborg

Resolution: duplicate
Status: newclosed

#1166 implements the 'creation date' part and #108 is for the rest.

comment:10 Changed 12 years ago by Jari Häkkinen

Milestone: BASE 2.x+
Note: See TracTickets for help on using tickets.