It's all about the answers!

Ask a question

Is it possible to query assets based on the SHORT description?


Angela Borchard (701220) | asked Aug 12 '13, 11:35 p.m.
edited Aug 12 '13, 11:40 p.m.

Hello,

Can you please advise if it is possible to query via the RAM (7.5.1.2) Java API to find assets by:

- Short Description  AND

- Version

I have created the following, however it appears this is using the long description, not the short description:

   RAMAssetQueryBuilder queryString = new RAMAssetQueryBuilder(session);
   queryString.addQueryField(queryString.QUERY_FIELD_DESCRIPTION, assetShortDescription);
   queryString.addQueryField(queryString.QUERY_FIELD_VERSION, assetVersion);
      
   SearchResult searchResult = session.getAssets(queryString);
   RAMAsset[] assetResults = (RAMAsset[])searchResult.getAssets(); 
       

I couldnt see anything obvious to do this at the following locations:

http://pic.dhe.ibm.com/infocenter/ramhelp/v7r5m1/index.jsp?topic=%2Fcom.ibm.ram.api.doc%2Ftopics%2Fcom%2Fibm%2Fram%2Fclient%2FRAMAssetQueryBuilder.html

http://pic.dhe.ibm.com/infocenter/ramhelp/v7r5m1/index.jsp?topic=%2Fcom.ibm.ram.doc%2Ftopics%2Fr_api_advancedsearch.html

Thanks!

Accepted answer


permanent link
Sheehan Anderson (1.2k4) | answered Aug 13 '13, 2:03 p.m.
JAZZ DEVELOPER
edited Aug 13 '13, 2:04 p.m.
It's not documented, but here's the code to search the short description.

import com.ibm.ram.client.RAMAssetQueryBuilder;
import com.ibm.ram.client.RAMSession;
import com.ibm.ram.common.data.AssetSearchResult;
import com.ibm.ram.common.data.SearchResult;
public class ClientTestSearch {
  public static void main(String [] args) {
    RAMSession session = null; 
    try { 
      session = new RAMSession("https://vhost0016.site1.compute.ihost.com/ram", "connie", "connie");                   
      RAMAssetQueryBuilder queryString = new RAMAssetQueryBuilder(session);  
      queryString.addQueryField("shortDescription", "Example of an IBM Workload Deployer Script");
      queryString.addQueryField(queryString.QUERY_FIELD_VERSION, "1.0"); 
      SearchResult searchResult = session.getAssets(queryString);
      AssetSearchResult[] assets = searchResult.getAssetSearchResults();
      for(AssetSearchResult asset : assets) {
        System.out.println(asset.getAsset().getName()); 
      }
    } finally {
      if(session != null) {
        session.release(); 
      }
    }
  } }
Angela Borchard selected this answer as the correct answer

Comments
Steven Su commented Aug 13 '13, 7:53 p.m.

Hi Sheehan,

Can we publish this search strng to RAM Java document as well? Thanks!


Sheehan Anderson commented Aug 14 '13, 2:39 p.m.
JAZZ DEVELOPER

It's too late to add this to the documentation for the 7.5.2 release, but you can open an enhancement for a future release.

3 other answers



permanent link
Roy yu (411) | answered Aug 13 '13, 9:36 a.m.
JAZZ DEVELOPER
edited Aug 13 '13, 11:14 a.m. by Rich Kulp (3.6k38)
Hi Angela.
The query for short description are : AssetManager.QUERY_SHORT_DESCRIPTION  and IndexConfigImpl.ASSET_SHORT_DESCRIPTION . But those two classes cannot be put into RAMSession.getAsset(SearchQuery query). And the SearchQuery class and its subclasses don't support the shot description query.  I think there is no way to do that search with JAVA API

permanent link
Rich Kulp (3.6k38) | answered Aug 13 '13, 11:17 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Currently this is an internal field. But the search string for this is "_shortDescription_". See if that works.

permanent link
Angela Borchard (701220) | answered Aug 13 '13, 6:13 p.m.
Thank you everyone for your help :-)

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.