source: src/main/java/com/example/medweb/service/impl/UpatServiceImpl.java

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 
1package com.example.medweb.service.impl;
2
3import com.example.medweb.model.Pacient;
4import com.example.medweb.model.Upat;
5import com.example.medweb.model.exceptions.InvalidArgumentsException;
6import com.example.medweb.repository.UpatRepository;
7import com.example.medweb.service.UpatService;
8import org.springframework.stereotype.Service;
9
10import java.util.List;
11import java.util.Optional;
12
13
14@Service
15public 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.