2 * Copyright © 2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.applicationconfig.impl;
19 import java.util.Collection;
20 import org.openecomp.core.utilities.applicationconfig.ApplicationConfig;
21 import org.openecomp.core.utilities.applicationconfig.dao.type.ApplicationConfigEntity;
22 import org.openecomp.core.utilities.applicationconfig.impl.ApplicationConfigImpl;
23 import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData;
24 import org.openecomp.sdc.applicationconfig.ApplicationConfigManager;
25 import org.openecomp.sdc.common.errors.CoreException;
26 import org.openecomp.sdc.common.errors.ErrorCategory;
27 import org.openecomp.sdc.common.errors.ErrorCode;
30 * Created by Talio on 8/8/2016.
32 public class ApplicationConfigManagerImpl implements ApplicationConfigManager {
34 private static final String SCHEMA_GENERATOR_INITIALIZATION_ERROR =
35 "SCHEMA_GENERATOR_INITIALIZATION_ERROR";
36 private static final String SCHEMA_GENERATOR_INITIALIZATION_ERROR_MSG =
37 "Error occurred while loading questionnaire schema templates";
38 private ApplicationConfig applicationConfig = new ApplicationConfigImpl();
41 public void insertIntoTable(String namespace, String key, String value) {
43 applicationConfig.insertValue(namespace, key, value);
44 } catch (Exception exception) {
45 throw new CoreException(new ErrorCode.ErrorCodeBuilder().withCategory(ErrorCategory
46 .APPLICATION).withId(SCHEMA_GENERATOR_INITIALIZATION_ERROR).withMessage(
47 SCHEMA_GENERATOR_INITIALIZATION_ERROR_MSG).build(), exception);
52 public ConfigurationData getFromTable(String namespace, String key) {
53 return applicationConfig.getConfigurationData(namespace, key);
57 public Collection<ApplicationConfigEntity> getListOfConfigurationByNamespace(String namespace) {
58 return applicationConfig.getListOfConfigurationByNamespace(namespace);