blob: e295655fd9c824a61a1103b614fbb0f99ec1f971 [file] [log] [blame]
Aharoni, Pavel (pa0916)ca3cb012018-10-22 15:29:57 +03001/*-
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
23package org.onap.osam.core;
24
25import org.onap.osam.model.dao.Subscriber;
26import org.onap.osam.model.repository.SubscriberRepository;
27import org.onap.osam.api.service.SubscriberService;
28import org.springframework.beans.factory.annotation.Autowired;
29import org.springframework.stereotype.Service;
30
31import java.util.List;
32
33/**
34 * Created by cemturker on 18.09.2018.
35 */
36@Service
37public class SubscriberServiceImpl extends AbstractBaseServiceImpl implements SubscriberService {
38
39 private SubscriberRepository subscriberRepository;
40
41 @Autowired
42 public SubscriberServiceImpl(SubscriberRepository subscriberRepository) {
43 this.subscriberRepository = subscriberRepository;
44 }
45
46 @Override
47 public Subscriber addOrUpdate(Subscriber subscriber) {
48 //TODO Add Check the devices.....
49 return add(subscriber, subscriberRepository);
50 }
51
52 @Override
53 public void removeById(Long id) {
54 remove(id, subscriberRepository, Subscriber.class);
55 }
56
57 @Override
58 public Subscriber getById(Long id) {
59 return get(id, subscriberRepository);
60 }
61
62 @Override
63 public List<Subscriber> getAll() {
64 return getAll(subscriberRepository);
65 }
66
67 @Override
68 public Subscriber getBySubscriberIdentifier(String userIdentifier) {
69 return subscriberRepository.findByUserIdentifier(userIdentifier);
70 }
71}