As of 2.3.x, we have made several changes to how JSON is
serialized and parsed.
If you created custom extensions using the
MDEXStateManager,
MDEXSecurityManager, or
QueryFunctions, or have built custom components, you
will need to update them.
The changes are:
- Previously, the
QueryFunction serialization and parsing framework
required a string version of setters for any non-string properties. This is no
longer required. If any setters are left with both string and other data type
overloads, JSON deserialization will break.
- Jackson annotations can now
be used to customize JSON output for custom
QueryFunctions.
- The following interfaces
have been removed:
- com.endeca.portal.data.functions.QueryFunction.getInstance
- com.endeca.portal.data.functions.QueryFunction.toJSON
- Built-in QueryFunctions no
longer set their content in the
PassThroughElements in the Conversation Service.
- The default
MDEXSecurityManager has been updated to adjust how
it serializes and parses
QueryFunctions.
- Previously, the JSON
produced by serialization converted all values to Strings regardless of their
type.
So an object with a boolean getter or an int getter would return
"prop":"true" or
"prop":"42", instead of
"prop":true or
"prop":42.
The new
QueryFunctionUtils can parse JSON of the form
"prop":"true" into an object with a boolean setter.
This could potentially affect the following
QueryFilter-generated JSON:
-
ExposeRefinement -
dimExposed,
exposeAll
-
RefinementFilter -
isNavigable
-
SearchFilter -
isSearchWithin,
enableSnippeting,
snippetLength
Note: This does not mean that bookmarks, deep links, or data source
definitions will become invalid.
- In JSON serializations,
RecordDetailsConfig must have both
attributeKey and
attributeValue properties.
To reflect these changes, you will need to update your custom
QueryFunctions. As a reminder, make sure you load all
custom
QueryFunctions into the global classloader.
The required changes are:
- Remove the string setters
for non-string properties. To do this, either:
- Remove all
getGetters and
getSetters.
- For
com.endeca.portal.data.functions.QueryFunction.getInstanceMove,
move customizations to:
com.endeca.portal.data.functions.utils.QueryFunctionUtils.fromString/fromJSONObject
For
com.endeca.portal.data.functions.QueryFunction.toJSON,
move customizations to:
com.endeca.portal.data.functions.utils.QueryFunctionUtils.toString/toJSONObject
Update any custom
MDEXStateManagers that relied on these removed
QueryFunction interfaces.
- Update any customized
versions of the
MDEXSecurityManager to reflect the change to the
serialization and parsing of
QueryFunctions.
- Instead of scanning the
com.endeca.mdex.conversation.Results object's
passthrough elements for filters, look in
MDEXState/DataSource.getQueryState().