001/* 002 * Licensed to DuraSpace under one or more contributor license agreements. 003 * See the NOTICE file distributed with this work for additional information 004 * regarding copyright ownership. 005 * 006 * DuraSpace licenses this file to you under the Apache License, 007 * Version 2.0 (the "License"); you may not use this file except in 008 * compliance with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.fcrepo.search.api; 019 020import com.fasterxml.jackson.annotation.JsonProperty; 021 022import java.util.List; 023import java.util.Map; 024 025import static com.google.common.base.Preconditions.checkNotNull; 026 027/** 028 * This class holds the search result data for a single page. 029 * @author dbernstein 030 */ 031public class SearchResult { 032 @JsonProperty 033 private PaginationInfo pagination; 034 @JsonProperty 035 private List<Map<String, Object>> items; 036 037 /** 038 * Default Constructor 039 */ 040 public SearchResult() { } 041 /** 042 * Constructor 043 * 044 * @param items The individual search result items 045 * @param pagination The pagination info 046 */ 047 public SearchResult(final List<Map<String, Object>> items, final PaginationInfo pagination) { 048 checkNotNull(items, "items cannot be null"); 049 checkNotNull(pagination, "pagination cannot be null"); 050 this.items = items; 051 this.pagination = pagination; 052 } 053 054 /** 055 * The pagination information. 056 * @return The pagination info 057 */ 058 public PaginationInfo getPagination() { 059 return this.pagination; 060 } 061 062 /** 063 * The list of items returned by the search operation associated with the page indicated by the pagination info. 064 * @return The list of items 065 */ 066 public List<Map<String, Object>> getItems() { 067 return this.items; 068 } 069}