635922741d9360c265b484b6e415641d922aa1de
[aai/search-data-service.git] / src / main / java / org / openecomp / sa / searchdbabstraction / searchapi / AbstractAggregation.java
1 /**
2  * ============LICENSE_START=======================================================
3  * Search Data Service
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property.
6  * Copyright © 2017 Amdocs
7  * All rights reserved.
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License ati
12  *
13  *    http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  *
22  * ECOMP and OpenECOMP are trademarks
23  * and service marks of AT&T Intellectual Property.
24  */
25 package org.openecomp.sa.searchdbabstraction.searchapi;
26
27 import com.fasterxml.jackson.annotation.JsonProperty;
28
29
30 /**
31  * This is the common parent from which all aggregation types inherit.  It defines
32  * the common fields that all aggregations must include.
33  */
34 public abstract class AbstractAggregation {
35
36   /**
37    * The name of the field to apply the aggregation against.
38    */
39   protected String field;
40
41   /**
42    * Optionally allows the number of buckets for the aggregation to be
43    * specified.
44    */
45   protected Integer size;
46
47   /**
48    * Optionally sets the minimum number of matches that must occur before
49    * a particular bucket is included in the aggregation result.
50    */
51   @JsonProperty("min-threshold")
52   protected Integer minThreshold;
53
54
55   public String getField() {
56     return field;
57   }
58
59   public void setField(String field) {
60     this.field = field;
61   }
62
63   public Integer getSize() {
64     return size;
65   }
66
67   public void setSize(Integer size) {
68     this.size = size;
69   }
70
71   public Integer getMinThreshold() {
72     return minThreshold;
73   }
74
75   public void setMinThreshold(Integer minThreshold) {
76     this.minThreshold = minThreshold;
77   }
78
79   public abstract String toElasticSearch();
80
81   public abstract String toString();
82 }