Search in sources :

Example 6 with UnpaginatedRequestBuilder

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

the class DatabaseRepositoryCloudantClient method queryForIdsAsValue.

public Set<String> queryForIdsAsValue(ViewRequestBuilder query, Set<String> keys) {
    String[] arrayOfString = new String[keys.size()];
    int index = 0;
    for (String str : keys) arrayOfString[index++] = str;
    UnpaginatedRequestBuilder req = query.newRequest(Key.Type.STRING, Object.class).keys(arrayOfString);
    return queryForIdsFromReqBuilder(req);
}
Also used : UnpaginatedRequestBuilder(com.cloudant.client.api.views.UnpaginatedRequestBuilder)

Example 7 with UnpaginatedRequestBuilder

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

the class DatabaseRepositoryCloudantClient method queryByIds.

public List<T> queryByIds(String viewName, Collection<String> ids) {
    String[] idStrs = new String[ids.size()];
    int index = 0;
    for (String str : ids) idStrs[index++] = str;
    ViewRequestBuilder query = connector.createQuery(type, viewName);
    UnpaginatedRequestBuilder reqBuilder = query.newRequest(Key.Type.STRING, Object.class).includeDocs(true).keys(idStrs);
    return queryView(reqBuilder);
}
Also used : ViewRequestBuilder(com.cloudant.client.api.views.ViewRequestBuilder) UnpaginatedRequestBuilder(com.cloudant.client.api.views.UnpaginatedRequestBuilder)

Example 8 with UnpaginatedRequestBuilder

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

the class DatabaseRepositoryCloudantClient method queryForIdsAsValue.

public Set<String> queryForIdsAsValue(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 queryForIdsAsValue(req);
}
Also used : ViewRequestBuilder(com.cloudant.client.api.views.ViewRequestBuilder) UnpaginatedRequestBuilder(com.cloudant.client.api.views.UnpaginatedRequestBuilder)

Example 9 with UnpaginatedRequestBuilder

use of com.cloudant.client.api.views.UnpaginatedRequestBuilder 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 10 with UnpaginatedRequestBuilder

use of com.cloudant.client.api.views.UnpaginatedRequestBuilder 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)

Aggregations

UnpaginatedRequestBuilder (com.cloudant.client.api.views.UnpaginatedRequestBuilder)15 ViewRequestBuilder (com.cloudant.client.api.views.ViewRequestBuilder)14 Key (com.cloudant.client.api.views.Key)2 MapReduce (com.cloudant.client.api.model.DesignDocument.MapReduce)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 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 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 DatabaseConnectorCloudant (org.eclipse.sw360.datahandler.cloudantclient.DatabaseConnectorCloudant)1 DatabaseRepositoryCloudantClient (org.eclipse.sw360.datahandler.cloudantclient.DatabaseRepositoryCloudantClient)1