It's all about the answers!

Ask a question

Querying selective attributes of item


vinay reddy (1711205) | asked Mar 12 '09, 4:35 p.m.
I need item info structured as per attributes. However, only some attributes need to be selected. When I use IItemQuery, item info is structured as per attributes but pulls up all attributes. So, I tried the following(IDataQuery) but it does not show the data structured around attributes. Instead it shows every thing organized as <rawData>. Can some one suggest what is to be added to the following piece?



IQueryService queryService = getService(IQueryService.class);
ContributorQueryModel queryModel = BaseContributorQueryModel.ContributorQueryModel.ROOT;
IDataQuery query = IDataQuery.FACTORY.newInstance(queryModel);
query.select(queryModel.itemId(), queryModel.name());
IDataQueryPage contributorByNamePage = queryService.queryData(query, IQueryService.EMPTY_PARAMETERS, IQueryService.ITEM_QUERY_MAX_PAGE_SIZE);

return contributorByNamePage;

One answer



permanent link
vinay reddy (1711205) | answered Mar 13 '09, 12:44 a.m.
There is good support for querying items with desired attributes.

Example:
String [] Props ={"itemId", "name"};
IItem[] items = repositoryItemService.fetchItems(itemQueryPage.handlesAsArray(), Props);

Your answer


Register or to post your answer.