Hi all.
Method getPage(long id) is
Deprecated. since 7.3.0
Are there any examples of using PageManagerInternal to get a page by id?
Hi,
What about using getById: https://docs.atlassian.com/ConfluenceServer/javadoc/7.3.2/com/atlassian/confluence/core/ContentEntityManager.html#getById-long-
It should give you a https://docs.atlassian.com/ConfluenceServer/javadoc/7.3.2/com/atlassian/confluence/core/ContentEntityObject.html.
Pseudo Groovy code:
import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
import com.atlassian.sal.api.component.ComponentLocator
def pageManager = ComponentLocator.getComponent(PageManager)
def page = pageManager.getById(100L)
if (page instanceof Page) {
// Then do something with your Page object
}
Regards
Lasse Langhorn
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Since Version 7.5.0 also ContentEntityManager.getById() is deprecated.
In the deprecation message is referred to ContentService.find()
In https://community.atlassian.com/t5/Confluence-questions/How-to-use-ContentService-instead-of-PageManager/qaq-p/1546008 is explained how to use these ContentServices. Unfortunately I can't use the output of these methods as I needed the original Page class and no api model class.
With some further research I found PageService.getIdPageLocator().
import com.atlassian.confluence.content.service.PageService
import com.atlassian.confluence.pages.Page
import com.atlassian.sal.api.component.ComponentLocator
final pageService = ComponentLocator.getComponent(PageService)
final Page page = pageService.getIdPageLocator(yourContentId).getPage()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.