A couple of notes:
1. if we add something to the entity engine to check this we would
need to move the Status* entities from the common component to the
entity component
2. I played with doing a separate method that genericized checking the
StatusValidChange, but it made the code bigger and (IMO) more
difficult to follow and customize, especially since the
StatusValidChange checking is pretty simple in the first place.
However, the code would be more generic and perhaps slightly more
simply (ie maybe not fewer lines, but some of the lines would be less
complex), so there might be some merit in it...
3. related to #1, but a variation on that approach: we could perhaps
have a service that checks this generically that is called through an
EECA or SECA rule, and then all we have to do is setup that ECA rule
for each entity we want checked
-David
On May 6, 2009, at 9:29 PM, Scott Gray wrote:
Hi All
Currently there is a ton of code in various places that checks to
make sure a status change is valid using the StatusValidChange
entity, and there are also places where there is no check even
though records exist (createShipment for example). I'm wondering we
couldn't add support for this to the entity engine itself so that it
doesn't have to be done manually, we could add some sort of flag to
the entity field def and then GenericEntity could perform the check
when setting the field. Thoughts?
The only thing I'm not too sure on is the purpose of the condition
field on StatusValidChange and how it is intended to be used, there
are no examples of its use in the existing data.
Failing that I'd at least like to add a utility method and a simple
method operation to simplify the task.
Thanks
Scott
HotWax Media
http://www.hotwaxmedia.com