It's all about the answers!

Ask a question

RAM API: Is there a way to create a Search Subscription for a particular User?


Troy Klomp (858) | asked Jun 20 '14, 4:06 p.m.
From a web browser, when you access Rational Asset Manager, go to Assets (or Search). Once you Filter your search, there is an orange flag on the right side that you can click to "Subscribe to this search".



Is there any way from the RAM API that you can create a subscription like this for a user?
We are using RAM 7.5.2.1. Thanks.
   - Troy Klomp

2 answers



permanent link
Lin Lu (3063) | answered Jun 23 '14, 5:41 a.m.
JAZZ DEVELOPER
Hi, Try RAMSubscription. One could add a subscription like:
         SearchQuery query = session.createAssetQuery("asset");
         RAMAssetQueryBuilder queryBuilder = (RAMAssetQueryBuilder)query;
         SearchResult result = session.getAssets(queryBuilder);
         
         for(AssetSearchResult assetRe:result.getAssetSearchResults()){
        	 RAMAsset asset = session.getAsset(assetRe.getAsset().getIdentification());
        	 asset.addSubscription(new RAMSubscription("my sub", session.getUser("admin")));
        	 try{
        		 session.queueAssetForPut(asset);
        	 }catch(Exception e){
        		 e.printStackTrace();
        		 //if asset locked. ignore
        	 }
         }

PS: use RAMSubscription.setFrequency to make a weekly subscription.

Comments
1
Troy Klomp commented Jun 24 '14, 10:39 a.m.

Thanks for the reply, but this is not what we are looking for. The above sample code does a search for assets, and creates a subscription to every asset currently found in the search. So, the search is run once, and all individual assets (that already exist) are subscribed. The user would then have multiple subscriptions to manage for all of the assets found.

We are looking for a subscription to the search criteria, so that if any assets are created or updated that match that search criteria, users would be notified. So, the search would be run on a scheduled basis (e.g., daily, weekly), and the subscription would be on the search results, if any assets are created or updated. The user would have just one subscription to manage (where are these stored?), so it would be easy to unsubscribe if desired.


permanent link
Lin Lu (3063) | answered Jun 25 '14, 12:18 a.m.
JAZZ DEVELOPER
Ok, thanks for your further interpretation. 
I am afraid there is not a function in API to add search subscription at this moment. You may would like to create a wi for Ram or raise a RFE.

Thanks.  

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.