2 * Copyright © 2017-2018 AT&T Intellectual Property.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 package org.onap.ccsdk.apps.controllerblueprints.service.rs;
\r
19 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
\r
20 import org.onap.ccsdk.apps.controllerblueprints.service.ConfigModelService;
\r
21 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
\r
22 import org.springframework.stereotype.Service;
\r
24 import java.util.List;
\r
30 public class ConfigModelRestImpl implements ConfigModelRest {
\r
32 private ConfigModelService configModelService;
\r
35 * This is a ConfigModelRestImpl constructor.
\r
37 * @param configModelService Config Model Service
\r
39 public ConfigModelRestImpl(ConfigModelService configModelService) {
\r
40 this.configModelService = configModelService;
\r
45 public ConfigModel getInitialConfigModel(String name) throws BluePrintException {
\r
47 return this.configModelService.getInitialConfigModel(name);
\r
48 } catch (Exception e) {
\r
49 throw new BluePrintException(2000, e.getMessage(), e);
\r
54 public ConfigModel saveConfigModel(ConfigModel configModel) throws BluePrintException {
\r
56 return this.configModelService.saveConfigModel(configModel);
\r
57 } catch (Exception e) {
\r
58 throw new BluePrintException(2200, e.getMessage(), e);
\r
63 public void deleteConfigModel(Long id) throws BluePrintException {
\r
65 this.configModelService.deleteConfigModel(id);
\r
66 } catch (Exception e) {
\r
67 throw new BluePrintException(4000, e.getMessage(), e);
\r
72 public ConfigModel publishConfigModel(Long id) throws BluePrintException {
\r
74 return this.configModelService.publishConfigModel(id);
\r
75 } catch (Exception e) {
\r
76 throw new BluePrintException(2500, e.getMessage(), e);
\r
81 public ConfigModel getConfigModel(Long id) throws BluePrintException {
\r
83 return this.configModelService.getConfigModel(id);
\r
84 } catch (Exception e) {
\r
85 throw new BluePrintException(2001, e.getMessage(), e);
\r
90 public ConfigModel getConfigModelByNameAndVersion(String name, String version) throws BluePrintException {
\r
92 return this.configModelService.getConfigModelByNameAndVersion(name, version);
\r
93 } catch (Exception e) {
\r
94 throw new BluePrintException(2002, e.getMessage(), e);
\r
99 public List<ConfigModel> searchConfigModels(String tags) throws BluePrintException {
\r
101 return this.configModelService.searchConfigModels(tags);
\r
102 } catch (Exception e) {
\r
103 throw new BluePrintException(2003, e.getMessage(), e);
\r
108 public ConfigModel getCloneConfigModel(Long id) throws BluePrintException {
\r
110 return this.configModelService.getCloneConfigModel(id);
\r
111 } catch (Exception e) {
\r
112 throw new BluePrintException(2004, e.getMessage(), e);
\r