-
Improvement
-
Resolution: Fixed
-
Major
-
2.2.0
-
None
-
4.2 M11
The method #QueryHelper.getQueriesRootNode(AmetysObjectResolver) should be modified, two ways for this :
- Move it to a serviceable component (maybe we will have websites implementations in the future) -> More relevant in the QueryDAO ?
- Transform the QueryHelper to a serviceable component
We should avoid to call QueryHelper directly. Instead we should add and use methods on Query and QueryContainer objects like :
- #getQueries()
- #getQueriesContainer()
- #getRelativePath() (optional) - Path to the container root node
We must avoid to build the parent path of a Query[Container] object manually like this :
StringBuilder parentPath = new StringBuilder("/jcr:root").append(ISO9075.encodePath(container.getNode().getPath()));
This is bad and with that we are completely JCR dependent.
We shouldn't have a StringBuilder as an argument in the QueryHelper methods because it's an alterable type and even if the StringBuilder is duplicate to be reused, it's not clear for the developer. Also, doing new StringBuilder(stringBuilder) or new StringBuilder(stringBuilder.build()) have almost the same cost.
Methods of QueryHelper should be able to accept a QueryContainer instead of a parent path and rebuild it dynamically if necessary.
After that, all calls to QueryHelper should be study to use Query or QueryContainer instead.