Skip to content

Commit

Permalink
implemented deleteTask feature. DOES NOT INCLUDE IMPLEMENTATION OF RE…
Browse files Browse the repository at this point in the history
…MOVE TASK ENTITY FROM COLUMN ENTITY'S LIST OF TASKS.
  • Loading branch information
wennapengooin committed Aug 2, 2023
1 parent aa6496f commit da54083
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ default void updateTaskDetail(UUID taskID, TaskModel updatedTask) {

}

default void deleteTask(UUID taskID, TaskModel deletedTask) {
default void removeTask(UUID taskID, TaskModel deletedTask) {

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public AddTask(TaskModel model) {
}

/**
* This method makes creates the task and calls the method that will add the task to the database
* This method creates the task and calls the method that will add the task to the database
* NEED TO IMPLEMENT ADDING TASK TO THE LIST OF TASKS IN THE COLUMN ENTITY
*/
public void addTask() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package b_application_business_rules.use_cases.project_viewing_and_modification_use_cases;

import b_application_business_rules.DataAccessInterface;

import b_application_business_rules.entity_models.TaskModel;
import b_application_business_rules.factories.TaskModelFactory;
import b_application_business_rules.use_cases.project_selection_gateways.IDBInsert;
import b_application_business_rules.use_cases.project_selection_gateways.IDBRemove;
import b_application_business_rules.use_cases.project_selection_gateways.IDBSearch;
import d_frameworks_and_drivers.database_management.DBControllers.DBManagerInsertController;
import d_frameworks_and_drivers.database_management.DBControllers.DBManagerRemoveController;
import d_frameworks_and_drivers.database_management.DBControllers.DBManagerSearchController;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.UUID;

/**
* A use case class for deleting a task
*/
public class DeleteTask implements DataAccessInterface{
TaskModel taskModel;
UUID taskID;

public DeleteTask(TaskModel model, UUID id) {
this.taskModel = model;
this.taskID = id;
}

/**
* NEED TO IMPLEMENT REMOVING TASK ENTITY FROM COLUMN ENTITY
*/
public void deleteTask() {

//call the method that accesses the database
removeTask(taskID, taskModel);
}

@Override
public void removeTask(UUID taskID, TaskModel deletedTask) {
//initialize controller
IDBRemove removeTask = new DBManagerRemoveController();
//remove task from database
removeTask.DBRemove(taskModel, taskID);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ public void addNewTask(String idOfColumn, String taskName, String taskDescriptio

}

@Override
public void deleteTask(TaskModel task, UUID TaskUIid) {
DeleteTask useCase = new DeleteTask(task, TaskUIid);
try {
useCase.deleteTask();
TaskViewModel newTask = new TaskViewModel(task.getName(), TaskUIid, task.getDescription(),
task.getCompletionStatus(), task.getDueDateTime());
presenter.displayRemovedTask(TaskUIid, newTask);
}
catch(Exception e) {
e.printStackTrace();
}

}

@Override
public void deleteColumn(UUID columnBoxId) {
// TODO: DO NECESSARY STUFF.
Expand All @@ -81,10 +96,6 @@ public void renameColumn(UUID columnBoxId) {
presenter.displayRenamedColumn(c);
}

@Override
public void deleteTask(TaskModel task, UUID TaskUIid) {

}

/**
* Changes the task details given the new TaskModel task. Calls the use case to make
Expand Down

0 comments on commit da54083

Please sign in to comment.