main
Last change
on this file since 7aa3382 was 7aa3382, checked in by SazdovaEkaterina <sazdovaekaterina@…>, 16 months ago |
add approve functionality
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[996b8ba] | 1 | package finki.paw5.service.implementation;
|
---|
| 2 |
|
---|
| 3 | import finki.paw5.model.entities.Adopter;
|
---|
| 4 | import finki.paw5.repository.AdopterRepository;
|
---|
| 5 | import finki.paw5.service.AdopterService;
|
---|
| 6 | import org.springframework.stereotype.Service;
|
---|
| 7 |
|
---|
| 8 | import java.util.List;
|
---|
| 9 | import java.util.stream.Collectors;
|
---|
| 10 |
|
---|
[104185f] | 11 | @Service
|
---|
[996b8ba] | 12 | public class AdopterServiceImplementation implements AdopterService {
|
---|
| 13 | private final AdopterRepository adopterRepository;
|
---|
| 14 |
|
---|
| 15 | public AdopterServiceImplementation(AdopterRepository adopterRepository) {
|
---|
| 16 | this.adopterRepository = adopterRepository;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | @Override
|
---|
| 20 | public List<Adopter> findAllThatNeedApproval() {
|
---|
| 21 |
|
---|
| 22 | return adopterRepository.findAll().stream()
|
---|
[104185f] | 23 | .filter(a -> !a.getVerified() && a.getEmployeeVerificator() == null)
|
---|
[996b8ba] | 24 | .collect(Collectors.toList());
|
---|
| 25 | }
|
---|
[7aa3382] | 26 |
|
---|
| 27 | @Override
|
---|
| 28 | public Adopter findById(Integer id) {
|
---|
| 29 | return this.adopterRepository.findById(id).get();
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | @Override
|
---|
| 33 | public void save(Adopter adopter) {
|
---|
| 34 | this.adopterRepository.save(adopter);
|
---|
| 35 | }
|
---|
[996b8ba] | 36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.