It's all about the answers!

Ask a question

How to view/see an asset categorization using Ant


Allen Earnest (6212337) | asked Apr 15 '13, 6:12 p.m.
 Hello All,

Using Ant scripting, is there a way to use the ram client to view the custom attributes and categorization of an asset?

For example, I can write this script to see the name of my asset...

<target name="viewAsset1" depends="preReq">
<ram:propertyHelper />
<ram:asset id="myasset" server="ramServer" guid="${ram.asset.guid}" version="${ram.asset.version}" />
<echo message="Asset Name = ${myasset.Name}" />
</target>

I could then use this name attribute in a variety of ways.  The Name is a built in attribute and is available to me through the Asset interface.  So that's no problem.

For the custom attributes and categorization, I see that there is an "AssetAttribute" (getAssetAttribute) and a "Categorizations" (getCategorizations) methods as part of the Asset interface.  But these methods require parameters.  I assume these are how I would retrieve the custom attributes and categorization information.  Is this correct?  How do I specify the parameters for these via an Ant script?

Thanks for any help!

Accepted answer


permanent link
Eric Bordeau (27632) | answered Apr 16 '13, 10:43 a.m.
JAZZ DEVELOPER
The only thing I can think of is to iterate over the collection until you find the one you want. For instance, you could do something like this (using the Ant-Contrib if functionality). It's not pretty, but it should do the trick. (Note: for categories, you'd need to iterate over the schemas first, then when you find the schema you want, iterate over the categories.)

<target ... >
     ...
     <ram:iterate collection="asset.assetAttributes" param="attr" target="handleAttribute" />
</target>
<target name="handleAttribute">
     <if>
          <equals arg1="${attr.name}" arg2="My Attribute" />
          <then>
               Do something...
          </then>
     </if>
</target>
Allen Earnest selected this answer as the correct answer

Comments
Allen Earnest commented Apr 16 '13, 10:54 a.m.

Thanks Eric.  I did try that and you are correct on both points... it works, but its awkward.


I'll leave the question open a little longer in hopes someone knows an easier way...

Many thanks for the reply!

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.