Last change
on this file since b101b69 was b101b69, checked in by ppaunovski <paunovskipavel@…>, 6 months ago |
initial classes, no inheritance yet v2
|
-
Property mode
set to
100644
|
File size:
839 bytes
|
Line | |
---|
1 | package mk.ukim.finki.busngo.service.impl;
|
---|
2 |
|
---|
3 | import mk.ukim.finki.busngo.model.entities.Patnik;
|
---|
4 | import mk.ukim.finki.busngo.model.exceptions.InvalidPatnikIdException;
|
---|
5 | import mk.ukim.finki.busngo.repository.PatnikRepository;
|
---|
6 | import mk.ukim.finki.busngo.service.PatnikService;
|
---|
7 | import org.springframework.stereotype.Service;
|
---|
8 |
|
---|
9 | import java.util.List;
|
---|
10 |
|
---|
11 | @Service
|
---|
12 | public class PatnikServiceImpl implements PatnikService {
|
---|
13 | private final PatnikRepository patnikRepository;
|
---|
14 |
|
---|
15 | public PatnikServiceImpl(PatnikRepository patnikRepository) {
|
---|
16 | this.patnikRepository = patnikRepository;
|
---|
17 | }
|
---|
18 |
|
---|
19 | @Override
|
---|
20 | public List<Patnik> listAll() {
|
---|
21 | return patnikRepository.findAll();
|
---|
22 | }
|
---|
23 |
|
---|
24 | @Override
|
---|
25 | public Patnik findById(Long id) {
|
---|
26 | return patnikRepository.findById(id).orElseThrow(InvalidPatnikIdException::new);
|
---|
27 | }
|
---|
28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.