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.openecomp.datarouter.search.filters.config;
26 import java.io.IOException;
28 import org.onap.aai.cl.api.Logger;
29 import org.onap.aai.cl.eelf.LoggerFactory;
30 import org.openecomp.datarouter.logging.DataRouterMsgs;
31 import org.openecomp.datarouter.util.DataRouterConstants;
33 import com.fasterxml.jackson.databind.ObjectMapper;
36 * Utility methods for interacting with the UI filters schema file
38 public class UiFiltersSchemaUtility {
39 private static final Logger LOG =
40 LoggerFactory.getInstance().getLogger(UiFiltersSchemaUtility.class);
42 private ObjectMapper mapper = new ObjectMapper();
45 * Reads in the file and populates an object with that data
49 public UiFiltersConfig loadUiFiltersConfig() {
50 UiFiltersConfig filtersConfig = new UiFiltersConfig();
53 filtersConfig = mapper.readValue(new File(DataRouterConstants.UI_FILTER_LIST_FILE), UiFiltersConfig.class);
54 } catch (IOException e) {
55 LOG.error(DataRouterMsgs.JSON_CONVERSION_ERROR, "Could not convert filters config file " +
56 DataRouterConstants.UI_FILTER_LIST_FILE + " to " + filtersConfig.getClass());