Aharoni, Pavel (pa0916) | ca3cb01 | 2018-10-22 15:29:57 +0300 | [diff] [blame] | 1 | /*-
|
| 2 | * ============LICENSE_START=======================================================
|
| 3 | * OSAM Core
|
| 4 | * ================================================================================
|
| 5 | * Copyright (C) 2018 Netsia
|
| 6 | * ================================================================================
|
| 7 | * Licensed under the Apache License, Version 2.0 (the "License");
|
| 8 | * you may not use this file except in compliance with the License.
|
| 9 | * You may obtain a copy of the License at
|
| 10 | *
|
| 11 | * http://www.apache.org/licenses/LICENSE-2.0
|
| 12 | *
|
| 13 | * Unless required by applicable law or agreed to in writing, software
|
| 14 | * distributed under the License is distributed on an "AS IS" BASIS,
|
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 16 | * See the License for the specific language governing permissions and
|
| 17 | * limitations under the License.
|
| 18 | * ============LICENSE_END=========================================================
|
| 19 | */
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 | package org.onap.osam.core;
|
| 24 |
|
| 25 | import org.onap.osam.model.repository.PmConfigsRepository;
|
| 26 | import org.onap.osam.model.dao.PmConfig;
|
| 27 | import org.onap.osam.model.dao.PmConfigs;
|
| 28 | import org.onap.osam.model.dao.PmGroupConfig;
|
| 29 | import org.onap.osam.model.repository.PmConfigRepository;
|
| 30 | import org.onap.osam.model.repository.PmGroupConfigRepository;
|
| 31 | import org.onap.osam.api.service.PmConfigsService;
|
| 32 | import org.springframework.beans.factory.annotation.Autowired;
|
| 33 | import org.springframework.stereotype.Service;
|
| 34 |
|
| 35 | import java.util.List;
|
| 36 |
|
| 37 | @Service
|
| 38 | public class PmConfigsServiceImpl extends AbstractBaseServiceImpl implements PmConfigsService{
|
| 39 |
|
| 40 | protected PmConfigRepository pmConfigRepository;
|
| 41 | protected PmConfigsRepository pmConfigsRepository;
|
| 42 | protected PmGroupConfigRepository pmGroupConfigRepository;
|
| 43 |
|
| 44 | @Autowired
|
| 45 | public PmConfigsServiceImpl(PmConfigRepository pmConfigRepository,PmConfigsRepository pmConfigsRepository,
|
| 46 | PmGroupConfigRepository pmGroupConfigRepository){
|
| 47 |
|
| 48 | this.pmConfigRepository=pmConfigRepository;
|
| 49 | this.pmGroupConfigRepository=pmGroupConfigRepository;
|
| 50 | this.pmConfigsRepository=pmConfigsRepository;
|
| 51 | }
|
| 52 |
|
| 53 |
|
| 54 | @Override
|
| 55 | public List<PmConfig> getPmConfigByPmConfigsId(Long pmConfigsId) {
|
| 56 | return pmConfigRepository.getByPmConfigs_Id(pmConfigsId);
|
| 57 | }
|
| 58 |
|
| 59 | @Override
|
| 60 | public List<PmConfig> getPmConfigByPmConfigGroupId(Long pmGroupConfigsId) {
|
| 61 | return pmConfigRepository.getByPmGroupConfig_Id(pmGroupConfigsId);
|
| 62 | }
|
| 63 |
|
| 64 | @Override
|
| 65 | public void addPmGroupConfig(PmConfig pmConfig) {
|
| 66 | add(pmConfig,pmConfigRepository);
|
| 67 | }
|
| 68 |
|
| 69 | @Override
|
| 70 | public void addPmGroupConfig(PmGroupConfig pmGroupConfig) {
|
| 71 | add(pmGroupConfig,pmGroupConfigRepository);
|
| 72 | }
|
| 73 |
|
| 74 | @Override
|
| 75 | public void removePmConfig(Long pmConfigId) {
|
| 76 | remove(pmConfigId,pmConfigRepository,PmConfig.class);
|
| 77 | }
|
| 78 |
|
| 79 | @Override
|
| 80 | public void removeGroupPmConfig(Long pmGroupConfigId) {
|
| 81 | remove(pmGroupConfigId,pmGroupConfigRepository,PmGroupConfig.class);
|
| 82 | }
|
| 83 |
|
| 84 |
|
| 85 | @Override
|
| 86 | public PmConfigs addOrUpdate(PmConfigs value) {
|
| 87 | return add(value,pmConfigsRepository);
|
| 88 | }
|
| 89 |
|
| 90 | @Override
|
| 91 | public void removeById(Long key) {
|
| 92 | remove(key,pmConfigsRepository,PmConfigs.class);
|
| 93 | }
|
| 94 |
|
| 95 | @Override
|
| 96 | public PmConfigs getById(Long key) {
|
| 97 | return get(key,pmConfigsRepository);
|
| 98 | }
|
| 99 |
|
| 100 | @Override
|
| 101 | public List<PmConfigs> getAll() {
|
| 102 | return getAll(pmConfigsRepository);
|
| 103 | }
|
| 104 | }
|