我有如下查询,
/rest-1.v1/Data/TeamRoom?sel=Name,Team,Participants.@Count&where=Team='Team:4250032'
如何从VersionOne Java SDK中执行相同操作?
答案 0 :(得分:1)
找到答案。
IAssetType assetType = _metaModel.getAssetType("TeamRoom");
Query query = new Query(assetType);
IAttributeDefinition team = assetType.getAttributeDefinition("Team");
IAttributeDefinition name = assetType.getAttributeDefinition("Name");
IAttributeDefinition count = assetType.getAttributeDefinition("Participants.@Count");
IFilterTerm teamName = new TokenTerm("Team='Team:4250032'");
query.getSelection().add(team);
query.getSelection().add(name);
query.getSelection().add(count);
query.setFilter(teamName);
QueryResult result = _services.retrieve(query);