It's all about the answers!

Ask a question

ramDownloadAssset


Swat Oon Kwee (611125) | asked Apr 10 '11, 12:03 p.m.
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

9 answers



permanent link
Eric Bordeau (27632) | answered Apr 11 '11, 2:24 p.m.
JAZZ DEVELOPER
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.

permanent link
Swat Oon Kwee (611125) | answered Apr 12 '11, 1:19 a.m.
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!

permanent link
Eric Bordeau (27632) | answered Apr 12 '11, 10:05 a.m.
JAZZ DEVELOPER
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.

permanent link
Swat Oon Kwee (611125) | answered Apr 15 '11, 2:13 a.m.
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

permanent link
Eric Bordeau (27632) | answered Apr 15 '11, 11:42 a.m.
JAZZ DEVELOPER
What version of Ant are you using? What version of RAM?

permanent link
Swat Oon Kwee (611125) | answered Apr 18 '11, 12:20 p.m.
What version of Ant are you using? What version of RAM?


I am using ant 1.8.0, RAM version 7.5.0.1.

permanent link
Eric Bordeau (27632) | answered Apr 18 '11, 1:59 p.m.
JAZZ DEVELOPER
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.

permanent link
Swat Oon Kwee (611125) | answered Apr 19 '11, 10:44 a.m.
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.

permanent link
Eric Bordeau (27632) | answered Apr 19 '11, 3:29 p.m.
JAZZ DEVELOPER
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.

Your answer


Register or 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.