One of the things to keep in mind during these discussions is the
forthcoming ExecutionContext - a part of the security redesign. Instead
of passing a delegator around the framework, the current delegator is
assigned to the current thread and a static method exists to retrieve it
at any point in the execution path.
I should have that code committed sometime late this week, or this
weekend at the latest. Even though the new security design is disabled,
the ExecutionContext can still be used. In fact, we can use it to start
fixing issues like the ones described here.
-Adrian
Bob Morley wrote:
Bob Morley wrote:
Will do. I seem to recall that I had to change a number of signatures
in the entity pkg to float down appropriate context so default would
not be used. I will dig up my work on Monday and compare to latest
ofbiz trunk.
Adam -- I took a look at the changes that I had put in place and one of the
fundamental problems can be seen in EntityExpr -> makeWhereString around
line 130 "this.checkRhsType(modelEntity, null);". The second argument there
is meant to be the delegator. In checkRhsType it has logic to check for a
null delegator and if so "we'll cheat a little here and assume the default
delegator". Our issue was that our default delegator database looked quite
a bit different from our "tenant" database so we would get into this code
and use the wrong delegator and as a result the wrong entity model.
We made a few changes such as ...
- change the signature chain for entity expressions to provide the delegator
- if checkRhsType is called with a null delegator we log a warning message *
- removed default constructor for GenericValue to one that required a
delegator
- throw illegal argument exception if GenericDelegator is constructed with a
null delegatorName
- creation of GenericValue and GenericPK to require a delegator rather than
an anti-pattern of construction and setDelegator pattern.
* I wonder if this should have been changed to an IllegalArgumentException
upon reflection.
I could package these changes up for your review and possible inclusion into
Ofbiz if you feel there is value in doing so ... thoughts?
PS. I think some of my list of changes here have been covered off by your
changes. I looked into the expression stuff in trunk, but the rest I was
just eye balling in FishEye against our svn.