Velocity - How to generate report of items in a Baseline
Hello all,
I am trying to write a Velocity script that generates a document containing the baseline item name, version and description (of all non-Test Case items), along with their upstream relationships (for the baseline version)
So far I've managed to print all the information but I cannot retrieve the upstream relationships for the baselined version.
It also prints the items in creation order rather than the visible order...
#set($docDao = $documentSource)
#set($verDao = $documentSource)
#set($baseline = $baselineSource.getBaseLine($mathTool.abs($myBaseline)))
#set($baselineId = $baseline.getId())
#set($documentIds = $baselineSource.getDocumentIds($baselineId))
#set($baseDocNodes = [] )
#foreach ($documentId in $documentIds)
#set($dN1=$docDao.getDocumentNodeForBaseLine( 5, $documentId, $baselineId))
#if($dN1.scopeId == 5)
#if( $baseDocNodes.add($dN1))
#end
#end
#end
#foreach($dn in $baseDocNodes)
#set($baseDoc = $docDao.getDocument($dn.refId))
#set($baseVer = $verDao.getVersionByDocumentId($baseDoc.id))
Dn.refId = $dn.refId
<h1>$baseDoc.documentKey - $baseDoc.name - v$baseVer.versionNumber</h1>
## Upstream Items
#set($upstreamIds = $docDao.getUpstreamDocumentIds($dn.refId))
#if($upstreamIds.size() > 0)
<p>Upstream Items</p>
<ul>
#foreach($upstreamId in $upstreamIds)
#set($upstreamDoc = $docDao.getDocument($upstreamId))
<li> $upstreamDoc.documentKey - $upstreamDoc.name
#end
</ul>
#end
#if($baseDoc.description)
<p>Description</p>
<p>$baseDoc.description</p>
#end
#end
Does anyone have an idea how to improve this?
Warm regards
Dimitrios
Comments
-
Hi Dimitrios,
So that we can take a deeper look into this, can you open a Support ticket and reference this thread in the ticket description (as well as your version/type of Jama and any other pertinent info) on it, please?
Thank you!
------------------------------
Carly Rossi // she/her
Community Manager // Jama Software
Portland, OR
------------------------------
-------------------------------------------
Original Message:
Sent: 03-08-2023 00:40
From: Dimitrios Pananakis
Subject: Velocity - How to generate report of items in a BaselineHello all,
I am trying to write a Velocity script that generates a document containing the baseline item name, version and description (of all non-Test Case items), along with their upstream relationships (for the baseline version)
So far I've managed to print all the information but I cannot retrieve the upstream relationships for the baselined version.
It also prints the items in creation order rather than the visible order...#set($docDao = $documentSource)
#set($verDao = $documentSource)
#set($baseline = $baselineSource.getBaseLine($mathTool.abs($myBaseline)))
#set($baselineId = $baseline.getId())
#set($documentIds = $baselineSource.getDocumentIds($baselineId))
#set($baseDocNodes = [] )
#foreach ($documentId in $documentIds)
#set($dN1=$docDao.getDocumentNodeForBaseLine( 5, $documentId, $baselineId))
#if($dN1.scopeId == 5)
#if( $baseDocNodes.add($dN1))
#end
#end
#end
#foreach($dn in $baseDocNodes)
#set($baseDoc = $docDao.getDocument($dn.refId))
#set($baseVer = $verDao.getVersionByDocumentId($baseDoc.id))
Dn.refId = $dn.refId
<h1>$baseDoc.documentKey - $baseDoc.name - v$baseVer.versionNumber</h1>
## Upstream Items
#set($upstreamIds = $docDao.getUpstreamDocumentIds($dn.refId))
#if($upstreamIds.size() > 0)
<p>Upstream Items</p>
<ul>
#foreach($upstreamId in $upstreamIds)
#set($upstreamDoc = $docDao.getDocument($upstreamId))
<li> $upstreamDoc.documentKey - $upstreamDoc.name
#end
</ul>
#end
#if($baseDoc.description)
<p>Description</p>
<p>$baseDoc.description</p>
#end
#end
Does anyone have an idea how to improve this?
Warm regards
Dimitrios
0