All Downloads are FREE. Search and download functionalities are using the official Maven repository.

am.ik.blog.entry.EntryMapper Maven / Gradle / Ivy

package am.ik.blog.entry;

import java.util.Collections;
import java.util.List;

import am.ik.blog.entry.criteria.SearchCriteria;
import reactor.core.publisher.Flux;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;

public interface EntryMapper {
	long count(SearchCriteria searchCriteria);

	Entry findOne(EntryId entryId, boolean excludeContent);

	List findAll(SearchCriteria searchCriteria, Pageable pageable);

	void save(Entry entry);

	int delete(EntryId entryId);

	default Page findPage(SearchCriteria searchCriteria, Pageable pageable) {
		long count = count(searchCriteria);
		if (count <= 0) {
			return new PageImpl<>(Collections.emptyList(), pageable, count);
		}
		else {
			return new PageImpl<>(findAll(searchCriteria, pageable), pageable, count);
		}
	}

	Flux collectAll(SearchCriteria searchCriteria, Pageable pageable);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy