8324ec940612e6c428dbf395c205a85a0a0d74c0
[platform/core/security/suspicious-activity-monitor.git] / server / samserver / src / main / java / com / samsung / samserver / service / impl / ReportServiceImpl.java
1 /*
2  * In Samsung Ukraine R&D Center (SRK under a contract between)
3  * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
4  * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
5  */
6 package com.samsung.samserver.service.impl;
7
8 import com.samsung.samserver.service.ReportService;
9 import com.samsung.samserver.domain.primary.Report;
10 import com.samsung.samserver.repository.primary.ReportRepository;
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
13 import org.springframework.stereotype.Service;
14 import org.springframework.transaction.annotation.Transactional;
15
16 import java.util.List;
17
18 /**
19  * Service Implementation for managing Report.
20  */
21 @Service
22 @Transactional
23 public class ReportServiceImpl implements ReportService {
24
25     private final Logger log = LoggerFactory.getLogger(ReportServiceImpl.class);
26
27     private final ReportRepository reportRepository;
28
29     public ReportServiceImpl(ReportRepository reportRepository) {
30         this.reportRepository = reportRepository;
31     }
32
33     /**
34      * Save a report.
35      *
36      * @param report the entity to save
37      * @return the persisted entity
38      */
39     @Override
40     public Report save(Report report) {
41         log.debug("Request to save Report : {}", report);
42         return reportRepository.save(report);
43     }
44
45     /**
46      * Get all the reports.
47      *
48      * @return the list of entities
49      */
50     @Override
51     @Transactional(readOnly = true)
52     public List<Report> findAll() {
53         log.debug("Request to get all Reports"); //NOSONAR
54         return reportRepository.findAll();
55     }
56
57     /**
58      * Get one report by id.
59      *
60      * @param id the id of the entity
61      * @return the entity
62      */
63     @Override
64     @Transactional(readOnly = true)
65     public Report findOne(Long id) {
66         log.debug("Request to get Report : {}", id);
67         return reportRepository.findOne(id);
68     }
69
70     /**
71      * Delete the report by id.
72      *
73      * @param id the id of the entity
74      */
75     @Override
76     public void delete(Long id) {
77         log.debug("Request to delete Report : {}", id);
78         reportRepository.delete(id);
79     }
80 }