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:
Thanks!
Accepted answer
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();
}
}
} }
3 other answers
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
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