Last change
on this file was e5fefbd, checked in by Anita Terziska <63020646+Nit4e@…>, 2 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | package com.example.medweb.service.impl;
|
---|
2 |
|
---|
3 | import com.example.medweb.model.Pacient;
|
---|
4 | import com.example.medweb.model.Upat;
|
---|
5 | import com.example.medweb.model.exceptions.InvalidArgumentsException;
|
---|
6 | import com.example.medweb.repository.UpatRepository;
|
---|
7 | import com.example.medweb.service.UpatService;
|
---|
8 | import org.springframework.stereotype.Service;
|
---|
9 |
|
---|
10 | import java.util.List;
|
---|
11 | import java.util.Optional;
|
---|
12 |
|
---|
13 |
|
---|
14 | @Service
|
---|
15 | public class UpatServiceImpl implements UpatService {
|
---|
16 |
|
---|
17 | private final UpatRepository upatRepository;
|
---|
18 |
|
---|
19 | public UpatServiceImpl(UpatRepository upatRepository) {
|
---|
20 | this.upatRepository = upatRepository;
|
---|
21 | }
|
---|
22 |
|
---|
23 | @Override
|
---|
24 | public Optional<Upat> findById(Integer id) {
|
---|
25 | return this.upatRepository.findById(id);
|
---|
26 | }
|
---|
27 |
|
---|
28 | @Override
|
---|
29 | public List<Upat> findAllByPacient(Pacient pacient) {
|
---|
30 | return this.upatRepository.findAllByPacient(pacient);
|
---|
31 | }
|
---|
32 |
|
---|
33 | @Override
|
---|
34 | public Optional<Upat> selectedUpat(Integer upat_id) {
|
---|
35 | if (upat_id == null) {
|
---|
36 | throw new InvalidArgumentsException();
|
---|
37 | }
|
---|
38 | return this.upatRepository.findById(upat_id);
|
---|
39 | }
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.