-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
similar to Soumayadip's update task details feature, implemented add …
…task use case to update the database and create new task entities. HAS NOT IMPLEMENTED HOW TO ADD THE NEWLY CREATED TASK ENTITY TO THE RESPECTIVE COLUMN'S LIST OF TASKS.Implemented delete task use case to update the database. HAS NOT IMPLEMENTED HOW TO DELETE TASK ENTITY FROM COLUMN ENTITY'S LIST OF TASKS.
- Loading branch information
1 parent
8e413b1
commit f72bda4
Showing
6 changed files
with
124 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package b_application_business_rules.use_cases.project_viewing_and_modification_use_cases; | ||
|
||
import a_enterprise_business_rules.entities.Task; | ||
import b_application_business_rules.DataAccessInterface; | ||
|
||
import b_application_business_rules.entity_models.TaskModel; | ||
import b_application_business_rules.use_cases.project_selection_gateways.IDBInsert; | ||
import d_frameworks_and_drivers.database_management.DBControllers.DBManagerInsertController; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
|
||
/** | ||
* A use case class for editing task details (name and description) | ||
*/ | ||
public class AddTask implements DataAccessInterface { | ||
TaskModel taskModel; | ||
|
||
public AddTask(TaskModel model) { | ||
this.taskModel = model; | ||
} | ||
|
||
/** | ||
* 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() { | ||
// Create task entity | ||
String name = taskModel.getName(); | ||
UUID taskID = taskModel.getID(); | ||
String description = taskModel.getDescription(); | ||
boolean isCompleted = taskModel.getCompletionStatus(); | ||
LocalDateTime dueDate = taskModel.getDueDateTime(); | ||
Task newTask = new Task(name, taskID, description, isCompleted, dueDate); | ||
//Call the method that accesses the database | ||
addNewTask(taskModel); | ||
} | ||
|
||
/** | ||
* Adds the newly created task to the database | ||
* @param newTask | ||
*/ | ||
@Override | ||
public void addNewTask(TaskModel newTask) { | ||
//Initializing the required controllers | ||
IDBInsert insertTask = new DBManagerInsertController(); | ||
insertTask.DBInsert(newTask); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
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.use_cases.project_selection_gateways.IDBRemove; | ||
import d_frameworks_and_drivers.database_management.DBControllers.DBManagerRemoveController; | ||
|
||
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters