source:
Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/PostServiceImplementation.java@
e76c5a6
Last change on this file since e76c5a6 was a762b3a, checked in by , 17 months ago | |
---|---|
|
|
File size: 828 bytes |
Rev | Line | |
---|---|---|
[738b31a] | 1 | package finki.paw5.service.implementation; |
2 | ||
[6479fe1] | 3 | import finki.paw5.model.entities.Post; |
4 | import finki.paw5.repository.PostRepository; | |
[738b31a] | 5 | import finki.paw5.service.PostService; |
[6479fe1] | 6 | import org.springframework.stereotype.Service; |
[738b31a] | 7 | |
[a762b3a] | 8 | import java.util.List; |
9 | import java.util.Optional; | |
10 | ||
[6479fe1] | 11 | @Service |
[55c0119] | 12 | public class PostServiceImplementation implements PostService { |
[738b31a] | 13 | |
[6479fe1] | 14 | private final PostRepository postRepository; |
[738b31a] | 15 | |
[55c0119] | 16 | public PostServiceImplementation(PostRepository PostRepository){ |
[6479fe1] | 17 | this.postRepository = PostRepository; |
18 | } | |
[738b31a] | 19 | |
20 | @Override | |
[468b7b6] | 21 | public void save(Post post) { |
22 | this.postRepository.save(post); | |
[738b31a] | 23 | } |
[6479fe1] | 24 | |
[a762b3a] | 25 | @Override |
26 | public List<Post> findAll() { | |
27 | return this.postRepository.findAll(); | |
28 | } | |
29 | ||
30 | @Override | |
31 | public Optional<Post> findById(Integer id) { | |
32 | return this.postRepository.findById(id); | |
33 | } | |
[738b31a] | 34 | } |
Note:
See TracBrowser
for help on using the repository browser.