Last change
on this file since a51a591 was a51a591, checked in by colovik <j.colovik@…>, 14 months ago |
final
|
-
Property mode
set to
100644
|
File size:
807 bytes
|
Line | |
---|
1 | package com.example.service.impl;
|
---|
2 |
|
---|
3 | import com.example.exceptions.NoSuchUsernameException;
|
---|
4 | import com.example.model.Band;
|
---|
5 | import com.example.repository.BandRepository;
|
---|
6 | import com.example.service.BandService;
|
---|
7 | import org.springframework.stereotype.Service;
|
---|
8 |
|
---|
9 | import java.util.List;
|
---|
10 |
|
---|
11 | @Service
|
---|
12 | public class BandServiceImpl implements BandService{
|
---|
13 |
|
---|
14 | private final BandRepository bandRepository;
|
---|
15 |
|
---|
16 | public BandServiceImpl(BandRepository bandRepository) {
|
---|
17 | this.bandRepository = bandRepository;
|
---|
18 | }
|
---|
19 |
|
---|
20 | @Override
|
---|
21 | public List<Band> findAll() {
|
---|
22 | return this.bandRepository.findAll();
|
---|
23 | }
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | public Band findByName(String name) {
|
---|
27 | return this.bandRepository.findAllByName(name).stream().findFirst()
|
---|
28 | .orElseThrow(NoSuchUsernameException::new);
|
---|
29 | }
|
---|
30 | }
|
---|
31 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.