001/* 002 * The contents of this file are subject to the license and copyright 003 * detailed in the LICENSE and NOTICE files at the root of the source 004 * tree. 005 */ 006package org.fcrepo.search.api; 007 008import com.fasterxml.jackson.annotation.JsonProperty; 009 010import java.util.List; 011import java.util.Map; 012 013import static com.google.common.base.Preconditions.checkNotNull; 014 015/** 016 * This class holds the search result data for a single page. 017 * @author dbernstein 018 */ 019public class SearchResult { 020 @JsonProperty 021 private PaginationInfo pagination; 022 @JsonProperty 023 private List<Map<String, Object>> items; 024 025 /** 026 * Default Constructor 027 */ 028 public SearchResult() { } 029 /** 030 * Constructor 031 * 032 * @param items The individual search result items 033 * @param pagination The pagination info 034 */ 035 public SearchResult(final List<Map<String, Object>> items, final PaginationInfo pagination) { 036 checkNotNull(items, "items cannot be null"); 037 checkNotNull(pagination, "pagination cannot be null"); 038 this.items = items; 039 this.pagination = pagination; 040 } 041 042 /** 043 * The pagination information. 044 * @return The pagination info 045 */ 046 public PaginationInfo getPagination() { 047 return this.pagination; 048 } 049 050 /** 051 * The list of items returned by the search operation associated with the page indicated by the pagination info. 052 * @return The list of items 053 */ 054 public List<Map<String, Object>> getItems() { 055 return this.items; 056 } 057}