History/logging

We have the following bits of information:

* the record we are interested in logging

* what is related to this record (I think only one to many relations
  are important. Many to many records are not usually related as
  dependent objects. many to one means this record is dependent on
  another)

* the creation time of a record.

* the publication start time of a record.

* the publication end time of a record.

* the person who last modified the record.

* the person who published the record.

* the status of the record

* the code of the record to identify related records.

We need to be able to detect:

* modifications (to record and dependent records)

* workflow transitions

We should have an API where we ask for the workflow events that
happened to a bunch of ORM-backed objects. That won't be sufficient
however, as it will ignore those objects that were historically
releted.  So perhaps it is really needed to have an API that can give
workflow information about all records that are associated to an
object by a one-to-many relation.

The objects should be sorted by the publication start timestamp. For those
records that aren't published yet, there is only one of them: the current
editing state. This should be sorted to the top.

It may be possible to find out more about the current editing state,
but it's going to be hard and involves comparing records. I think this
is a problem that should be delegated until we figure out the rest.

But it would also be nice to find out *what* was edited in an editing
action. The simplest thing is the record represented by the object
itself, comparing it to the version before it. We can also compare
relations. We can identify the relations to compare by using the code
of the related record. We can then create an action message out of it,
which discuss what has been edited. We can also see relations that
have been added or removed.

The application will have to provide knowledge about what relations
are interesting. Message rendering can also be handled by the application.


