Wiki source code of Confluence Resolvers
Last modified by Raphaël Jakse on 2026/03/23 13:17
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | The Confluence resolvers extension provides: | ||
| 2 | |||
| 3 | * APIs to resolve Confluence entities in XWiki, | ||
| 4 | * a default implementation of these APIs that uses other implementations of the APIs present in the wiki | ||
| 5 | * an implementation based on the ##ConfluencePageClass## objects, which can be optionally imported when using [[Confluence XML>>doc:extensions:Extension.Confluence.XML.WebHome]]. | ||
| 6 | |||
| 7 | The following (##@Role##) interface are defined: | ||
| 8 | |||
| 9 | * ##ConfluencePageIdResolver## to find a document by its Confluence ID | ||
| 10 | * ##ConfluencePageTitleResolver## to find a document from a space key and a page title | ||
| 11 | * ##ConfluenceSpaceKeyResolver## to find a XWiki space from the key of a Confluence space. | ||
| 12 | |||
| 13 | The definition of these interfaces, as well as their implementations which can be used as examples can be found at [[https://github.com/xwiki-contrib/confluence/tree/master/confluence-resolvers/src/main/java/org/xwiki/contrib/confluence/resolvers]]. | ||
| 14 | |||
| 15 | For convenience, we reproduce the interface here, without the imports and the license header (however, the definitive reference would be the source code). | ||
| 16 | |||
| 17 | {{code language="java"}} | ||
| 18 | @Role | ||
| 19 | public interface ConfluencePageIdResolver | ||
| 20 | { | ||
| 21 | /** | ||
| 22 | * @return the document in XWiki, or null if the document is not found. | ||
| 23 | * @param id the Confluence ID of the document | ||
| 24 | */ | ||
| 25 | EntityReference getDocumentById(long id) throws ConfluenceResolverException; | ||
| 26 | } | ||
| 27 | {{/code}} | ||
| 28 | |||
| 29 | {{code language="java"}} | ||
| 30 | @Role | ||
| 31 | public interface ConfluenceSpaceKeyResolver | ||
| 32 | { | ||
| 33 | /** | ||
| 34 | * @return the space (EntityType.SPACE) in XWiki, or null if the space is not found. | ||
| 35 | * @param spaceKey the Confluence space key | ||
| 36 | */ | ||
| 37 | EntityReference getSpaceByKey(String spaceKey) throws ConfluenceResolverException; | ||
| 38 | } | ||
| 39 | {{/code}} | ||
| 40 | |||
| 41 | {{code language="java"}} | ||
| 42 | @Role | ||
| 43 | public interface ConfluencePageTitleResolver | ||
| 44 | { | ||
| 45 | /** | ||
| 46 | * @return the document in XWiki, or null if the document is not found. | ||
| 47 | * @param spaceKey the Confluence space of the document | ||
| 48 | * @param title the Confluence title of the document | ||
| 49 | */ | ||
| 50 | EntityReference getDocumentByTitle(String spaceKey, String title) throws ConfluenceResolverException; | ||
| 51 | } | ||
| 52 | {{/code}} | ||
| 53 | |||
| 54 | See also [[xwiki:documentation.extensions.admin.confluence.reference-handling.WebHome]]. |