diff --git a/src/main/java/org/alfresco/service/cmr/search/RangeParameters.java b/src/main/java/org/alfresco/service/cmr/search/RangeParameters.java new file mode 100644 index 0000000000..7a148f49fa --- /dev/null +++ b/src/main/java/org/alfresco/service/cmr/search/RangeParameters.java @@ -0,0 +1,143 @@ +/* + * #%L + * Alfresco Data model classes + * %% + * Copyright (C) 2005 - 2017 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.service.cmr.search; + +import java.util.List; + +import org.alfresco.api.AlfrescoPublicApi; +import org.codehaus.jackson.annotate.JsonCreator; +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * Parameters used for search range. + */ +@AlfrescoPublicApi +public class RangeParameters +{ + private String field; + private int minCount; + private String start; + private String end; + private String gap; + private boolean hardend; + private String other; + private String include; + private List tags; + private List excludeFilters; + + public RangeParameters() {} + + @JsonCreator + public RangeParameters( @JsonProperty("field") String field, + @JsonProperty("facet.range.start") String start, + @JsonProperty("facet.range.end") String end, + @JsonProperty("facet.range.gap") String gap) + { + super(); + this.field = field; + this.start = start; + this.end = end; + this.gap = gap; + this.hardend = false; + } + /** + * Constructor. + * @param field + * @param minCount + * @param start + * @param end + * @param gap + * @param hardend + * @param other + * @param include + * @param tags + * @param excludeFilters + */ + public RangeParameters(String field, + int minCount, + String start, + String end, + String gap, + boolean hardend, + String other, + String include, + List tags, + List excludeFilters) + { + super(); + this.field = field; + this.minCount = minCount; + this.start = start; + this.end = end; + this.gap = gap; + this.hardend = hardend; + this.other = other; + this.include = include; + this.tags = tags; + this.excludeFilters = excludeFilters; + } + + public String getField() + { + return field; + } + public int getMinCount() + { + return minCount; + } + public String getStart() + { + return start; + } + public String getEnd() + { + return end; + } + public String getGap() + { + return gap; + } + public boolean isHardend() + { + return hardend; + } + public String getOther() + { + return other; + } + public String getInclude() + { + return include; + } + public List getTags() + { + return tags; + } + public List getExcludeFilters() + { + return excludeFilters; + } +} diff --git a/src/main/java/org/alfresco/service/cmr/search/SearchParameters.java b/src/main/java/org/alfresco/service/cmr/search/SearchParameters.java index f2e0e130a6..62bf86706f 100644 --- a/src/main/java/org/alfresco/service/cmr/search/SearchParameters.java +++ b/src/main/java/org/alfresco/service/cmr/search/SearchParameters.java @@ -194,6 +194,8 @@ public class SearchParameters implements BasicSearchParameters private IntervalParameters interval; private List stats; + + private RangeParameters range; /** * Default constructor @@ -243,6 +245,7 @@ public class SearchParameters implements BasicSearchParameters sp.highlight = this.highlight; sp.interval = this.interval; sp.stats = this.stats; + sp.range = this.range; return sp; } @@ -322,6 +325,16 @@ public class SearchParameters implements BasicSearchParameters this.interval = interval; } + public RangeParameters getRange() + { + return range; + } + + public void setRange(RangeParameters range) + { + this.range = range; + } + /** * Set the query language. * @@ -1304,6 +1317,7 @@ public class SearchParameters implements BasicSearchParameters .append(this.sinceTxId).append(", searchTerm=").append(this.searchTerm) .append(", highlight=").append(this.highlight) .append(", interval=").append(this.interval) + .append(", range=").append(this.range) .append(", spellCheck=").append(this.spellCheck).append("]"); return builder.toString(); }