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

query in a custom policy

I need to query for another asset as part of a custom policy. I noticed there is the AssetManager class that accepts a String text query. What is the format of the query?

I essentially need the query to look like this (using SQL-like syntax)

select * from assets where (type="TypeA") and (community="CommunityA") and (Category="Domain.SuperCat.SubCat") and (Category="Team.SuperTeam.SubTeam")

So essentially I need to find an asset of a certain type and of a certain community that has 2 different particular Category Schema values.

0 votes



3 answers

Permanent link
Use the Web UI to do the search with your filters, and then click on search shortcut icon (on to the right of the search box with a little maginfying glass).... it will give you the search shortcut for the current query.

0 votes


Permanent link
I have tried everything but nothing works. I have tried every permutation of the query string I can think of such as replacing %2c with a comma, removing the ramSearch prefix, etc. and nothing works. Actually, the string as it exists from the search page causes the policy to throw an exception. Always returns zero assets.

Here is my snippet:

AssetManager am = AssetManager.getInstance();

String query = "ramSearch:(1fType%2Cmapping)";
SearchResults sr;
try {
sr = am.searchAssets(user, query, false, false);
} catch (InvalidQueryException e) {
String message = (new StringBuilder("Unable to search for mapping asset")).toString();
result.setMessage(message);
result.setReturnCode(ResultDetail.ERROR);
return result;
}

AbstractSearchAsset assets[] = sr.getAssets();
if (assets.length < 1) {
String message = (new StringBuilder("Search for mapping asset did not return a result")).toString();
result.setMessage(message);
result.setReturnCode(ResultDetail.ERROR);
return result;
}

0 votes


Permanent link
The am.searchAssets(user, query, false, false); is an internal API and may be removed in the near future.

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

Question asked: Apr 08 '10, 8:01 p.m.

Question was seen: 7,080 times

Last updated: Apr 08 '10, 8:01 p.m.

Confirmation Cancel Confirm