Search in sources :

Example 11 with ViewRequestBuilder

use of com.cloudant.client.api.views.ViewRequestBuilder in project sw360 by eclipse.

the class DatabaseRepositoryCloudantClient method queryForIds.

public Collection<? extends String> queryForIds(String queryName, ComplexKey startKeys, ComplexKey endKeys) {
    ViewRequestBuilder query = connector.createQuery(type, queryName);
    UnpaginatedRequestBuilder reqBuilder = query.newRequest(Key.Type.COMPLEX, Object.class).startKey(startKeys).endKey(endKeys);
    return queryForIds(reqBuilder);
}
Also used : ViewRequestBuilder(com.cloudant.client.api.views.ViewRequestBuilder) UnpaginatedRequestBuilder(com.cloudant.client.api.views.UnpaginatedRequestBuilder)

Example 12 with ViewRequestBuilder

use of com.cloudant.client.api.views.ViewRequestBuilder in project sw360 by eclipse.

the class DatabaseRepositoryCloudantClient method queryView.

public List<T> queryView(String viewName, String key) {
    ViewRequestBuilder query = connector.createQuery(type, viewName);
    UnpaginatedRequestBuilder reqBuild = query.newRequest(Key.Type.STRING, Object.class).keys(key).includeDocs(true);
    return queryView(reqBuild);
}
Also used : ViewRequestBuilder(com.cloudant.client.api.views.ViewRequestBuilder) UnpaginatedRequestBuilder(com.cloudant.client.api.views.UnpaginatedRequestBuilder)

Example 13 with ViewRequestBuilder

use of com.cloudant.client.api.views.ViewRequestBuilder 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);
}
Also used : ViewRequestBuilder(com.cloudant.client.api.views.ViewRequestBuilder) UnpaginatedRequestBuilder(com.cloudant.client.api.views.UnpaginatedRequestBuilder)

Example 14 with ViewRequestBuilder

use of com.cloudant.client.api.views.ViewRequestBuilder 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);
}
Also used : ViewRequestBuilder(com.cloudant.client.api.views.ViewRequestBuilder) ComplexKey(com.cloudant.client.api.views.Key.ComplexKey) ComplexKey(com.cloudant.client.api.views.Key.ComplexKey) Key(com.cloudant.client.api.views.Key) ComplexKey(com.cloudant.client.api.views.Key.ComplexKey) UnpaginatedRequestBuilder(com.cloudant.client.api.views.UnpaginatedRequestBuilder)

Example 15 with ViewRequestBuilder

use of com.cloudant.client.api.views.ViewRequestBuilder 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);
}
Also used : ViewRequestBuilder(com.cloudant.client.api.views.ViewRequestBuilder) UnpaginatedRequestBuilder(com.cloudant.client.api.views.UnpaginatedRequestBuilder)

Aggregations

ViewRequestBuilder (com.cloudant.client.api.views.ViewRequestBuilder)19 UnpaginatedRequestBuilder (com.cloudant.client.api.views.UnpaginatedRequestBuilder)14 Key (com.cloudant.client.api.views.Key)3 PaginationData (org.eclipse.sw360.datahandler.thrift.PaginationData)2 Component (org.eclipse.sw360.datahandler.thrift.components.Component)2 NotNull (org.jetbrains.annotations.NotNull)2 MapReduce (com.cloudant.client.api.model.DesignDocument.MapReduce)1 QueryBuilder (com.cloudant.client.api.query.QueryBuilder)1 Selector (com.cloudant.client.api.query.Selector)1 ComplexKey (com.cloudant.client.api.views.Key.ComplexKey)1 MultipleRequestBuilder (com.cloudant.client.api.views.MultipleRequestBuilder)1 ViewResponse (com.cloudant.client.api.views.ViewResponse)1 TestWithDbPerTest (com.cloudant.tests.base.TestWithDbPerTest)1 Strings (com.google.common.base.Strings)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Lists (com.google.common.collect.Lists)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 List (java.util.List)1