List parents and children relationship
Hi fellows,
I am building an app that lists assets and their relationships (belongs to,
has).
Here is a part of code:
RAMAssetQueryBuilder query;
query.addQueryField(query.QUERY_FIELD_NAME, "*");
query.addQueryField(query.QUERY_FIELD_VERSION, "*");
RAMCommunity com = session.getCommunity("Services");
query.addSearchFilter(com);
SearchResult result = session.getAssets(query);
RAMAssetSearchResult[] serviceAssets = (RAMAssetSearchResult)result.getAssetSearchResults();
This code will return me a list of assets.
But now I need to get asset relationships informations (parents, children). How to do this? I know there is a getRelationships() method for RAMAsset object, but the relationship returned do not give to me information about the related assets. I also know there is a getParentAsset() method for RAMRelationship object, but I cannot cast Relationship to RAMRelationship. How to get parents and children informations?
Thanks!!!
I am building an app that lists assets and their relationships (belongs to,
has).
Here is a part of code:
RAMAssetQueryBuilder query;
query.addQueryField(query.QUERY_FIELD_NAME, "*");
query.addQueryField(query.QUERY_FIELD_VERSION, "*");
RAMCommunity com = session.getCommunity("Services");
query.addSearchFilter(com);
SearchResult result = session.getAssets(query);
RAMAssetSearchResult[] serviceAssets = (RAMAssetSearchResult)result.getAssetSearchResults();
This code will return me a list of assets.
But now I need to get asset relationships informations (parents, children). How to do this? I know there is a getRelationships() method for RAMAsset object, but the relationship returned do not give to me information about the related assets. I also know there is a getParentAsset() method for RAMRelationship object, but I cannot cast Relationship to RAMRelationship. How to get parents and children informations?
Thanks!!!
One answer
First
query.addQueryField(query.QUERY_FIELD_NAME, "*");
query.addQueryField(query.QUERY_FIELD_VERSION, "*");
is not adding anything you can just use the community filter in your search and get the same result.
Second
You can cast the Relationship you get back from getRelationships() to a RAMRelationship.
query.addQueryField(query.QUERY_FIELD_NAME, "*");
query.addQueryField(query.QUERY_FIELD_VERSION, "*");
is not adding anything you can just use the community filter in your search and get the same result.
Second
You can cast the Relationship you get back from getRelationships() to a RAMRelationship.