In this release of Expanders, we've cleaned up some long-deprecated code that still uses UserContext
as the main
context transport object. There's also been several improvements in the infrastructure to improve ease of use for
functional keys.
Resources
The expansion resources below provide Expanders 5.32.0
.
Resource | Version |
---|
Expanders | 5.32.0 |
nsx-default-stack | 2023.15.2 |
rest-jaxrs-stack | 3.27.0 |
Changes and improvements
Functional key infrastructure
FinderResolver
A new class FinderResolver
has been introduced, which is called from the Bean.find()
method in the logic layer. This
class will automatically resolve the DataRefs for any field operator pairs that target link fields. Resolving means that
it will resolve the DataRef against the database in case there's no database identifier present in it. While much of the
methods in the stack already did this, the finders still did not, which often caused some confusion. The finder would
not work as intended if the database identifier was not present in the DataRefs. This resolution will only occur if
there is no database identifier in the DataRef, so the impact on performance should be negligible in existing code.
Agent.getDetails()
The Agent.getDetails(DataRef)
method did not behave quite the same as LocalAgent.getDetails(DataRef)
. Even though
the same code was called down the line, the way it worked on the remote agent would lose all information in the DataRef
except for the database identifier. This meant that it had to be resolved prior to use. This issue has now been resolved
as well, by having it call getProjection()
instead, just like its LocalAgent
counterpart.
Context transport
In a distant past, there was no Context
class, rather the only context was UserContext
ans it was used to pass all
context information. This has been replaced for years in favor of the Context
class and the UserContext
has since
only been used for actual information about the user. Therefore, we've started removing a lot of this deprecated
infrastructure that still relied on UserContext
where Context
should be used instead. Some of these methods include
Agent.getAgent(UserContext)
and LocalAgent.getLocalAgent()
.
Deprecating old methods
We intend to remove a lot of clutter that has been created in the stack over the years, with methods for backwards
compatibility that should no longer be used. We've started marking many of these methods as deprecated for removal, so
it is already clear to developers that these should not be used in new code and should be refactored if they are still
in use in older code. A prime example of these are methods in the stack that still use a database identifier as a Long
parameter, rather than a DataRef. We'll be marking more of these as deprecated in future releases.
Typed finders
The typed finders system is now the default for all applications. The option finders.enableTypedFinders
is now no
longer required. Typed finders means that generics are used through the stack for finders, to ensure that the compiler
will verify that they are not used with infrastructure of the wrong DataElement. It also changes the FinderBean to use
mapped method references for the finder implementations, rather than reflection. This means that it is no longer
possible to defined custom finders that are not present in the model.