001/* 002 * (C) Copyright 2014 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Benoit Delbosc 016 */ 017package org.nuxeo.ecm.platform.query.api; 018 019import java.util.List; 020import java.util.Map; 021 022/** 023 * @since 6.0 024 */ 025public interface Aggregate<B extends Bucket> { 026 /** 027 * The aggregate identifier. 028 */ 029 String getId(); 030 031 /** 032 * Type of aggregation. 033 */ 034 String getType(); 035 036 /** 037 * Nuxeo field to aggregate. 038 */ 039 String getField(); 040 041 /** 042 * Properties of the aggregate. 043 */ 044 Map<String, String> getProperties(); 045 046 /** 047 * Range definition for aggregate of type range. 048 */ 049 List<AggregateRangeDefinition> getRanges(); 050 051 /** 052 * Date Range definition for aggregate of type date range. 053 */ 054 List<AggregateRangeDateDefinition> getDateRanges(); 055 056 /** 057 * The selection filter that is going to be applied to the main query as a post filter. 058 */ 059 List<String> getSelection(); 060 061 void setSelection(List<String> selection); 062 063 /** 064 * The aggregate results. 065 */ 066 List<B> getBuckets(); 067 068 void setBuckets(List<B> buckets); 069 070 Bucket getBucket(final String key); 071 072 boolean hasBucket(final String key); 073 074 void resetSelection(); 075 076 /** 077 * The regular list of buckets plus buckets with doc count at 0 for selected buckets which are not returned from es 078 * post filtering. 079 */ 080 List<Bucket> getExtendedBuckets(); 081}