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.List;
26 import org.onap.aai.sparky.search.filters.config.UiFilterConfig;
27 import org.onap.aai.sparky.search.filters.config.UiFilterOptionsValuesConfig;
29 import com.fasterxml.jackson.annotation.JsonInclude;
30 import com.fasterxml.jackson.annotation.JsonInclude.Include;
33 * Stores data for a single filter for a given UI view.
35 * When a UI view wants to know which filters it should display, an object of this class is created for each
36 * filter discovered and stores data for that filter. Each filter/object of this class is added to a
37 * ViewFilterList object which is then serialized to JSON and returned to the view in the response body.
39 @JsonInclude(Include.NON_NULL)
40 public class UiFilterEntity {
41 private String filterId;
42 private String filterName;
43 private String displayName;
44 private String dataType;
46 private String multiSelect;
47 private String watermark;
48 private UiFilterOptionsValuesConfig defaultValue;
49 private String optionsType;
51 private List<UiFilterOptionsValuesConfig> optionsValues;
53 private List<UiFilterValueEntity> filterValueList;
55 public UiFilterEntity() {}
57 public UiFilterEntity(UiFilterConfig filterConfig) {
58 if (filterConfig.getFilterId() != null) {
59 this.setFilterId(filterConfig.getFilterId());
61 if (filterConfig.getFilterName() != null) {
62 this.setFilterName(filterConfig.getFilterName());
64 if (filterConfig.getDisplayName() != null) {
65 this.setDisplayName(filterConfig.getDisplayName());
67 if (filterConfig.getDataType() != null) {
68 this.setDataType(filterConfig.getDataType());
70 if (filterConfig.getMultiSelect() != null) {
71 this.setMultiSelect(filterConfig.getMultiSelect());
73 if (filterConfig.getWatermark() != null) {
74 this.setWatermark(filterConfig.getWatermark());
76 if (filterConfig.getDefaultValue() != null) {
77 this.setDefaultValue(filterConfig.getDefaultValue());
79 if (filterConfig.getOptionsType() != null) {
80 this.setOptionsType(filterConfig.getOptionsType());
82 if(filterConfig.getOptionsValues() != null && !filterConfig.getOptionsValues().isEmpty()) {
83 this.setOptionsValues(filterConfig.getOptionsValues());
85 this.optionsValues = new ArrayList<UiFilterOptionsValuesConfig>();
89 public void addFilterValue(UiFilterValueEntity valueEntity) {
90 if (null == filterValueList) {
91 filterValueList = new ArrayList<>();
94 this.filterValueList.add(valueEntity);
97 public String getFilterId() {
101 public String getFilterName() {
105 public String getDisplayName() {
109 public String getDataType() {
113 public UiFilterOptionsValuesConfig getDefaultValue() {
117 public List<UiFilterValueEntity> getFilterValueList() {
118 return filterValueList;
121 public void setFilterId(String filterId) {
122 this.filterId = filterId;
125 public void setFilterName(String filterName) {
126 this.filterName = filterName;
129 public void setDisplayName(String displayName) {
130 this.displayName = displayName;
133 public void setDataType(String dataType) {
134 this.dataType = dataType;
137 public String getMultiSelect() {
141 public void setMultiSelect(String multiSelect) {
142 this.multiSelect = multiSelect;
145 public String getWatermark() {
149 public void setWatermark(String watermark) {
150 this.watermark = watermark;
153 public String getOptionsType() {
157 public void setOptionsType(String optionsType) {
158 this.optionsType = optionsType;
161 public List<UiFilterOptionsValuesConfig> getOptionsValues() {
162 return optionsValues;
165 public void setOptionsValues(List<UiFilterOptionsValuesConfig> optionsValues) {
166 this.optionsValues = optionsValues;
169 public void setDefaultValue(UiFilterOptionsValuesConfig defaultValue) {
170 this.defaultValue = defaultValue;
173 public void setFilterValueList(List<UiFilterValueEntity> values) {
174 this.filterValueList = values;