Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

RAM customer ANT library download search

Hello,

We have a schema where a parent asset represents a release and it has many related assets which are components of the system for a given release.

Using the RAM custom ANT library I'd like to be able to download the latest version of a component asset by specifying the parent asset GUID (or better still by name and version) and also the name of a related component asset. I've looked through the RAM ANT APIs and this doesn't seem to be possible currently. The search element of the download task doesn't seem to give me a way to specify the relationship.

Should I write my own ANT task to perform this specialized query and return a GUID that I could then use in the download task?

0 votes



18 answers

Permanent link
If you give the search an ID, you should be able to use the property helper to get the assets and GUIDs. (Note that the following script won't work as-is. I left out a lot for brevity's sake.)

<ram:propertyHelper />

<ram:download>
<ram:search id="mySearch" name="My Asset" version="1.0" />
</ram:download>
<echo message="GUID: ${mySearch.assets[0].GUID}" />

0 votes


Permanent link
Thanks Eric. But as expected the code didnt work. I am still trying to work out the internal referencing of the assests.

The following code didnt work either:

<ram:propertyHelper />

<ram:download destdir="${lib.dir}" server="ramServer" extract="true" overwrite="true">
<ram:search id="mySearch" name="${ram.asset.name}" version="1.0" />
</ram:download>
<echo message="GUID: ${mySearch.assets[0].assetAttributes[0].name}" /><echo>

I am not sure how to reference the assets within the search result.

0 votes


Permanent link
echo message="GUID:
${mySearch.assets.assetAttributes.name}"
/><echo


That's not the guid. That's the name of the first attribute (if there is
one, this could actually be an error because there may not be any
attributes).

If you said that:

<echo>

doesn't give you the guid, then what did it show?


--
Rich Kulp
Rational Asset Manager developer

0 votes


Permanent link
Sorry, the echo part was wrong. Try this:

<ram:propertyHelper />

<ram:download>
<ram:search id="results" name="My Asset" version="1.0" />
</ram:download>
<echo message="GUID: ${results[0].GUID}" />

0 votes


Permanent link
echo message="GUID:
${mySearch.assets.assetAttributes.name}"
/><echo


That's not the guid. That's the name of the first attribute (if there is
one, this could actually be an error because there may not be any
attributes).

If you said that:

<echo>

doesn't give you the guid, then what did it show?


--
Rich Kulp
Rational Asset Manager developer


Hi Rich,
The following prints out a list of all the attributes associated with an asset.


<echo message="Asset Attribute: ${results[0].assetAttributes[1].name}" />
<echo message="Asset Attribute: ${results[0].assetAttributes[2].name}" />
<echo message="Asset Attribute: ${results[0].assetAttributes[3].name}" />
<echo message="Asset Attribute: ${results[0].assetAttributes[4].name}" />

0 votes


Permanent link
Sorry, the echo part was wrong. Try this:

<ram:propertyHelper />

<ram:download>
<ram:search id="results" name="My Asset" version="1.0" />
</ram:download>
<echo message="GUID: ${results[0].GUID}" />




Thanks Eric, the code works. I can now retrieve the GUID from the search results.


<ram:propertyHelper />
<ram:download destdir="${lib.dir}" server="ramServer" extract="true" overwrite="true">
<ram:search id="results" query="name:(${ram.asset.name}) state:(approved) />
</ram:download>
<echo message="Name: ${results[0].name}" />
<echo message="GUID: ${results[0].GUID}" />
<echo message="State: ${results[0].assetType}" />


How can I access assets related to results
I have tried the following and it didnt work:

<!-- The following didnt work -->

<echo message="RelatedAsset 1: ${results[0].relatedAssetList[0].assetName}" />

<echo message="RelatedAsset 1: ${results[0].relatedAssetList[0].relatedAsset[0].name}" />

<echo message="RelatedAsset 1: ${results[0].relatedAssetList[0].relatedAsset[0].assetName}" />

<echo message="RelatedAsset 2: ${results[0].relatedAssetList[0].name}" />

<echo message="RelatedAsset 3: ${results[0].RelatedAsset[0].assetName}" />

<echo message="RelatedAsset 4: ${results[0].relatedAsset[0].relationshipType}" />

<echo message="RelatedAsset 5: ${results[0].RelatedAsset.relationshipType}" />


I assume I am referencing the Related Assets incorrectly. Not sure what the correct reference is.

Thanks again for your help Eric. :)

0 votes


Permanent link
The property helper works by giving you access to public, no-parameter get methods of RAMAsset and the public, no-parameter get methods of the objects those methods return, ad infinitum. So in this case, you have the search results object (which is an array of RAMAssets) and you want information about the related assets. RAMAsset has a getRelationships() method, so you would do something like this:

<echo message="Related asset 1 GUID: ${results[0].relationships[0].childAssetGUID}" />


getRelationships() returns an array of Relationship objects. I'm not positive, but I think in reality they will be of type RAMRelationship and you'll have access to any of its public get methods. If not, you could take the GUID and version and use the <ram:asset> tag to get its properties.

0 votes


Permanent link
Thank you Eric!

Absolutely spot on!

Following code works:
<echo message="Related asset 1 GUID: ${results[0].relationships[0].childAssetGUID}" />

<echo message="Related asset 2 GUID: ${results[0].relationships[0].childAssetVersion}" />
<echo message="Related asset 3 GUID: ${results[0].relationships[0].relationshipTypeName}" />

Which corresponds to the following methods:
getChildAssetGUID()

getChildAssetVersion()
getParentAsset()
getRelationshipTypeName()

Thanks again! :)

0 votes

1–15 items
page 2of 1 pagesof 2 pages

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Jul 23 '10, 2:41 a.m.

Question was seen: 25,421 times

Last updated: Jul 23 '10, 2:41 a.m.

Confirmation Cancel Confirm