2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 package org.onap.aai.sparky.search.filters.entity;
23 import java.util.ArrayList;
24 import java.util.Arrays;
25 import java.util.List;
28 * A base entity to contain the details of the filter id and values from the FE to the BE for the
29 * purpose of driving DAL calls into ElasticSearch, Search Abstraction Service, or as a utility
30 * object within the query builders.
32 * The class has unique identifier for the filter id, and then 1 or more filter values. The value
33 * list has been introduced to help us with a multi-select use case that will need to be supported
36 public class SearchFilter {
38 private String filterId;
39 private List<String> values;
41 public SearchFilter() {
42 values = new ArrayList<String>();
45 public SearchFilter(String filterId) {
47 this.filterId = filterId;
50 public SearchFilter(String filterId, String... values) {
52 this.filterId = filterId;
53 this.values.addAll(Arrays.asList(values));
56 public String getFilterId() {
60 public void setFilterId(String filterId) {
61 this.filterId = filterId;
64 public List<String> getValues() {
68 public void setValues(List<String> values) {
72 public void addValue(String v) {
73 if (!values.contains(v)) {
80 public String toString() {
81 return "SearchFilter [filterId=" + filterId + ", values=" + values + "]";