Combine Validation and Transaction together? [message #577547] |
Mon, 15 May 2006 05:45 |
Eclipse User |
|
|
|
Originally posted by: hocnt.cybersoft-vn.com
Dear ALL,
I want to combine EMFT Validation and Transaction in this scenario:
In my (example) application which manages a book store, there is a rule:
a book may have one or more than chapters. So, if user tries to delete
the last chapter of a book, he will get an error message to inform him
that he can not do that. The last chapter of the book won't be deleted.
I'm using EMFT Transaction. I'm trying to use EMFT Validation. Thus, I
wish I can define a validation rule that will be triggered when user
tries to delete the last chapter of a book and I can prevent that action.
Ideally, the validation shall be triggerred BEFORE user has performed
the delete action, but this seems impossible.
Less ideally, the validation shall be triggerred in the MIDDLE of the
deleting process, that means in context of a transaction (during the
deleting action). In the validation code, I wish to be able to get the
current transaction and rollback it, but once again, this seems impossible.
Well, the reality is, the validation is triggerred right AFTER the
delete action has been performed. So, I guess that I have to get the
last command in the command stack and undo it. This is not an optimized way.
(Of course, I know that I can write some code to check the constraint
before proceeding the delete action just in the RemoveCommand but I want
to concentrate on the validation in one place)
I'm new with EMFT framework, so please enlighten me about it.
Thanks,
Hoc Nguyen
|
|
|
Powered by
FUDForum. Page generated in 0.03951 seconds