From b730782c949a8b17e4683cafba80f27c03050d15 Mon Sep 17 00:00:00 2001 From: Darsh Nair Date: Sat, 6 Aug 2022 23:35:59 +0530 Subject: [PATCH 1/2] 2022.08.07-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index db73597..9203b13 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.nms nms - 2022.08.05-SNAPSHOT + 2022.08.07-SNAPSHOT nms nms From 8dd3e8c066f61442d7854455dee8a68d63737042 Mon Sep 17 00:00:00 2001 From: labuser Date: Mon, 8 Aug 2022 05:45:24 +0000 Subject: [PATCH 2/2] Model classes added --- src/main/java/com/nms/bo/Movie.java | 130 ++++++++++++++++ src/main/java/com/nms/bo/Payment.java | 93 ++++++++++++ src/main/java/com/nms/bo/Screening.java | 132 ++++++++++++++++ src/main/java/com/nms/bo/Seat.java | 67 +++++++++ src/main/java/com/nms/bo/Theater.java | 129 ++++++++++++++++ src/main/java/com/nms/bo/TicketBooking.java | 158 ++++++++++++++++++++ src/main/java/com/nms/bo/User.java | 145 ++++++++++++++++++ 7 files changed, 854 insertions(+) create mode 100644 src/main/java/com/nms/bo/Movie.java create mode 100644 src/main/java/com/nms/bo/Payment.java create mode 100644 src/main/java/com/nms/bo/Screening.java create mode 100644 src/main/java/com/nms/bo/Seat.java create mode 100644 src/main/java/com/nms/bo/Theater.java create mode 100644 src/main/java/com/nms/bo/TicketBooking.java create mode 100644 src/main/java/com/nms/bo/User.java diff --git a/src/main/java/com/nms/bo/Movie.java b/src/main/java/com/nms/bo/Movie.java new file mode 100644 index 0000000..d1201f2 --- /dev/null +++ b/src/main/java/com/nms/bo/Movie.java @@ -0,0 +1,130 @@ +package com.nms.bo; + +import java.util.Date; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "MOVIE") +public class Movie { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "MOVIE_ID") + protected int movieID; + + @Column(name="MOVIE_NM") + protected String movieName; + + protected String duration; + + @Column(name="DATE_OF_BOOKING") + protected Date dateofbooking; + + protected String show; + + @Column(name="NUMBER_OF_TICKETS") + protected int nooftickets; + + @OneToMany(mappedBy = "movie", cascade = CascadeType.ALL) + protected Set screening; + + @ManyToOne + @JoinColumn(name="THEATER_ID", nullable = false) + protected Theater theater; + + public Movie(int movieID, String movieName, String duration, Date dateofbooking, String show, int nooftickets, + Set screening, Theater theater) { + super(); + this.movieID = movieID; + this.movieName = movieName; + this.duration = duration; + this.dateofbooking = dateofbooking; + this.show = show; + this.nooftickets = nooftickets; + this.screening = screening; + this.theater = theater; + } + + public int getMovieID() { + return movieID; + } + + public void setMovieID(int movieID) { + this.movieID = movieID; + } + + public String getMovieName() { + return movieName; + } + + public void setMovieName(String movieName) { + this.movieName = movieName; + } + + public String getDuration() { + return duration; + } + + public void setDuration(String duration) { + this.duration = duration; + } + + public Date getDateofbooking() { + return dateofbooking; + } + + public void setDateofbooking(Date dateofbooking) { + this.dateofbooking = dateofbooking; + } + + public String getShow() { + return show; + } + + public void setShow(String show) { + this.show = show; + } + + public int getNooftickets() { + return nooftickets; + } + + public void setNooftickets(int nooftickets) { + this.nooftickets = nooftickets; + } + + public Set getScreening() { + return screening; + } + + public void setScreening(Set screening) { + this.screening = screening; + } + + public Theater getTheater() { + return theater; + } + + public void setTheater(Theater theater) { + this.theater = theater; + } + + @Override + public String toString() { + return "Movie [movieID=" + movieID + ", movieName=" + movieName + ", duration=" + duration + ", dateofbooking=" + + dateofbooking + ", show=" + show + ", nooftickets=" + nooftickets + ", screening=" + screening + + ", theater=" + theater + "]"; + } + +} diff --git a/src/main/java/com/nms/bo/Payment.java b/src/main/java/com/nms/bo/Payment.java new file mode 100644 index 0000000..5013a41 --- /dev/null +++ b/src/main/java/com/nms/bo/Payment.java @@ -0,0 +1,93 @@ +package com.nms.bo; + +import java.time.LocalDate; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="PAYMENT") +public class Payment { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "PAYMENT_ID") + protected int paymentid; + + @Column(name = "PAY_AMOUNT") + protected float payamount; + + @Column(name = "PAY_DESC") + protected String paydescription; + + @Column(name = "PAY_DATE") + protected LocalDate paydate; + + @ManyToOne + @JoinColumn(name="USER_ID", nullable = false) + protected User user; + + public Payment(int paymentid, float payamount, String paydescription, LocalDate paydate, User user) { + super(); + this.paymentid = paymentid; + this.payamount = payamount; + this.paydescription = paydescription; + this.paydate = paydate; + this.user = user; + } + + public int getPaymentid() { + return paymentid; + } + + public void setPaymentid(int paymentid) { + this.paymentid = paymentid; + } + + public float getPayamount() { + return payamount; + } + + public void setPayamount(float payamount) { + this.payamount = payamount; + } + + public String getPaydescription() { + return paydescription; + } + + public void setPaydescription(String paydescription) { + this.paydescription = paydescription; + } + + public LocalDate getPaydate() { + return paydate; + } + + public void setPaydate(LocalDate paydate) { + this.paydate = paydate; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + @Override + public String toString() { + return "Payment [paymentid=" + paymentid + ", payamount=" + payamount + ", paydescription=" + paydescription + + ", paydate=" + paydate + ", user=" + user + "]"; + } + + + +} diff --git a/src/main/java/com/nms/bo/Screening.java b/src/main/java/com/nms/bo/Screening.java new file mode 100644 index 0000000..a9acf96 --- /dev/null +++ b/src/main/java/com/nms/bo/Screening.java @@ -0,0 +1,132 @@ +package com.nms.bo; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name="SCREENING") +public class Screening { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "SCREEN_ID") + protected int screenid; + + protected LocalDate date; + + @Column(name = "SHOW_STARTTIME") + protected LocalTime showstartTime; + + @Column(name="SHOW_ENDTIME") + protected LocalTime showendtime; + + @Column(name="IS_FULL") + protected boolean isfull; + + protected double price; + + @ManyToOne + @JoinColumn(name="MOVIE_ID", nullable = false) + protected Movie movie; + + @OneToMany(mappedBy = "screening", cascade = CascadeType.ALL) + protected Set bookings; + + public Screening(int screenid, LocalDate date, LocalTime showstartTime, LocalTime showendtime, boolean isfull, + double price, Movie movie, Set bookings) { + super(); + this.screenid = screenid; + this.date = date; + this.showstartTime = showstartTime; + this.showendtime = showendtime; + this.isfull = isfull; + this.price = price; + this.movie = movie; + this.bookings = bookings; + } + + public int getScreenid() { + return screenid; + } + + public void setScreenid(int screenid) { + this.screenid = screenid; + } + + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + + public LocalTime getShowstartTime() { + return showstartTime; + } + + public void setShowstartTime(LocalTime showstartTime) { + this.showstartTime = showstartTime; + } + + public LocalTime getShowendtime() { + return showendtime; + } + + public void setShowendtime(LocalTime showendtime) { + this.showendtime = showendtime; + } + + public boolean isIsfull() { + return isfull; + } + + public void setIsfull(boolean isfull) { + this.isfull = isfull; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + + public Movie getMovie() { + return movie; + } + + public void setMovie(Movie movie) { + this.movie = movie; + } + + public Set getBookings() { + return bookings; + } + + public void setBookings(Set bookings) { + this.bookings = bookings; + } + + @Override + public String toString() { + return "Screening [screenid=" + screenid + ", date=" + date + ", showstartTime=" + showstartTime + + ", showendtime=" + showendtime + ", isfull=" + isfull + ", price=" + price + ", movie=" + movie + + ", bookings=" + bookings + "]"; + } + + +} diff --git a/src/main/java/com/nms/bo/Seat.java b/src/main/java/com/nms/bo/Seat.java new file mode 100644 index 0000000..77f7353 --- /dev/null +++ b/src/main/java/com/nms/bo/Seat.java @@ -0,0 +1,67 @@ +package com.nms.bo; + +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "SEAT") +public class Seat { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "SEAT_ID") + protected int seatid; + + @Column(name="SEAT_NUMBER") + protected String seatnumber; + + @OneToMany(mappedBy = "seat", cascade = CascadeType.ALL) + protected Set ticketbooking; + + public Seat(int seatid, String seatnumber, Set ticketbooking) { + super(); + this.seatid = seatid; + this.seatnumber = seatnumber; + this.ticketbooking = ticketbooking; + } + + public int getSeatid() { + return seatid; + } + + public void setSeatid(int seatid) { + this.seatid = seatid; + } + + public String getSeatnumber() { + return seatnumber; + } + + public void setSeatnumber(String seatnumber) { + this.seatnumber = seatnumber; + } + + public Set getTicketbooking() { + return ticketbooking; + } + + public void setTicketbooking(Set ticketbooking) { + this.ticketbooking = ticketbooking; + } + + @Override + public String toString() { + return "Seat [seatid=" + seatid + ", seatnumber=" + seatnumber + ", ticketbooking=" + ticketbooking + "]"; + } + + + +} diff --git a/src/main/java/com/nms/bo/Theater.java b/src/main/java/com/nms/bo/Theater.java new file mode 100644 index 0000000..174dca4 --- /dev/null +++ b/src/main/java/com/nms/bo/Theater.java @@ -0,0 +1,129 @@ +package com.nms.bo; + +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name="THEATER") +public class Theater { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "THEATER_ID") + protected int tid; + + @Column(name="THEATER_NAME") + protected String tname; + + @Column(name="THEATER_ADDRESS") + protected String taddress; + + @Column(name = "THEATER_MANAGER") + protected String tmanager; + + @Column(name="THEATER_SIZE") + protected String tsize; + + @Column(name="THEATER_COST") + protected float tcost; + + @Column(name = "THEATER_TYPE") + protected String ttype; + + @OneToMany(mappedBy = "theater", cascade = CascadeType.ALL) + protected Set movies; + + public Theater(int tid, String tname, String taddress, String tmanager, String tsize, float tcost, String ttype, + Set movies) { + super(); + this.tid = tid; + this.tname = tname; + this.taddress = taddress; + this.tmanager = tmanager; + this.tsize = tsize; + this.tcost = tcost; + this.ttype = ttype; + this.movies = movies; + } + + public int getTid() { + return tid; + } + + public void setTid(int tid) { + this.tid = tid; + } + + public String getTname() { + return tname; + } + + public void setTname(String tname) { + this.tname = tname; + } + + public String getTaddress() { + return taddress; + } + + public void setTaddress(String taddress) { + this.taddress = taddress; + } + + public String getTmanager() { + return tmanager; + } + + public void setTmanager(String tmanager) { + this.tmanager = tmanager; + } + + public String getTsize() { + return tsize; + } + + public void setTsize(String tsize) { + this.tsize = tsize; + } + + public float getTcost() { + return tcost; + } + + public void setTcost(float tcost) { + this.tcost = tcost; + } + + public String getTtype() { + return ttype; + } + + public void setTtype(String ttype) { + this.ttype = ttype; + } + + public Set getMovies() { + return movies; + } + + public void setMovies(Set movies) { + this.movies = movies; + } + + @Override + public String toString() { + return "Theater [tid=" + tid + ", tname=" + tname + ", taddress=" + taddress + ", tmanager=" + tmanager + + ", tsize=" + tsize + ", tcost=" + tcost + ", ttype=" + ttype + ", movies=" + movies + "]"; + } + + + +} diff --git a/src/main/java/com/nms/bo/TicketBooking.java b/src/main/java/com/nms/bo/TicketBooking.java new file mode 100644 index 0000000..647b056 --- /dev/null +++ b/src/main/java/com/nms/bo/TicketBooking.java @@ -0,0 +1,158 @@ +package com.nms.bo; + +import java.time.LocalTime; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name="TICKET_BOOKING") +public class TicketBooking { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="BOOKING_ID") + protected int bookId; + + @Column(name="USER_NAME") + protected String uname; + + @Column(name = "TICKET_NM") + protected String tname; + + @Column(name="SHOW_DATE") + protected Date showdate; + + @Column(name="SHOW_TIME") + protected LocalTime showtime; + + @Column(name="NUMBER_OF_TICKETS") + protected int nooftickets; + + protected float price; + + @ManyToOne + @JoinColumn(name="USER_ID", nullable = false) + protected User user; + + @ManyToOne + @JoinColumn(name="SCREEN_ID", nullable = false) + protected Screening screening; + + @ManyToOne + @JoinColumn(name="SEAT_ID", nullable = false) + protected Seat seat; + + public TicketBooking(int bookId, String uname, String tname, Date showdate, LocalTime showtime, int nooftickets, + float price, User user, Screening screening, Seat seat) { + super(); + this.bookId = bookId; + this.uname = uname; + this.tname = tname; + this.showdate = showdate; + this.showtime = showtime; + this.nooftickets = nooftickets; + this.price = price; + this.user = user; + this.screening = screening; + this.seat = seat; + } + + public int getBookId() { + return bookId; + } + + public void setBookId(int bookId) { + this.bookId = bookId; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public String getTname() { + return tname; + } + + public void setTname(String tname) { + this.tname = tname; + } + + public Date getShowdate() { + return showdate; + } + + public void setShowdate(Date showdate) { + this.showdate = showdate; + } + + public LocalTime getShowtime() { + return showtime; + } + + public void setShowtime(LocalTime showtime) { + this.showtime = showtime; + } + + public int getNooftickets() { + return nooftickets; + } + + public void setNooftickets(int nooftickets) { + this.nooftickets = nooftickets; + } + + public float getPrice() { + return price; + } + + public void setPrice(float price) { + this.price = price; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + + public Screening getScreening() { + return screening; + } + + public void setScreening(Screening screening) { + this.screening = screening; + } + + public Seat getSeat() { + return seat; + } + + public void setSeat(Seat seat) { + this.seat = seat; + } + + @Override + public String toString() { + return "TicketBooking [bookId=" + bookId + ", uname=" + uname + ", tname=" + tname + ", showdate=" + showdate + + ", showtime=" + showtime + ", nooftickets=" + nooftickets + ", price=" + price + ", user=" + user + + ", screening=" + screening + ", seat=" + seat + "]"; + } + + + +} diff --git a/src/main/java/com/nms/bo/User.java b/src/main/java/com/nms/bo/User.java new file mode 100644 index 0000000..912406a --- /dev/null +++ b/src/main/java/com/nms/bo/User.java @@ -0,0 +1,145 @@ +package com.nms.bo; + +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + + +@Entity +@Table(name="USER") +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name="USER_ID") + protected int uid; + + @Column(name="USER_NAME") + protected String uname; + + protected String password; + + protected String gender; + + @Column(name="PH_NO") + protected int phno; + + @Column(name="EMAIL_ID") + protected String emailId; + + protected int age; + + @OneToMany(mappedBy = "user", cascade = CascadeType.ALL) + protected Set bookings; + + @OneToMany(mappedBy = "user", cascade = CascadeType.ALL) + protected Set payment; + + public User(int uid, String uname, String password, String gender, int phno, String emailId, int age, + Set bookings, Set payment) { + super(); + this.uid = uid; + this.uname = uname; + this.password = password; + this.gender = gender; + this.phno = phno; + this.emailId = emailId; + this.age = age; + this.bookings = bookings; + this.payment = payment; + } + + public int getUid() { + return uid; + } + + public void setUid(int uid) { + this.uid = uid; + } + + public String getUname() { + return uname; + } + + public void setUname(String uname) { + this.uname = uname; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getGender() { + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public int getPhno() { + return phno; + } + + public void setPhno(int phno) { + this.phno = phno; + } + + public String getEmailId() { + return emailId; + } + + public void setEmailId(String emailId) { + this.emailId = emailId; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public Set getBookings() { + return bookings; + } + + public void setBookings(Set bookings) { + this.bookings = bookings; + } + + public Set getPayment() { + return payment; + } + + public void setPayment(Set payment) { + this.payment = payment; + } + + @Override + public String toString() { + return "User [uid=" + uid + ", uname=" + uname + ", password=" + password + ", gender=" + gender + ", phno=" + + phno + ", emailId=" + emailId + ", age=" + age + ", bookings=" + bookings + ", payment=" + payment + + "]"; + } + + + + + + + + +}