2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
4 * ============================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
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 at
13 * http://www.apache.org/licenses/LICENSE-2.0
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=====================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
25 package org.onap.aai.sparky.search.filters.entity;
27 import java.util.ArrayList;
28 import java.util.Arrays;
29 import java.util.List;
32 * A base entity to contain the details of the filter id and values from the FE to the BE for the
33 * purpose of driving DAL calls into ElasticSearch, Search Abstraction Service, or as a utility
34 * object within the query builders.
36 * The class has unique identifier for the filter id, and then 1 or more filter values. The value
37 * list has been introduced to help us with a multi-select use case that will need to be supported
40 public class SearchFilter {
42 private String filterId;
43 private List<String> values;
45 public SearchFilter() {
46 values = new ArrayList<String>();
49 public SearchFilter(String filterId) {
51 this.filterId = filterId;
54 public SearchFilter(String filterId, String... values) {
56 this.filterId = filterId;
57 this.values.addAll(Arrays.asList(values));
60 public String getFilterId() {
64 public void setFilterId(String filterId) {
65 this.filterId = filterId;
68 public List<String> getValues() {
72 public void setValues(List<String> values) {
76 public void addValue(String v) {
77 if (!values.contains(v)) {
84 public String toString() {
85 return "SearchFilter [filterId=" + filterId + ", values=" + values + "]";