| XWIKI-19219 adds support for database list properties in the link refactoring: the pages stored in such a property are listed as backlinks of the target page and are updated when that page is renamed or moved. This only works for database lists whose values are known to be page references, i.e. when no custom query is used and the generated query selects doc.fullName as the stored value (only a class name, or doc.fullName as id or value field). A database list configured with a custom query is ignored, even when that query selects page references, so renaming a page leaves such a property pointing to the old page. Possible approaches:
- parse the custom query, for example with JSqlParser, to detect that its first selected column is doc.fullName. The query is HQL (or XWQL) and can contain Velocity that is evaluated against the current context before it runs, so this can only cover the simple cases;
- add a meta property to database list properties, so that the class author can state explicitly that the stored values are page references.
See the discussion in https://github.com/xwiki/xwiki-platform/pull/6509#discussion_r4123416003 |