Search in sources :

Example 6 with Selector

use of com.cloudant.client.api.query.Selector in project sw360 by eclipse.

the class ModerationRequestRepository method getRequestsByRequestingUser.

public List<ModerationRequest> getRequestsByRequestingUser(String user) {
    final Selector typeSelector = eq("type", "moderation");
    final Selector filterByModeratorSelector = eq("requestingUser", user);
    final Selector finalSelector = and(typeSelector, filterByModeratorSelector);
    QueryBuilder qb = new QueryBuilder(finalSelector);
    qb.useIndex("byUsers");
    List<ModerationRequest> mrs = getConnector().getQueryResult(qb.build(), ModerationRequest.class).getDocs();
    return makeSummaryFromFullDocs(SummaryType.SHORT, mrs);
}
Also used : ModerationRequest(org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest) QueryBuilder(com.cloudant.client.api.query.QueryBuilder) Selector(com.cloudant.client.api.query.Selector)

Aggregations

QueryBuilder (com.cloudant.client.api.query.QueryBuilder)6 Selector (com.cloudant.client.api.query.Selector)6 ModerationRequest (org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest)4 PaginationData (org.eclipse.sw360.datahandler.thrift.PaginationData)3 IOException (java.io.IOException)2 List (java.util.List)2 ViewRequestBuilder (com.cloudant.client.api.views.ViewRequestBuilder)1 ArrayList (java.util.ArrayList)1 Project (org.eclipse.sw360.datahandler.thrift.projects.Project)1 User (org.eclipse.sw360.datahandler.thrift.users.User)1