From 8b5d73a5ddc180834efbd8e979e9300c73a1de9e Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Sat, 25 Jul 2020 09:58:40 +0200 Subject: [PATCH] Added enums --- .../java/com/plannaplan/entities/Groups.java | 21 +++++++++++++++++++ .../java/com/plannaplan/types/GroupType.java | 5 +++++ .../java/com/plannaplan/types/WeekDay.java | 11 ++++++++++ .../src/main/resources/application.properties | 2 +- 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 buisnesslogic/src/main/java/com/plannaplan/types/GroupType.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/types/WeekDay.java diff --git a/buisnesslogic/src/main/java/com/plannaplan/entities/Groups.java b/buisnesslogic/src/main/java/com/plannaplan/entities/Groups.java index c617b23..4f1aa7d 100644 --- a/buisnesslogic/src/main/java/com/plannaplan/entities/Groups.java +++ b/buisnesslogic/src/main/java/com/plannaplan/entities/Groups.java @@ -5,6 +5,9 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import com.plannaplan.types.GroupType; +import com.plannaplan.types.WeekDay; + @Entity public class Groups { @Id @@ -14,10 +17,28 @@ public class Groups { private int time; private String room; private int capacity; + private GroupType type; + private WeekDay day; public Groups() { } + public WeekDay getDay() { + return day; + } + + public void setDay(WeekDay day) { + this.day = day; + } + + public GroupType getType() { + return type; + } + + public void setType(GroupType type) { + this.type = type; + } + public int getCapacity() { return capacity; } diff --git a/buisnesslogic/src/main/java/com/plannaplan/types/GroupType.java b/buisnesslogic/src/main/java/com/plannaplan/types/GroupType.java new file mode 100644 index 0000000..ef537a3 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/types/GroupType.java @@ -0,0 +1,5 @@ +package com.plannaplan.types; + +public enum GroupType { + LECTURE, CLASS +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/types/WeekDay.java b/buisnesslogic/src/main/java/com/plannaplan/types/WeekDay.java new file mode 100644 index 0000000..bee55b2 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/types/WeekDay.java @@ -0,0 +1,11 @@ +package com.plannaplan.types; + +public enum WeekDay { + MONDAY(1), TUESDAY(2), WEDNESDAY(3), THURSDAY(4), FRIDAY(5), SATURDAY(6), SUNDAY(7); + + public final int label; + + private WeekDay(int label) { + this.label = label; + } +} \ No newline at end of file diff --git a/restservice/src/main/resources/application.properties b/restservice/src/main/resources/application.properties index ea42903..d7a0cf8 100644 --- a/restservice/src/main/resources/application.properties +++ b/restservice/src/main/resources/application.properties @@ -1,5 +1,5 @@ spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect -spring.datasource.url=jdbc:mysql://172.20.0.3:3306/test?useUnicode=yes&characterEncoding=UTF-8 +spring.datasource.url=jdbc:mysql://172.20.0.2:3306/test?useUnicode=yes&characterEncoding=UTF-8 spring.datasource.username=root spring.datasource.password=example spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver