Changes in / [f8ef9bd:608fefef]


Ignore:
Location:
src/main
Files:
2 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/config/WebSecurityConfig.java

    rf8ef9bd r608fefef  
    3232        http.csrf().disable()
    3333                .authorizeRequests()
    34                 .antMatchers("/","/home/getFilm/**", "/home", "/assets/**", "/register", "/api/**").permitAll()
     34                .antMatchers("/", "/home", "/assets/**", "/register", "/api/**").permitAll()
    3535                .antMatchers("/admin/**").hasRole("ADMIN")
    3636                .anyRequest()
  • src/main/java/com/example/moviezone/model/Film.java

    rf8ef9bd r608fefef  
    4646
    4747    }
    48 
    49     public Integer getId_film() {
    50         return id_film;
    51     }
    52 
    53     public String getName() {
    54         return name;
    55     }
    56 
    57     public Integer getDuration() {
    58         return duration;
    59     }
    60 
    61     public String getActors() {
    62         return actors;
    63     }
    64 
    65     public String getGenre() {
    66         return genre;
    67     }
    68 
    69     public String getAge_category() {
    70         return age_category;
    71     }
    72 
    73     public String getUrl() {
    74         return url;
    75     }
    76 
    77     public String getDirector() {
    78         return director;
    79     }
    80 
    81     public LocalDate getStart_date() {
    82         return start_date;
    83     }
    84 
    85     public LocalDate getEnd_date() {
    86         return end_date;
    87     }
    8848}
  • src/main/java/com/example/moviezone/model/Projection.java

    rf8ef9bd r608fefef  
    3939        this.film = film;
    4040    }
    41 
    42     public Projection() {
    43     }
    4441}
  • src/main/java/com/example/moviezone/repository/FilmRepository.java

    rf8ef9bd r608fefef  
    33import com.example.moviezone.model.Film;
    44import org.springframework.data.jpa.repository.JpaRepository;
    5 import org.springframework.data.jpa.repository.query.Procedure;
    6 import org.springframework.data.repository.query.Param;
    7 
    8 import java.util.List;
    95
    106public interface FilmRepository extends JpaRepository<Film,Integer> {
    11 
    127}
  • src/main/java/com/example/moviezone/repository/ProjectionRepository.java

    rf8ef9bd r608fefef  
    99public interface ProjectionRepository extends JpaRepository<Projection,Integer> {
    1010    //    NOTE: CHANGE THIS WITH MATERIALIZED VIEW
    11     //List<Projection> findAllBydate_time_startBefore(LocalDate datum);
     11    List<Projection> findAllByDate_time_startBefore(LocalDate datum);
    1212}
  • src/main/java/com/example/moviezone/service/FilmService.java

    rf8ef9bd r608fefef  
    55import java.time.LocalDate;
    66import java.util.List;
    7 import java.util.Optional;
    87
    98public interface FilmService {
     
    1110    Film save(String name, Integer duration, String actors, String genre,
    1211              String age_category, String url, String director, LocalDate start_date,LocalDate end_date);
    13     Optional<Film> getFilmById(Long id);
    1412}
  • src/main/java/com/example/moviezone/service/Impl/FilmServiceImpl.java

    rf8ef9bd r608fefef  
    77
    88import java.time.LocalDate;
    9 import java.util.Collections;
    109import java.util.List;
    11 import java.util.Optional;
    1210
    1311@Service
     
    2826        return filmRepository.save(new Film(name,duration,actors,genre,age_category,url,director,start_date,end_date));
    2927    }
    30 
    31     @Override
    32     public Optional<Film> getFilmById(Long id) {
    33         return filmRepository.findAllById(Collections.singleton(id.intValue())).stream().findFirst();
    34     }
    35 
    3628}
  • src/main/java/com/example/moviezone/service/Impl/ProjectionServiceImpl.java

    rf8ef9bd r608fefef  
    2525    }
    2626
     27    @Override
     28    public List<Projection> findAllAvailableProjections(LocalDate date) {
     29        return projectionRepository.findAllByDate_time_startBefore(date);
     30    }
    2731
    2832    @Override
  • src/main/java/com/example/moviezone/service/ProjectionService.java

    rf8ef9bd r608fefef  
    99public interface ProjectionService {
    1010    List<Projection> findAllProjections();
     11List<Projection> findAllAvailableProjections(LocalDate date);
    1112Projection save(LocalDate date_time_start,LocalDate date_time_end, String type_of_technology, Integer id_film );
    1213}
  • src/main/java/com/example/moviezone/web/HomeController.java

    rf8ef9bd r608fefef  
    33
    44import com.example.moviezone.model.Customer;
    5 import com.example.moviezone.model.Film;
    65import com.example.moviezone.model.User;
    76import com.example.moviezone.model.exceptions.UserNotFoundException;
     
    109import org.springframework.stereotype.Controller;
    1110import org.springframework.ui.Model;
    12 import org.springframework.web.bind.annotation.*;
     11import org.springframework.web.bind.annotation.GetMapping;
     12import org.springframework.web.bind.annotation.PostMapping;
     13import org.springframework.web.bind.annotation.RequestMapping;
     14import org.springframework.web.bind.annotation.RequestParam;
    1315
    1416import javax.servlet.http.HttpSession;
    1517import java.time.LocalDate;
    16 import java.util.List;
    17 import java.util.Optional;
    18 import java.util.stream.Collectors;
    1918
    2019@Controller
    21 @RequestMapping({"/","/home"})
     20@RequestMapping("/")
    2221public class HomeController {
    2322
     
    3837    }
    3938
    40     @GetMapping
     39    @GetMapping({"/","/home"})
    4140    public String getHomePage(Model model) {
    42         List<Film> films=filmService.findAllFilms();
    43         films=films.stream().limit(5).collect(Collectors.toList());
    44         model.addAttribute("films", films);
    4541        model.addAttribute("bodyContent", "home");
    46 
    47         return "master-template";
    48     }
    49     @GetMapping("/getFilm/{id}")
    50     public String getFilm(@PathVariable Long id, Model model) {
    51         Optional<Film> film=filmService.getFilmById(id);
    52         model.addAttribute("film", film);
    53         model.addAttribute("bodyContent", "home");
    54 
    5542        return "master-template";
    5643    }
     
    11097    public String getProjectionsPage(Model model)
    11198    {
    112         model.addAttribute("projections",projectionService.findAllProjections());
     99        model.addAttribute("projections",projectionService.findAllAvailableProjections(LocalDate.now()));
    113100        model.addAttribute("bodyContent","projections");
    114101        return "master-template";
  • src/main/resources/templates/fragments/header.html

    rf8ef9bd r608fefef  
    5858</style>
    5959<body>
    60 <div style="width: 100%">
    6160<nav class="menu">
    6261    <ul class="menu-left">
     
    7170        <li class="reg"><a href="#!">Регистрација</a></li>
    7271    </ul>
    73 </nav></div>
     72</nav>
    7473</body>
    7574</html>
  • src/main/resources/templates/master-template.html

    rf8ef9bd r608fefef  
    33<head>
    44    <meta charset="UTF-8"/>
    5 
    6     <title>MovieZone</title>
    7 
     5    <title>Products</title>
    86    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    97    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
     
    1917
    2018<footer th:replace="fragments/footer"/>
    21 
    2219</body>
    2320</html>
Note: See TracChangeset for help on using the changeset viewer.