Wednesday, March 12, 2008

This Week in Wonder

Automatic Inverse Relationship Updating
This feature was partially implemented a while back, but it didn't work in all cases. This now should work all the time (Chuck! It has test cases!). Essentially what it means is that you no longer have to think about addObjectToBothSidesOfBlah or removeObjectFromBothSidesBlah, you can just use the normal EOF methods and it will automatically call the necessary methods to update your relationships.

The EOGenerator templates that ship with WOLips (and that were inherited from some long-since-paste original version) have always had methods that made this easier -- the person.setCompanyRelationship(company) and company.addToEmployeesRelationship(Person person) methods, and these are nice in code, but you are vulnerable in certain cases (like binding in components) that don't know about those methods and can leave you with only one side being updated properly.

There are new Wonder templates in WOLips that provide overrides for the core setXxx method variants, and they check to see if inverse updating is enabled. If it is, then the new way will be used, if not, the old way will be. So in the above example, when auto-updating of inverse relationships is enabled, you can can person.setCompany(company) and company.addToEmployees(person), and it will Do The Right Thing™.

To enable it, in your Properties file, just set:

er.extensions.ERXEnterpriseObject.updateInverseRelationships=true

Misc API
ERXJavaScript now has the same binding naming conventions as ERXStyleSheet (and the rest of WO) -- framework = "xxx" filename = "yyy", though the old bindings are still maintained.

Utilities
ERXUtilities.deepClone (for anything -- it will call the corresponding object, array, or dictionary methods), ERXArrayUtilities.deepClone (for arrays), and ERXDictionaryUtilities.deepClone (for dictionaries) have been added. If you ever run into a situation where cloning a dictionary is not enough, and you need to clone arrays and dictionaries INSIDE that dictionary, these are the methods for you. deepClone will attempt to recursively clone all of the objects in the graph. You can optionally have it clone just the collections or the leaf nodes as well. Leaf nodes will only clone if they implement Cloneable and provide a clone method -- Currently this will not properly clone EO's, for instance.

Database PlugIns
There's been a long-standing totally annoying (what I consider a) bug in EOF that you have to open a database connection to be able to retrieve jdbc2Info, which is required to do things like SQL generation. If you've ever noticed when you made a new model in EOModeler, or when you try to generate SQL in Entity Modeler, it would yell at you if it couldn't connect to your DB, that's why. jdbc2Info contains things like database type information, which is almost always static with your database version.

Thanks to Andrew Lindesay, the plugins in Wonder (Postgresql and FrontBase right now) both now provide overrides for loading jdbc2Info from a static resource in the plugin jar, which means you can fully create a model and generate SQL without needing a database connection.

For postgresql, make your connection string: jdbc:postgresql://yourhost/yourdb?useBundledJdbcInfo=true

For FrontBase, make your connection string: jdbc:FrontBase://yourhost/yourdb/useBundledJdbcInfo=true

Click-To-Open
Chuck documented Click-To-Open support here.

Ajax
Ajax framework has been upgraded to Prototype 1.6 and Scriptaculous 1.8. Check your apps accordingly.

1 comment:

  1. Mike, just wanted to say that I appreciate your summary of changes to Wonder each week. Makes for great reading.

    Thanks, Kieran

    ReplyDelete