We want to create statistics based on labels. The statistics should only refer to one space. Is there a user macro for this?
## @param Label:title=Label|type=string|required=true|desc=Please enter a label to count
## @param Spaces:title=Space|type=string|required=false|desc=Separate each item with a comma or single space. Example: SPACEKEY,@personal. Blank means all spaces.
#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 ( $labelManager = $containerContext.getComponent('labelManager') )
#set ( $requestedLabel = $labelManager.getLabel($paramLabel) )
#set ( $spaceManager = $containerContext.getComponent('spaceManager') )
#set ( $requestedSpace = $spaceManager.getSpace($paramSpaces) )
#set ($labelinspace = $labelManager.getLabelsByDetail($requestedLabel,null,$requestedSpace,null))
#if ( $labelinspace )
$labelManager.getContentCount($labelinspace)
#else
0
#end
Does anyone know, where is the mistake?
Here is the link to this question: https://community.atlassian.com/t5/Confluence-questions/How-to-get-the-amount-of-pages-with-a-certain-label-in-Conflunce/qaq-p/295325
The only solution - user macro.
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.