diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 87616b2..0158f0a 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -1,14 +1,18 @@ -import course_creation_use_case.*; -//import course_enrolment_use_case.CourseEnrolmentDsGateway; -import course_enrolment_use_case.CourseEnrolmentInputBoundary; -import course_enrolment_use_case.CourseEnrolmentInteractor; -import course_enrolment_use_case.CourseEnrolmentOutputBoundary; import entities.*; -import event_creation_screens.*; -import event_creation_use_case.*; -import progress_tracker_use_case.*; import screens.*; -import user_register_usecase.*; +import screens.calendar_scheduler.*; +import screens.course_progress.*; +import screens.courses_features.*; +import screens.login_registration.*; +import screens.task_management.event_creation_screens.*; +import use_cases.course_features.course_creation_use_case.*; +import use_cases.course_tracker.progress_tracker_use_case.*; +import screens.collaborative_task_scheduling.*; +import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.*; +import use_cases.calendar_scheduler.schedule_conflict_use_case.ScheduleConflictPresenter; +import use_cases.calendar_scheduler.scheduler_use_case.SchedulerPresenter; +import use_cases.login_registration.user_register_usecase.*; +import use_cases.task_management.event_creation_use_case.*; import javax.swing.*; import java.awt.*; @@ -39,31 +43,31 @@ public static void main(String[] args) { User user = ((UserRegInteractor) userInteractor).getUser(); EventCreationPresenter eventPresenter = new EventCreationResponseFormatter(); - EventCreationInputBoundary eventInteractor = new EventCreationInteractor(eventPresenter, (StudentUser) user); - EventCreationController eventCreationController = new EventCreationController(eventInteractor); +// EventCreationInputBoundary eventInteractor = new EventCreationInteractor(eventPresenter, (StudentUser) user); +// EventCreationController eventCreationController = new EventCreationController(eventInteractor); ProgressTrackerOutputBoundary trackerPresenter = new ProgressTrackerPresenter(); ProgressTrackerInputBoundary trackerInteractor = new ProgressTrackerInteractor (trackerPresenter); ProgressTrackerController trackerController = new ProgressTrackerController(trackerInteractor, user, "", allTasks, allUsers, allCourses); CourseCreationDsGateway course; - try { - course = new FileCourse("./courses.csv"); - } catch (IOException | ClassNotFoundException e) { - throw new RuntimeException("Could not create file."); - } - CourseCreationOutputBoundary presenter = new CourseCreationPresenter(); - CourseMap courseMap = new CourseMap(); - CourseCreationInputBoundary interactor = new CourseCreationInteractor(course, presenter, courseMap); - CourseCreationController courseCreationController = new CourseCreationController(interactor); +// try { +// course = new FileCourse("./courses.csv"); +// } catch (IOException | ClassNotFoundException e) { +// throw new RuntimeException("Could not create file."); +// } +// CourseCreationOutputBoundary presenter = new CourseCreationPresenter(); +// CourseMap courseMap = new CourseMap(); +// CourseCreationInputBoundary interactor = new CourseCreationInteractor(course, presenter, courseMap); +// CourseCreationController courseCreationController = new CourseCreationController(interactor); // CourseEnrolmentOutputBoundary enrolmentPresenter = new CourseEnrolmentPresenter(); // CourseEnrolmentInputBoundary enrolmentInteractor = new CourseEnrolmentInteractor (enrolmentPresenter, courseMap, user.getName()); // CourseEnrolmentController enrolmentController = new CourseEnrolmentController(enrolmentInteractor); // Build the GUI - EventCreationScreen taskScreen = new EventCreationScreen(eventCreationController, screens, cardLayout); - screens.add("toDoList", taskScreen); +// EventCreationScreen taskScreen = new EventCreationScreen(eventCreationController, screens, cardLayout); +// screens.add("toDoList", taskScreen); CalendarScreen calendarScreen = new CalendarScreen((StudentUser) user, allTasks, screens, cardLayout); screens.add("calendar", calendarScreen); @@ -71,8 +75,8 @@ public static void main(String[] args) { ProgressTrackerScreen progressTrackerScreen = new ProgressTrackerScreen(trackerController); screens.add("tracker", progressTrackerScreen); - CourseCreationScreen courseCreationScreen = new CourseCreationScreen(courseCreationController, screens, cardLayout); - screens.add("course", courseCreationScreen); +// CourseCreationScreen courseCreationScreen = new CourseCreationScreen(courseCreationController, screens, cardLayout); +// screens.add("course", courseCreationScreen); // CourseEnrolmentScreen courseEnrolmentScreen = new CourseEnrolmentScreen(enrolmentController); diff --git a/src/main/java/entities/TaskMap.java b/src/main/java/entities/TaskMap.java index 6885bae..37f0e77 100644 --- a/src/main/java/entities/TaskMap.java +++ b/src/main/java/entities/TaskMap.java @@ -1,6 +1,6 @@ package entities; -import read_write.ReadWriter; +import use_cases.task_management.read_write.ReadWriter; import java.io.IOException; import java.io.Serializable; diff --git a/src/main/java/logout_usecase/LogoutRequestModel.java b/src/main/java/logout_usecase/LogoutRequestModel.java deleted file mode 100644 index bd63aed..0000000 --- a/src/main/java/logout_usecase/LogoutRequestModel.java +++ /dev/null @@ -1,4 +0,0 @@ -package logout_usecase; - -public class LogoutRequestModel { -} diff --git a/src/main/java/scheduling_ct_screens/EnterTimeAndTask.java b/src/main/java/scheduling_ct_screens/EnterTimeAndTask.java deleted file mode 100644 index 172c81e..0000000 --- a/src/main/java/scheduling_ct_screens/EnterTimeAndTask.java +++ /dev/null @@ -1,65 +0,0 @@ -package scheduling_ct_screens; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * The View for the Scheduling Collaborative Tasks Use Case - */ - -public class EnterTimeAndTask extends JFrame implements ActionListener { - - ScheduleCTController scheduleCTController; - JTextField taskTitle = new JTextField(15); - JTextField startTime = new JTextField(15); - JTextField endTime = new JTextField(15); - - - public EnterTimeAndTask(ScheduleCTController scheduleCTController) { - - this.scheduleCTController = scheduleCTController; - - - JLabel title = new JLabel("Scheduling Collaborative Tasks"); - title.setAlignmentX(Component.CENTER_ALIGNMENT); - - LabelTextPanel taskInfo = new LabelTextPanel(new JLabel("Enter task title"), taskTitle); - - LabelTextPanel startInfo = new LabelTextPanel(new JLabel("Enter start time"), startTime); - - LabelTextPanel endInfo = new LabelTextPanel(new JLabel("Enter end time"), endTime); - - - JButton submit = new JButton("Submit"); - - JPanel buttons = new JPanel(); - buttons.add(submit); - - submit.addActionListener(this); - - this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - - JPanel main = new JPanel(); - main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); - - main.add(title); - main.add(taskInfo); - main.add(startInfo); - main.add(endInfo); - main.add(buttons); - this.setContentPane(main); - - this.pack(); - setVisible(true); - } - - // React to button click that results in evt - public void actionPerformed(ActionEvent evt) { -// System.out.println("Click" + evt.getActionCommand()); - scheduleCTController.isConflict(taskTitle.getText(), startTime.getText(), endTime.getText()); - - - } -} diff --git a/src/main/java/scheduling_ct_screens/LabelTextPanel.java b/src/main/java/scheduling_ct_screens/LabelTextPanel.java deleted file mode 100644 index d6dc19a..0000000 --- a/src/main/java/scheduling_ct_screens/LabelTextPanel.java +++ /dev/null @@ -1,16 +0,0 @@ -package scheduling_ct_screens; - -import javax.swing.*; - -// Frameworks/Drivers layer - -/** - * UI helper class that creates labeled text panel - */ - -public class LabelTextPanel extends JPanel { - public LabelTextPanel(JLabel label, JTextField textField) { - this.add(label); - this.add(textField); - } -} \ No newline at end of file diff --git a/src/main/java/scheduling_ct_screens/PresentOutput.java b/src/main/java/scheduling_ct_screens/PresentOutput.java deleted file mode 100644 index 609433d..0000000 --- a/src/main/java/scheduling_ct_screens/PresentOutput.java +++ /dev/null @@ -1,20 +0,0 @@ -package scheduling_ct_screens; - -import javax.swing.*; - -public class PresentOutput extends JFrame { - - String message; - - public PresentOutput(String message) { - this.message = message; - - JLabel text = new JLabel(message); - - JPanel main = new JPanel(); - main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); - - main.add(text); - setVisible(true); - } -} diff --git a/src/main/java/scheduling_ct_screens/ScheduleCTController.java b/src/main/java/scheduling_ct_screens/ScheduleCTController.java deleted file mode 100644 index d0f576a..0000000 --- a/src/main/java/scheduling_ct_screens/ScheduleCTController.java +++ /dev/null @@ -1,40 +0,0 @@ -package scheduling_ct_screens; -import entities.StudentUser; -import entities.Task; -import scheduling_ct_use_case.*; - -import java.util.HashMap; - -/** - * Controller for the Scheduling Collaborative Tasks Use Case - * Triggers the interactor - */ - -public class ScheduleCTController { - - final ScheduleCTInputBoundary scheduleInput; - - private final HashMap hashMap; - - private final StudentUser studentUser; - - public ScheduleCTController(ScheduleCTInputBoundary scheduleInput, HashMap hashMap, StudentUser studentUser) { - this.scheduleInput = scheduleInput; - this.hashMap = hashMap; - this.studentUser = studentUser; - } - - public HashMap getTaskMap() { - return hashMap; - } - - public StudentUser getStudentUser() { - return studentUser; - } - - public ScheduleCTResponseModel isConflict(String taskName, String startTime, String endTime) { - ScheduleCTRequestModel inputData = new ScheduleCTRequestModel(taskName, startTime, endTime, studentUser); - return scheduleInput.schedule(inputData, this.hashMap); - } - -} diff --git a/src/main/java/scheduling_ct_screens/ScheduleCTPresenter.java b/src/main/java/scheduling_ct_screens/ScheduleCTPresenter.java deleted file mode 100644 index a5e0104..0000000 --- a/src/main/java/scheduling_ct_screens/ScheduleCTPresenter.java +++ /dev/null @@ -1,23 +0,0 @@ -package scheduling_ct_screens; -import scheduling_ct_use_case.*; - -/** - * Presenter for the Collaborative Scheduling Use Case - * Implements the Output Boundary as part of the dependency inversion - */ - -public class ScheduleCTPresenter implements ScheduleCTOutputBoundary { - - @Override - public ScheduleCTResponseModel prepareNoConflictView(ScheduleCTResponseModel responseModel) { - if ((!responseModel.getIsConflict())) { - responseModel.setDisplayString("Successful input"); - } - return responseModel; - } - - @Override - public ScheduleCTResponseModel prepareFailView(String error) { - throw new SchedulingTimesFailed(error); - } -} diff --git a/src/main/java/scheduling_ct_use_case/ScheduleCTInputBoundary.java b/src/main/java/scheduling_ct_use_case/ScheduleCTInputBoundary.java deleted file mode 100644 index 12b8365..0000000 --- a/src/main/java/scheduling_ct_use_case/ScheduleCTInputBoundary.java +++ /dev/null @@ -1,14 +0,0 @@ -package scheduling_ct_use_case; - -import entities.Task; -import java.util.HashMap; - -/** - * Input Boundary interface for the Scheduling Collaborative Tasks Use Case - * (inverts dependency from Controller to Interactor) - */ - -public interface ScheduleCTInputBoundary { - - ScheduleCTResponseModel schedule(ScheduleCTRequestModel scheduleCTRequestModel, HashMap hashMap); -} diff --git a/src/main/java/scheduling_ct_use_case/ScheduleCTInteractor.java b/src/main/java/scheduling_ct_use_case/ScheduleCTInteractor.java deleted file mode 100644 index b959a12..0000000 --- a/src/main/java/scheduling_ct_use_case/ScheduleCTInteractor.java +++ /dev/null @@ -1,304 +0,0 @@ -package scheduling_ct_use_case; - -import entities.*; - -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.HashMap; - -/** - * Scheduling Collaborative Tasks Use Case Interactor (use case layer) - * Implements business logic on entities - */ - -public class ScheduleCTInteractor implements ScheduleCTInputBoundary { - private final ScheduleCTOutputBoundary scheduleCTOutputBoundary; - - public ScheduleCTInteractor(ScheduleCTOutputBoundary scheduleCTOutputBoundary) { - this.scheduleCTOutputBoundary = scheduleCTOutputBoundary; - } - - /** - * The main controller of this interactor that calls the helper methods - */ - @Override - public ScheduleCTResponseModel schedule(ScheduleCTRequestModel requestModel, HashMap hashMap) { - // returns that this has conflict - // otherwise will automatically schedule and return a success view - - - CollaborativeTask task = getTaskObjectFromName(requestModel.getTaskName(), hashMap); - - if (requestModel.getStudentUser() != task.getLeader()) { - return scheduleCTOutputBoundary.prepareFailView("User is not the leader. " + - "You don't have scheduling access"); - } - - ArrayList users = task.getTeammates(); - users.add(task.getLeader()); - - ArrayList unavailableUsers = new ArrayList<>(); - - LocalDateTime startTime = convertStringToLocalDateTime(requestModel.getStartTime()); - LocalDateTime endTime = convertStringToLocalDateTime(requestModel.getEndTime()); - - for (StudentUser user : users) { - ArrayList userTasks = getTaskFromId(user, hashMap); - if (!isUserAvailableAtDateTime(user, userTasks, startTime, endTime)) { - unavailableUsers.add(user); - } - } - if (!unavailableUsers.isEmpty()) { - if (task.getFrequency().equals("")) { - ArrayList> oneDate = new ArrayList<>(); - ArrayList theDate = new ArrayList<>(); - theDate.add(startTime); - theDate.add(endTime); - oneDate.add(theDate); - task.setTimeBlocks(oneDate); - } else { - ArrayList> dates = getDates(task.getFrequency(), startTime, endTime, task.getDeadline()); - task.setTimeBlocks(dates); - } - ScheduleCTResponseModel scheduleCTResponseModel = new ScheduleCTResponseModel(false); - return scheduleCTOutputBoundary.prepareNoConflictView(scheduleCTResponseModel); - } else { - ScheduleCTResponseModel scheduleCTResponseModel = new ScheduleCTResponseModel(true); - return scheduleCTOutputBoundary.prepareFailView("Cannot schedule due to conflict"); - } - } - - /** - * Finds all the dates to meet up given the frequency of a task - * @param frequency - either "daily", "weekly" or "monthly" - * @param startTime - the start time of the time block - * @param endTime - the end time of the time block - * @param deadline - the deadline of the task - * @return an array list of array lists of local date time (i.e. the dates to meet up) - */ - public ArrayList> getDates(String frequency, LocalDateTime startTime, LocalDateTime endTime, LocalDateTime deadline) { - ArrayList> times = new ArrayList<>(); - ArrayList initialTime = new ArrayList<>(); - initialTime.add(startTime); - initialTime.add(endTime); - times.add(initialTime); - - LocalDateTime currStart = startTime; - LocalDateTime currEnd = endTime; - - switch (frequency) { - case "daily": - do { - ArrayList date = new ArrayList<>(); - currStart = currStart.plusDays(1); - currEnd = currEnd.plusDays(1); - - date.add(currStart); - date.add(currEnd); - times.add(date); - } while (endTime.isBefore(deadline)); - break; - case "weekly": - do { - ArrayList date = new ArrayList<>(); - currStart = currStart.plusWeeks(1); - currEnd = currEnd.plusWeeks(1); - - date.add(currStart); - date.add(currEnd); - times.add(date); - } while (endTime.isBefore(deadline)); - break; - case "monthly": - do { - ArrayList date = new ArrayList<>(); - currStart = currStart.plusMonths(1); - currEnd = currEnd.plusMonths(1); - - date.add(currStart); - date.add(currEnd); - times.add(date); - } while (endTime.isBefore(deadline)); - break; - } - return times; - } - - /** - * Check if a user is available at a fixed date time - * @param user - the student user - * @param tasks - an array list of a user's tasks - * @param start - the start time of the time block - * @param end -the end time of the time block - * @return whether or not the user is available at this date time - */ - public boolean isUserAvailableAtDateTime(StudentUser user, ArrayList tasks, LocalDateTime start, - LocalDateTime end) { - // assume there's a method in TaskUseCase that gets all the tasks a student has - - boolean is_task_free = true; - boolean is_working_hours_free = true; - for (Task task : tasks) { - - if (task instanceof Event) { - if (((Event) task).getTimeBlock() != null) { - LocalDateTime[] timeBlock = ((Event) task).getTimeBlock(); - LocalDateTime timeBlockStart = timeBlock[0]; - LocalDateTime timeBlockEnd = timeBlock[1]; - is_task_free = is_task_free && givenTime(timeBlockStart, timeBlockEnd, start, end); - } - } else if (task instanceof Test) { - if (((Test) task).getTimeBlock() != null) { - - LocalDateTime[] timeBlock = ((Test) task).getTimeBlock(); - LocalDateTime timeBlockStart = timeBlock[0]; - LocalDateTime timeBlockEnd = timeBlock[1]; - - is_task_free = is_task_free && givenTime(timeBlockStart, timeBlockEnd, start, end); - - if (((Test) task).getPrepTimeScheduled() != null) { - ArrayList> scheduledPrep = ((Test) task).getPrepTimeScheduled(); - for (ArrayList prep : scheduledPrep) { - LocalDateTime prepStart = prep.get(0); - LocalDateTime prepEnd = prep.get(1); - - is_task_free = is_task_free && givenTime(prepStart, prepEnd, start, end); - } - - } - } - } else if (task instanceof Assignment) { - - if (((Assignment) task).getPrepTimeScheduled() != null) { - ArrayList> scheduledPrep = ((Assignment) task).getPrepTimeScheduled(); - for (ArrayList prep : scheduledPrep) { - LocalDateTime prepStart = prep.get(0); - LocalDateTime prepEnd = prep.get(1); - - is_task_free = is_task_free && givenTime(prepStart, prepEnd, start, end); - } - } - } - - } - if (user.getWorkingHours() != null) { - ArrayList workingHours = user.getWorkingHours(); - LocalTime workingHoursStart = workingHours.get(0); - LocalTime workingHoursEnd = workingHours.get(1); - is_working_hours_free = workingHoursFree(start, end, workingHoursStart, workingHoursEnd); - } - return is_task_free && is_working_hours_free; - } - - /** - * Check if a time block conflicts with a user's working hours - * @param timeBlockStart - the start of the time block - * @param timeBlockEnd - the end of the time block - * @param workingHoursStart - the start of a user's working hours - * @param workingHoursEnd - the end of a user's working hours - * @return whether or not a time block conflicts with a user's working hours - */ - public boolean workingHoursFree(LocalDateTime timeBlockStart, LocalDateTime timeBlockEnd, - LocalTime workingHoursStart, LocalTime workingHoursEnd) { - // if timeBlock is within working hours - // timeBlockStart.isAfter(ChronoLocalDateTime.from(workingHoursStart)) && - // timeBlockEnd.isBefore(ChronoLocalDateTime.from(workingHoursEnd)) - if (timeBlockStart.getHour() > workingHoursStart.getHour() && - timeBlockEnd.getHour() < workingHoursEnd.getHour()) { - return false; - // if timeBlock covers the whole period of working hours - // timeBlockStart.isBefore(ChronoLocalDateTime.from(workingHoursStart)) && - // timeBlockEnd.isAfter(ChronoLocalDateTime.from(workingHoursEnd)) - } else if (timeBlockStart.getHour() < workingHoursStart.getHour() && - timeBlockEnd.getHour() > workingHoursEnd.getHour()) { - return false; - // if timeBlockStart is before workingHoursStart and timeBlockEnd is before workingHoursEnd - } else if (timeBlockStart.getHour()< workingHoursStart.getHour() && - timeBlockEnd.getHour() < workingHoursEnd.getHour()) { - return false; - // if timeBlockStart is the same as workingHoursStart - } else if (timeBlockStart.getHour() == workingHoursStart.getHour()) { - return false; - // if timeBlockEnd is the same as workingHoursEnd - } else if (timeBlockEnd.getHour() == workingHoursEnd.getHour()) { - return false; - // if timeBlockStart is after workingHoursStart and timeBlockEnd is after workingHoursEnd - } else return !(timeBlockStart.getHour() > workingHoursStart.getHour() && - timeBlockEnd.getHour() > workingHoursEnd.getHour()); - } - - /** - * Check if two time blocks conflict - * @param timeBlockStart - the start of the time block - * @param timeBlockEnd - the end of the time block - * @param start - the start of another time block - * @param end - the end of another time block - * @return whether or not two time blocks conflict - */ - public boolean givenTime(LocalDateTime timeBlockStart, LocalDateTime timeBlockEnd, - LocalDateTime start, LocalDateTime end) { - // in the case where the time block is within the time of start and end - if (timeBlockStart.isAfter(start) && timeBlockEnd.isBefore(end)) { - return false; - // in the case where it covers the time period - } else if (timeBlockStart.isBefore(start) && timeBlockEnd.isAfter(end)) { - return false; - // in the case where timeBlockStart is before start and timeBlockEnd is before end - } else if (timeBlockStart.isBefore(start) && timeBlockEnd.isBefore(end)) { - return false; - // if the start time same as start time of block, return false - } else if (timeBlockStart.isEqual(start)) { - return false; - // if the end time same as end time of block, return false - } else if (timeBlockEnd.isEqual(end)) { - return false; - // in the case where timeBlockStart is after start time and timeBlockEnd is after end time - } else return !(timeBlockStart.isAfter(start) && timeBlockEnd.isAfter(end)); - } - - /** - * Retrieve the tasks associated with a user from the given hash map - * @param user - the student user - * @param hashMap - a hash map of all task ids to tasks - * @return an array list of tasks - */ - public ArrayList getTaskFromId(StudentUser user, HashMap hashMap) { - ArrayList userTasks = new ArrayList<>(); - - ArrayList toDoList = user.getToDoList(); - - for (String taskId : toDoList) { - Task task_value = hashMap.get(taskId); - userTasks.add(task_value); - } - return userTasks; - } - - /** - * Get the task object from the task map given the name of the task - * @param taskName - the name of the task - * @param hashMap - hashmap of task ids to tasks - * @return the task object that corresponds to the task name - */ - public CollaborativeTask getTaskObjectFromName(String taskName, HashMap hashMap) { - for (Task task : hashMap.values()) { - if (task.getTitle().equals(taskName) && task instanceof CollaborativeTask) { - return (CollaborativeTask) task; - } - } - throw new RuntimeException("Task does not exist"); - } - - /** - * Convert the given string to a LocalDateTime object - * @param stringTime - the string representation of a date time - * @return the string formatted as LocalDateTime - */ - public LocalDateTime convertStringToLocalDateTime(String stringTime) { - DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); - return LocalDateTime.parse(stringTime, format); - } - -} diff --git a/src/main/java/scheduling_ct_use_case/ScheduleCTOutputBoundary.java b/src/main/java/scheduling_ct_use_case/ScheduleCTOutputBoundary.java deleted file mode 100644 index 03c9ca0..0000000 --- a/src/main/java/scheduling_ct_use_case/ScheduleCTOutputBoundary.java +++ /dev/null @@ -1,13 +0,0 @@ -package scheduling_ct_use_case; - -/** - * Output Boundary for the Scheduling Collaborative Tasks Use Case - * (inverts dependency for interactor to presenter) - */ - -public interface ScheduleCTOutputBoundary { - - ScheduleCTResponseModel prepareNoConflictView(ScheduleCTResponseModel responseModel); - - ScheduleCTResponseModel prepareFailView(String error); -} diff --git a/src/main/java/scheduling_ct_use_case/ScheduleCTResponseModel.java b/src/main/java/scheduling_ct_use_case/ScheduleCTResponseModel.java deleted file mode 100644 index 17c4b24..0000000 --- a/src/main/java/scheduling_ct_use_case/ScheduleCTResponseModel.java +++ /dev/null @@ -1,28 +0,0 @@ -package scheduling_ct_use_case; - -/** - * Response Model for the Scheduling Collaborative Tasks Use Case - * Acts as the output data object in the use case layer - */ - -public class ScheduleCTResponseModel { - - private final boolean isConflict; - String displayString; - - public ScheduleCTResponseModel(boolean isConflict) { - - this.isConflict = isConflict; - } - - public boolean getIsConflict() { - return isConflict; - } - - public String getDisplayString() { - return displayString; - } - public void setDisplayString(String displayString) { - this.displayString = displayString; - } -} diff --git a/src/main/java/screens/MainScreen.java b/src/main/java/screens/MainScreen.java index b597919..3ef9199 100644 --- a/src/main/java/screens/MainScreen.java +++ b/src/main/java/screens/MainScreen.java @@ -14,6 +14,7 @@ public class MainScreen extends JPanel implements ActionListener { JButton calendar; JButton progressTracker; JButton courses; + JButton scheduleCT; /** * Objects for connecting to the other screens @@ -38,11 +39,13 @@ public MainScreen(JPanel screens, CardLayout cardLayout) { calendar = new JButton("Calendar"); progressTracker = new JButton("Progress Tracker"); courses = new JButton("Courses"); + scheduleCT = new JButton("Schedule Collaborative Task"); toDoList.addActionListener(this); calendar.addActionListener(this); progressTracker.addActionListener(this); courses.addActionListener(this); + scheduleCT.addActionListener(this); // Create panel for buttons JPanel buttons = new JPanel(); @@ -50,6 +53,7 @@ public MainScreen(JPanel screens, CardLayout cardLayout) { buttons.add(calendar); buttons.add(progressTracker); buttons.add(courses); + buttons.add(scheduleCT); // Add all components to the panel this.add(title); @@ -73,6 +77,9 @@ public void actionPerformed(ActionEvent evt) { if (evt.getSource() == courses) { cardLayout.show(screens, "course"); } + if (evt.getSource() == scheduleCT) { + cardLayout.show(screens, "scheduleCT"); + } } diff --git a/src/main/java/screens/CalendarScreen.java b/src/main/java/screens/calendar_scheduler/CalendarScreen.java similarity index 99% rename from src/main/java/screens/CalendarScreen.java rename to src/main/java/screens/calendar_scheduler/CalendarScreen.java index 3ce79dc..52c2e4b 100644 --- a/src/main/java/screens/CalendarScreen.java +++ b/src/main/java/screens/calendar_scheduler/CalendarScreen.java @@ -1,4 +1,4 @@ -package screens; +package screens.calendar_scheduler; import entities.StudentUser; import entities.Task; diff --git a/src/main/java/screens/DayViewPanel.java b/src/main/java/screens/calendar_scheduler/DayViewPanel.java similarity index 94% rename from src/main/java/screens/DayViewPanel.java rename to src/main/java/screens/calendar_scheduler/DayViewPanel.java index 5eb129b..53076d3 100644 --- a/src/main/java/screens/DayViewPanel.java +++ b/src/main/java/screens/calendar_scheduler/DayViewPanel.java @@ -1,4 +1,4 @@ -package screens; +package screens.calendar_scheduler; import entities.StudentUser; import entities.Task; @@ -6,6 +6,7 @@ import javax.swing.*; import java.awt.*; +import java.time.DayOfWeek; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; @@ -50,8 +51,11 @@ public DayViewPanel(LocalDate date, ArrayList allTasks, StudentUser user) String[] weekdays = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; ArrayList weekday = new ArrayList<>(); weekday.add(""); - int weekdayInt = date.getDayOfWeek().getValue(); - weekday.add(weekdays[weekdayInt]); + WeekFields weekField = WeekFields.SUNDAY_START; + TemporalField tempField = weekField.dayOfWeek(); + DayOfWeek dayOfWeek = date.getDayOfWeek(); + int weekdayInt = dayOfWeek.get(tempField); + weekday.add(weekdays[weekdayInt - 1]); for (int i = 0; i < weekday.size(); i++) { GridBagConstraints c = new GridBagConstraints(); diff --git a/src/main/java/screens/MonthViewPanel.java b/src/main/java/screens/calendar_scheduler/MonthViewPanel.java similarity index 99% rename from src/main/java/screens/MonthViewPanel.java rename to src/main/java/screens/calendar_scheduler/MonthViewPanel.java index 37a8a49..3f5e5f5 100644 --- a/src/main/java/screens/MonthViewPanel.java +++ b/src/main/java/screens/calendar_scheduler/MonthViewPanel.java @@ -1,4 +1,4 @@ -package screens; +package screens.calendar_scheduler; import entities.Assignment; import entities.Event; diff --git a/src/main/java/screens/ScheduleConflictResponseFormatter.java b/src/main/java/screens/calendar_scheduler/ScheduleConflictResponseFormatter.java similarity index 74% rename from src/main/java/screens/ScheduleConflictResponseFormatter.java rename to src/main/java/screens/calendar_scheduler/ScheduleConflictResponseFormatter.java index 22347ac..c3a9010 100644 --- a/src/main/java/screens/ScheduleConflictResponseFormatter.java +++ b/src/main/java/screens/calendar_scheduler/ScheduleConflictResponseFormatter.java @@ -1,9 +1,9 @@ -package screens; +package screens.calendar_scheduler; import entities.Task; -import schedule_conflict_use_case.ScheduleConflictPresenter; -import schedule_conflict_use_case.ScheduleConflictRequestModel; -import schedule_conflict_use_case.ScheduleConflictResponseModel; +import use_cases.calendar_scheduler.schedule_conflict_use_case.ScheduleConflictPresenter; +import use_cases.calendar_scheduler.schedule_conflict_use_case.ScheduleConflictRequestModel; +import use_cases.calendar_scheduler.schedule_conflict_use_case.ScheduleConflictResponseModel; import javax.swing.*; diff --git a/src/main/java/screens/SchedulerResponseFormatter.java b/src/main/java/screens/calendar_scheduler/SchedulerResponseFormatter.java similarity index 81% rename from src/main/java/screens/SchedulerResponseFormatter.java rename to src/main/java/screens/calendar_scheduler/SchedulerResponseFormatter.java index 82a7cf6..eec353f 100644 --- a/src/main/java/screens/SchedulerResponseFormatter.java +++ b/src/main/java/screens/calendar_scheduler/SchedulerResponseFormatter.java @@ -1,8 +1,8 @@ -package screens; +package screens.calendar_scheduler; import entities.Task; -import scheduler_use_case.SchedulerPresenter; -import scheduler_use_case.SchedulerResponseModel; +import use_cases.calendar_scheduler.scheduler_use_case.SchedulerPresenter; +import use_cases.calendar_scheduler.scheduler_use_case.SchedulerResponseModel; import javax.swing.*; diff --git a/src/main/java/screens/WeekViewPanel.java b/src/main/java/screens/calendar_scheduler/WeekViewPanel.java similarity index 96% rename from src/main/java/screens/WeekViewPanel.java rename to src/main/java/screens/calendar_scheduler/WeekViewPanel.java index 9a9f9bb..3ca5aa2 100644 --- a/src/main/java/screens/WeekViewPanel.java +++ b/src/main/java/screens/calendar_scheduler/WeekViewPanel.java @@ -1,4 +1,4 @@ -package screens; +package screens.calendar_scheduler; import entities.StudentUser; import entities.Task; @@ -62,7 +62,11 @@ public WeekViewPanel(LocalDate date, ArrayList allTasks, StudentUser user) Calendar iterator = (Calendar) calendar.clone(); iterator.add(Calendar.DAY_OF_MONTH, -(iterator.get(Calendar.DAY_OF_WEEK) - 1)); Calendar maximum = (Calendar) calendar.clone(); - maximum.add(Calendar.DAY_OF_WEEK, 7-dayOfWeek); + if (maximum.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { + maximum.add(Calendar.DAY_OF_WEEK, 7-dayOfWeek); + } else { + maximum.add(Calendar.DAY_OF_WEEK, dayOfWeek); + } // Create day of week panels String[] weekdays = {"", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; diff --git a/src/main/java/screens/collaborative_task_scheduling/ScheduleCTController.java b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTController.java new file mode 100644 index 0000000..2b85a3b --- /dev/null +++ b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTController.java @@ -0,0 +1,48 @@ +package screens.collaborative_task_scheduling; +import entities.StudentUser; +import entities.Task; +import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTInputBoundary; +import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTRequestModel; +import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTResponseModel; + +import java.util.HashMap; + +/** + * Controller for the Scheduling Collaborative Tasks Use Case + * Triggers the interactor + */ + +public class ScheduleCTController { + + final ScheduleCTInputBoundary scheduleInput; + + private final HashMap hashMap; + + private final StudentUser studentUser; + + /** + * Constructor for ScheduleCTController + * @param scheduleInput - the scheduleCTInputBoundary + * @param hashMap - a hash map of all task ids mapped to the task object + * @param studentUser - the current student user logged in + */ + public ScheduleCTController(ScheduleCTInputBoundary scheduleInput, HashMap hashMap, StudentUser studentUser) { + this.scheduleInput = scheduleInput; + this.hashMap = hashMap; + this.studentUser = studentUser; + } + + /** + * Bundles information given by user as well as ScheduleCTController instance variables into a + * ScheduleCTRequestModel, scheduling that input + * @param taskName - the string title/name of the task + * @param startTime - the string representation of the start date and time the user wants to schedule + * @param endTime - the string representation of the end date and time the user wants to schedule + * @return a scheduleCTResponseModel + */ + public ScheduleCTResponseModel isConflict(String taskName, String startTime, String endTime) { + ScheduleCTRequestModel inputData = new ScheduleCTRequestModel(taskName, startTime, endTime, studentUser); + return scheduleInput.schedule(inputData, this.hashMap); + } + +} diff --git a/src/main/java/screens/collaborative_task_scheduling/ScheduleCTFormatter.java b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTFormatter.java new file mode 100644 index 0000000..e3ebf91 --- /dev/null +++ b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTFormatter.java @@ -0,0 +1,23 @@ +package screens.collaborative_task_scheduling; + +import java.util.ArrayList; + +/** + * Model for passing information from ScheduleCTPresenter to ScheduleCTView + */ +public class ScheduleCTFormatter { + + /** + * The dates and times that will be presented to the user + */ + private final ArrayList scheduledDateTimes; + + public ScheduleCTFormatter(ArrayList scheduledDateTimes) { + this.scheduledDateTimes = scheduledDateTimes; + } + + public ArrayList getScheduledDateTimes() { + return scheduledDateTimes; + } + +} diff --git a/src/main/java/screens/collaborative_task_scheduling/ScheduleCTPresenter.java b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTPresenter.java new file mode 100644 index 0000000..2b9e133 --- /dev/null +++ b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTPresenter.java @@ -0,0 +1,47 @@ +package screens.collaborative_task_scheduling; +import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTOutputBoundary; +import use_cases.collaborative_task_scheduling.scheduling_ct_use_case.ScheduleCTResponseModel; + +import java.util.ArrayList; + +/** + * Presenter for the Collaborative Scheduling Use Case + * Implements the Output Boundary as part of the dependency inversion + */ + +public class ScheduleCTPresenter implements ScheduleCTOutputBoundary { + + ScheduleCTViewInterface scheduleCTViewInterface; + + public ScheduleCTPresenter(ScheduleCTViewInterface scheduleCTViewInterface) { + this.scheduleCTViewInterface = scheduleCTViewInterface; + } + + /** + * Implemented method from ScheduleCTOutputBoundary which calls on the View Interface to update the view + * @param responseModel - a scheduleCTResponseModel + * @return a scheduleCTResponseModel + */ + @Override + public ScheduleCTResponseModel prepareNoConflictView(ScheduleCTResponseModel responseModel) { + + ArrayList availableDates = responseModel.getScheduledTimes(); + + // making an instance of a class between presenter and view that can communicate information + ScheduleCTFormatter scheduleCTFormatter = new ScheduleCTFormatter(availableDates); + + scheduleCTViewInterface.present(scheduleCTFormatter); + + return responseModel; + } + + /** + * Implemented method from ScheduleCTOutputBoundary that prepares the fail view + * @param error - the type of error that happened + * @return a SchedulingTimesFailed error with the specific error + */ + @Override + public ScheduleCTResponseModel prepareFailView(String error) { + throw new SchedulingTimesFailed(error); + } +} diff --git a/src/main/java/screens/collaborative_task_scheduling/ScheduleCTScreen.java b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTScreen.java new file mode 100644 index 0000000..cc9e94e --- /dev/null +++ b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTScreen.java @@ -0,0 +1,94 @@ +package screens.collaborative_task_scheduling; + +import screens.LabelTextPanel; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + +/** + * The View for the Scheduling Collaborative Tasks Use Case + */ + +public class ScheduleCTScreen extends JPanel implements ActionListener { + + /** + * The controller + */ + ScheduleCTController scheduleCTController; + /** + * The task title + */ + JTextField taskTitle = new JTextField(15); + /** + * The end time + */ + JTextField startTime = new JTextField(15); + /** + * The start time + */ + JTextField endTime = new JTextField(15); + + /** + * Objects for connecting to the other screens + */ + CardLayout screenLayout; + JPanel screens; + + /** + * Prepares screen that the user inputs information (task title, start time, end time) into + * @param scheduleCTController - the instance of the ScheduleCTController + */ + public ScheduleCTScreen(ScheduleCTController scheduleCTController, JPanel screens, CardLayout screenLayout) { + + this.scheduleCTController = scheduleCTController; + this.screenLayout = screenLayout; + this.screens = screens; + + + JLabel title = new JLabel("Scheduling Collaborative Tasks"); + title.setAlignmentX(Component.CENTER_ALIGNMENT); + + LabelTextPanel taskInfo = new LabelTextPanel(new JLabel("Enter task title"), taskTitle); + + LabelTextPanel startInfo = new LabelTextPanel(new JLabel("Enter start time as yyyy-MM-dd HH:mm"), startTime); + + LabelTextPanel endInfo = new LabelTextPanel(new JLabel("Enter end time as yyyy-MM-dd HH:mm"), endTime); + + JButton cancel = new JButton("Cancel"); + JButton submit = new JButton("Schedule"); + + JPanel buttons = new JPanel(); + buttons.add(cancel); + buttons.add(submit); + + cancel.addActionListener(this); + submit.addActionListener(this); + + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + + this.add(title); + this.add(taskInfo); + this.add(startInfo); + this.add(endInfo); + this.add(buttons); + } + + /** + * Reacts to the "schedule" button click that results in event, passing information to the scheduleCTController, + * and the "cancel" button click, returns the user back to main + * @param evt the event to be processed + */ + public void actionPerformed(ActionEvent evt) { + if (evt.getActionCommand().equals("Cancel")) { + screenLayout.show(screens, "main"); + } else if (evt.getActionCommand().equals("Schedule")) { + try { + scheduleCTController.isConflict(taskTitle.getText(), startTime.getText(), endTime.getText()); + } catch (Exception e) { + JOptionPane.showMessageDialog(this, e.getMessage()); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/screens/collaborative_task_scheduling/ScheduleCTView.java b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTView.java new file mode 100644 index 0000000..34264fb --- /dev/null +++ b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTView.java @@ -0,0 +1,71 @@ +package screens.collaborative_task_scheduling; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; + +public class ScheduleCTView extends JPanel implements ScheduleCTViewInterface, ActionListener { + + /** + * Objects for connecting to the other screens + */ + CardLayout screenLayout; + JPanel screens; + + /** + * Constructor for PresentOutput + * @param screenLayout - the connecting CardLayout screen + * @param screens - the connecting JPanel screens + */ + public ScheduleCTView(CardLayout screenLayout, JPanel screens) { + this.screenLayout = screenLayout; + this.screens = screens; + } + + /** + * Method implemented from PresentOutputInterface which presents the dates the user wishes to schedule + * @param scheduleCTFormatter - a ScheduleCTFormatter which stores the dates to present + */ + @Override + public void present(ScheduleCTFormatter scheduleCTFormatter) { + ArrayList dateTimes = scheduleCTFormatter.getScheduledDateTimes(); + + JLabel title = new JLabel("Scheduled Times"); + title.setAlignmentX(Component.CENTER_ALIGNMENT); + + JPanel labels = new JPanel(); + + for (String timeBlock : dateTimes) { + JLabel time = new JLabel(timeBlock); + labels.add(time); + } + + JPanel separateNote = new JPanel(); + JLabel note = new JLabel("Remember to communicate these times to your teammates!"); + separateNote.add(note); + + + JButton returnToMain = new JButton("Return to main"); + JPanel buttons = new JPanel(); + buttons.add(returnToMain); + + returnToMain.addActionListener(this); + + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + + this.add(title); + this.add(labels); + this.add(separateNote); + this.add(buttons); + } + + public void actionPerformed(ActionEvent evt) { + try { + screenLayout.show(screens, "main"); + } catch (Exception e) { + JOptionPane.showMessageDialog(this, e.getMessage()); + } + } +} diff --git a/src/main/java/screens/collaborative_task_scheduling/ScheduleCTViewInterface.java b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTViewInterface.java new file mode 100644 index 0000000..ac2ecac --- /dev/null +++ b/src/main/java/screens/collaborative_task_scheduling/ScheduleCTViewInterface.java @@ -0,0 +1,15 @@ +package screens.collaborative_task_scheduling; + + +/** + * View Interface for the Scheduling Collaborative Tasks Presenter (ScheduleCTPresenter) + * (inverts dependency for presenter to view) + */ +public interface ScheduleCTViewInterface { + + /** + * The method implemented in the view that prepares a screen showing the dates that were scheduled + * @param scheduleCTFormatter - a scheduleCTFormatter + */ + void present(ScheduleCTFormatter scheduleCTFormatter); +} diff --git a/src/main/java/scheduling_ct_screens/SchedulingTimesFailed.java b/src/main/java/screens/collaborative_task_scheduling/SchedulingTimesFailed.java similarity index 74% rename from src/main/java/scheduling_ct_screens/SchedulingTimesFailed.java rename to src/main/java/screens/collaborative_task_scheduling/SchedulingTimesFailed.java index 758bd09..c710934 100644 --- a/src/main/java/scheduling_ct_screens/SchedulingTimesFailed.java +++ b/src/main/java/screens/collaborative_task_scheduling/SchedulingTimesFailed.java @@ -1,4 +1,4 @@ -package scheduling_ct_screens; +package screens.collaborative_task_scheduling; public class SchedulingTimesFailed extends RuntimeException{ public SchedulingTimesFailed(String error){ diff --git a/src/main/java/screens/ProgressTrackerController.java b/src/main/java/screens/course_progress/ProgressTrackerController.java similarity index 83% rename from src/main/java/screens/ProgressTrackerController.java rename to src/main/java/screens/course_progress/ProgressTrackerController.java index 1436eec..a4368e5 100644 --- a/src/main/java/screens/ProgressTrackerController.java +++ b/src/main/java/screens/course_progress/ProgressTrackerController.java @@ -1,11 +1,11 @@ -package screens; +package screens.course_progress; import entities.Course; import entities.Task; import entities.User; -import progress_tracker_use_case.ProgressTrackerInputBoundary; -import progress_tracker_use_case.ProgressTrackerRequestModel; -import progress_tracker_use_case.ProgressTrackerResponseModel; +import use_cases.course_tracker.progress_tracker_use_case.ProgressTrackerInputBoundary; +import use_cases.course_tracker.progress_tracker_use_case.ProgressTrackerRequestModel; +import use_cases.course_tracker.progress_tracker_use_case.ProgressTrackerResponseModel; import java.util.HashMap; diff --git a/src/main/java/screens/ProgressTrackerPresenter.java b/src/main/java/screens/course_progress/ProgressTrackerPresenter.java similarity index 87% rename from src/main/java/screens/ProgressTrackerPresenter.java rename to src/main/java/screens/course_progress/ProgressTrackerPresenter.java index ffffbe2..347752b 100644 --- a/src/main/java/screens/ProgressTrackerPresenter.java +++ b/src/main/java/screens/course_progress/ProgressTrackerPresenter.java @@ -1,7 +1,7 @@ -package screens; +package screens.course_progress; -import progress_tracker_use_case.ProgressTrackerOutputBoundary; -import progress_tracker_use_case.ProgressTrackerResponseModel; +import use_cases.course_tracker.progress_tracker_use_case.ProgressTrackerOutputBoundary; +import use_cases.course_tracker.progress_tracker_use_case.ProgressTrackerResponseModel; /** * Presenter for the Progress Tracker Use Case diff --git a/src/main/java/screens/ProgressTrackerScreen.java b/src/main/java/screens/course_progress/ProgressTrackerScreen.java similarity index 95% rename from src/main/java/screens/ProgressTrackerScreen.java rename to src/main/java/screens/course_progress/ProgressTrackerScreen.java index 0499963..44a5b3a 100644 --- a/src/main/java/screens/ProgressTrackerScreen.java +++ b/src/main/java/screens/course_progress/ProgressTrackerScreen.java @@ -1,6 +1,7 @@ -package screens; +package screens.course_progress; -import progress_tracker_use_case.ProgressTrackerResponseModel; +import screens.LabelTextPanel; +import use_cases.course_tracker.progress_tracker_use_case.ProgressTrackerResponseModel; import javax.swing.*; import java.awt.*; diff --git a/src/main/java/screens/ProgressTrackingFail.java b/src/main/java/screens/course_progress/ProgressTrackingFail.java similarity index 86% rename from src/main/java/screens/ProgressTrackingFail.java rename to src/main/java/screens/course_progress/ProgressTrackingFail.java index 12bf46c..69fee05 100644 --- a/src/main/java/screens/ProgressTrackingFail.java +++ b/src/main/java/screens/course_progress/ProgressTrackingFail.java @@ -1,4 +1,4 @@ -package screens; +package screens.course_progress; /** * New Exception type for the Progress Tracker Use Case diff --git a/src/main/java/screens/CourseCreationController.java b/src/main/java/screens/courses_features/CourseCreationController.java similarity index 66% rename from src/main/java/screens/CourseCreationController.java rename to src/main/java/screens/courses_features/CourseCreationController.java index 7c5efd8..f41d078 100644 --- a/src/main/java/screens/CourseCreationController.java +++ b/src/main/java/screens/courses_features/CourseCreationController.java @@ -1,8 +1,8 @@ -package screens; +package screens.courses_features; -import course_creation_use_case.CourseCreationInputBoundary; -import course_creation_use_case.CourseCreationRequestModel; -import course_creation_use_case.CourseCreationResponseModel; +import use_cases.course_features.course_creation_use_case.CourseCreationInputBoundary; +import use_cases.course_features.course_creation_use_case.CourseCreationRequestModel; +import use_cases.course_features.course_creation_use_case.CourseCreationResponseModel; import java.util.ArrayList; diff --git a/src/main/java/screens/CourseCreationFailed.java b/src/main/java/screens/courses_features/CourseCreationFailed.java similarity index 80% rename from src/main/java/screens/CourseCreationFailed.java rename to src/main/java/screens/courses_features/CourseCreationFailed.java index 319602a..87a422c 100644 --- a/src/main/java/screens/CourseCreationFailed.java +++ b/src/main/java/screens/courses_features/CourseCreationFailed.java @@ -1,4 +1,4 @@ -package screens; +package screens.courses_features; public class CourseCreationFailed extends RuntimeException { public CourseCreationFailed(String error) { diff --git a/src/main/java/screens/CourseCreationPresenter.java b/src/main/java/screens/courses_features/CourseCreationPresenter.java similarity index 77% rename from src/main/java/screens/CourseCreationPresenter.java rename to src/main/java/screens/courses_features/CourseCreationPresenter.java index 9d68af1..1a7e747 100644 --- a/src/main/java/screens/CourseCreationPresenter.java +++ b/src/main/java/screens/courses_features/CourseCreationPresenter.java @@ -1,9 +1,9 @@ -package screens; +package screens.courses_features; // Interface adapters layer -import course_creation_use_case.CourseCreationOutputBoundary; -import course_creation_use_case.CourseCreationResponseModel; +import use_cases.course_features.course_creation_use_case.CourseCreationOutputBoundary; +import use_cases.course_features.course_creation_use_case.CourseCreationResponseModel; import javax.swing.*; diff --git a/src/main/java/screens/CourseCreationScreen.java b/src/main/java/screens/courses_features/CourseCreationScreen.java similarity index 98% rename from src/main/java/screens/CourseCreationScreen.java rename to src/main/java/screens/courses_features/CourseCreationScreen.java index 74eca2c..4ee988c 100644 --- a/src/main/java/screens/CourseCreationScreen.java +++ b/src/main/java/screens/courses_features/CourseCreationScreen.java @@ -1,7 +1,9 @@ -package screens; +package screens.courses_features; // Framework / Drivers layer +import screens.LabelTextPanel; + import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; diff --git a/src/main/java/screens/CourseEnrolmentController.java b/src/main/java/screens/courses_features/CourseEnrolmentController.java similarity index 63% rename from src/main/java/screens/CourseEnrolmentController.java rename to src/main/java/screens/courses_features/CourseEnrolmentController.java index 1a117b9..790e5c7 100644 --- a/src/main/java/screens/CourseEnrolmentController.java +++ b/src/main/java/screens/courses_features/CourseEnrolmentController.java @@ -1,8 +1,8 @@ -package screens; +package screens.courses_features; -import course_enrolment_use_case.CourseEnrolmentInputBoundary; -import course_enrolment_use_case.CourseEnrolmentRequestModel; -import course_enrolment_use_case.CourseEnrolmentResponseModel; +import use_cases.course_features.course_enrolment_use_case.CourseEnrolmentInputBoundary; +import use_cases.course_features.course_enrolment_use_case.CourseEnrolmentRequestModel; +import use_cases.course_features.course_enrolment_use_case.CourseEnrolmentResponseModel; public class CourseEnrolmentController { final CourseEnrolmentInputBoundary enrolmentInput; diff --git a/src/main/java/screens/CourseEnrolmentFailed.java b/src/main/java/screens/courses_features/CourseEnrolmentFailed.java similarity index 80% rename from src/main/java/screens/CourseEnrolmentFailed.java rename to src/main/java/screens/courses_features/CourseEnrolmentFailed.java index c42ca10..42b2f9d 100644 --- a/src/main/java/screens/CourseEnrolmentFailed.java +++ b/src/main/java/screens/courses_features/CourseEnrolmentFailed.java @@ -1,4 +1,4 @@ -package screens; +package screens.courses_features; public class CourseEnrolmentFailed extends RuntimeException { public CourseEnrolmentFailed(String error) { diff --git a/src/main/java/screens/CourseEnrolmentPresenter.java b/src/main/java/screens/courses_features/CourseEnrolmentPresenter.java similarity index 78% rename from src/main/java/screens/CourseEnrolmentPresenter.java rename to src/main/java/screens/courses_features/CourseEnrolmentPresenter.java index cd8bcae..70e9488 100644 --- a/src/main/java/screens/CourseEnrolmentPresenter.java +++ b/src/main/java/screens/courses_features/CourseEnrolmentPresenter.java @@ -1,9 +1,9 @@ -package screens; +package screens.courses_features; // Interfaces adapters layer -import course_enrolment_use_case.CourseEnrolmentOutputBoundary; -import course_enrolment_use_case.CourseEnrolmentResponseModel; +import use_cases.course_features.course_enrolment_use_case.CourseEnrolmentOutputBoundary; +import use_cases.course_features.course_enrolment_use_case.CourseEnrolmentResponseModel; import javax.swing.*; diff --git a/src/main/java/screens/CourseEnrolmentScreen.java b/src/main/java/screens/courses_features/CourseEnrolmentScreen.java similarity index 97% rename from src/main/java/screens/CourseEnrolmentScreen.java rename to src/main/java/screens/courses_features/CourseEnrolmentScreen.java index 435836c..8f9df64 100644 --- a/src/main/java/screens/CourseEnrolmentScreen.java +++ b/src/main/java/screens/courses_features/CourseEnrolmentScreen.java @@ -1,7 +1,9 @@ -package screens; +package screens.courses_features; // Framework/Drivers layer +import screens.LabelTextPanel; + import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; diff --git a/src/main/java/screens/CourseFoundScreen.java b/src/main/java/screens/courses_features/CourseFoundScreen.java similarity index 96% rename from src/main/java/screens/CourseFoundScreen.java rename to src/main/java/screens/courses_features/CourseFoundScreen.java index 369c132..cf404b9 100644 --- a/src/main/java/screens/CourseFoundScreen.java +++ b/src/main/java/screens/courses_features/CourseFoundScreen.java @@ -1,4 +1,4 @@ -package screens; +package screens.courses_features; // Framework/Driver layer diff --git a/src/main/java/screens/FileCourse.java b/src/main/java/screens/courses_features/FileCourse.java similarity index 90% rename from src/main/java/screens/FileCourse.java rename to src/main/java/screens/courses_features/FileCourse.java index 8e8da95..1ea7d63 100644 --- a/src/main/java/screens/FileCourse.java +++ b/src/main/java/screens/courses_features/FileCourse.java @@ -1,8 +1,7 @@ -package screens; +package screens.courses_features; -import course_creation_use_case.CourseCreationDsGateway; -import entities.*; -import course_creation_use_case.CourseCreationRequestModel; +import use_cases.course_features.course_creation_use_case.CourseCreationDsGateway; +import use_cases.course_features.course_creation_use_case.CourseCreationRequestModel; import java.io.*; import java.util.ArrayList; diff --git a/src/main/java/screens/InMemoryCourse.java b/src/main/java/screens/courses_features/InMemoryCourse.java similarity index 76% rename from src/main/java/screens/InMemoryCourse.java rename to src/main/java/screens/courses_features/InMemoryCourse.java index 70f14b2..46b6b91 100644 --- a/src/main/java/screens/InMemoryCourse.java +++ b/src/main/java/screens/courses_features/InMemoryCourse.java @@ -1,7 +1,7 @@ -package screens; +package screens.courses_features; -import course_creation_use_case.CourseCreationDsGateway; -import course_creation_use_case.CourseCreationRequestModel; +import use_cases.course_features.course_creation_use_case.CourseCreationDsGateway; +import use_cases.course_features.course_creation_use_case.CourseCreationRequestModel; import java.util.HashMap; diff --git a/src/main/java/screens/FileUser.java b/src/main/java/screens/login_registration/FileUser.java similarity index 89% rename from src/main/java/screens/FileUser.java rename to src/main/java/screens/login_registration/FileUser.java index 180faf1..724b14f 100644 --- a/src/main/java/screens/FileUser.java +++ b/src/main/java/screens/login_registration/FileUser.java @@ -1,15 +1,12 @@ -package screens; +package screens.login_registration; -import login_usecase.LoginGateway; -import logout_usecase.LogoutGateway; -import user_register_usecase.UserRegGateway; -import user_register_usecase.UserRegSaveRequest; +import use_cases.login_registration.login_usecase.LoginGateway; +import use_cases.login_registration.logout_usecase.LogoutGateway; +import use_cases.login_registration.user_register_usecase.UserRegGateway; +import use_cases.login_registration.user_register_usecase.UserRegSaveRequest; import java.io.*; -import java.security.KeyException; -import java.time.LocalDateTime; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.Map; public class FileUser implements UserRegGateway, LoginGateway, LogoutGateway { diff --git a/src/main/java/screens/InMemoryUser.java b/src/main/java/screens/login_registration/InMemoryUser.java similarity index 77% rename from src/main/java/screens/InMemoryUser.java rename to src/main/java/screens/login_registration/InMemoryUser.java index 9836532..3dbdf06 100644 --- a/src/main/java/screens/InMemoryUser.java +++ b/src/main/java/screens/login_registration/InMemoryUser.java @@ -1,8 +1,8 @@ -package screens; +package screens.login_registration; -import login_usecase.LoginGateway; -import user_register_usecase.UserRegSaveRequest; -import user_register_usecase.UserRegGateway; +import use_cases.login_registration.login_usecase.LoginGateway; +import use_cases.login_registration.user_register_usecase.UserRegSaveRequest; +import use_cases.login_registration.user_register_usecase.UserRegGateway; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/screens/LoggedInScreen.java b/src/main/java/screens/login_registration/LoggedInScreen.java similarity index 94% rename from src/main/java/screens/LoggedInScreen.java rename to src/main/java/screens/login_registration/LoggedInScreen.java index a5234af..157f90b 100644 --- a/src/main/java/screens/LoggedInScreen.java +++ b/src/main/java/screens/login_registration/LoggedInScreen.java @@ -1,4 +1,6 @@ -package screens; +package screens.login_registration; + +import screens.LabelTextPanel; import javax.swing.*; import java.awt.*; diff --git a/src/main/java/screens/LoginController.java b/src/main/java/screens/login_registration/LoginController.java similarity index 62% rename from src/main/java/screens/LoginController.java rename to src/main/java/screens/login_registration/LoginController.java index 0d6c356..08d8fa9 100644 --- a/src/main/java/screens/LoginController.java +++ b/src/main/java/screens/login_registration/LoginController.java @@ -1,8 +1,8 @@ -package screens; +package screens.login_registration; -import login_usecase.LoginInputBoundary; -import login_usecase.LoginRequestModel; -import login_usecase.LoginResponseModel; +import use_cases.login_registration.login_usecase.LoginInputBoundary; +import use_cases.login_registration.login_usecase.LoginRequestModel; +import use_cases.login_registration.login_usecase.LoginResponseModel; // Interface adapters layer diff --git a/src/main/java/screens/LoginFailed.java b/src/main/java/screens/login_registration/LoginFailed.java similarity index 76% rename from src/main/java/screens/LoginFailed.java rename to src/main/java/screens/login_registration/LoginFailed.java index 4d513dd..7196603 100644 --- a/src/main/java/screens/LoginFailed.java +++ b/src/main/java/screens/login_registration/LoginFailed.java @@ -1,4 +1,4 @@ -package screens; +package screens.login_registration; public class LoginFailed extends Throwable { public LoginFailed(String error) { diff --git a/src/main/java/screens/LoginResponseFormatter.java b/src/main/java/screens/login_registration/LoginResponseFormatter.java similarity index 77% rename from src/main/java/screens/LoginResponseFormatter.java rename to src/main/java/screens/login_registration/LoginResponseFormatter.java index 349908b..b780b2e 100644 --- a/src/main/java/screens/LoginResponseFormatter.java +++ b/src/main/java/screens/login_registration/LoginResponseFormatter.java @@ -1,8 +1,7 @@ -package screens; +package screens.login_registration; -import login_usecase.LoginPresenter; -import login_usecase.LoginResponseModel; -import user_register_usecase.UserRegResponse; +import use_cases.login_registration.login_usecase.LoginPresenter; +import use_cases.login_registration.login_usecase.LoginResponseModel; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/src/main/java/screens/LoginScreen.java b/src/main/java/screens/login_registration/LoginScreen.java similarity index 96% rename from src/main/java/screens/LoginScreen.java rename to src/main/java/screens/login_registration/LoginScreen.java index 8491ce2..555232c 100644 --- a/src/main/java/screens/LoginScreen.java +++ b/src/main/java/screens/login_registration/LoginScreen.java @@ -1,4 +1,6 @@ -package screens; +package screens.login_registration; + +import screens.LabelTextPanel; import javax.swing.*; import java.awt.*; diff --git a/src/main/java/screens/LogoutController.java b/src/main/java/screens/login_registration/LogoutController.java similarity index 62% rename from src/main/java/screens/LogoutController.java rename to src/main/java/screens/login_registration/LogoutController.java index e4b3efe..ab42e48 100644 --- a/src/main/java/screens/LogoutController.java +++ b/src/main/java/screens/login_registration/LogoutController.java @@ -1,8 +1,8 @@ -package screens; +package screens.login_registration; -import logout_usecase.LogoutInputBoundary; -import logout_usecase.LogoutRequestModel; -import logout_usecase.LogoutResponseModel; +import use_cases.login_registration.logout_usecase.LogoutInputBoundary; +import use_cases.login_registration.logout_usecase.LogoutRequestModel; +import use_cases.login_registration.logout_usecase.LogoutResponseModel; import java.io.IOException; diff --git a/src/main/java/screens/RegisterScreen.java b/src/main/java/screens/login_registration/RegisterScreen.java similarity index 98% rename from src/main/java/screens/RegisterScreen.java rename to src/main/java/screens/login_registration/RegisterScreen.java index b379eb5..3679d6d 100644 --- a/src/main/java/screens/RegisterScreen.java +++ b/src/main/java/screens/login_registration/RegisterScreen.java @@ -1,4 +1,6 @@ -package screens; +package screens.login_registration; + +import screens.LabelTextPanel; import javax.swing.*; import java.awt.*; diff --git a/src/main/java/screens/UserCreationFailed.java b/src/main/java/screens/login_registration/UserCreationFailed.java similarity index 79% rename from src/main/java/screens/UserCreationFailed.java rename to src/main/java/screens/login_registration/UserCreationFailed.java index af28fcb..5b8cdf2 100644 --- a/src/main/java/screens/UserCreationFailed.java +++ b/src/main/java/screens/login_registration/UserCreationFailed.java @@ -1,4 +1,4 @@ -package screens; +package screens.login_registration; public class UserCreationFailed extends RuntimeException { public UserCreationFailed(String error) { diff --git a/src/main/java/screens/UserRegController.java b/src/main/java/screens/login_registration/UserRegController.java similarity index 64% rename from src/main/java/screens/UserRegController.java rename to src/main/java/screens/login_registration/UserRegController.java index 130496d..2d7f5ad 100644 --- a/src/main/java/screens/UserRegController.java +++ b/src/main/java/screens/login_registration/UserRegController.java @@ -1,8 +1,8 @@ -package screens; +package screens.login_registration; -import user_register_usecase.UserRegInputBoundary; -import user_register_usecase.UserRegRequest; -import user_register_usecase.UserRegResponse; +import use_cases.login_registration.user_register_usecase.UserRegInputBoundary; +import use_cases.login_registration.user_register_usecase.UserRegRequest; +import use_cases.login_registration.user_register_usecase.UserRegResponse; import java.io.IOException; diff --git a/src/main/java/screens/UserRegResponseFormatter.java b/src/main/java/screens/login_registration/UserRegResponseFormatter.java similarity index 76% rename from src/main/java/screens/UserRegResponseFormatter.java rename to src/main/java/screens/login_registration/UserRegResponseFormatter.java index dc94d38..2c16ee0 100644 --- a/src/main/java/screens/UserRegResponseFormatter.java +++ b/src/main/java/screens/login_registration/UserRegResponseFormatter.java @@ -1,7 +1,7 @@ -package screens; +package screens.login_registration; -import user_register_usecase.UserRegPresenter; -import user_register_usecase.UserRegResponse; +import use_cases.login_registration.user_register_usecase.UserRegPresenter; +import use_cases.login_registration.user_register_usecase.UserRegResponse; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/src/main/java/assignment_creation_screens/AssignmentCreationController.java b/src/main/java/screens/task_management/assignment_creation_screens/AssignmentCreationController.java similarity index 61% rename from src/main/java/assignment_creation_screens/AssignmentCreationController.java rename to src/main/java/screens/task_management/assignment_creation_screens/AssignmentCreationController.java index 85ed49c..c7324f5 100644 --- a/src/main/java/assignment_creation_screens/AssignmentCreationController.java +++ b/src/main/java/screens/task_management/assignment_creation_screens/AssignmentCreationController.java @@ -1,8 +1,8 @@ -package assignment_creation_screens; +package screens.task_management.assignment_creation_screens; -import assignment_creation_use_case.AssignmentCreationInputBoundary; -import assignment_creation_use_case.AssignmentCreationRequestModel; -import assignment_creation_use_case.AssignmentCreationResponseModel; +import use_cases.task_management.assignment_creation_use_case.AssignmentCreationInputBoundary; +import use_cases.task_management.assignment_creation_use_case.AssignmentCreationRequestModel; +import use_cases.task_management.assignment_creation_use_case.AssignmentCreationResponseModel; import java.time.LocalDateTime; diff --git a/src/main/java/assignment_edit_screens/AssignmentEditController.java b/src/main/java/screens/task_management/assignment_edit_screens/AssignmentEditController.java similarity index 64% rename from src/main/java/assignment_edit_screens/AssignmentEditController.java rename to src/main/java/screens/task_management/assignment_edit_screens/AssignmentEditController.java index 570db7a..15052fe 100644 --- a/src/main/java/assignment_edit_screens/AssignmentEditController.java +++ b/src/main/java/screens/task_management/assignment_edit_screens/AssignmentEditController.java @@ -1,9 +1,9 @@ -package assignment_edit_screens; +package screens.task_management.assignment_edit_screens; import entities.Assignment; -import assignment_edit_use_case.AssignmentEditInputBoundary; -import assignment_edit_use_case.AssignmentEditRequestModel; -import assignment_edit_use_case.AssignmentEditResponseModel; +import use_cases.task_management.assignment_edit_use_case.AssignmentEditInputBoundary; +import use_cases.task_management.assignment_edit_use_case.AssignmentEditRequestModel; +import use_cases.task_management.assignment_edit_use_case.AssignmentEditResponseModel; import java.time.LocalDateTime; diff --git a/src/main/java/event_creation_screens/EventCreationController.java b/src/main/java/screens/task_management/event_creation_screens/EventCreationController.java similarity index 66% rename from src/main/java/event_creation_screens/EventCreationController.java rename to src/main/java/screens/task_management/event_creation_screens/EventCreationController.java index 1d26d44..f7a8254 100644 --- a/src/main/java/event_creation_screens/EventCreationController.java +++ b/src/main/java/screens/task_management/event_creation_screens/EventCreationController.java @@ -1,8 +1,8 @@ -package event_creation_screens; +package screens.task_management.event_creation_screens; -import event_creation_use_case.EventCreationInputBoundary; -import event_creation_use_case.EventCreationRequestModel; -import event_creation_use_case.EventCreationResponseModel; +import use_cases.task_management.event_creation_use_case.EventCreationInputBoundary; +import use_cases.task_management.event_creation_use_case.EventCreationRequestModel; +import use_cases.task_management.event_creation_use_case.EventCreationResponseModel; import java.time.LocalDateTime; diff --git a/src/main/java/event_creation_screens/EventCreationFailed.java b/src/main/java/screens/task_management/event_creation_screens/EventCreationFailed.java similarity index 71% rename from src/main/java/event_creation_screens/EventCreationFailed.java rename to src/main/java/screens/task_management/event_creation_screens/EventCreationFailed.java index b2ffa56..467d65c 100644 --- a/src/main/java/event_creation_screens/EventCreationFailed.java +++ b/src/main/java/screens/task_management/event_creation_screens/EventCreationFailed.java @@ -1,4 +1,4 @@ -package event_creation_screens; +package screens.task_management.event_creation_screens; public class EventCreationFailed extends RuntimeException { public EventCreationFailed(String error) { diff --git a/src/main/java/event_creation_screens/EventCreationResponseFormatter.java b/src/main/java/screens/task_management/event_creation_screens/EventCreationResponseFormatter.java similarity index 61% rename from src/main/java/event_creation_screens/EventCreationResponseFormatter.java rename to src/main/java/screens/task_management/event_creation_screens/EventCreationResponseFormatter.java index 5e576c6..609ad02 100644 --- a/src/main/java/event_creation_screens/EventCreationResponseFormatter.java +++ b/src/main/java/screens/task_management/event_creation_screens/EventCreationResponseFormatter.java @@ -1,7 +1,7 @@ -package event_creation_screens; +package screens.task_management.event_creation_screens; -import event_creation_use_case.EventCreationPresenter; -import event_creation_use_case.EventCreationResponseModel; +import use_cases.task_management.event_creation_use_case.EventCreationPresenter; +import use_cases.task_management.event_creation_use_case.EventCreationResponseModel; public class EventCreationResponseFormatter implements EventCreationPresenter { diff --git a/src/main/java/event_creation_screens/EventCreationScreen.java b/src/main/java/screens/task_management/event_creation_screens/EventCreationScreen.java similarity index 97% rename from src/main/java/event_creation_screens/EventCreationScreen.java rename to src/main/java/screens/task_management/event_creation_screens/EventCreationScreen.java index 87c9bab..4036f9c 100644 --- a/src/main/java/event_creation_screens/EventCreationScreen.java +++ b/src/main/java/screens/task_management/event_creation_screens/EventCreationScreen.java @@ -1,4 +1,4 @@ -package event_creation_screens; +package screens.task_management.event_creation_screens; import screens.LabelCheckBox; import screens.LabelTextPanel; @@ -7,8 +7,6 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.time.LocalDateTime; import static javax.swing.JOptionPane.showMessageDialog; diff --git a/src/main/java/event_edit_screens/EventEditController.java b/src/main/java/screens/task_management/event_edit_screens/EventEditController.java similarity index 68% rename from src/main/java/event_edit_screens/EventEditController.java rename to src/main/java/screens/task_management/event_edit_screens/EventEditController.java index 1ba9cb5..3039d26 100644 --- a/src/main/java/event_edit_screens/EventEditController.java +++ b/src/main/java/screens/task_management/event_edit_screens/EventEditController.java @@ -1,9 +1,9 @@ -package event_edit_screens; +package screens.task_management.event_edit_screens; import entities.Event; -import event_edit_use_case.EventEditInputBoundary; -import event_edit_use_case.EventEditRequestModel; -import event_edit_use_case.EventEditResponseModel; +import use_cases.task_management.event_edit_use_case.EventEditInputBoundary; +import use_cases.task_management.event_edit_use_case.EventEditRequestModel; +import use_cases.task_management.event_edit_use_case.EventEditResponseModel; import java.time.LocalDateTime; diff --git a/src/main/java/task_deletion_screens/TaskDeletionController.java b/src/main/java/screens/task_management/task_deletion_screens/TaskDeletionController.java similarity index 70% rename from src/main/java/task_deletion_screens/TaskDeletionController.java rename to src/main/java/screens/task_management/task_deletion_screens/TaskDeletionController.java index e46a486..56448af 100644 --- a/src/main/java/task_deletion_screens/TaskDeletionController.java +++ b/src/main/java/screens/task_management/task_deletion_screens/TaskDeletionController.java @@ -1,11 +1,11 @@ -package task_deletion_screens; +package screens.task_management.task_deletion_screens; import entities.Course; import entities.StudentUser; import entities.Task; -import task_deletion_use_case.TaskDeletionInputBoundary; -import task_deletion_use_case.TaskDeletionRequestModel; -import task_deletion_use_case.TaskDeletionResponseModel; +import use_cases.task_management.task_deletion_use_case.TaskDeletionInputBoundary; +import use_cases.task_management.task_deletion_use_case.TaskDeletionRequestModel; +import use_cases.task_management.task_deletion_use_case.TaskDeletionResponseModel; public class TaskDeletionController { final TaskDeletionInputBoundary input; diff --git a/src/main/java/test_creation_screens/TestCreationController.java b/src/main/java/screens/task_management/test_creation_screens/TestCreationController.java similarity index 63% rename from src/main/java/test_creation_screens/TestCreationController.java rename to src/main/java/screens/task_management/test_creation_screens/TestCreationController.java index 143cdd3..cd168ae 100644 --- a/src/main/java/test_creation_screens/TestCreationController.java +++ b/src/main/java/screens/task_management/test_creation_screens/TestCreationController.java @@ -1,8 +1,8 @@ -package test_creation_screens; +package screens.task_management.test_creation_screens; -import test_creation_use_case.TestCreationInputBoundary; -import test_creation_use_case.TestCreationRequestModel; -import test_creation_use_case.TestCreationResponseModel; +import use_cases.task_management.test_creation_use_case.TestCreationInputBoundary; +import use_cases.task_management.test_creation_use_case.TestCreationRequestModel; +import use_cases.task_management.test_creation_use_case.TestCreationResponseModel; import java.time.LocalDateTime; diff --git a/src/main/java/test_edit_screens/TestEditController.java b/src/main/java/screens/task_management/test_edit_screens/TestEditController.java similarity index 66% rename from src/main/java/test_edit_screens/TestEditController.java rename to src/main/java/screens/task_management/test_edit_screens/TestEditController.java index 3477d9e..82d087f 100644 --- a/src/main/java/test_edit_screens/TestEditController.java +++ b/src/main/java/screens/task_management/test_edit_screens/TestEditController.java @@ -1,9 +1,9 @@ -package test_edit_screens; +package screens.task_management.test_edit_screens; import entities.Test; -import test_edit_use_case.TestEditInputBoundary; -import test_edit_use_case.TestEditRequestModel; -import test_edit_use_case.TestEditResponseModel; +import use_cases.task_management.test_edit_use_case.TestEditInputBoundary; +import use_cases.task_management.test_edit_use_case.TestEditRequestModel; +import use_cases.task_management.test_edit_use_case.TestEditResponseModel; import java.time.LocalDateTime; diff --git a/src/main/java/tasks_to_student_tasklist_use_case/TaskToTasklistPresenter.java b/src/main/java/tasks_to_student_tasklist_use_case/TaskToTasklistPresenter.java deleted file mode 100644 index 66f3c46..0000000 --- a/src/main/java/tasks_to_student_tasklist_use_case/TaskToTasklistPresenter.java +++ /dev/null @@ -1,4 +0,0 @@ -package tasks_to_student_tasklist_use_case; - -public interface TaskToTasklistPresenter { -} diff --git a/src/main/java/schedule_conflict_use_case/ScheduleConflictPresenter.java b/src/main/java/use_cases/calendar_scheduler/schedule_conflict_use_case/ScheduleConflictPresenter.java similarity index 79% rename from src/main/java/schedule_conflict_use_case/ScheduleConflictPresenter.java rename to src/main/java/use_cases/calendar_scheduler/schedule_conflict_use_case/ScheduleConflictPresenter.java index 02d540c..9d68698 100644 --- a/src/main/java/schedule_conflict_use_case/ScheduleConflictPresenter.java +++ b/src/main/java/use_cases/calendar_scheduler/schedule_conflict_use_case/ScheduleConflictPresenter.java @@ -1,4 +1,4 @@ -package schedule_conflict_use_case; +package use_cases.calendar_scheduler.schedule_conflict_use_case; public interface ScheduleConflictPresenter { diff --git a/src/main/java/schedule_conflict_use_case/ScheduleConflictRequestModel.java b/src/main/java/use_cases/calendar_scheduler/schedule_conflict_use_case/ScheduleConflictRequestModel.java similarity index 89% rename from src/main/java/schedule_conflict_use_case/ScheduleConflictRequestModel.java rename to src/main/java/use_cases/calendar_scheduler/schedule_conflict_use_case/ScheduleConflictRequestModel.java index 74e54cf..efaa88e 100644 --- a/src/main/java/schedule_conflict_use_case/ScheduleConflictRequestModel.java +++ b/src/main/java/use_cases/calendar_scheduler/schedule_conflict_use_case/ScheduleConflictRequestModel.java @@ -1,4 +1,4 @@ -package schedule_conflict_use_case; +package use_cases.calendar_scheduler.schedule_conflict_use_case; import entities.Task; diff --git a/src/main/java/schedule_conflict_use_case/ScheduleConflictResponseModel.java b/src/main/java/use_cases/calendar_scheduler/schedule_conflict_use_case/ScheduleConflictResponseModel.java similarity index 89% rename from src/main/java/schedule_conflict_use_case/ScheduleConflictResponseModel.java rename to src/main/java/use_cases/calendar_scheduler/schedule_conflict_use_case/ScheduleConflictResponseModel.java index 8ef17c9..fc01a8f 100644 --- a/src/main/java/schedule_conflict_use_case/ScheduleConflictResponseModel.java +++ b/src/main/java/use_cases/calendar_scheduler/schedule_conflict_use_case/ScheduleConflictResponseModel.java @@ -1,4 +1,4 @@ -package schedule_conflict_use_case; +package use_cases.calendar_scheduler.schedule_conflict_use_case; public class ScheduleConflictResponseModel { diff --git a/src/main/java/scheduler_use_case/SchedulerController.java b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerController.java similarity index 54% rename from src/main/java/scheduler_use_case/SchedulerController.java rename to src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerController.java index 4674ac7..c42f140 100644 --- a/src/main/java/scheduler_use_case/SchedulerController.java +++ b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerController.java @@ -1,9 +1,10 @@ -package scheduler_use_case; +package use_cases.calendar_scheduler.scheduler_use_case; +import entities.Event; import entities.StudentUser; -import entities.Task; +import use_cases.task_management.event_creation_use_case.EventCreationResponseModel; -import java.util.ArrayList; +import java.time.LocalDateTime; public class SchedulerController { @@ -22,10 +23,12 @@ public SchedulerController(SchedulerInputBoundary taskInput) { /** * Create a request model with the given task and return the corresponding response model - * @param task - the given task + * @param responseModel - the created task's response model */ - SchedulerResponseModel schedule(Task task, ArrayList allTasks, StudentUser user) { - SchedulerRequestModel requestModel = new SchedulerRequestModel(task, allTasks, user); + public SchedulerResponseModel schedule(EventCreationResponseModel responseModel) { + Event task = new Event("test", "test", 0, LocalDateTime.now(), LocalDateTime.now(), false, null); + StudentUser user = new StudentUser("test", "test"); + SchedulerRequestModel requestModel = new SchedulerRequestModel(task, user); return taskInput.schedule(requestModel); } diff --git a/src/main/java/scheduler_use_case/SchedulerInputBoundary.java b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerInputBoundary.java similarity index 81% rename from src/main/java/scheduler_use_case/SchedulerInputBoundary.java rename to src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerInputBoundary.java index 4bdca04..71070e9 100644 --- a/src/main/java/scheduler_use_case/SchedulerInputBoundary.java +++ b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerInputBoundary.java @@ -1,4 +1,4 @@ -package scheduler_use_case; +package use_cases.calendar_scheduler.scheduler_use_case; public interface SchedulerInputBoundary { diff --git a/src/main/java/scheduler_use_case/SchedulerInteractor.java b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerInteractor.java similarity index 95% rename from src/main/java/scheduler_use_case/SchedulerInteractor.java rename to src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerInteractor.java index ec1e1ed..ae7e9b8 100644 --- a/src/main/java/scheduler_use_case/SchedulerInteractor.java +++ b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerInteractor.java @@ -1,12 +1,12 @@ -package scheduler_use_case; +package use_cases.calendar_scheduler.scheduler_use_case; import entities.Preparatory; import entities.StudentUser; import entities.Task; import entities.Timeblockable; -import schedule_conflict_use_case.ScheduleConflictPresenter; -import schedule_conflict_use_case.ScheduleConflictRequestModel; -import schedule_conflict_use_case.ScheduleConflictResponseModel; +import use_cases.calendar_scheduler.schedule_conflict_use_case.ScheduleConflictPresenter; +import use_cases.calendar_scheduler.schedule_conflict_use_case.ScheduleConflictRequestModel; +import use_cases.calendar_scheduler.schedule_conflict_use_case.ScheduleConflictResponseModel; import java.time.Duration; import java.time.LocalDate; diff --git a/src/main/java/scheduler_use_case/SchedulerPresenter.java b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerPresenter.java similarity index 89% rename from src/main/java/scheduler_use_case/SchedulerPresenter.java rename to src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerPresenter.java index 31c4214..2b54ae5 100644 --- a/src/main/java/scheduler_use_case/SchedulerPresenter.java +++ b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerPresenter.java @@ -1,4 +1,4 @@ -package scheduler_use_case; +package use_cases.calendar_scheduler.scheduler_use_case; public interface SchedulerPresenter { diff --git a/src/main/java/scheduler_use_case/SchedulerRequestModel.java b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerRequestModel.java similarity index 76% rename from src/main/java/scheduler_use_case/SchedulerRequestModel.java rename to src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerRequestModel.java index f2c8f00..0bde48c 100644 --- a/src/main/java/scheduler_use_case/SchedulerRequestModel.java +++ b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerRequestModel.java @@ -1,4 +1,4 @@ -package scheduler_use_case; +package use_cases.calendar_scheduler.scheduler_use_case; import entities.StudentUser; import entities.Task; @@ -13,11 +13,11 @@ public class SchedulerRequestModel { /** * Creates a request model with the given input - * @param task - the given Task - * @param allTasks - the given user's to-do list - * @param user - the given StudentUser + * @param task - the newly created task + * @param user - the student currently logged in */ - public SchedulerRequestModel(Task task, ArrayList allTasks, StudentUser user) { + public SchedulerRequestModel(Task task, StudentUser user) { + this.task = task; this.allTasks = allTasks; this.user = user; diff --git a/src/main/java/scheduler_use_case/SchedulerResponseModel.java b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerResponseModel.java similarity index 92% rename from src/main/java/scheduler_use_case/SchedulerResponseModel.java rename to src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerResponseModel.java index ce51473..3eb653d 100644 --- a/src/main/java/scheduler_use_case/SchedulerResponseModel.java +++ b/src/main/java/use_cases/calendar_scheduler/scheduler_use_case/SchedulerResponseModel.java @@ -1,4 +1,4 @@ -package scheduler_use_case; +package use_cases.calendar_scheduler.scheduler_use_case; import entities.Task; diff --git a/src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationInputBoundary.java b/src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationInputBoundary.java similarity index 65% rename from src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationInputBoundary.java rename to src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationInputBoundary.java index 2be69e3..59c43b1 100644 --- a/src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationInputBoundary.java +++ b/src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationInputBoundary.java @@ -1,6 +1,4 @@ -package collaborative_task_creation_use_case; - -import entities.CollaborativeTask; +package use_cases.collaborative_task_management.collaborative_task_creation_use_case; public interface CollaborativeTaskCreationInputBoundary { CollaborativeTaskCreationResponseModel create(CollaborativeTaskCreationRequestModel requestModel); diff --git a/src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationInteractor.java b/src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationInteractor.java similarity index 92% rename from src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationInteractor.java rename to src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationInteractor.java index 776053c..000832e 100644 --- a/src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationInteractor.java +++ b/src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationInteractor.java @@ -1,9 +1,9 @@ -package collaborative_task_creation_use_case; +package use_cases.collaborative_task_management.collaborative_task_creation_use_case; import entities.CollaborativeTask; import entities.StudentUser; import entities.TaskMap; -import read_write.*; +import use_cases.task_management.read_write.TaskReadWrite; import java.time.LocalDateTime; diff --git a/src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationPresenter.java b/src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationPresenter.java similarity index 76% rename from src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationPresenter.java rename to src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationPresenter.java index d432461..c36c8c0 100644 --- a/src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationPresenter.java +++ b/src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationPresenter.java @@ -1,6 +1,4 @@ -package collaborative_task_creation_use_case; - -import entities.CollaborativeTask; +package use_cases.collaborative_task_management.collaborative_task_creation_use_case; public interface CollaborativeTaskCreationPresenter { CollaborativeTaskCreationResponseModel prepareSuccessView(CollaborativeTaskCreationResponseModel collaborativeTaskCreationResponseModel); diff --git a/src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationRequestModel.java b/src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationRequestModel.java similarity index 94% rename from src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationRequestModel.java rename to src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationRequestModel.java index 9fa8de5..2fe5471 100644 --- a/src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationRequestModel.java +++ b/src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationRequestModel.java @@ -1,4 +1,4 @@ -package collaborative_task_creation_use_case; +package use_cases.collaborative_task_management.collaborative_task_creation_use_case; import entities.CollaborativeTask; import entities.StudentUser; diff --git a/src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationResponseModel.java b/src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationResponseModel.java similarity index 88% rename from src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationResponseModel.java rename to src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationResponseModel.java index ff4f98c..1f967bf 100644 --- a/src/main/java/collaborative_task_creation_use_case/CollaborativeTaskCreationResponseModel.java +++ b/src/main/java/use_cases/collaborative_task_management/collaborative_task_creation_use_case/CollaborativeTaskCreationResponseModel.java @@ -1,4 +1,4 @@ -package collaborative_task_creation_use_case; +package use_cases.collaborative_task_management.collaborative_task_creation_use_case; import entities.CollaborativeTask; import entities.StudentUser; diff --git a/src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditInputBoundary.java b/src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditInputBoundary.java similarity index 64% rename from src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditInputBoundary.java rename to src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditInputBoundary.java index a5bf1a8..4c32c7b 100644 --- a/src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditInputBoundary.java +++ b/src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditInputBoundary.java @@ -1,6 +1,4 @@ -package collaborative_task_edit_use_case; - -import entities.CollaborativeTask; +package use_cases.collaborative_task_management.collaborative_task_edit_use_case; public interface CollaborativeTaskEditInputBoundary { CollaborativeTaskEditResponseModel edit(CollaborativeTaskEditRequestModel requestModel); diff --git a/src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditInteractor.java b/src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditInteractor.java similarity index 90% rename from src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditInteractor.java rename to src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditInteractor.java index 3295ef8..0f06d4c 100644 --- a/src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditInteractor.java +++ b/src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditInteractor.java @@ -1,11 +1,7 @@ -package collaborative_task_edit_use_case; +package use_cases.collaborative_task_management.collaborative_task_edit_use_case; -import collaborative_task_creation_use_case.CollaborativeTaskCreationResponseModel; -import entities.CollaborativeTask; import entities.StudentUser; -import java.util.ArrayList; - public class CollaborativeTaskEditInteractor implements CollaborativeTaskEditInputBoundary { private final CollaborativeTaskEditPresenter presenter; private final StudentUser student; diff --git a/src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditPresenter.java b/src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditPresenter.java similarity index 75% rename from src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditPresenter.java rename to src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditPresenter.java index 22aa207..af098b4 100644 --- a/src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditPresenter.java +++ b/src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditPresenter.java @@ -1,6 +1,4 @@ -package collaborative_task_edit_use_case; - -import entities.CollaborativeTask; +package use_cases.collaborative_task_management.collaborative_task_edit_use_case; public interface CollaborativeTaskEditPresenter { CollaborativeTaskEditResponseModel prepareSuccessView(CollaborativeTaskEditResponseModel collaborativeTaskEditResponseModel); diff --git a/src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditRequestModel.java b/src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditRequestModel.java similarity index 96% rename from src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditRequestModel.java rename to src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditRequestModel.java index 44b9abc..40bb026 100644 --- a/src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditRequestModel.java +++ b/src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditRequestModel.java @@ -1,4 +1,4 @@ -package collaborative_task_edit_use_case; +package use_cases.collaborative_task_management.collaborative_task_edit_use_case; import entities.CollaborativeTask; import entities.StudentUser; diff --git a/src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditResponseModel.java b/src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditResponseModel.java similarity index 89% rename from src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditResponseModel.java rename to src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditResponseModel.java index d133967..4939f25 100644 --- a/src/main/java/collaborative_task_edit_use_case/CollaborativeTaskEditResponseModel.java +++ b/src/main/java/use_cases/collaborative_task_management/collaborative_task_edit_use_case/CollaborativeTaskEditResponseModel.java @@ -1,4 +1,4 @@ -package collaborative_task_edit_use_case; +package use_cases.collaborative_task_management.collaborative_task_edit_use_case; import entities.StudentUser; diff --git a/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTInputBoundary.java b/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTInputBoundary.java new file mode 100644 index 0000000..06dd107 --- /dev/null +++ b/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTInputBoundary.java @@ -0,0 +1,21 @@ +package use_cases.collaborative_task_scheduling.scheduling_ct_use_case; + +import entities.Task; + +import java.util.HashMap; + +/** + * Input Boundary interface for the Scheduling Collaborative Tasks Use Case + * (inverts dependency from Controller to Interactor) + */ + +public interface ScheduleCTInputBoundary { + + /** + * The method implemented in ScheduleCTInteractor that schedules the task given the inputs + * @param scheduleCTRequestModel - the scheduleCTRequestModel (i.e. information given from the user) + * @param hashMap - hash map of task ids mapped to Task objects + * @return a scheduleCTResponseModel + */ + ScheduleCTResponseModel schedule(ScheduleCTRequestModel scheduleCTRequestModel, HashMap hashMap); +} \ No newline at end of file diff --git a/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTInteractor.java b/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTInteractor.java new file mode 100644 index 0000000..2b54fd3 --- /dev/null +++ b/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTInteractor.java @@ -0,0 +1,402 @@ +package use_cases.collaborative_task_scheduling.scheduling_ct_use_case; + +import entities.*; + +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; + +/** + * Scheduling Collaborative Tasks Use Case Interactor (use case layer) + * Implements business logic on entities + */ + +public class ScheduleCTInteractor implements ScheduleCTInputBoundary { + private final ScheduleCTOutputBoundary scheduleCTOutputBoundary; + + public ScheduleCTInteractor(ScheduleCTOutputBoundary scheduleCTOutputBoundary) { + this.scheduleCTOutputBoundary = scheduleCTOutputBoundary; + } + + /** + * The main controller of this interactor that calls the helper methods + */ + @Override + public ScheduleCTResponseModel schedule(ScheduleCTRequestModel requestModel, HashMap hashMap) { + + CollaborativeTask task = getTaskObjectFromName(requestModel.getTaskName(), hashMap); + + if (requestModel.getStudentUser() != task.getLeader()) { + return scheduleCTOutputBoundary.prepareFailView("User is not the leader. " + + "You do not have scheduling access"); + } + + ArrayList users = task.getTeammates(); + users.add(task.getLeader()); + + ArrayList unavailableUsers = new ArrayList<>(); + + LocalDateTime startTime = convertStringToLocalDateTime(requestModel.getStartTime()); + LocalDateTime endTime = convertStringToLocalDateTime(requestModel.getEndTime()); + + for (StudentUser user : users) { + ArrayList userTasks = getAllTaskFromIdExceptOne(task, user, hashMap); + // isUserAvailableAtDateTime returns false if not available + // if isUserAvailableAtDateTime is false, add it to the list of unavailable users + if (!isUserAvailableAtDateTime(user, userTasks, startTime, endTime)) { + unavailableUsers.add(user); + } + } + // if unavailableUser is empty, that means that the users are free and there's no conflict + if (unavailableUsers.isEmpty()) { + // if task is recurring and the frequency is not an empty string + ArrayList> dates = getDates(task.getFrequency(), startTime, endTime, task.getDeadline()); + + // initialize ArrayList for all the formatted strings + ArrayList formattedDateTimes = new ArrayList<>(); + + for (ArrayList possibleTimeBlock : dates) { + LocalDateTime possibleTimeStart = possibleTimeBlock.get(0); + LocalDateTime possibleTimeEnd = possibleTimeBlock.get(1); + String formattedTimeBlock = convertLocalDateTimeToString(possibleTimeStart, possibleTimeEnd); + formattedDateTimes.add(formattedTimeBlock); + } + + ScheduleCTResponseModel scheduleCTResponseModel = new ScheduleCTResponseModel(false, formattedDateTimes); + scheduleCTResponseModel.setTimesToSchedule(dates); + task.setTimeBlocks(dates); + + return scheduleCTOutputBoundary.prepareNoConflictView(scheduleCTResponseModel); + // branches into else when there is a conflict + } else { + // ScheduleCTResponseModel scheduleCTResponseModel = new ScheduleCTResponseModel(true); + return scheduleCTOutputBoundary.prepareFailView("Cannot schedule due to conflict. " + + "Try another time if you'd like to. :')"); + } + } + + /** + * Finds all the dates to meet up given the frequency of a task + * @param frequency - either "daily", "weekly" or "monthly" + * @param startTime - the start time of the time block + * @param endTime - the end time of the time block + * @param deadline - the deadline of the task + * @return an array list of array lists of local date time (i.e. the dates to meet up) + */ + public ArrayList> getDates(String frequency, LocalDateTime startTime, LocalDateTime endTime, LocalDateTime deadline) { + ArrayList> times = new ArrayList<>(); + ArrayList initialTime = new ArrayList<>(); + initialTime.add(startTime); + initialTime.add(endTime); + times.add(initialTime); + + LocalDateTime currStart = startTime; + LocalDateTime currEnd = endTime; + + if (frequency.equals("daily")) { + while (currEnd.plusDays(1).isBefore(deadline)) { + ArrayList date = new ArrayList<>(); + currStart = currStart.plusDays(1); + currEnd = currEnd.plusDays(1); + + date.add(currStart); + date.add(currEnd); + times.add(date); + } + } else if (frequency.equals("weekly")) { + while (currEnd.plusWeeks(1).isBefore(deadline)) { + ArrayList date = new ArrayList<>(); + currStart = currStart.plusWeeks(1); + currEnd = currEnd.plusWeeks(1); + + date.add(currStart); + date.add(currEnd); + times.add(date); + } + } else if (frequency.equals("monthly")) { + while (currEnd.plusMonths(1).isBefore(deadline)) { + ArrayList date = new ArrayList<>(); + currStart = currStart.plusMonths(1); + currEnd = currEnd.plusMonths(1); + + date.add(currStart); + date.add(currEnd); + times.add(date); + } + } + return times; + } + + /** + * Check if a user is available at a fixed date time + * @param user - the student user + * @param tasks - an array list of a user's tasks + * @param start - the start time of the time block + * @param end -the end time of the time block + * @return true if user is available, return false is user is not available + */ + public boolean isUserAvailableAtDateTime(StudentUser user, ArrayList tasks, LocalDateTime start, + LocalDateTime end) { + // assume there's a method in TaskUseCase that gets all the tasks a student has + + ArrayList isAvailable = new ArrayList<>(); + + boolean is_working_hours_free = true; + for (Task task : tasks) { + if (task instanceof Event) { + if (((Event) task).getTimeBlock() != null) { + isAvailable.add(eventFree((Event) task, start, end)); + } + } else if (task instanceof Test) { + if (((Test) task).getTimeBlock() != null) { + isAvailable.add(testFree((Test) task, start, end)); + } + } else if (task instanceof Assignment) { + if (((Assignment) task).getPrepTimeScheduled() != null) { + isAvailable.add(assignmentFree((Assignment) task, start, end)); + } + } else if (task instanceof CollaborativeTask) { + if (((CollaborativeTask) task).getTimeBlocks() != null) { + isAvailable.add(collaborativeTaskFree((CollaborativeTask) task, start, end)); + } + } + + } + if (user.getWorkingHours() != null) { + ArrayList workingHours = user.getWorkingHours(); + LocalTime workingHoursStart = workingHours.get(0); + LocalTime workingHoursEnd = workingHours.get(1); + if (!workingHoursFree(start, end, workingHoursStart, workingHoursEnd)) { + is_working_hours_free = false; + } + } + // is_task_free is true if the array list contains false; that means there is a conflict + boolean is_task_free = !(isAvailable.contains(false)); + return is_task_free && is_working_hours_free; + } + + /** + * Given a task that is an instance of Event, return whether any of the time blocks associated with that task + * does not conflict with the given time block + * @param event - the Event that you want to see if conflicts occur + * @param start - the start date and time of the time block + * @param end - the end date and time of the time block + * @return - true if there are no conflicts, false if there are conflicts + */ + public boolean eventFree(Event event, LocalDateTime start, LocalDateTime end) { + + LocalDateTime[] timeBlock = event.getTimeBlock(); + LocalDateTime timeBlockStart = timeBlock[0]; + LocalDateTime timeBlockEnd = timeBlock[1]; + return givenTime(timeBlockStart, timeBlockEnd, start, end); + } + + /** + * Given a task that is an instance of Test, return whether any of the time blocks associated with that task + * does not conflict with the given time block + * @param test - the Test that you want to see if conflicts occur + * @param start - the start date and time of the time block + * @param end - the end date and time of the time block + * @return - true if there are no conflicts, false if there are conflicts + */ + public boolean testFree(Test test, LocalDateTime start, LocalDateTime end) { + LocalDateTime[] timeBlock = test.getTimeBlock(); + LocalDateTime timeBlockStart = timeBlock[0]; + LocalDateTime timeBlockEnd = timeBlock[1]; + + boolean is_test_free = givenTime(timeBlockStart, timeBlockEnd, start, end); + + ArrayList> prepTime = test.getPrepTimeScheduled(); + + if (prepTime != null){ + for (ArrayList prep : prepTime) { + LocalDateTime prepStart = prep.get(0); + LocalDateTime prepEnd = prep.get(1); + + // if there is a conflict + if (!givenTime(prepStart, prepEnd, start, end)) { + is_test_free = false; + } + } + } + return is_test_free; + } + + /** + * Given a task that is an instance of Assignment, return whether any of the time blocks associated with that task + * does not conflict with the given time block + * @param assignment - the Assignment that you want to see if conflicts occur + * @param start - the start date and time of the time block + * @param end - the end date and time of the time block + * @return true if there are no conflicts, false if there are conflicts + */ + public boolean assignmentFree(Assignment assignment, LocalDateTime start, LocalDateTime end) { + + boolean is_assignment_free = true; + ArrayList> prepTime = assignment.getPrepTimeScheduled(); + + if (prepTime != null) { + for (ArrayList prep : prepTime) { + LocalDateTime prepStart = prep.get(0); + LocalDateTime prepEnd = prep.get(1); + if (!givenTime(prepStart, prepEnd, start, end)) { + is_assignment_free = false; + } + } + } + return is_assignment_free; + } + + /** + * Given a task that is an instance of CollaborativeTask, return whether any of the time blocks associated with that + * task does not conflict with the given time block + * @param collaborativeTask - the CollaborativeTask that you want to see if conflicts occur + * @param start - the start date and time of the time block + * @param end - the end date and time of the time block + * @return true if there are no conflicts, false if there are conflicts + */ + public boolean collaborativeTaskFree(CollaborativeTask collaborativeTask, LocalDateTime start, LocalDateTime end) { + boolean is_collaborative_task_free = true; + + ArrayList> meetingTimes = collaborativeTask.getTimeBlocks(); + if (meetingTimes != null) { + for (ArrayList timeBlock : meetingTimes) { + LocalDateTime timeStart = timeBlock.get(0); + LocalDateTime timeEnd = timeBlock.get(1); + if (!givenTime(timeStart, timeEnd, start, end)) { + is_collaborative_task_free = false; + } + } + } + return is_collaborative_task_free; + } + + /** + * Check if a time block conflicts with a user's working hours + * @param timeBlockStart - the start of the time block + * @param timeBlockEnd - the end of the time block + * @param workingHoursStart - the start of a user's working hours + * @param workingHoursEnd - the end of a user's working hours + * @return true if there are no conflict, false if there are conflicts + */ + public boolean workingHoursFree(LocalDateTime timeBlockStart, LocalDateTime timeBlockEnd, + LocalTime workingHoursStart, LocalTime workingHoursEnd) { + // if timeBlock is within working hours + if (timeBlockStart.getHour() > workingHoursStart.getHour() && + timeBlockEnd.getHour() < workingHoursEnd.getHour()) { + return false; + // if timeBlock covers whole working hours + } else if (timeBlockStart.getHour() < workingHoursStart.getHour() && + timeBlockEnd.getHour() > workingHoursEnd.getHour()) { + return false; + // if timeBlockStart is before workingHoursStart, timeBlockEnd is after workingHoursStart, + // and timeBlockEnd is before workingHoursEnd + } else if (timeBlockStart.getHour() < workingHoursStart.getHour() && + timeBlockEnd.getHour() > workingHoursStart.getHour() && + timeBlockEnd.getHour() < workingHoursEnd.getHour()) { + return false; + // if timeBlockStart is after workingHoursStart, timeBlockStart is before workingHoursEnd, + // and timeBlockEnd is after workingHoursEnd + } else if (timeBlockStart.getHour() > workingHoursStart.getHour() && + timeBlockStart.getHour() < workingHoursEnd.getHour() && + timeBlockEnd.getHour() > workingHoursEnd.getHour()) { + return false; + // if timeBlockEnd is equal to workingHoursEnd + } else if (timeBlockEnd.getHour() == workingHoursEnd.getHour()) { + return false; + // if timeBlockStart is equal to workingHoursStart + } else return timeBlockStart.getHour() != workingHoursStart.getHour(); + } + + /** + * Given two time blocks, return if they do not conflict + * @param timeBlockStart - the start of the time block in a user's tasks + * @param timeBlockEnd - the end of the time block in a user's tasks + * @param start - the start of the time the user inputs + * @param end - the end of the time the user inputs + * @return true if there is no conflict, false is there is a conflict + */ + public boolean givenTime(LocalDateTime timeBlockStart, LocalDateTime timeBlockEnd, + LocalDateTime start, LocalDateTime end) { + // in the case where the time block is within the time of start and end + if (timeBlockStart.isAfter(start) && timeBlockEnd.isBefore(end)) { + return false; + // in the case where it covers the time period + } else if (timeBlockStart.isBefore(start) && timeBlockEnd.isAfter(end)) { + return false; + // in the case where timeBlockStart is before start, timeBlockEnd is after start, + // and timeBlockEnd is before end + } else if (timeBlockStart.isBefore(start) && timeBlockEnd.isAfter(start) && timeBlockEnd.isBefore(end)) { + return false; + // if the start time same as start time of block, return false + } else if (timeBlockStart.isEqual(start)) { + return false; + // if the end time same as end time of block, return false + } else if (timeBlockEnd.isEqual(end)) { + return false; + // in the case where timeBlockStart is after start time, timeBlockStart is before end time + // and timeBlockEnd is after end time + } else return !(timeBlockStart.isAfter(start) && timeBlockStart.isBefore(end) && timeBlockEnd.isAfter(end)); + } + + /** + * Retrieve the tasks associated with a user from the given hash map, other than the task that you want scheduled + * (remove that task or else when checking for conflicts, it might conflict with that task, don't want that) + * @param user - the student user + * @param hashMap - a hash map of all task ids to tasks + * @return an array list of tasks + */ + public ArrayList getAllTaskFromIdExceptOne(Task task, StudentUser user, HashMap hashMap) { + ArrayList userTasks = new ArrayList<>(); + + ArrayList toDoList = user.getToDoList(); + + for (String taskId : toDoList) { + Task task_value = hashMap.get(taskId); + userTasks.add(task_value); + } + userTasks.remove(task); + return userTasks; + } + + /** + * Get the task object from the task map given the name of the task + * @param taskName - the name of the task + * @param hashMap - hashmap of task ids to tasks + * @return the task object that corresponds to the task name, if it exists + */ + public CollaborativeTask getTaskObjectFromName(String taskName, HashMap hashMap) { + for (Task task : hashMap.values()) { + if (task.getTitle().equals(taskName) && task instanceof CollaborativeTask) { + return (CollaborativeTask) task; + } + } + throw new RuntimeException("Task does not exist"); + } + + /** + * Convert the given string to a LocalDateTime object + * @param stringTime - the string representation of a date time + * @return the string formatted as LocalDateTime + */ + public LocalDateTime convertStringToLocalDateTime(String stringTime) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); + return LocalDateTime.parse(stringTime, formatter); + } + + /** + * Convert the given LocalDateTime objects into a string + * @param start - the start time and date as a LocalDateTime object + * @param end - the end time and date as a LocalDateTime object + * @return the LocalDateTime objects concatenated as a string with the word "to" between + */ + public String convertLocalDateTimeToString(LocalDateTime start, LocalDateTime end) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); + String formattedStart = start.format(formatter); + String formattedEnd = end.format(formatter); + return formattedStart + " to " + formattedEnd; + } + +} \ No newline at end of file diff --git a/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTOutputBoundary.java b/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTOutputBoundary.java new file mode 100644 index 0000000..46b0f9c --- /dev/null +++ b/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTOutputBoundary.java @@ -0,0 +1,23 @@ +package use_cases.collaborative_task_scheduling.scheduling_ct_use_case; + +/** + * Output Boundary for the Scheduling Collaborative Tasks Use Case + * (inverts dependency for interactor to presenter) + */ + +public interface ScheduleCTOutputBoundary { + + /** + * The method implemented in the presenter that prepares the no conflict view when there is no conflict + * @param responseModel - a scheduleCTResponseModel + * @return a scheduleCTResponseModel + */ + ScheduleCTResponseModel prepareNoConflictView(ScheduleCTResponseModel responseModel); + + /** + * The method implemented in the presenter that prepares the fail view for when there is conflict + * @param error - the type of error that happened + * @return a scheduleCTResponseModel + */ + ScheduleCTResponseModel prepareFailView(String error); +} \ No newline at end of file diff --git a/src/main/java/scheduling_ct_use_case/ScheduleCTRequestModel.java b/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTRequestModel.java similarity index 79% rename from src/main/java/scheduling_ct_use_case/ScheduleCTRequestModel.java rename to src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTRequestModel.java index 7a09f6a..4d1b1bb 100644 --- a/src/main/java/scheduling_ct_use_case/ScheduleCTRequestModel.java +++ b/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTRequestModel.java @@ -1,4 +1,4 @@ -package scheduling_ct_use_case; +package use_cases.collaborative_task_scheduling.scheduling_ct_use_case; import entities.StudentUser; @@ -24,19 +24,16 @@ public ScheduleCTRequestModel(String taskName, String startTime, String endTime, this.studentUser = studentUser; } - public String getTaskName() { - return taskName; - } + public String getTaskName() { return taskName; } + public String getStartTime() { return startTime; } + public String getEndTime() { return endTime; } - public StudentUser getStudentUser() { - return studentUser; - } - + public StudentUser getStudentUser() { return studentUser; } -} +} \ No newline at end of file diff --git a/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTResponseModel.java b/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTResponseModel.java new file mode 100644 index 0000000..d029926 --- /dev/null +++ b/src/main/java/use_cases/collaborative_task_scheduling/scheduling_ct_use_case/ScheduleCTResponseModel.java @@ -0,0 +1,30 @@ +package use_cases.collaborative_task_scheduling.scheduling_ct_use_case; + +import java.time.LocalDateTime; +import java.util.ArrayList; + +/** + * Response Model for the Scheduling Collaborative Tasks Use Case + * Acts as the output data object in the use case layer + */ + +public class ScheduleCTResponseModel { + + private final boolean isConflict; + private final ArrayList scheduledTimes; + ArrayList> timesToSchedule; + + public ScheduleCTResponseModel(boolean isConflict, ArrayList scheduledTimes) { + + this.isConflict = isConflict; + this.scheduledTimes = scheduledTimes; + } + + public ArrayList getScheduledTimes() { + return scheduledTimes; + } + + public void setTimesToSchedule(ArrayList> timesToSchedule) { + this.timesToSchedule = timesToSchedule; + } +} diff --git a/src/main/java/course_creation_use_case/CourseCreationDsGateway.java b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationDsGateway.java similarity index 81% rename from src/main/java/course_creation_use_case/CourseCreationDsGateway.java rename to src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationDsGateway.java index 17dc902..19200df 100644 --- a/src/main/java/course_creation_use_case/CourseCreationDsGateway.java +++ b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationDsGateway.java @@ -1,4 +1,4 @@ -package course_creation_use_case; +package use_cases.course_features.course_creation_use_case; // Use case layer diff --git a/src/main/java/course_creation_use_case/CourseCreationInputBoundary.java b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationInputBoundary.java similarity index 83% rename from src/main/java/course_creation_use_case/CourseCreationInputBoundary.java rename to src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationInputBoundary.java index 95d4426..2a25f5c 100644 --- a/src/main/java/course_creation_use_case/CourseCreationInputBoundary.java +++ b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationInputBoundary.java @@ -1,4 +1,4 @@ -package course_creation_use_case; +package use_cases.course_features.course_creation_use_case; // Use case layer diff --git a/src/main/java/course_creation_use_case/CourseCreationInteractor.java b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationInteractor.java similarity index 95% rename from src/main/java/course_creation_use_case/CourseCreationInteractor.java rename to src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationInteractor.java index ebc0ce2..3bda6ea 100644 --- a/src/main/java/course_creation_use_case/CourseCreationInteractor.java +++ b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationInteractor.java @@ -1,10 +1,10 @@ -package course_creation_use_case; +package use_cases.course_features.course_creation_use_case; // Use case layer import entities.*; -import read_write.CourseReadWrite; -import read_write.TaskReadWrite; +//import read_write.CourseReadWrite; +//import read_write.TaskReadWrite; import java.util.ArrayList; diff --git a/src/main/java/course_creation_use_case/CourseCreationOutputBoundary.java b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationOutputBoundary.java similarity index 89% rename from src/main/java/course_creation_use_case/CourseCreationOutputBoundary.java rename to src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationOutputBoundary.java index 86e46df..84881b0 100644 --- a/src/main/java/course_creation_use_case/CourseCreationOutputBoundary.java +++ b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationOutputBoundary.java @@ -1,4 +1,4 @@ -package course_creation_use_case; +package use_cases.course_features.course_creation_use_case; // Use case layer diff --git a/src/main/java/course_creation_use_case/CourseCreationRequestModel.java b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationRequestModel.java similarity index 96% rename from src/main/java/course_creation_use_case/CourseCreationRequestModel.java rename to src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationRequestModel.java index 80341f5..da2a6dd 100644 --- a/src/main/java/course_creation_use_case/CourseCreationRequestModel.java +++ b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationRequestModel.java @@ -1,4 +1,4 @@ -package course_creation_use_case; +package use_cases.course_features.course_creation_use_case; // Use case layer diff --git a/src/main/java/course_creation_use_case/CourseCreationResponseModel.java b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationResponseModel.java similarity index 94% rename from src/main/java/course_creation_use_case/CourseCreationResponseModel.java rename to src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationResponseModel.java index 68708ab..a846056 100644 --- a/src/main/java/course_creation_use_case/CourseCreationResponseModel.java +++ b/src/main/java/use_cases/course_features/course_creation_use_case/CourseCreationResponseModel.java @@ -1,4 +1,4 @@ -package course_creation_use_case; +package use_cases.course_features.course_creation_use_case; import java.util.ArrayList; diff --git a/src/main/java/course_enrolment_use_case/CourseEnrolmentDsGateway.java b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentDsGateway.java similarity index 100% rename from src/main/java/course_enrolment_use_case/CourseEnrolmentDsGateway.java rename to src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentDsGateway.java diff --git a/src/main/java/course_enrolment_use_case/CourseEnrolmentInputBoundary.java b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentInputBoundary.java similarity index 71% rename from src/main/java/course_enrolment_use_case/CourseEnrolmentInputBoundary.java rename to src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentInputBoundary.java index 4e8e201..711e32d 100644 --- a/src/main/java/course_enrolment_use_case/CourseEnrolmentInputBoundary.java +++ b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentInputBoundary.java @@ -1,4 +1,4 @@ -package course_enrolment_use_case; +package use_cases.course_features.course_enrolment_use_case; // Use case layer diff --git a/src/main/java/course_enrolment_use_case/CourseEnrolmentInteractor.java b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentInteractor.java similarity index 98% rename from src/main/java/course_enrolment_use_case/CourseEnrolmentInteractor.java rename to src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentInteractor.java index af82ed2..c95f480 100644 --- a/src/main/java/course_enrolment_use_case/CourseEnrolmentInteractor.java +++ b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentInteractor.java @@ -1,4 +1,4 @@ -package course_enrolment_use_case; +package use_cases.course_features.course_enrolment_use_case; // Use case layer diff --git a/src/main/java/course_enrolment_use_case/CourseEnrolmentOutputBoundary.java b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentOutputBoundary.java similarity index 89% rename from src/main/java/course_enrolment_use_case/CourseEnrolmentOutputBoundary.java rename to src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentOutputBoundary.java index a747100..9693ffc 100644 --- a/src/main/java/course_enrolment_use_case/CourseEnrolmentOutputBoundary.java +++ b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentOutputBoundary.java @@ -1,4 +1,4 @@ -package course_enrolment_use_case; +package use_cases.course_features.course_enrolment_use_case; // Use case layer diff --git a/src/main/java/course_enrolment_use_case/CourseEnrolmentRequestModel.java b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentRequestModel.java similarity index 94% rename from src/main/java/course_enrolment_use_case/CourseEnrolmentRequestModel.java rename to src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentRequestModel.java index 1eeae6d..64bdcf2 100644 --- a/src/main/java/course_enrolment_use_case/CourseEnrolmentRequestModel.java +++ b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentRequestModel.java @@ -1,4 +1,4 @@ -package course_enrolment_use_case; +package use_cases.course_features.course_enrolment_use_case; // Use case layer diff --git a/src/main/java/course_enrolment_use_case/CourseEnrolmentResponseModel.java b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentResponseModel.java similarity index 91% rename from src/main/java/course_enrolment_use_case/CourseEnrolmentResponseModel.java rename to src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentResponseModel.java index ac8dea6..a6826f5 100644 --- a/src/main/java/course_enrolment_use_case/CourseEnrolmentResponseModel.java +++ b/src/main/java/use_cases/course_features/course_enrolment_use_case/CourseEnrolmentResponseModel.java @@ -1,4 +1,4 @@ -package course_enrolment_use_case; +package use_cases.course_features.course_enrolment_use_case; import java.util.ArrayList; diff --git a/src/main/java/progress_tracker_use_case/ProgressTrackerInputBoundary.java b/src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerInputBoundary.java similarity index 81% rename from src/main/java/progress_tracker_use_case/ProgressTrackerInputBoundary.java rename to src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerInputBoundary.java index 16e6841..59e4953 100644 --- a/src/main/java/progress_tracker_use_case/ProgressTrackerInputBoundary.java +++ b/src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerInputBoundary.java @@ -1,4 +1,4 @@ -package progress_tracker_use_case; +package use_cases.course_tracker.progress_tracker_use_case; /** * Input Boundary interface for the Progress Tracker Use Case diff --git a/src/main/java/progress_tracker_use_case/ProgressTrackerInteractor.java b/src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerInteractor.java similarity index 99% rename from src/main/java/progress_tracker_use_case/ProgressTrackerInteractor.java rename to src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerInteractor.java index 5178775..9b35a7f 100644 --- a/src/main/java/progress_tracker_use_case/ProgressTrackerInteractor.java +++ b/src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerInteractor.java @@ -1,4 +1,4 @@ -package progress_tracker_use_case; +package use_cases.course_tracker.progress_tracker_use_case; import entities.*; diff --git a/src/main/java/progress_tracker_use_case/ProgressTrackerOutputBoundary.java b/src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerOutputBoundary.java similarity index 83% rename from src/main/java/progress_tracker_use_case/ProgressTrackerOutputBoundary.java rename to src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerOutputBoundary.java index 47056c5..ae2e44b 100644 --- a/src/main/java/progress_tracker_use_case/ProgressTrackerOutputBoundary.java +++ b/src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerOutputBoundary.java @@ -1,4 +1,4 @@ -package progress_tracker_use_case; +package use_cases.course_tracker.progress_tracker_use_case; /** * Output Boundary for the Progress Tracker Use Case diff --git a/src/main/java/progress_tracker_use_case/ProgressTrackerRequestModel.java b/src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerRequestModel.java similarity index 97% rename from src/main/java/progress_tracker_use_case/ProgressTrackerRequestModel.java rename to src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerRequestModel.java index 935e007..8ff11e5 100644 --- a/src/main/java/progress_tracker_use_case/ProgressTrackerRequestModel.java +++ b/src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerRequestModel.java @@ -1,4 +1,4 @@ -package progress_tracker_use_case; +package use_cases.course_tracker.progress_tracker_use_case; import entities.Course; import entities.Task; diff --git a/src/main/java/progress_tracker_use_case/ProgressTrackerResponseModel.java b/src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerResponseModel.java similarity index 94% rename from src/main/java/progress_tracker_use_case/ProgressTrackerResponseModel.java rename to src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerResponseModel.java index 833f924..ff94f33 100644 --- a/src/main/java/progress_tracker_use_case/ProgressTrackerResponseModel.java +++ b/src/main/java/use_cases/course_tracker/progress_tracker_use_case/ProgressTrackerResponseModel.java @@ -1,4 +1,4 @@ -package progress_tracker_use_case; +package use_cases.course_tracker.progress_tracker_use_case; /** * Response Model for the Progress Tracker Use Case diff --git a/src/main/java/login_usecase/LoginGateway.java b/src/main/java/use_cases/login_registration/login_usecase/LoginGateway.java similarity index 81% rename from src/main/java/login_usecase/LoginGateway.java rename to src/main/java/use_cases/login_registration/login_usecase/LoginGateway.java index e8986b0..403d4f4 100644 --- a/src/main/java/login_usecase/LoginGateway.java +++ b/src/main/java/use_cases/login_registration/login_usecase/LoginGateway.java @@ -1,6 +1,6 @@ -package login_usecase; +package use_cases.login_registration.login_usecase; -import user_register_usecase.UserRegSaveRequest; +import use_cases.login_registration.user_register_usecase.UserRegSaveRequest; import java.util.Map; diff --git a/src/main/java/login_usecase/LoginInputBoundary.java b/src/main/java/use_cases/login_registration/login_usecase/LoginInputBoundary.java similarity index 77% rename from src/main/java/login_usecase/LoginInputBoundary.java rename to src/main/java/use_cases/login_registration/login_usecase/LoginInputBoundary.java index 8ddb83d..edc2491 100644 --- a/src/main/java/login_usecase/LoginInputBoundary.java +++ b/src/main/java/use_cases/login_registration/login_usecase/LoginInputBoundary.java @@ -1,6 +1,6 @@ -package login_usecase; +package use_cases.login_registration.login_usecase; -import screens.LoginFailed; +import screens.login_registration.LoginFailed; public interface LoginInputBoundary { diff --git a/src/main/java/login_usecase/LoginInteractor.java b/src/main/java/use_cases/login_registration/login_usecase/LoginInteractor.java similarity index 89% rename from src/main/java/login_usecase/LoginInteractor.java rename to src/main/java/use_cases/login_registration/login_usecase/LoginInteractor.java index 62ff85b..ccbe8b1 100644 --- a/src/main/java/login_usecase/LoginInteractor.java +++ b/src/main/java/use_cases/login_registration/login_usecase/LoginInteractor.java @@ -1,15 +1,14 @@ -package login_usecase; +package use_cases.login_registration.login_usecase; import entities.InstructorUser; import entities.StudentUser; import entities.User; -import screens.LoginFailed; -import user_register_usecase.InstructorSaveRequest; -import user_register_usecase.StudentSaveRequest; -import user_register_usecase.UserRegSaveRequest; +import screens.login_registration.LoginFailed; +import use_cases.login_registration.user_register_usecase.InstructorSaveRequest; +import use_cases.login_registration.user_register_usecase.StudentSaveRequest; +import use_cases.login_registration.user_register_usecase.UserRegSaveRequest; import java.time.LocalDateTime; -import java.util.HashMap; public class LoginInteractor implements LoginInputBoundary { diff --git a/src/main/java/login_usecase/LoginPresenter.java b/src/main/java/use_cases/login_registration/login_usecase/LoginPresenter.java similarity index 75% rename from src/main/java/login_usecase/LoginPresenter.java rename to src/main/java/use_cases/login_registration/login_usecase/LoginPresenter.java index 7e09fd1..d6da7ff 100644 --- a/src/main/java/login_usecase/LoginPresenter.java +++ b/src/main/java/use_cases/login_registration/login_usecase/LoginPresenter.java @@ -1,6 +1,6 @@ -package login_usecase; +package use_cases.login_registration.login_usecase; -import screens.LoginFailed; +import screens.login_registration.LoginFailed; public interface LoginPresenter { diff --git a/src/main/java/login_usecase/LoginRequestModel.java b/src/main/java/use_cases/login_registration/login_usecase/LoginRequestModel.java similarity index 92% rename from src/main/java/login_usecase/LoginRequestModel.java rename to src/main/java/use_cases/login_registration/login_usecase/LoginRequestModel.java index b97729f..4f1068a 100644 --- a/src/main/java/login_usecase/LoginRequestModel.java +++ b/src/main/java/use_cases/login_registration/login_usecase/LoginRequestModel.java @@ -1,4 +1,4 @@ -package login_usecase; +package use_cases.login_registration.login_usecase; public class LoginRequestModel { diff --git a/src/main/java/login_usecase/LoginResponseModel.java b/src/main/java/use_cases/login_registration/login_usecase/LoginResponseModel.java similarity index 93% rename from src/main/java/login_usecase/LoginResponseModel.java rename to src/main/java/use_cases/login_registration/login_usecase/LoginResponseModel.java index eb9d13b..3db6b5e 100644 --- a/src/main/java/login_usecase/LoginResponseModel.java +++ b/src/main/java/use_cases/login_registration/login_usecase/LoginResponseModel.java @@ -1,4 +1,4 @@ -package login_usecase; +package use_cases.login_registration.login_usecase; public class LoginResponseModel { diff --git a/src/main/java/logout_usecase/LogoutGateway.java b/src/main/java/use_cases/login_registration/logout_usecase/LogoutGateway.java similarity index 67% rename from src/main/java/logout_usecase/LogoutGateway.java rename to src/main/java/use_cases/login_registration/logout_usecase/LogoutGateway.java index ec48dc7..20952cf 100644 --- a/src/main/java/logout_usecase/LogoutGateway.java +++ b/src/main/java/use_cases/login_registration/logout_usecase/LogoutGateway.java @@ -1,6 +1,6 @@ -package logout_usecase; +package use_cases.login_registration.logout_usecase; -import user_register_usecase.UserRegSaveRequest; +import use_cases.login_registration.user_register_usecase.UserRegSaveRequest; import java.io.IOException; diff --git a/src/main/java/logout_usecase/LogoutInputBoundary.java b/src/main/java/use_cases/login_registration/logout_usecase/LogoutInputBoundary.java similarity index 83% rename from src/main/java/logout_usecase/LogoutInputBoundary.java rename to src/main/java/use_cases/login_registration/logout_usecase/LogoutInputBoundary.java index 05e0af2..e1f79c7 100644 --- a/src/main/java/logout_usecase/LogoutInputBoundary.java +++ b/src/main/java/use_cases/login_registration/logout_usecase/LogoutInputBoundary.java @@ -1,4 +1,4 @@ -package logout_usecase; +package use_cases.login_registration.logout_usecase; import java.io.IOException; diff --git a/src/main/java/logout_usecase/LogoutInteractor.java b/src/main/java/use_cases/login_registration/logout_usecase/LogoutInteractor.java similarity index 86% rename from src/main/java/logout_usecase/LogoutInteractor.java rename to src/main/java/use_cases/login_registration/logout_usecase/LogoutInteractor.java index d2858e3..cab36bb 100644 --- a/src/main/java/logout_usecase/LogoutInteractor.java +++ b/src/main/java/use_cases/login_registration/logout_usecase/LogoutInteractor.java @@ -1,10 +1,11 @@ -package logout_usecase; +package use_cases.login_registration.logout_usecase; import entities.InstructorUser; import entities.StudentUser; import entities.User; -import entities.UserFactory; -import user_register_usecase.*; +import use_cases.login_registration.user_register_usecase.InstructorSaveRequest; +import use_cases.login_registration.user_register_usecase.StudentSaveRequest; +import use_cases.login_registration.user_register_usecase.UserRegSaveRequest; import java.io.IOException; import java.time.LocalDateTime; diff --git a/src/main/java/logout_usecase/LogoutPresenter.java b/src/main/java/use_cases/login_registration/logout_usecase/LogoutPresenter.java similarity index 79% rename from src/main/java/logout_usecase/LogoutPresenter.java rename to src/main/java/use_cases/login_registration/logout_usecase/LogoutPresenter.java index 1da924b..8ed055e 100644 --- a/src/main/java/logout_usecase/LogoutPresenter.java +++ b/src/main/java/use_cases/login_registration/logout_usecase/LogoutPresenter.java @@ -1,4 +1,4 @@ -package logout_usecase; +package use_cases.login_registration.logout_usecase; public interface LogoutPresenter { diff --git a/src/main/java/use_cases/login_registration/logout_usecase/LogoutRequestModel.java b/src/main/java/use_cases/login_registration/logout_usecase/LogoutRequestModel.java new file mode 100644 index 0000000..7fbeeb2 --- /dev/null +++ b/src/main/java/use_cases/login_registration/logout_usecase/LogoutRequestModel.java @@ -0,0 +1,4 @@ +package use_cases.login_registration.logout_usecase; + +public class LogoutRequestModel { +} diff --git a/src/main/java/logout_usecase/LogoutResponseModel.java b/src/main/java/use_cases/login_registration/logout_usecase/LogoutResponseModel.java similarity index 92% rename from src/main/java/logout_usecase/LogoutResponseModel.java rename to src/main/java/use_cases/login_registration/logout_usecase/LogoutResponseModel.java index e68631f..02129bc 100644 --- a/src/main/java/logout_usecase/LogoutResponseModel.java +++ b/src/main/java/use_cases/login_registration/logout_usecase/LogoutResponseModel.java @@ -1,4 +1,4 @@ -package logout_usecase; +package use_cases.login_registration.logout_usecase; public class LogoutResponseModel { diff --git a/src/main/java/user_register_usecase/InstructorSaveRequest.java b/src/main/java/use_cases/login_registration/user_register_usecase/InstructorSaveRequest.java similarity index 94% rename from src/main/java/user_register_usecase/InstructorSaveRequest.java rename to src/main/java/use_cases/login_registration/user_register_usecase/InstructorSaveRequest.java index db22423..a5b1732 100644 --- a/src/main/java/user_register_usecase/InstructorSaveRequest.java +++ b/src/main/java/use_cases/login_registration/user_register_usecase/InstructorSaveRequest.java @@ -1,4 +1,4 @@ -package user_register_usecase; +package use_cases.login_registration.user_register_usecase; import entities.InstructorUser; diff --git a/src/main/java/user_register_usecase/StudentSaveRequest.java b/src/main/java/use_cases/login_registration/user_register_usecase/StudentSaveRequest.java similarity index 97% rename from src/main/java/user_register_usecase/StudentSaveRequest.java rename to src/main/java/use_cases/login_registration/user_register_usecase/StudentSaveRequest.java index 96306a2..ed1da82 100644 --- a/src/main/java/user_register_usecase/StudentSaveRequest.java +++ b/src/main/java/use_cases/login_registration/user_register_usecase/StudentSaveRequest.java @@ -1,11 +1,10 @@ -package user_register_usecase; +package use_cases.login_registration.user_register_usecase; import entities.StudentUser; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.ArrayList; -import java.util.HashMap; import java.util.Map; public class StudentSaveRequest extends UserRegSaveRequest { diff --git a/src/main/java/user_register_usecase/UserRegGateway.java b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegGateway.java similarity index 87% rename from src/main/java/user_register_usecase/UserRegGateway.java rename to src/main/java/use_cases/login_registration/user_register_usecase/UserRegGateway.java index 37e7136..89b6681 100644 --- a/src/main/java/user_register_usecase/UserRegGateway.java +++ b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegGateway.java @@ -1,4 +1,4 @@ -package user_register_usecase; +package use_cases.login_registration.user_register_usecase; // Use case layer diff --git a/src/main/java/user_register_usecase/UserRegInputBoundary.java b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegInputBoundary.java similarity index 84% rename from src/main/java/user_register_usecase/UserRegInputBoundary.java rename to src/main/java/use_cases/login_registration/user_register_usecase/UserRegInputBoundary.java index da171eb..44e2dd9 100644 --- a/src/main/java/user_register_usecase/UserRegInputBoundary.java +++ b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegInputBoundary.java @@ -1,4 +1,4 @@ -package user_register_usecase; +package use_cases.login_registration.user_register_usecase; // Use Case Layer diff --git a/src/main/java/user_register_usecase/UserRegInteractor.java b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegInteractor.java similarity index 97% rename from src/main/java/user_register_usecase/UserRegInteractor.java rename to src/main/java/use_cases/login_registration/user_register_usecase/UserRegInteractor.java index 84768b3..04be09a 100644 --- a/src/main/java/user_register_usecase/UserRegInteractor.java +++ b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegInteractor.java @@ -1,4 +1,4 @@ -package user_register_usecase; +package use_cases.login_registration.user_register_usecase; import entities.*; diff --git a/src/main/java/user_register_usecase/UserRegPresenter.java b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegPresenter.java similarity index 86% rename from src/main/java/user_register_usecase/UserRegPresenter.java rename to src/main/java/use_cases/login_registration/user_register_usecase/UserRegPresenter.java index 2cd18e4..5b25cee 100644 --- a/src/main/java/user_register_usecase/UserRegPresenter.java +++ b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegPresenter.java @@ -1,4 +1,4 @@ -package user_register_usecase; +package use_cases.login_registration.user_register_usecase; // Use Case Layer diff --git a/src/main/java/user_register_usecase/UserRegRequest.java b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegRequest.java similarity index 96% rename from src/main/java/user_register_usecase/UserRegRequest.java rename to src/main/java/use_cases/login_registration/user_register_usecase/UserRegRequest.java index af8f2d2..967b30f 100644 --- a/src/main/java/user_register_usecase/UserRegRequest.java +++ b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegRequest.java @@ -1,4 +1,4 @@ -package user_register_usecase; +package use_cases.login_registration.user_register_usecase; // Use Case Layer diff --git a/src/main/java/user_register_usecase/UserRegResponse.java b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegResponse.java similarity index 92% rename from src/main/java/user_register_usecase/UserRegResponse.java rename to src/main/java/use_cases/login_registration/user_register_usecase/UserRegResponse.java index 47d35ad..3a15dc5 100644 --- a/src/main/java/user_register_usecase/UserRegResponse.java +++ b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegResponse.java @@ -1,4 +1,4 @@ -package user_register_usecase; +package use_cases.login_registration.user_register_usecase; public class UserRegResponse { /** diff --git a/src/main/java/user_register_usecase/UserRegSaveRequest.java b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegSaveRequest.java similarity index 95% rename from src/main/java/user_register_usecase/UserRegSaveRequest.java rename to src/main/java/use_cases/login_registration/user_register_usecase/UserRegSaveRequest.java index cc2556c..851b146 100644 --- a/src/main/java/user_register_usecase/UserRegSaveRequest.java +++ b/src/main/java/use_cases/login_registration/user_register_usecase/UserRegSaveRequest.java @@ -1,4 +1,4 @@ -package user_register_usecase; +package use_cases.login_registration.user_register_usecase; import entities.InstructorUser; import entities.StudentUser; diff --git a/src/main/java/assignment_creation_use_case/AssignmentCreationInputBoundary.java b/src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationInputBoundary.java similarity index 69% rename from src/main/java/assignment_creation_use_case/AssignmentCreationInputBoundary.java rename to src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationInputBoundary.java index abf0bd2..2311ea7 100644 --- a/src/main/java/assignment_creation_use_case/AssignmentCreationInputBoundary.java +++ b/src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationInputBoundary.java @@ -1,4 +1,4 @@ -package assignment_creation_use_case; +package use_cases.task_management.assignment_creation_use_case; public interface AssignmentCreationInputBoundary { AssignmentCreationResponseModel create(AssignmentCreationRequestModel requestModel); diff --git a/src/main/java/assignment_creation_use_case/AssignmentCreationInteractor.java b/src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationInteractor.java similarity index 91% rename from src/main/java/assignment_creation_use_case/AssignmentCreationInteractor.java rename to src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationInteractor.java index 97d0b16..824c616 100644 --- a/src/main/java/assignment_creation_use_case/AssignmentCreationInteractor.java +++ b/src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationInteractor.java @@ -1,9 +1,9 @@ -package assignment_creation_use_case; +package use_cases.task_management.assignment_creation_use_case; import entities.Assignment; import entities.StudentUser; import entities.TaskMap; -import read_write.TaskReadWrite; +import use_cases.task_management.read_write.TaskReadWrite; import java.time.LocalDateTime; diff --git a/src/main/java/assignment_creation_use_case/AssignmentCreationPresenter.java b/src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationPresenter.java similarity index 77% rename from src/main/java/assignment_creation_use_case/AssignmentCreationPresenter.java rename to src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationPresenter.java index 929aa9e..46a9d9c 100644 --- a/src/main/java/assignment_creation_use_case/AssignmentCreationPresenter.java +++ b/src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationPresenter.java @@ -1,4 +1,4 @@ -package assignment_creation_use_case; +package use_cases.task_management.assignment_creation_use_case; public interface AssignmentCreationPresenter { AssignmentCreationResponseModel prepareSuccessView(AssignmentCreationResponseModel responseModel); diff --git a/src/main/java/assignment_creation_use_case/AssignmentCreationRequestModel.java b/src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationRequestModel.java similarity index 91% rename from src/main/java/assignment_creation_use_case/AssignmentCreationRequestModel.java rename to src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationRequestModel.java index 2713d14..a5a778a 100644 --- a/src/main/java/assignment_creation_use_case/AssignmentCreationRequestModel.java +++ b/src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationRequestModel.java @@ -1,4 +1,4 @@ -package assignment_creation_use_case; +package use_cases.task_management.assignment_creation_use_case; import java.time.LocalDateTime; diff --git a/src/main/java/assignment_creation_use_case/AssignmentCreationResponseModel.java b/src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationResponseModel.java similarity index 81% rename from src/main/java/assignment_creation_use_case/AssignmentCreationResponseModel.java rename to src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationResponseModel.java index bb91acb..ebf21ff 100644 --- a/src/main/java/assignment_creation_use_case/AssignmentCreationResponseModel.java +++ b/src/main/java/use_cases/task_management/assignment_creation_use_case/AssignmentCreationResponseModel.java @@ -1,4 +1,4 @@ -package assignment_creation_use_case; +package use_cases.task_management.assignment_creation_use_case; import java.time.LocalDateTime; diff --git a/src/main/java/assignment_edit_use_case/AssignmentEditInputBoundary.java b/src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditInputBoundary.java similarity index 68% rename from src/main/java/assignment_edit_use_case/AssignmentEditInputBoundary.java rename to src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditInputBoundary.java index 874149c..09a7d3e 100644 --- a/src/main/java/assignment_edit_use_case/AssignmentEditInputBoundary.java +++ b/src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditInputBoundary.java @@ -1,4 +1,4 @@ -package assignment_edit_use_case; +package use_cases.task_management.assignment_edit_use_case; public interface AssignmentEditInputBoundary { AssignmentEditResponseModel edit(AssignmentEditRequestModel requestModel); diff --git a/src/main/java/assignment_edit_use_case/AssignmentEditInteractor.java b/src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditInteractor.java similarity index 93% rename from src/main/java/assignment_edit_use_case/AssignmentEditInteractor.java rename to src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditInteractor.java index 035b7ed..58ca180 100644 --- a/src/main/java/assignment_edit_use_case/AssignmentEditInteractor.java +++ b/src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditInteractor.java @@ -1,4 +1,4 @@ -package assignment_edit_use_case; +package use_cases.task_management.assignment_edit_use_case; public class AssignmentEditInteractor implements AssignmentEditInputBoundary { AssignmentEditPresenter presenter; diff --git a/src/main/java/assignment_edit_use_case/AssignmentEditPresenter.java b/src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditPresenter.java similarity index 77% rename from src/main/java/assignment_edit_use_case/AssignmentEditPresenter.java rename to src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditPresenter.java index f40ba33..0795e1f 100644 --- a/src/main/java/assignment_edit_use_case/AssignmentEditPresenter.java +++ b/src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditPresenter.java @@ -1,4 +1,4 @@ -package assignment_edit_use_case; +package use_cases.task_management.assignment_edit_use_case; public interface AssignmentEditPresenter { AssignmentEditResponseModel prepareSuccessView(AssignmentEditResponseModel responseModel); diff --git a/src/main/java/assignment_edit_use_case/AssignmentEditRequestModel.java b/src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditRequestModel.java similarity index 93% rename from src/main/java/assignment_edit_use_case/AssignmentEditRequestModel.java rename to src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditRequestModel.java index 6e225c0..52ad09b 100644 --- a/src/main/java/assignment_edit_use_case/AssignmentEditRequestModel.java +++ b/src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditRequestModel.java @@ -1,4 +1,4 @@ -package assignment_edit_use_case; +package use_cases.task_management.assignment_edit_use_case; import entities.Assignment; diff --git a/src/main/java/assignment_edit_use_case/AssignmentEditResponseModel.java b/src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditResponseModel.java similarity index 71% rename from src/main/java/assignment_edit_use_case/AssignmentEditResponseModel.java rename to src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditResponseModel.java index 03c2650..cfa01d1 100644 --- a/src/main/java/assignment_edit_use_case/AssignmentEditResponseModel.java +++ b/src/main/java/use_cases/task_management/assignment_edit_use_case/AssignmentEditResponseModel.java @@ -1,4 +1,4 @@ -package assignment_edit_use_case; +package use_cases.task_management.assignment_edit_use_case; public class AssignmentEditResponseModel { String title; diff --git a/src/main/java/event_creation_use_case/EventCreationInputBoundary.java b/src/main/java/use_cases/task_management/event_creation_use_case/EventCreationInputBoundary.java similarity index 68% rename from src/main/java/event_creation_use_case/EventCreationInputBoundary.java rename to src/main/java/use_cases/task_management/event_creation_use_case/EventCreationInputBoundary.java index 5798614..48c9e22 100644 --- a/src/main/java/event_creation_use_case/EventCreationInputBoundary.java +++ b/src/main/java/use_cases/task_management/event_creation_use_case/EventCreationInputBoundary.java @@ -1,4 +1,4 @@ -package event_creation_use_case; +package use_cases.task_management.event_creation_use_case; public interface EventCreationInputBoundary { EventCreationResponseModel create(EventCreationRequestModel requestModel); diff --git a/src/main/java/event_creation_use_case/EventCreationInteractor.java b/src/main/java/use_cases/task_management/event_creation_use_case/EventCreationInteractor.java similarity index 60% rename from src/main/java/event_creation_use_case/EventCreationInteractor.java rename to src/main/java/use_cases/task_management/event_creation_use_case/EventCreationInteractor.java index d28193d..b0ead90 100644 --- a/src/main/java/event_creation_use_case/EventCreationInteractor.java +++ b/src/main/java/use_cases/task_management/event_creation_use_case/EventCreationInteractor.java @@ -1,9 +1,13 @@ -package event_creation_use_case; +package use_cases.task_management.event_creation_use_case; import entities.Event; import entities.StudentUser; import entities.TaskMap; -import read_write.*; +import use_cases.calendar_scheduler.schedule_conflict_use_case.ScheduleConflictPresenter; +import use_cases.calendar_scheduler.scheduler_use_case.SchedulerInteractor; +import use_cases.calendar_scheduler.scheduler_use_case.SchedulerPresenter; +import use_cases.calendar_scheduler.scheduler_use_case.SchedulerRequestModel; +import use_cases.task_management.read_write.TaskReadWrite; import java.time.LocalDateTime; @@ -11,9 +15,14 @@ public class EventCreationInteractor implements EventCreationInputBoundary { final EventCreationPresenter presenter; final StudentUser student; - public EventCreationInteractor(EventCreationPresenter eventPresenter, StudentUser student) { + // For connecting to Scheduler use case + final SchedulerInteractor scheduler; + + public EventCreationInteractor(EventCreationPresenter eventPresenter, StudentUser student, + SchedulerPresenter schedulerPresenter, ScheduleConflictPresenter scheduleConflictPresenter) { this.presenter = eventPresenter; this.student = student; + this.scheduler = new SchedulerInteractor(scheduleConflictPresenter, schedulerPresenter); } @Override @@ -29,12 +38,16 @@ public EventCreationResponseModel create(EventCreationRequestModel requestModel) requestModel.getStartTime(), requestModel.getEndTime(), requestModel.getRecurring(), requestModel.getFrequency()); + EventCreationResponseModel eventResponseModel = new EventCreationResponseModel( + requestModel.getTitle(), requestModel.getStartTime(), requestModel.getEndTime()); + + // Schedule the newly created event + SchedulerRequestModel scheduleRequestModel = new SchedulerRequestModel(event, student); + scheduler.schedule(scheduleRequestModel); TaskReadWrite trw = new TaskReadWrite("src/data/TaskMap"); TaskMap.saveToFile(trw); - EventCreationResponseModel eventResponseModel = new EventCreationResponseModel( - requestModel.getTitle(), requestModel.getStartTime(), requestModel.getEndTime()); return presenter.prepareSuccessView(eventResponseModel); } } diff --git a/src/main/java/event_creation_use_case/EventCreationPresenter.java b/src/main/java/use_cases/task_management/event_creation_use_case/EventCreationPresenter.java similarity index 76% rename from src/main/java/event_creation_use_case/EventCreationPresenter.java rename to src/main/java/use_cases/task_management/event_creation_use_case/EventCreationPresenter.java index 3241b56..1f1bff5 100644 --- a/src/main/java/event_creation_use_case/EventCreationPresenter.java +++ b/src/main/java/use_cases/task_management/event_creation_use_case/EventCreationPresenter.java @@ -1,4 +1,4 @@ -package event_creation_use_case; +package use_cases.task_management.event_creation_use_case; public interface EventCreationPresenter { EventCreationResponseModel prepareSuccessView(EventCreationResponseModel e); diff --git a/src/main/java/event_creation_use_case/EventCreationRequestModel.java b/src/main/java/use_cases/task_management/event_creation_use_case/EventCreationRequestModel.java similarity index 94% rename from src/main/java/event_creation_use_case/EventCreationRequestModel.java rename to src/main/java/use_cases/task_management/event_creation_use_case/EventCreationRequestModel.java index 0685741..eda3bb3 100644 --- a/src/main/java/event_creation_use_case/EventCreationRequestModel.java +++ b/src/main/java/use_cases/task_management/event_creation_use_case/EventCreationRequestModel.java @@ -1,4 +1,4 @@ -package event_creation_use_case; +package use_cases.task_management.event_creation_use_case; import java.time.LocalDateTime; diff --git a/src/main/java/event_creation_use_case/EventCreationResponseModel.java b/src/main/java/use_cases/task_management/event_creation_use_case/EventCreationResponseModel.java similarity index 86% rename from src/main/java/event_creation_use_case/EventCreationResponseModel.java rename to src/main/java/use_cases/task_management/event_creation_use_case/EventCreationResponseModel.java index 0064b4a..4630575 100644 --- a/src/main/java/event_creation_use_case/EventCreationResponseModel.java +++ b/src/main/java/use_cases/task_management/event_creation_use_case/EventCreationResponseModel.java @@ -1,4 +1,4 @@ -package event_creation_use_case; +package use_cases.task_management.event_creation_use_case; import java.time.LocalDateTime; diff --git a/src/main/java/event_edit_use_case/EventEditInputBoundary.java b/src/main/java/use_cases/task_management/event_edit_use_case/EventEditInputBoundary.java similarity index 67% rename from src/main/java/event_edit_use_case/EventEditInputBoundary.java rename to src/main/java/use_cases/task_management/event_edit_use_case/EventEditInputBoundary.java index 7036ef7..ade4d82 100644 --- a/src/main/java/event_edit_use_case/EventEditInputBoundary.java +++ b/src/main/java/use_cases/task_management/event_edit_use_case/EventEditInputBoundary.java @@ -1,4 +1,4 @@ -package event_edit_use_case; +package use_cases.task_management.event_edit_use_case; public interface EventEditInputBoundary { EventEditResponseModel edit(EventEditRequestModel requestModel); diff --git a/src/main/java/event_edit_use_case/EventEditInteractor.java b/src/main/java/use_cases/task_management/event_edit_use_case/EventEditInteractor.java similarity index 94% rename from src/main/java/event_edit_use_case/EventEditInteractor.java rename to src/main/java/use_cases/task_management/event_edit_use_case/EventEditInteractor.java index fec1e84..7a24cb2 100644 --- a/src/main/java/event_edit_use_case/EventEditInteractor.java +++ b/src/main/java/use_cases/task_management/event_edit_use_case/EventEditInteractor.java @@ -1,6 +1,4 @@ -package event_edit_use_case; - -import java.util.ArrayList; +package use_cases.task_management.event_edit_use_case; public class EventEditInteractor implements EventEditInputBoundary{ EventEditPresenter presenter; diff --git a/src/main/java/event_edit_use_case/EventEditPresenter.java b/src/main/java/use_cases/task_management/event_edit_use_case/EventEditPresenter.java similarity index 76% rename from src/main/java/event_edit_use_case/EventEditPresenter.java rename to src/main/java/use_cases/task_management/event_edit_use_case/EventEditPresenter.java index ab95147..eb5ef67 100644 --- a/src/main/java/event_edit_use_case/EventEditPresenter.java +++ b/src/main/java/use_cases/task_management/event_edit_use_case/EventEditPresenter.java @@ -1,4 +1,4 @@ -package event_edit_use_case; +package use_cases.task_management.event_edit_use_case; public interface EventEditPresenter { EventEditResponseModel prepareSuccessView(EventEditResponseModel requestModel); diff --git a/src/main/java/event_edit_use_case/EventEditRequestModel.java b/src/main/java/use_cases/task_management/event_edit_use_case/EventEditRequestModel.java similarity index 95% rename from src/main/java/event_edit_use_case/EventEditRequestModel.java rename to src/main/java/use_cases/task_management/event_edit_use_case/EventEditRequestModel.java index ae05508..cbc73ea 100644 --- a/src/main/java/event_edit_use_case/EventEditRequestModel.java +++ b/src/main/java/use_cases/task_management/event_edit_use_case/EventEditRequestModel.java @@ -1,4 +1,4 @@ -package event_edit_use_case; +package use_cases.task_management.event_edit_use_case; import entities.Event; diff --git a/src/main/java/event_edit_use_case/EventEditResponseModel.java b/src/main/java/use_cases/task_management/event_edit_use_case/EventEditResponseModel.java similarity index 73% rename from src/main/java/event_edit_use_case/EventEditResponseModel.java rename to src/main/java/use_cases/task_management/event_edit_use_case/EventEditResponseModel.java index 272c984..9e1b060 100644 --- a/src/main/java/event_edit_use_case/EventEditResponseModel.java +++ b/src/main/java/use_cases/task_management/event_edit_use_case/EventEditResponseModel.java @@ -1,4 +1,4 @@ -package event_edit_use_case; +package use_cases.task_management.event_edit_use_case; public class EventEditResponseModel { private String title; diff --git a/src/main/java/read_write/CourseReadWrite.java b/src/main/java/use_cases/task_management/read_write/CourseReadWrite.java similarity index 97% rename from src/main/java/read_write/CourseReadWrite.java rename to src/main/java/use_cases/task_management/read_write/CourseReadWrite.java index ff999fc..2d78ed4 100644 --- a/src/main/java/read_write/CourseReadWrite.java +++ b/src/main/java/use_cases/task_management/read_write/CourseReadWrite.java @@ -1,4 +1,5 @@ -package read_write; +package use_cases.task_management.read_write; + import entities.*; diff --git a/src/main/java/read_write/ReadWriter.java b/src/main/java/use_cases/task_management/read_write/ReadWriter.java similarity index 89% rename from src/main/java/read_write/ReadWriter.java rename to src/main/java/use_cases/task_management/read_write/ReadWriter.java index d1fb2b7..fb489c8 100644 --- a/src/main/java/read_write/ReadWriter.java +++ b/src/main/java/use_cases/task_management/read_write/ReadWriter.java @@ -1,4 +1,4 @@ -package read_write; +package use_cases.task_management.read_write; import java.io.IOException; diff --git a/src/main/java/read_write/TaskReadWrite.java b/src/main/java/use_cases/task_management/read_write/TaskReadWrite.java similarity index 95% rename from src/main/java/read_write/TaskReadWrite.java rename to src/main/java/use_cases/task_management/read_write/TaskReadWrite.java index 1c64983..29736af 100644 --- a/src/main/java/read_write/TaskReadWrite.java +++ b/src/main/java/use_cases/task_management/read_write/TaskReadWrite.java @@ -1,4 +1,4 @@ -package read_write; +package use_cases.task_management.read_write; import java.io.*; import java.util.HashMap; diff --git a/src/main/java/task_deletion_use_case/TaskDeletionInputBoundary.java b/src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionInputBoundary.java similarity index 67% rename from src/main/java/task_deletion_use_case/TaskDeletionInputBoundary.java rename to src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionInputBoundary.java index 63e5f06..a6a6e96 100644 --- a/src/main/java/task_deletion_use_case/TaskDeletionInputBoundary.java +++ b/src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionInputBoundary.java @@ -1,8 +1,4 @@ -package task_deletion_use_case; - -import entities.Course; -import entities.StudentUser; -import entities.Task; +package use_cases.task_management.task_deletion_use_case; public interface TaskDeletionInputBoundary { TaskDeletionResponseModel deleteStudentTask(TaskDeletionRequestModel requestModel); diff --git a/src/main/java/task_deletion_use_case/TaskDeletionInteractor.java b/src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionInteractor.java similarity index 91% rename from src/main/java/task_deletion_use_case/TaskDeletionInteractor.java rename to src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionInteractor.java index e75ab48..343e621 100644 --- a/src/main/java/task_deletion_use_case/TaskDeletionInteractor.java +++ b/src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionInteractor.java @@ -1,7 +1,7 @@ -package task_deletion_use_case; +package use_cases.task_management.task_deletion_use_case; import entities.TaskMap; -import read_write.TaskReadWrite; +import use_cases.task_management.read_write.TaskReadWrite; public class TaskDeletionInteractor implements TaskDeletionInputBoundary { final TaskDeletionPresenter presenter; diff --git a/src/main/java/task_deletion_use_case/TaskDeletionPresenter.java b/src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionPresenter.java similarity index 76% rename from src/main/java/task_deletion_use_case/TaskDeletionPresenter.java rename to src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionPresenter.java index 8d92490..6b611fb 100644 --- a/src/main/java/task_deletion_use_case/TaskDeletionPresenter.java +++ b/src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionPresenter.java @@ -1,4 +1,4 @@ -package task_deletion_use_case; +package use_cases.task_management.task_deletion_use_case; public interface TaskDeletionPresenter { TaskDeletionResponseModel prepareSuccessView(TaskDeletionResponseModel t); diff --git a/src/main/java/task_deletion_use_case/TaskDeletionRequestModel.java b/src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionRequestModel.java similarity index 92% rename from src/main/java/task_deletion_use_case/TaskDeletionRequestModel.java rename to src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionRequestModel.java index 19f6d22..f9118a7 100644 --- a/src/main/java/task_deletion_use_case/TaskDeletionRequestModel.java +++ b/src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionRequestModel.java @@ -1,4 +1,4 @@ -package task_deletion_use_case; +package use_cases.task_management.task_deletion_use_case; import entities.Course; import entities.StudentUser; diff --git a/src/main/java/task_deletion_use_case/TaskDeletionResponseModel.java b/src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionResponseModel.java similarity index 73% rename from src/main/java/task_deletion_use_case/TaskDeletionResponseModel.java rename to src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionResponseModel.java index 5696a84..1e9b95d 100644 --- a/src/main/java/task_deletion_use_case/TaskDeletionResponseModel.java +++ b/src/main/java/use_cases/task_management/task_deletion_use_case/TaskDeletionResponseModel.java @@ -1,4 +1,4 @@ -package task_deletion_use_case; +package use_cases.task_management.task_deletion_use_case; public class TaskDeletionResponseModel { private String title; diff --git a/src/main/java/tasks_to_student_tasklist_use_case/TaskToTasklistInteractor.java b/src/main/java/use_cases/task_management/tasks_to_student_tasklist_use_case/TaskToTasklistInteractor.java similarity index 69% rename from src/main/java/tasks_to_student_tasklist_use_case/TaskToTasklistInteractor.java rename to src/main/java/use_cases/task_management/tasks_to_student_tasklist_use_case/TaskToTasklistInteractor.java index de154a0..a2e4492 100644 --- a/src/main/java/tasks_to_student_tasklist_use_case/TaskToTasklistInteractor.java +++ b/src/main/java/use_cases/task_management/tasks_to_student_tasklist_use_case/TaskToTasklistInteractor.java @@ -1,4 +1,4 @@ -package tasks_to_student_tasklist_use_case; +package use_cases.task_management.tasks_to_student_tasklist_use_case; public class TaskToTasklistInteractor { // request model is the student's id and the course id diff --git a/src/main/java/use_cases/task_management/tasks_to_student_tasklist_use_case/TaskToTasklistPresenter.java b/src/main/java/use_cases/task_management/tasks_to_student_tasklist_use_case/TaskToTasklistPresenter.java new file mode 100644 index 0000000..b271f53 --- /dev/null +++ b/src/main/java/use_cases/task_management/tasks_to_student_tasklist_use_case/TaskToTasklistPresenter.java @@ -0,0 +1,4 @@ +package use_cases.task_management.tasks_to_student_tasklist_use_case; + +public interface TaskToTasklistPresenter { +} diff --git a/src/main/java/test_creation_use_case/TestCreationInputBoundary.java b/src/main/java/use_cases/task_management/test_creation_use_case/TestCreationInputBoundary.java similarity index 66% rename from src/main/java/test_creation_use_case/TestCreationInputBoundary.java rename to src/main/java/use_cases/task_management/test_creation_use_case/TestCreationInputBoundary.java index 50948c8..b5c738f 100644 --- a/src/main/java/test_creation_use_case/TestCreationInputBoundary.java +++ b/src/main/java/use_cases/task_management/test_creation_use_case/TestCreationInputBoundary.java @@ -1,6 +1,4 @@ -package test_creation_use_case; - -import entities.StudentUser; +package use_cases.task_management.test_creation_use_case; public interface TestCreationInputBoundary { TestCreationResponseModel create(TestCreationRequestModel requestModel); diff --git a/src/main/java/test_creation_use_case/TestCreationInteractor.java b/src/main/java/use_cases/task_management/test_creation_use_case/TestCreationInteractor.java similarity index 92% rename from src/main/java/test_creation_use_case/TestCreationInteractor.java rename to src/main/java/use_cases/task_management/test_creation_use_case/TestCreationInteractor.java index 9b06ee1..fde4922 100644 --- a/src/main/java/test_creation_use_case/TestCreationInteractor.java +++ b/src/main/java/use_cases/task_management/test_creation_use_case/TestCreationInteractor.java @@ -1,9 +1,9 @@ -package test_creation_use_case; +package use_cases.task_management.test_creation_use_case; import entities.StudentUser; import entities.TaskMap; import entities.Test; -import read_write.TaskReadWrite; +import use_cases.task_management.read_write.TaskReadWrite; import java.time.LocalDateTime; diff --git a/src/main/java/test_creation_use_case/TestCreationPresenter.java b/src/main/java/use_cases/task_management/test_creation_use_case/TestCreationPresenter.java similarity index 76% rename from src/main/java/test_creation_use_case/TestCreationPresenter.java rename to src/main/java/use_cases/task_management/test_creation_use_case/TestCreationPresenter.java index 0acbf05..2766ee7 100644 --- a/src/main/java/test_creation_use_case/TestCreationPresenter.java +++ b/src/main/java/use_cases/task_management/test_creation_use_case/TestCreationPresenter.java @@ -1,4 +1,4 @@ -package test_creation_use_case; +package use_cases.task_management.test_creation_use_case; public interface TestCreationPresenter { TestCreationResponseModel prepareSuccessView(TestCreationResponseModel response); diff --git a/src/main/java/test_creation_use_case/TestCreationRequestModel.java b/src/main/java/use_cases/task_management/test_creation_use_case/TestCreationRequestModel.java similarity index 93% rename from src/main/java/test_creation_use_case/TestCreationRequestModel.java rename to src/main/java/use_cases/task_management/test_creation_use_case/TestCreationRequestModel.java index c95a254..7f228d7 100644 --- a/src/main/java/test_creation_use_case/TestCreationRequestModel.java +++ b/src/main/java/use_cases/task_management/test_creation_use_case/TestCreationRequestModel.java @@ -1,4 +1,4 @@ -package test_creation_use_case; +package use_cases.task_management.test_creation_use_case; import java.time.LocalDateTime; diff --git a/src/main/java/test_creation_use_case/TestCreationResponseModel.java b/src/main/java/use_cases/task_management/test_creation_use_case/TestCreationResponseModel.java similarity index 76% rename from src/main/java/test_creation_use_case/TestCreationResponseModel.java rename to src/main/java/use_cases/task_management/test_creation_use_case/TestCreationResponseModel.java index 1e593c3..0a2a61c 100644 --- a/src/main/java/test_creation_use_case/TestCreationResponseModel.java +++ b/src/main/java/use_cases/task_management/test_creation_use_case/TestCreationResponseModel.java @@ -1,4 +1,4 @@ -package test_creation_use_case; +package use_cases.task_management.test_creation_use_case; import java.time.LocalDateTime; diff --git a/src/main/java/test_edit_use_case/TestEditInputBoundary.java b/src/main/java/use_cases/task_management/test_edit_use_case/TestEditInputBoundary.java similarity index 67% rename from src/main/java/test_edit_use_case/TestEditInputBoundary.java rename to src/main/java/use_cases/task_management/test_edit_use_case/TestEditInputBoundary.java index b897c9d..e1e79f6 100644 --- a/src/main/java/test_edit_use_case/TestEditInputBoundary.java +++ b/src/main/java/use_cases/task_management/test_edit_use_case/TestEditInputBoundary.java @@ -1,4 +1,4 @@ -package test_edit_use_case; +package use_cases.task_management.test_edit_use_case; public interface TestEditInputBoundary { TestEditResponseModel edit(TestEditRequestModel requestModel); diff --git a/src/main/java/test_edit_use_case/TestEditInteractor.java b/src/main/java/use_cases/task_management/test_edit_use_case/TestEditInteractor.java similarity index 93% rename from src/main/java/test_edit_use_case/TestEditInteractor.java rename to src/main/java/use_cases/task_management/test_edit_use_case/TestEditInteractor.java index 72af6b1..9d78293 100644 --- a/src/main/java/test_edit_use_case/TestEditInteractor.java +++ b/src/main/java/use_cases/task_management/test_edit_use_case/TestEditInteractor.java @@ -1,4 +1,4 @@ -package test_edit_use_case; +package use_cases.task_management.test_edit_use_case; public class TestEditInteractor implements TestEditInputBoundary { TestEditPresenter presenter; diff --git a/src/main/java/test_edit_use_case/TestEditPresenter.java b/src/main/java/use_cases/task_management/test_edit_use_case/TestEditPresenter.java similarity index 76% rename from src/main/java/test_edit_use_case/TestEditPresenter.java rename to src/main/java/use_cases/task_management/test_edit_use_case/TestEditPresenter.java index 6f83c70..596d3b0 100644 --- a/src/main/java/test_edit_use_case/TestEditPresenter.java +++ b/src/main/java/use_cases/task_management/test_edit_use_case/TestEditPresenter.java @@ -1,4 +1,4 @@ -package test_edit_use_case; +package use_cases.task_management.test_edit_use_case; public interface TestEditPresenter { TestEditResponseModel prepareSuccessView(TestEditResponseModel responseModel); diff --git a/src/main/java/test_edit_use_case/TestEditRequestModel.java b/src/main/java/use_cases/task_management/test_edit_use_case/TestEditRequestModel.java similarity index 95% rename from src/main/java/test_edit_use_case/TestEditRequestModel.java rename to src/main/java/use_cases/task_management/test_edit_use_case/TestEditRequestModel.java index bf7f5e8..ddf65b3 100644 --- a/src/main/java/test_edit_use_case/TestEditRequestModel.java +++ b/src/main/java/use_cases/task_management/test_edit_use_case/TestEditRequestModel.java @@ -1,4 +1,4 @@ -package test_edit_use_case; +package use_cases.task_management.test_edit_use_case; import entities.Test; diff --git a/src/main/java/test_edit_use_case/TestEditResponseModel.java b/src/main/java/use_cases/task_management/test_edit_use_case/TestEditResponseModel.java similarity index 72% rename from src/main/java/test_edit_use_case/TestEditResponseModel.java rename to src/main/java/use_cases/task_management/test_edit_use_case/TestEditResponseModel.java index 0739245..069380c 100644 --- a/src/main/java/test_edit_use_case/TestEditResponseModel.java +++ b/src/main/java/use_cases/task_management/test_edit_use_case/TestEditResponseModel.java @@ -1,4 +1,4 @@ -package test_edit_use_case; +package use_cases.task_management.test_edit_use_case; public class TestEditResponseModel { String title; diff --git a/src/test/java/FileUserTest.java b/src/test/java/FileUserTest.java index 8206db8..9f76778 100644 --- a/src/test/java/FileUserTest.java +++ b/src/test/java/FileUserTest.java @@ -1,10 +1,6 @@ -import entities.StudentUser; import org.junit.jupiter.api.Test; //import screens.FileUser2; -import user_register_usecase.StudentSaveRequest; -import java.io.IOException; -import java.time.LocalDateTime; public class FileUserTest { diff --git a/src/test/java/progress_tracker_use_case/ProgressTrackerTest.java b/src/test/java/progress_tracker_use_case/ProgressTrackerTest.java new file mode 100644 index 0000000..d5c5b11 --- /dev/null +++ b/src/test/java/progress_tracker_use_case/ProgressTrackerTest.java @@ -0,0 +1,9 @@ +package progress_tracker_use_case; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + + +public class ProgressTrackerTest { + +} diff --git a/src/test/java/scheduler_use_case/SchedulerInteractorTest.java b/src/test/java/scheduler_use_case/SchedulerInteractorTest.java new file mode 100644 index 0000000..c6e756a --- /dev/null +++ b/src/test/java/scheduler_use_case/SchedulerInteractorTest.java @@ -0,0 +1,34 @@ +//package scheduler_use_case; +// +//import entities.*; +//import org.junit.jupiter.api.Test; +//import use_cases.calendar_scheduler.schedule_conflict_use_case.ScheduleConflictPresenter; +//import screens.calendar_scheduler.ScheduleConflictResponseFormatter; +//import screens.calendar_scheduler.SchedulerResponseFormatter; +// +//import java.time.LocalDateTime; +// +//import static org.junit.jupiter.api.Assertions.*; +// +//class SchedulerInteractorTest { +// +// @Test +// void schedule() { +// // Initialise the classes +// SchedulerPresenter schedulerPresenter = new SchedulerResponseFormatter(); +// ScheduleConflictPresenter scheduleConflictPresenter = new ScheduleConflictResponseFormatter(); +// SchedulerInputBoundary interactor = new SchedulerInteractor(scheduleConflictPresenter, schedulerPresenter); +// +// // Create the test user and task +// Event event = new Event("testEvent", "testid", 0, LocalDateTime.of(2022, 11, 29, 14, 0), +// LocalDateTime.of(2022, 11, 29, 15, 0), false, null); +// StudentUser user = new StudentUser("testUser", "testPassword"); +// +// // Test the interactor +// SchedulerRequestModel requestModel = new SchedulerRequestModel(event, user); +// interactor.schedule(requestModel); +// +// +// } +// +//} \ No newline at end of file