From ed1ca387a2fcc29823a94b6683d123e6dc3717a6 Mon Sep 17 00:00:00 2001 From: sugan0tech Date: Thu, 21 Mar 2024 13:45:10 +0530 Subject: [PATCH] event slot addition --- .../ac/skcet/event_manager/event/Event.java | 1 + .../event_manager/event/EventCmdToEvent.java | 1 + .../event_manager/event/EventCommand.java | 1 + .../skcet/event_manager/event/Location.java | 27 +++++++++++++++++++ .../event_manager/on_duty/OnDutyForm.java | 1 + 5 files changed, 31 insertions(+) create mode 100644 src/main/java/in/ac/skcet/event_manager/event/Location.java diff --git a/src/main/java/in/ac/skcet/event_manager/event/Event.java b/src/main/java/in/ac/skcet/event_manager/event/Event.java index f6a23eb..aab52e3 100644 --- a/src/main/java/in/ac/skcet/event_manager/event/Event.java +++ b/src/main/java/in/ac/skcet/event_manager/event/Event.java @@ -18,6 +18,7 @@ public class Event { private Integer eventId; private String title; private String description; + private Location location = Location.DEFAULT; private Date fromDate; private Date endDate; private String classCode; diff --git a/src/main/java/in/ac/skcet/event_manager/event/EventCmdToEvent.java b/src/main/java/in/ac/skcet/event_manager/event/EventCmdToEvent.java index e4feafa..eb00a64 100644 --- a/src/main/java/in/ac/skcet/event_manager/event/EventCmdToEvent.java +++ b/src/main/java/in/ac/skcet/event_manager/event/EventCmdToEvent.java @@ -29,6 +29,7 @@ public Event convert(EventCommand eventCommand) { .title(eventCommand.getTitle()) .classCode(eventCommand.getClassCode()) .description(eventCommand.getDescription()) + .location(eventCommand.getLocation()) .fromDate(fromDate) .endDate(endDate).build(); } catch (ParseException e) { diff --git a/src/main/java/in/ac/skcet/event_manager/event/EventCommand.java b/src/main/java/in/ac/skcet/event_manager/event/EventCommand.java index 505ff5c..dbeb479 100644 --- a/src/main/java/in/ac/skcet/event_manager/event/EventCommand.java +++ b/src/main/java/in/ac/skcet/event_manager/event/EventCommand.java @@ -12,6 +12,7 @@ public class EventCommand { private String title; private String description; private String classCode; + private Location location; private String fromDate; private String endDate; diff --git a/src/main/java/in/ac/skcet/event_manager/event/Location.java b/src/main/java/in/ac/skcet/event_manager/event/Location.java new file mode 100644 index 0000000..6784979 --- /dev/null +++ b/src/main/java/in/ac/skcet/event_manager/event/Location.java @@ -0,0 +1,27 @@ +package in.ac.skcet.event_manager.event; + +public enum Location { + EXTERNAL, + REMOTE, + KRISHNA_HALL, + BS01, + BS02, + BS03, + BS04, + SEMINAR_HALL, + CONFERENCE_HALL, + JB_LAB, + AK_LAB; + + // Default value + public static final Location DEFAULT = EXTERNAL; + + public static Location fromString(String text) { + for (Location location : Location.values()) { + if (location.name().equalsIgnoreCase(text)) { + return location; + } + } + return null; + } +} diff --git a/src/main/java/in/ac/skcet/event_manager/on_duty/OnDutyForm.java b/src/main/java/in/ac/skcet/event_manager/on_duty/OnDutyForm.java index b1c87d7..fda0fd7 100644 --- a/src/main/java/in/ac/skcet/event_manager/on_duty/OnDutyForm.java +++ b/src/main/java/in/ac/skcet/event_manager/on_duty/OnDutyForm.java @@ -1,5 +1,6 @@ package in.ac.skcet.event_manager.on_duty; +import in.ac.skcet.event_manager.event.Event; import lombok.*; import org.bson.types.Binary; import org.springframework.data.mongodb.core.mapping.Document;