You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
I am trying to make a user macro that has a table of strings showing the page version, published date, contributor, and comments.
I am trying to use the VersionHistorySummary from the ContentEntityManager interface to get a list of VersionHistorySummary objects. Then use a foreach loop for building the table content.
I have tried the velocity template below in the user macro. However, the getVersionHistory is not seems to return anything.
#set($contentManagerClass=$content.class.forName('com.atlassian.spring.container.ContentEntityManager'))
#set($getVersionHistory=$containerManagerClass.getDeclaredMethod('getVersionHistorySummaries'))
Hi all
I once wrote a really big user macro for something like this. The script gets all childs and its versions. Here is some code sample:
#set( $containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager') )
#set( $getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null) )
#set( $containerManager=$getInstanceMethod.invoke(null,null) )
#set( $containerContext=$containerManager.containerContext )
#set( $pageManager=$containerContext.getComponent('pageManager') )
#set( $page = $pageManager.getPage($content.getId()) )
###GET ALL VERSIONS FOR FURTHER OPERATIONS
#set( $latestVersions = [] )
#set( $allVersions=[] )
#foreach( $child in $page.getDescendants() )
#set( $childVersions = $pageManager.getVersionHistorySummaries($child.getEntity()) )
#foreach( $childVersion in $childVersions)
#set( $modDate = $childVersion.getLastModificationDate() )
#end
#end
As far as I know, the getVersionHistory is not working. I think, I struggled as well, so I used getVersionHistorySummaries()
Regards, Dominic
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you sure that your first call actually returns an ContentEntityManager?
I'm doing something where I need to retrieve pages based on their pageId and I've tried to get a ContentEntityManager using both your example above as well as
#set ( $contentEntityManager = $containerContext.getComponent('contentEntityManager') )
without any luck.
Maybe someone else has a suggestion?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Atlassian Community, Remote work has shifted how teams collaborate, and we’ve heard from many of you that Microsoft Teams has become mission critical to many of your workflows, from how you chat...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.