dragonwell
Programmer
I am looking for a pattern here. (Mediator maybe?) My intent is to allow a client to add-to, remove-from, and change objects in collection, with the option to cancel all changes and revert back to the original. The collection is owned by a parent object, which can be modified and then have the changes either saved or discarded.
I am thinking I need some kind of temporary collection, which is a clone of the "real" collection, so that I can perform modifications without affecting the original. Then, during the Save process, clear the items in the orginal collection and copy the items in the temporary object to the real object and persist to the database.
I am stuck on where to place the responsibilty for maintaining this temporary collection.
One twist, is that to avoid duplicating what is added, I'll need to be able to refer to the temporary collection so that I can filter the choices when listing the possible items to add.
Does this sound familiar to anyone?
Any thoughts on this much appreciated as always.
Dragonwell
I am thinking I need some kind of temporary collection, which is a clone of the "real" collection, so that I can perform modifications without affecting the original. Then, during the Save process, clear the items in the orginal collection and copy the items in the temporary object to the real object and persist to the database.
I am stuck on where to place the responsibilty for maintaining this temporary collection.
One twist, is that to avoid duplicating what is added, I'll need to be able to refer to the temporary collection so that I can filter the choices when listing the possible items to add.
Does this sound familiar to anyone?
Any thoughts on this much appreciated as always.
Dragonwell