2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.onap.aai.sparky.search.filters.entity;
25 import java.util.ArrayList;
26 import java.util.List;
28 import org.onap.aai.sparky.search.filters.config.UiFilterConfig;
29 import org.onap.aai.sparky.search.filters.config.UiFilterOptionsValuesConfig;
31 import com.fasterxml.jackson.annotation.JsonInclude;
32 import com.fasterxml.jackson.annotation.JsonInclude.Include;
35 * Stores data for a single filter for a given UI view.
37 * When a UI view wants to know which filters it should display, an object of this class is created for each
38 * filter discovered and stores data for that filter. Each filter/object of this class is added to a
39 * ViewFilterList object which is then serialized to JSON and returned to the view in the response body.
41 @JsonInclude(Include.NON_NULL)
42 public class UiFilterEntity {
43 private String filterId;
44 private String filterName;
45 private String displayName;
46 private String dataType;
48 private String multiSelect;
49 private String watermark;
50 private UiFilterOptionsValuesConfig defaultValue;
51 private String optionsType;
53 private List<UiFilterOptionsValuesConfig> optionsValues;
55 private List<UiFilterValueEntity> filterValueList;
57 public UiFilterEntity() {}
59 public UiFilterEntity(UiFilterConfig filterConfig) {
60 if (filterConfig.getFilterId() != null) {
61 this.setFilterId(filterConfig.getFilterId());
63 if (filterConfig.getFilterName() != null) {
64 this.setFilterName(filterConfig.getFilterName());
66 if (filterConfig.getDisplayName() != null) {
67 this.setDisplayName(filterConfig.getDisplayName());
69 if (filterConfig.getDataType() != null) {
70 this.setDataType(filterConfig.getDataType());
72 if (filterConfig.getMultiSelect() != null) {
73 this.setMultiSelect(filterConfig.getMultiSelect());
75 if (filterConfig.getWatermark() != null) {
76 this.setWatermark(filterConfig.getWatermark());
78 if (filterConfig.getDefaultValue() != null) {
79 this.setDefaultValue(filterConfig.getDefaultValue());
81 if (filterConfig.getOptionsType() != null) {
82 this.setOptionsType(filterConfig.getOptionsType());
84 if(filterConfig.getOptionsValues() != null && !filterConfig.getOptionsValues().isEmpty()) {
85 this.setOptionsValues(filterConfig.getOptionsValues());
87 this.optionsValues = new ArrayList<UiFilterOptionsValuesConfig>();
91 public void addFilterValue(UiFilterValueEntity valueEntity) {
92 if (null == filterValueList) {
93 filterValueList = new ArrayList<>();
96 this.filterValueList.add(valueEntity);
99 public String getFilterId() {
103 public String getFilterName() {
107 public String getDisplayName() {
111 public String getDataType() {
115 public UiFilterOptionsValuesConfig getDefaultValue() {
119 public List<UiFilterValueEntity> getFilterValueList() {
120 return filterValueList;
123 public void setFilterId(String filterId) {
124 this.filterId = filterId;
127 public void setFilterName(String filterName) {
128 this.filterName = filterName;
131 public void setDisplayName(String displayName) {
132 this.displayName = displayName;
135 public void setDataType(String dataType) {
136 this.dataType = dataType;
139 public String getMultiSelect() {
143 public void setMultiSelect(String multiSelect) {
144 this.multiSelect = multiSelect;
147 public String getWatermark() {
151 public void setWatermark(String watermark) {
152 this.watermark = watermark;
155 public String getOptionsType() {
159 public void setOptionsType(String optionsType) {
160 this.optionsType = optionsType;
163 public List<UiFilterOptionsValuesConfig> getOptionsValues() {
164 return optionsValues;
167 public void setOptionsValues(List<UiFilterOptionsValuesConfig> optionsValues) {
168 this.optionsValues = optionsValues;
171 public void setDefaultValue(UiFilterOptionsValuesConfig defaultValue) {
172 this.defaultValue = defaultValue;
175 public void setFilterValueList(List<UiFilterValueEntity> values) {
176 this.filterValueList = values;