use of com.cloudant.client.api.views.UnpaginatedRequestBuilder in project sw360 by eclipse.
the class DatabaseRepositoryCloudantClient method queryForIdsAsComplexValue.
public Set<String> queryForIdsAsComplexValue(String queryName, String... keys) {
ViewRequestBuilder query = connector.createQuery(type, queryName);
UnpaginatedRequestBuilder reqBuild = query.newRequest(Key.Type.STRING, Object.class).keys(keys);
return queryForIds(reqBuild);
}
use of com.cloudant.client.api.views.UnpaginatedRequestBuilder in project sw360 by eclipse.
the class DatabaseRepositoryCloudantClient method queryForIdsAsComplexValues.
public Set<String> queryForIdsAsComplexValues(String queryName, Map<String, Set<String>> keys) {
Set<String[]> complexKeys = keys.entrySet().stream().map(DatabaseRepositoryCloudantClient::createComplexKeys).flatMap(Collection::stream).collect(Collectors.toSet());
ViewRequestBuilder query = connector.createQuery(type, queryName);
Key.ComplexKey[] complexKys = new Key.ComplexKey[complexKeys.size()];
int index = 0;
for (String[] keyArr : complexKeys) {
Key.ComplexKey key = Key.complex(keyArr);
complexKys[index++] = key;
}
UnpaginatedRequestBuilder reqBuild = query.newRequest(Key.Type.COMPLEX, Object.class).keys(complexKys);
return queryForIds(reqBuild);
}
use of com.cloudant.client.api.views.UnpaginatedRequestBuilder in project sw360 by eclipse.
the class DatabaseRepositoryCloudantClient method queryForIds.
public Set<String> queryForIds(String queryName, String startKey, String endKey) {
ViewRequestBuilder query = connector.createQuery(type, queryName);
UnpaginatedRequestBuilder req = query.newRequest(Key.Type.STRING, Object.class).startKey(startKey).endKey(endKey);
return queryForIds(req);
}
use of com.cloudant.client.api.views.UnpaginatedRequestBuilder in project sw360 by eclipse.
the class ConfigContainerRepository method getByConfigFor.
public ConfigContainer getByConfigFor(ConfigFor configFor) {
ViewRequestBuilder query = getConnector().createQuery(ConfigContainer.class, "byConfigFor");
UnpaginatedRequestBuilder reqBuilder = query.newRequest(Key.Type.STRING, Object.class).keys(configFor.toString()).includeDocs(true);
List<ConfigContainer> configs = queryView(reqBuilder);
if (configs.size() != 1) {
throw new IllegalStateException("There are " + configs.size() + " configuration objects in the couch db for type " + configFor + " while there should be exactly one!");
} else {
return configs.get(0);
}
}
use of com.cloudant.client.api.views.UnpaginatedRequestBuilder in project sw360 by eclipse.
the class RelationsUsageRepository method getUsedRelationsByProjectId.
public List<UsedReleaseRelations> getUsedRelationsByProjectId(String projectId) {
ViewRequestBuilder viewQuery = getConnector().createQuery(UsedReleaseRelations.class, "byProjectId");
UnpaginatedRequestBuilder req = viewQuery.newRequest(Key.Type.STRING, Object.class).includeDocs(true).reduce(false).keys(projectId);
return queryView(req);
}
Aggregations