From 307c0b59eb21facb490870840ed2fd248cf00d2f Mon Sep 17 00:00:00 2001 From: flifloo Date: Mon, 14 Dec 2020 12:05:24 +0100 Subject: [PATCH] Init DB table class --- build.gradle | 1 + src/main/java/DB/Competition.java | 78 +++++++++++++++++++++++++++++++ src/main/java/DB/Movie.java | 44 +++++++++++++++++ src/main/java/DB/Projection.java | 40 ++++++++++++++++ src/main/java/DB/Room.java | 44 +++++++++++++++++ src/main/java/DB/Slot.java | 42 +++++++++++++++++ src/main/java/DB/Table.java | 7 +++ src/main/java/DB/User.java | 46 ++++++++++++++++++ src/main/java/DB/UserType.java | 36 ++++++++++++++ 9 files changed, 338 insertions(+) create mode 100644 src/main/java/DB/Competition.java create mode 100644 src/main/java/DB/Movie.java create mode 100644 src/main/java/DB/Projection.java create mode 100644 src/main/java/DB/Room.java create mode 100644 src/main/java/DB/Slot.java create mode 100644 src/main/java/DB/Table.java create mode 100644 src/main/java/DB/User.java create mode 100644 src/main/java/DB/UserType.java diff --git a/build.gradle b/build.gradle index a643e53..5898818 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,7 @@ repositories { } dependencies { + implementation 'org.projectlombok:lombok:1.18.16' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' } diff --git a/src/main/java/DB/Competition.java b/src/main/java/DB/Competition.java new file mode 100644 index 0000000..43ba3bd --- /dev/null +++ b/src/main/java/DB/Competition.java @@ -0,0 +1,78 @@ +package DB; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; + +/** + * # Competition + *

+ * ## name + *

+ * The event name + *

+ * ## days + *

+ * The number of days a competition is planned + *

+ * ## movies + *

+ * The number of movies per day + *

+ * ## movieMax + *

+ * The maximum number of different movies projected + */ +public class Competition implements Table { + @Getter @Setter private String name; + @Getter @Setter private int days; + @Getter @Setter private int movies; + @Getter @Setter private int movieMax; + + public Competition() { + } + + static public ArrayList getAll() { + return null; + } + + static public ArrayList getAvailable() { + return null; + } + + public ArrayList getUsers() { + return null; + } + + public ArrayList getSlots() { + return null; + } + + public ArrayList getRooms() { + return null; + } + + public ArrayList getProjections() { + return null; + } + + public ArrayList getTableMovies() { + return null; + } + + @Override + public boolean save() { + return false; + } + + @Override + public boolean update() { + return false; + } + + @Override + public boolean delete() { + return false; + } +} diff --git a/src/main/java/DB/Movie.java b/src/main/java/DB/Movie.java new file mode 100644 index 0000000..16b030a --- /dev/null +++ b/src/main/java/DB/Movie.java @@ -0,0 +1,44 @@ +package DB; + +import lombok.Getter; +import lombok.Setter; + +import java.time.Duration; +import java.util.ArrayList; + +public class Movie implements Table { + @Getter @Setter private String name; + @Getter @Setter private User director; + @Getter @Setter private Duration duration; + @Getter @Setter private Competition competition; + + public Movie() { + } + + static public ArrayList getAll() { + return null; + } + + static public ArrayList getAvailable(Competition competition) { + return null; + } + + public ArrayList getProjections() { + return null; + } + + @Override + public boolean save() { + return false; + } + + @Override + public boolean update() { + return false; + } + + @Override + public boolean delete() { + return false; + } +} diff --git a/src/main/java/DB/Projection.java b/src/main/java/DB/Projection.java new file mode 100644 index 0000000..a41cc62 --- /dev/null +++ b/src/main/java/DB/Projection.java @@ -0,0 +1,40 @@ +package DB; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; +import java.util.Date; + +public class Projection implements Table { + @Getter @Setter private Date startDate; + @Getter @Setter private Competition competition; + @Getter @Setter private Room room; + @Setter @Getter private Movie movie; + + public Projection() { + } + + static public ArrayList getAll() { + return null; + } + + static public ArrayList getAvailable(Competition competition) { + return null; + } + + @Override + public boolean save() { + return false; + } + + @Override + public boolean update() { + return false; + } + + @Override + public boolean delete() { + return false; + } +} diff --git a/src/main/java/DB/Room.java b/src/main/java/DB/Room.java new file mode 100644 index 0000000..3f4d0db --- /dev/null +++ b/src/main/java/DB/Room.java @@ -0,0 +1,44 @@ +package DB; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; + +public class Room implements Table { + @Getter @Setter private int places; + + public Room() { + } + + static public ArrayList getAll() { + return null; + } + + static public ArrayList getAvailable(Movie movie, Slot slot) { + return null; + } + + public ArrayList getCompetitions() { + return null; + } + + public ArrayList getProjections() { + return null; + } + + @Override + public boolean save() { + return false; + } + + @Override + public boolean update() { + return false; + } + + @Override + public boolean delete() { + return false; + } +} diff --git a/src/main/java/DB/Slot.java b/src/main/java/DB/Slot.java new file mode 100644 index 0000000..0e26caa --- /dev/null +++ b/src/main/java/DB/Slot.java @@ -0,0 +1,42 @@ +package DB; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; +import java.util.Date; + +public class Slot implements Table { + @Getter @Setter private Date startTime; + @Getter @Setter private Competition competition; + + public Slot() { + } + + static public ArrayList getAll() { + return null; + } + + static public ArrayList getAvailable(Movie movie) { + return null; + } + + static public ArrayList getAvailable(Competition competition) { + return null; + } + + @Override + public boolean save() { + return false; + } + + @Override + public boolean update() { + return false; + } + + @Override + public boolean delete() { + return false; + } +} diff --git a/src/main/java/DB/Table.java b/src/main/java/DB/Table.java new file mode 100644 index 0000000..250ba7f --- /dev/null +++ b/src/main/java/DB/Table.java @@ -0,0 +1,7 @@ +package DB; + +public interface Table { + public boolean save(); + public boolean update(); + public boolean delete(); +} diff --git a/src/main/java/DB/User.java b/src/main/java/DB/User.java new file mode 100644 index 0000000..83b6f77 --- /dev/null +++ b/src/main/java/DB/User.java @@ -0,0 +1,46 @@ +package DB; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; + +public class User implements Table { + @Getter @Setter private String firstName; + @Getter @Setter private String lastName; + @Getter @Setter private String phoneNumber; + @Getter @Setter private String email; + @Getter @Setter private UserType type; + @Getter @Setter private Competition competition; + private String passwordHash; + + public User() { + } + + public String getPassword() { + return null; + } + + public boolean setPassword(String password) { + return false; + } + + static public ArrayList getAll() { + return null; + } + + @Override + public boolean save() { + return false; + } + + @Override + public boolean update() { + return false; + } + + @Override + public boolean delete() { + return false; + } +} diff --git a/src/main/java/DB/UserType.java b/src/main/java/DB/UserType.java new file mode 100644 index 0000000..6c68035 --- /dev/null +++ b/src/main/java/DB/UserType.java @@ -0,0 +1,36 @@ +package DB; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; + +public class UserType implements Table { + @Getter @Setter private String name; + + public UserType() { + } + + static public ArrayList getAll() { + return null; + } + + public ArrayList getUsers() { + return null; + } + + @Override + public boolean save() { + return false; + } + + @Override + public boolean update() { + return false; + } + + @Override + public boolean delete() { + return false; + } +}