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

ramDownloadAssset

I am running the ant ramDownloadAsset.xml script to download the RAM asset. I would like to amend the script to download asset only if a condition of one of the asset attributes is met (eg. sequence=1) and need some help on how to change the script. I was not able to add <ram> as I cannot set the value of the attribute.

<target>
<echo>
<mkdir>
<ram>
<ram>
</ram>
</target>
Thanks.

Regards,
Swat Oon

0 votes



9 answers

Permanent link
I am running the ant ramDownloadAsset.xml script to download the RAM asset. I would like to amend the script to download asset only if a condition of one of the asset attributes is met (eg. sequence=1) and need some help on how to change the script. I was not able to add <ram> as I cannot set the value of the attribute.

<target>
<echo>
<mkdir>
<ram>
<ram>
</ram>
</target>
Thanks.

Regards,
Swat Oon


The XML didn't render properly, so I'm not entirely sure what you're trying to do. If you're using the web interface for the forum, check the "Disable HTML in this post" checkbox when you enter HTML/XML.

What you want to accomplish is technically possible using the <ram:propertyHelper /> tag, but it's pretty limited in practice. Here's what you could do (note the <if>, <then> and <equals> tags are from the Ant-Contrib project):

<ram:propertyHelper />
<ram:server id="ramServer" url="..." username="..." password="..." />
<ram:asset id="myAsset" server="ramServer" guid="..." version="..." />
<if>
<equals arg1="${myAsset.assetAttributes.values}" arg2="1" />
<then>
<ram:download server="ramServer">
<ram:asset refid="myAsset" />
</ram:download>
</then>
</if>

This assumes the attribute you want is the first (or only) attribute in the list... and by this, I don't mean the first attribute you see in the web UI... it's the first attribute in the list returned by the Java API. This is the limited part I was talking about. You can't currently get an attribute by name. This is something we'd like to add at some point.

0 votes


Permanent link
Hi,

I tried to echo ${myAsset.assetAttributes.values} but the the output is this property has not been set.
I thought I have created the attribute in RAM. What could be wrong here?

Thanks for your help!

0 votes


Permanent link
Hi,

I tried to echo ${myAsset.assetAttributes.values} but the the output is this property has not been set.
I thought I have created the attribute in RAM. What could be wrong here?

Thanks for your help!


This script worked for me:

<project default="test" xmlns:ram="antlib:com.ibm.ram.ant">
<target name="test">
<ram:propertyHelper />
<ram:server id="ramServer" url="http://localhost:8080/ram/" username="admin" password="admin" />
<ram:asset id="myAsset" server="ramServer" guid="A6EAAFE9-A685-5B15-1C07-B45FF5615CD6" version="1.0" />
<echo>${myAsset.assetAttributes[0].values[0]}</echo>
</target>
</project>


That asset had one simple text attribute and the script echoed its value.

0 votes


Permanent link
Hi I used your script and changing only the parameters like url and guid. The build was successful but I am still not able to echo the attribute.

Creating session for user admin on server http://localhost:13080/ram/
Property "myAsset.assetAttributes.values" has not been set
${myAsset.assetAttributes.values}

BUILD SUCCESSFUL

0 votes


Permanent link
What version of Ant are you using? What version of RAM?

0 votes


Permanent link
What version of Ant are you using? What version of RAM?


I am using ant 1.8.0, RAM version 7.5.0.1.

0 votes


Permanent link
Ah... Ant 1.8 is not supported in RAM 7.5.0.1, because Ant's property helper stuff was all completely redone. As a matter of fact, in RAM 7.5.0.2, we throw an error if you're not using Ant 1.7.x. Try your script with Ant 1.7.x and it should work.

0 votes


Permanent link
Ah... Ant 1.8 is not supported in RAM 7.5.0.1, because Ant's property helper stuff was all completely redone. As a matter of fact, in RAM 7.5.0.2, we throw an error if you're not using Ant 1.7.x. Try your script with Ant 1.7.x and it should work.


Thank you so much for your help! I finally got it to work after using Ant 1.7.1 as you suggested.
Can I find out from you if it is possible to return the number of attributes in the asset? Where can I get such information from the documentation?

The attribute I want is the 3rd element, assetAttributes.name = Sequence Number, and assetAttributes.values = 1. Can I traverse the list in a for loop to get this attribute?

Thanks loads.

0 votes


Permanent link
I wanted to suggest getting the attribute this way, but there's a bug causing it not to work:


<ram:propertyHelper />
<ram:server id="ramServer" url="http://localhost:8080/ram" username="admin" password="admin" />
<ram:asset server="ramServer" guid="EC7CCE13-7301-13B3-72CB-6069B9398CC8" version="1.0">
<ram:attribute id="myAttr" name="Line Of Business" />
</ram:asset>
<echo message="${myAttr.name}: ${myAttr.values[0]}" />


It will be fixed in the next 7.5.1 build, but for 7.5.0.x it won't work. I don't think there's any way to loop through and find the attribute you want.

0 votes

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: Apr 10 '11, 12:03 p.m.

Question was seen: 5,671 times

Last updated: Apr 10 '11, 12:03 p.m.

Confirmation Cancel Confirm