Page 1 of 1

Access Live Document Comments from Wikipage/Velocity?

Posted: Wed Dec 17, 2014 2:42 pm
by Bernardo
Hello, I would like to know a way to create some statistics on live document comments, e.g.
a. Amount/List of comments
b. Amount/List of comment owners
c. Amount/List of unresolved comments, resolved comments

I donĀ“t find useful notes in the SDK. Can anyone recommend anything? Any velocity code known to access these data?
Many thanks, Bernardo

Re: Access Live Document Comments from Wikipage/Velocity?

Posted: Mon Dec 22, 2014 5:29 pm
by sergeD
Hello,

I tried to create such a wiki some months ago but have not investigated more since.I was not fully satisfied with as i was not successful to find the comments referred Work Items .
BTW, you have to use IModule, and then try:
#foreach ( $module in $modules)
#set ($docComments=$module.getComments())
#if (!$docComments.isEmpty()) ...
#foreach ( $aComment in $docComments)
#if (!$aComment.getParentComment()) ## IF to consider only Root Comments
$aComment.getText().getContent()
$aComment.isResolvedComment()
#set ($childComments=$aComment.getChildComments())...
#foreach ( $childComment in $childComments)..
Hope it helps
Sergio

Re: Access Live Document Comments from Wikipage/Velocity?

Posted: Tue Jan 10, 2017 6:59 pm
by DCwom
I only want to know if there are comments for a given Live Doc so I tried just this code snippet:

Code: Select all

#set ($docComments=$doc.moduleName.getComments())
#if ($docComments.isEmpty())
*Empty*
#else
*NOT Empty*
#end


But the code always returns NOT empty even if no comments exist in the Live Doc

Re: Access Live Document Comments from Wikipage/Velocity?

Posted: Wed Jan 11, 2017 4:22 pm
by DCwom
Ok, I solved my own problem, here's my wiki code. Now if I can only figure out how to check if the recycle bin is empty...

Code: Select all

###
### This script checks all of the Live docs in the space named Verification to see if they have any Live Doc comments (not WI comments).
###
#set($docsList = $trackerService.getModuleManager().getModules($project,$project.getLocation().append("Verification").getRelativeLocation($project.getLocation())))

1.1 VERIFICATION DOCUMENT SPACE
#foreach($doc in $docsList)

## Comment test
   #set ($CommentFlag = "FALSE")
   #foreach ( $aComment in $doc.getComments())
      #if ($aComment )
      #set ($CommentFlag = "TRUE")
      #end
   #end
   #if ($CommentFlag == "TRUE")
   #warning("Document Contains COMMENTS")
   #end
   

Re: Access Live Document Comments from Wikipage/Velocity?

Posted: Tue Jan 17, 2017 1:44 pm
by smarty
DCwom wrote:Now if I can only figure out how to check if the recycle bin is empty...


Hello DCwom,

maybe you can make use of the Workitems in Recycle Bin Macro to check for the opposite.

Regards, Martin

p.s.: I am not the vendor marked on the extensions portal.

Re: Access Live Document Comments from Wikipage/Velocity?

Posted: Fri Apr 21, 2017 8:51 am
by peterfriedrich
Hello
thanks for this post it was valuable.
Futhermore does anybody know how to get the link of a documents comment ?
The function getURI just result in an unreachable link: subterra:data-service:objects:/default/....
regards
Peter