WOToOneRelationship and Project WOnder ERExtensions framework
After installing the ERExtensions binary
framework, I found that WOToOneRelationship components that were working before
were throwing errors on pages that used them. The root of the problem is that
ERExtensions also contains a WOToOneRelationship component that is "patched in"
to replace Apple's one when ERExtensions framework loads. Anjo Krank, one of the
genius contributors to Project Wonder provided a solution......
The solution was to set the dataSource binding,
which although it is an optional binding for Apple's WOToOneRelationship
component, it is necessary for the ERExtensions version of
WOToOneRelationship.
Below is an
example of what binding and code changes were needed to fix one use of the
component where
CTUser <<->
CTSalesperson
Bindings that do NOT work
with ERExtensions framework installed, but do work without
it:
DefaultSalespersonRelationship:
WOToOneRelationship {
destinationDisplayKey
= "fullname";
relationshipKey =
"defaultSalesperson";
sourceEntityName =
"CTUser";
sourceObject =
user;
}
Bindings
that DO work with ERExtensions
installed:
DefaultSalespersonRelationship:
WOToOneRelationship {
destinationDisplayKey
= "fullname";
relationshipKey =
"defaultSalesperson";
sourceEntityName =
"CTUser";
sourceObject =
user;
dataSource =
allSalespeople;
}
This
required adding _allsalespeople ivar and an additional method to the component
like this:
public EODatabaseDataSource
allSalespeople() {
if (_allSalespeople ==
null) {
_allSalespeople = new
EODatabaseDataSource( user().editingContext(), "CTSalesperson"
);
}
return
_allSalespeople;
}
A small change like this is no
problem since it still remains compatable with Apple's framework AND we still
get the benefit of using a superbly useful framework like ERJavaMail that
depends on ERExtensions framework being present! Thanks again Anjo!
Posted: Tuesday - February 01, 2005 at 10:39 AM