org.graylog2.cluster.nodes.DataNodePaginatedService Maven / Gradle / Ivy
/*
* Copyright (C) 2020 Graylog, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* .
*/
package org.graylog2.cluster.nodes;
import org.graylog2.bindings.providers.MongoJackObjectMapperProvider;
import org.graylog2.database.MongoConnection;
import org.graylog2.database.PaginatedDbService;
import org.graylog2.database.PaginatedList;
import org.graylog2.search.SearchQuery;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
@Singleton
public class DataNodePaginatedService extends PaginatedDbService {
private static final String NODE_COLLECTION_NAME = "datanodes";
@Inject
public DataNodePaginatedService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper) {
super(mongoConnection, mapper, DataNodeDto.class, NODE_COLLECTION_NAME);
}
public PaginatedList searchPaginated(SearchQuery query,
String sortByField, String sortOrder, int page, int perPage) {
return findPaginatedWithQueryFilterAndSort(query.toDBQuery(), node -> true,
getSortBuilder(sortOrder, sortByField), page, perPage);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy