Hi all,

I made a little something to analyze dependencies between entities, and sort entities based on them. So that the non-dependent entities are at a lower index in the resulting list then the ones they are dependent on. The current implementation only deals with relationships, but the analysis method is agnostic of dependency types. To add your own dependencies check out the comment at line 127. It should work with any kind of a dependency constraint.

Usage:
Put into whichever app, and call the static sortedEntities() method. The returned value should be a list of entities in which the non- dependent entities are at a lower index in the resulting list then the ones they are dependent on. The entities are loaded from the default model group. If there is a circular dependency, an exception should be thrown.

It is not very well commented, and totally not optimized, as I am still working on it. I also hope to be able to fine-grain it a bit. Till now the only fine graining is the possibility to define non- mandatory dependencies, the _isDependent(...) method will use that flag.

Let me know if it works for you or not. I tested it with a fairly complex model (around 15 entities, 50+ relationships) successfully. It should be able to chew through anything though. I'd really appreciate if somebody with a really super-complex model group could give it a go.

F

Attachment: DependencyAnalizer.java
Description: Binary data

 _______________________________________________
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