Rickard Öberg wrote:
<usecase name='Add child'>
  <entity id='123'>
    <setproperty name='name'>Rickard</setproperty>
    <setproperty name='age'>33</setproperty>
    <setassociation name='childof'>456</setproperty>
  </entity>
  <entity id='456'>
    <addmanyassociation name='children' index='0'>123</addmanyassociation>
  </entity>
</usecase>

You know what, if we do this, we could then trivially add events like (slightly adjusted XML btw):
<unitofwork usecase='Add child'>
  <readversion id='123'>45</readversion>
  <readversion id='456'>32</readversion>
  <entity id='123'>
    <setproperty name='name'>Rickard</setproperty>
    <setproperty name='age'>33</setproperty>
    <setassociation name='childof'>456</setproperty>
  </entity>
  <entity id='456'>
    <addmanyassociation name='children' index='0'>123</addmanyassociation>
  </entity>
</unitofwork>
to capture the "I read 456 with version 32 and then added a manyassociation to it", as discussed recently. The read-version events would be added to the log when the EntityState is retrived from the underlying EntityStore.

With this we would also be able to tag each unit of work with a username (for auditing) and a hash (for data integrity).
<unitofwork usecase='Add child' user='rickardoberg' hash='ABdJE3243'>
  <readversion id='123'>45</readversion>
  <readversion id='456'>32</readversion>
  <entity id='123'>
    <setproperty name='name'>Rickard</setproperty>
    <setproperty name='age'>33</setproperty>
    <setassociation name='childof'>456</setproperty>
  </entity>
  <entity id='456'>
    <addmanyassociation name='children' index='0'>123</addmanyassociation>
  </entity>
</unitofwork>

So many nice features opens up...

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to