Changeset 7a0bf79 in Git for src/main/java/com/wediscussmovies/project/model
- Timestamp:
- 01/16/22 03:40:31 (3 years ago)
- Branches:
- main
- Children:
- 2a5d6a3
- Parents:
- 839f96a
- Location:
- src/main/java/com/wediscussmovies/project/model
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/wediscussmovies/project/model/Discussion.java
r839f96a r7a0bf79 1 1 package com.wediscussmovies.project.model; 2 3 import lombok.Data; 2 4 3 5 import javax.persistence.*; … … 5 7 import java.util.List; 6 8 9 @Data 7 10 @Entity 8 11 public class Discussion { -
src/main/java/com/wediscussmovies/project/model/Genre.java
r839f96a r7a0bf79 1 1 package com.wediscussmovies.project.model; 2 3 import lombok.Data; 2 4 3 5 import javax.persistence.Column; … … 6 8 import javax.persistence.Id; 7 9 10 @Data 8 11 @Entity(name="genres") 9 12 public class Genre { … … 15 18 @Column(name="genre_type", length = 100, nullable = false, unique = true) 16 19 private String genre_type; 20 21 public Genre(String genreName) { 22 this.genre_type = genreName; 23 } 24 25 public Genre() { 26 } 17 27 } 18 28 -
src/main/java/com/wediscussmovies/project/model/Movie.java
r839f96a r7a0bf79 1 1 package com.wediscussmovies.project.model; 2 3 import lombok.Data; 2 4 3 5 import javax.persistence.*; 4 6 import java.sql.Date; 7 import java.util.Comparator; 5 8 import java.util.List; 6 9 @Data 7 10 @Entity(name="movies") 8 11 public class Movie { … … 36 39 @ManyToMany(mappedBy = "movie_genres") 37 40 private List<Genre> genres; 41 42 public boolean isFromGenre(Genre genre){ 43 for(Genre g: genres){ 44 if(g.getGenre_id() == genre.getGenre_id()) 45 return true; 46 } 47 return false; 48 } 49 public boolean hasActor(Person p){ 50 for(Person person: actors){ 51 if(person.getPerson_id() == p.getPerson_id()) 52 return true; 53 } 54 return false; 55 } 56 57 public boolean isDirectedBy(Person p){ 58 return director.getPerson_id() == p.getPerson_id(); 59 } 60 61 public static Comparator<Movie> comparatorTitle = Comparator.comparing(Movie::getTitle); 62 63 public Movie(String title, String description, String image_url, Date airing_date, float imdb_rating, Person director, List<Person> actors, List<Genre> genres) { 64 Title = title; 65 this.description = description; 66 this.image_url = image_url; 67 this.airing_date = airing_date; 68 this.imdb_rating = imdb_rating; 69 this.director = director; 70 this.actors = actors; 71 this.genres = genres; 72 } 38 73 } 39 74 -
src/main/java/com/wediscussmovies/project/model/Person.java
r839f96a r7a0bf79 1 1 package com.wediscussmovies.project.model; 2 3 import lombok.Data; 2 4 3 5 import javax.persistence.*; … … 5 7 import java.util.List; 6 8 9 @Data 7 10 @Entity(name="persons") 8 11 public class Person { -
src/main/java/com/wediscussmovies/project/model/Reply.java
r839f96a r7a0bf79 1 1 package com.wediscussmovies.project.model; 2 3 import lombok.Data; 2 4 3 5 import javax.persistence.*; 4 6 import java.sql.Date; 5 7 8 @Data 6 9 @Entity(name="replies") 7 10 public class Reply { -
src/main/java/com/wediscussmovies/project/model/User.java
r839f96a r7a0bf79 1 1 package com.wediscussmovies.project.model; 2 3 import lombok.Data; 2 4 3 5 import javax.persistence.*; 4 6 import java.util.List; 5 7 8 @Data 6 9 @Entity(name="users") 7 10 public class User {
Note:
See TracChangeset
for help on using the changeset viewer.