Changes in / [693f587:ade54f6]


Ignore:
Location:
src/main
Files:
5 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/model/Event.java

    r693f587 rade54f6  
    2727    LocalDate start_date;
    2828
    29     public Event(String theme, String duration, String repeating, LocalDate start_date) {
    30         this.theme = theme;
    31         this.duration = duration;
    32         this.repeating = repeating;
    33         this.start_date = start_date;
    34     }
    3529}
  • src/main/java/com/example/moviezone/model/Film.java

    r693f587 rade54f6  
    3131    LocalDate end_date;
    3232
    33     public Film(String name, Integer duration, String actors, String genre, String age_category, String url, String director, LocalDate start_date, LocalDate end_date) {
    34         this.name = name;
    35         this.duration = duration;
    36         this.actors = actors;
    37         this.genre = genre;
    38         this.age_category = age_category;
    39         this.url = url;
    40         this.director = director;
    41         this.start_date = start_date;
    42         this.end_date = end_date;
    43     }
     33
    4434}
  • src/main/java/com/example/moviezone/model/Projection.java

    r693f587 rade54f6  
    3333    Discount discount;
    3434
    35     public Projection(LocalDate date_time_start, String type_of_technology, LocalDate date_time_end, Film film) {
    36         this.date_time_start = date_time_start;
    37         this.type_of_technology = type_of_technology;
    38         this.date_time_end = date_time_end;
    39         this.film = film;
    40     }
    4135}
  • src/main/java/com/example/moviezone/service/EventService.java

    r693f587 rade54f6  
    33import com.example.moviezone.model.Event;
    44
    5 import java.time.LocalDate;
    65import java.util.List;
    76
    87public interface EventService {
    98    List<Event> findAllEvents();
    10     Event save(LocalDate start_date,String theme,String duration,String repeating);
     9
    1110}
  • src/main/java/com/example/moviezone/service/FilmService.java

    r693f587 rade54f6  
    33import com.example.moviezone.model.Film;
    44
    5 import java.time.LocalDate;
    65import java.util.List;
    76
    87public interface FilmService {
    98    List<Film> findAllFilms();
    10     Film save(String name, Integer duration, String actors, String genre,
    11               String age_category, String url, String director, LocalDate start_date,LocalDate end_date );
    129}
  • src/main/java/com/example/moviezone/service/Impl/EventServiceImpl.java

    r693f587 rade54f6  
    66import org.springframework.stereotype.Service;
    77
    8 import java.time.LocalDate;
    98import java.util.List;
    109
     
    2120        return eventRepository.findAll();
    2221    }
    23 
    24     @Override
    25     public Event save(LocalDate start_date, String theme, String duration, String repeating) {
    26         return eventRepository.save(new Event(theme,duration,repeating,start_date));
    27     }
    2822}
  • src/main/java/com/example/moviezone/service/Impl/FilmServiceImpl.java

    r693f587 rade54f6  
    66import org.springframework.stereotype.Service;
    77
    8 import java.time.LocalDate;
    98import java.util.List;
    109
     
    2120        return filmRepository.findAll();
    2221    }
    23 
    24     @Override
    25     public Film save(String name, Integer duration, String actors, String genre, String age_category, String url, String director, LocalDate start_date, LocalDate end_date) {
    26         return filmRepository.save(new Film(name,duration,actors,genre,age_category,url,director,start_date,end_date));
    27     }
    2822}
  • src/main/java/com/example/moviezone/service/Impl/ProjectionServiceImpl.java

    r693f587 rade54f6  
    11package com.example.moviezone.service.Impl;
    22
    3 import com.example.moviezone.model.Film;
    43import com.example.moviezone.model.Projection;
    5 import com.example.moviezone.repository.FilmRepository;
    64import com.example.moviezone.repository.ProjectionRepository;
    75import com.example.moviezone.service.ProjectionService;
     
    1412public class ProjectionServiceImpl implements ProjectionService {
    1513    private final ProjectionRepository projectionRepository;
    16     private final FilmRepository filmRepository;
    17     public ProjectionServiceImpl(ProjectionRepository projectionRepository, FilmRepository filmRepository) {
     14
     15    public ProjectionServiceImpl(ProjectionRepository projectionRepository) {
    1816        this.projectionRepository = projectionRepository;
    19         this.filmRepository = filmRepository;
    2017    }
    2118
     
    3027    }
    3128
    32     @Override
    33     public Projection save(LocalDate date_time_start, LocalDate date_time_end, String type_of_technology, Integer id_film) {
    34        Film film=filmRepository.findById(id_film).orElseThrow(RuntimeException::new);
    35         return projectionRepository.save(new Projection(date_time_start,type_of_technology,date_time_end,film));
    36     }
    37 
    3829}
  • src/main/java/com/example/moviezone/service/ProjectionService.java

    r693f587 rade54f6  
    11package com.example.moviezone.service;
    22
    3 import com.example.moviezone.model.Film;
    43import com.example.moviezone.model.Projection;
    54
     
    109    List<Projection> findAllProjections();
    1110List<Projection> findAllAvailableProjections(LocalDate date);
    12 Projection save(LocalDate date_time_start,LocalDate date_time_end, String type_of_technology, Integer id_film );
     11
    1312}
  • src/main/java/com/example/moviezone/web/HomeController.java

    r693f587 rade54f6  
    22
    33
    4 import com.example.moviezone.model.Customer;
    5 import com.example.moviezone.model.Film;
    64import com.example.moviezone.model.User;
    75import com.example.moviezone.model.exceptions.UserNotFoundException;
    8 import com.example.moviezone.service.*;
    9 import org.springframework.format.annotation.DateTimeFormat;
     6import com.example.moviezone.service.EventService;
     7import com.example.moviezone.service.FilmService;
     8import com.example.moviezone.service.ProjectionService;
     9import com.example.moviezone.service.UserService;
    1010import org.springframework.stereotype.Controller;
    1111import org.springframework.ui.Model;
     
    2626private final ProjectionService projectionService;
    2727private final EventService eventService;
    28 private final TicketService ticketService;
    2928
    30     public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService) {
     29    public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService) {
    3130        this.filmService = filmService;
    3231        this.userService = userService;
    3332        this.projectionService = projectionService;
    3433        this.eventService = eventService;
    35         this.ticketService = ticketService;
    3634    }
    3735
    38     @GetMapping({"/","/home"})
     36    @GetMapping
    3937    public String getHomePage(Model model) {
    4038        model.addAttribute("bodyContent", "home");
     
    107105        return "master-template";
    108106    }
    109     @GetMapping("/myTickets")
    110     public  String getMyTicketsPage(Model model,HttpSession session)
    111     {
    112         model.addAttribute("tickets",ticketService.findAllByCustomer((Customer) session.getAttribute("user")));
    113         model.addAttribute("bodyContent","myTickets");
    114         return "master-template";
    115     }
    116     @GetMapping("/addProjection")
    117     public  String getAddProjectionPage(Model model)
    118     {
    119         model.addAttribute("films",filmService.findAllFilms());
    120         model.addAttribute("bodyContent","addProjection");
    121         return "master-template";
    122     }
    123     @GetMapping("/addEvent")
    124     public  String getAddEventPage(Model model)
    125     {
    126         model.addAttribute("bodyContent","addEvent");
    127         return "master-template";
    128     }
    129     @GetMapping("/addFilm")
    130     public  String getAddFilmPage(Model model)
    131     {
    132         model.addAttribute("bodyContent","addFilm");
    133         return "master-template";
    134     }
    135 
    136     @PostMapping("/addP")
    137     public String saveProjection(@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date_time_start,
    138                                  @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date_time_end,
    139                                  @RequestParam String type_of_technology,
    140                                  @RequestParam Integer id_film)
    141     {
    142         projectionService.save(date_time_start,date_time_end,type_of_technology,id_film);
    143          return "redirect:/home";
    144     }
    145     @PostMapping("/addE")
    146     public String saveEvent(@RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate start_date,
    147                                  @RequestParam String theme,
    148                                  @RequestParam String duration,
    149                             @RequestParam String repeating)
    150     {
    151         eventService.save(start_date,theme,duration,repeating);
    152         return "redirect:/home";
    153     }
    154     @PostMapping("/addF")
    155     public String saveFilm(
    156                             @RequestParam String name,
    157                             @RequestParam Integer duration,
    158                             @RequestParam String actors,
    159                            @RequestParam String genre,
    160                            @RequestParam String age_category,
    161                            @RequestParam String url,
    162                            @RequestParam String director,
    163                             @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate start_date,
    164                             @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate end_date
    165                            )
    166     {
    167         filmService.save(name,duration,actors,genre,age_category,url,director,start_date,end_date);
    168         return "redirect:/home";
    169     }
    170107
    171108}
Note: See TracChangeset for help on using the changeset viewer.