source: src/main/java/com/example/moviezone/service/Impl/FilmServiceImpl.java

Last change on this file was 90317ea, checked in by DenicaKj <dkorvezir@…>, 22 months ago

Events and Event

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[11dea8f]1package com.example.moviezone.service.Impl;
2
3import com.example.moviezone.model.Film;
[8d49568]4import com.example.moviezone.model.procedures.FilmsReturnTable;
[1b248e4]5import com.example.moviezone.repository.FilmRepository;
[11dea8f]6import com.example.moviezone.service.FilmService;
7import org.springframework.stereotype.Service;
8
[302b233]9import java.time.LocalDate;
[eb5426c]10import java.util.Collections;
[11dea8f]11import java.util.List;
[eb5426c]12import java.util.Optional;
[11dea8f]13
14@Service
15public class FilmServiceImpl implements FilmService {
[1b248e4]16 private final FilmRepository filmRepository;
17
18 public FilmServiceImpl(FilmRepository filmRepository) {
19 this.filmRepository = filmRepository;
20 }
21
[11dea8f]22 @Override
23 public List<Film> findAllFilms() {
[1b248e4]24 return filmRepository.findAll();
[11dea8f]25 }
[302b233]26
27 @Override
28 public Film save(String name, Integer duration, String actors, String genre, String age_category, String url, String director, LocalDate start_date, LocalDate end_date) {
29 return filmRepository.save(new Film(name,duration,actors,genre,age_category,url,director,start_date,end_date));
30 }
[eb5426c]31
32 @Override
33 public Optional<Film> getFilmById(Long id) {
34 return filmRepository.findAllById(Collections.singleton(id.intValue())).stream().findFirst();
35 }
36
[8d49568]37 @Override
[61fed7c]38 public List<Film> getFilmsFromCinema(int id) {
[8d49568]39 return filmRepository.getFilmsFromCinema(id);
40 }
41
[90317ea]42 @Override
43 public List<Film> getFilmsFromCinemaNow(int id) {
44 return filmRepository.getFilmsFromCinemaNow(id);
45 }
46
47 @Override
48 public List<Film> getFilmsNow() {
49 return filmRepository.getFilmsNow();
50 }
51
[11dea8f]52}
Note: See TracBrowser for help on using the repository browser.