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

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

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!

0 votes


Accepted answer

Permanent link
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

0 votes

Comments

Hi Sheehan,

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

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
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

0 votes


Permanent link
Currently this is an internal field. But the search string for this is "_shortDescription_". See if that works.

0 votes


Permanent link
Thank you everyone for your help :-)

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
× 10,938

Question asked: Aug 12 '13, 11:35 p.m.

Question was seen: 4,784 times

Last updated: Aug 14 '13, 2:39 p.m.

Confirmation Cancel Confirm