如何使用VersionOne JAVA SDK中的“WHERE”

时间:2014-10-27 20:48:26

标签: java api rest versionone

我有如下查询,

/rest-1.v1/Data/TeamRoom?sel=Name,Team,Participants.@Count&where=Team='Team:4250032'

如何从VersionOne Java SDK中执行相同操作?

1 个答案:

答案 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);