Hi,

I am facing a general design problem in EOF, maybe someone has already
thought about it and could give me some hints.

I´m trying to implement a way of keeping track of "historic" data in the
database with WebObjects.
That is, each time some data are changed, I would like to keep a copy of
the old data with a status "historic" in the database, and insert the new
(altered) data with status "active" in the database, instead of
overwriting and saving.

To illustrate the idea let me give a simple example.
I have an application with "examination results" of students.
These examinations were obtained through a questionnaire, which consists
of many questions. If later I want to modify a question (or delete one or
add a new one) for a future examination, I would like to archive the old
questionnaire with its questions. Like this it is possible to reproduce an
examination with its "historic" questionnaire and questions.

So I want to make a historic backup when:
one question is changed, one question is added, one question is removed, a
questionnaire is changed etc...

I tried to implement this desired feature in EOF in a general way. My
dream would be to have some kind of *framework* which I could always add
(with a minimum of necessary adaptations) to already existing
applications, introducing the possibility of archiving data.

Here is the approach I have taken so far:
Entities who should be archived will obtain a field "archivestatus" which
could be "active" or "historic".
I use my own extended EOEditingContext. To pick up only active data when a
fetch is made, I overwrote objectsWithFetchSpecification() adding a
qualifier with "status = active", in case the entity can be archived.

Then, when I want to save changes of a "question", I interfere in
saveChanges() of my EditingContext.
I have to make a copy of the altered question and its relating objects. (I
use the copy()-method implemented in "Practical WebObjects", which always
copies the whole "cycle" of related objects). The new objects are set to
"active" and the old ones "historic".

Now if I remove or add one question it becomes messier. I would have to
interfere in removeObjectFromBothSidesOfRelationshipWithKey(),
not to mention the complications when you add some objects and change
others at the same time and then call saveChanges()...

Anyway, I feel that it´s getting much more complex than I would have
liked. I have some doubts if I´m going in the right direction at all, or
is it just a too dangerous way to interfere like this in EOF!?
Maybe there is a clever pattern using EOObserverCenter?

Hope I have made clear enough my problem and how I tried to approach it.
Any advice and comments are appreciated!


Greetings,
Georg

--------------------
Georg von Bülow
[EMAIL PROTECTED]

Niterói - Rio de Janeiro - Brasil

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to