Skip to content

Commit

Permalink
Merge branch 'main' into 39-feature-21-handling-change-task-details
Browse files Browse the repository at this point in the history
  • Loading branch information
alexolowo authored Aug 4, 2023
2 parents 5458d6d + c211ef8 commit 8a18207
Show file tree
Hide file tree
Showing 38 changed files with 1,071 additions and 372 deletions.
1 change: 1 addition & 0 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import c_interface_adapters.ProjectSelectionPresenter;
import d_frameworks_and_drivers.database_management.DatabaseInitializer.DBInitializer;
import javafx.application.Application;

public class Main {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,9 @@ public String toString() {
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof Column)) {
if (!(o instanceof Column c)) {
return false;
}
Column c = (Column) o;
// Checking the equality of each of the attributes
boolean allAttributesAreEqual = c.getName().equals(this.getName()) &&
c.getID().equals(this.getID()) &&
Expand Down
40 changes: 30 additions & 10 deletions src/main/java/a_enterprise_business_rules/entities/Project.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

package a_enterprise_business_rules.entities;

import b_application_business_rules.entity_models.ColumnModel;

import java.util.List;
import java.util.Collections;

Expand Down Expand Up @@ -36,7 +38,7 @@ public class Project {
/**
* The columns in the kanban board for this project.
*/
private List<Column> columns;
private List<ColumnModel> columns;

/**
* Creates a new project, based in the inputted values.
Expand All @@ -46,7 +48,7 @@ public class Project {
* @param description A description of the task.
* @param columns The columns of the project.
*/
public Project(String name, UUID ID, String description, List<Column> columns) {
public Project(String name, UUID ID, String description, List<ColumnModel> columns) {
this.name = name;
this.columns = columns;
this.description = description;
Expand Down Expand Up @@ -112,7 +114,7 @@ public void setDescription(String newDescription) {
*
* @return an <code>List<Column></code> of <Column>s.
*/
public List<Column> getColumns() {
public List<ColumnModel> getColumns() {
return this.columns;
}

Expand All @@ -121,7 +123,7 @@ public List<Column> getColumns() {
*
* @param newColumns The new columns for the project.
*/
public void setColumns(List<Column> newColumns) {
public void setColumns(List<ColumnModel> newColumns) {
this.columns = newColumns;
}

Expand All @@ -130,7 +132,7 @@ public void setColumns(List<Column> newColumns) {
*
* @param newColumn The column to add.
*/
public void addColumn(Column newColumn) {
public void addColumn(ColumnModel newColumn) {
this.columns.add(newColumn);
}

Expand All @@ -140,7 +142,7 @@ public void addColumn(Column newColumn) {
* @param newColumn The column to add to the project.
* @param position The position/index to add the column at.
*/
public void addColumnToPosition(Column newColumn, int position) {
public void addColumnToPosition(ColumnModel newColumn, int position) {
this.columns.add(position, newColumn);
}

Expand All @@ -154,7 +156,7 @@ public void addColumnToPosition(Column newColumn, int position) {
* @throws IllegalArgumentException Throws exception when the specified index is out
* of bounds.
*/
public void moveColumnToPosition(Column columnToMove, int positionToMoveTo)
public void moveColumnToPosition(ColumnModel columnToMove, int positionToMoveTo)
throws NoSuchElementException, IllegalArgumentException {
// The moving of the columns is done by removing the object from the List
// and then adding it back at the indicated index
Expand Down Expand Up @@ -189,7 +191,7 @@ public void moveColumnToPosition(Column columnToMove, int positionToMoveTo)
* @throws NoSuchElementException Throws exception when the specified column to
* remove is not in the project.
*/
public void removeColumn(Column columnToRemove) throws NoSuchElementException {
public void removeColumn(ColumnModel columnToRemove) throws NoSuchElementException {
if (!this.columns.remove(columnToRemove)) {
// the java.util.List.remove method returns a bool,
// indicating whether the object was removed or not.
Expand All @@ -201,6 +203,25 @@ public void removeColumn(Column columnToRemove) throws NoSuchElementException {
}
}

/**
* Removes a column with the specified ID from the list of columns in the current project.
*
* @param idOfColumnToRemove The ID of the column to be removed.
* @throws NoSuchElementException If no column with the given ID is found in the project.
*/
public void removeColumn(UUID idOfColumnToRemove) throws NoSuchElementException {
for (ColumnModel column : columns) {
if (column.getID().equals(idOfColumnToRemove)) {
columns.remove(column);
return;
}
}
throw new NoSuchElementException(
"The column with ID " + idOfColumnToRemove + " is not in this project");
}



/**
* Swaps the order of two columns in the column.
*
Expand Down Expand Up @@ -242,10 +263,9 @@ public void swapColumnOrder(Column col1, Column col2) {
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof Project)) {
if (!(o instanceof Project p)) {
return false;
}
Project p = (Project) o;
// Checking the equality of each of the attributes
boolean allAttributesAreEqual = p.getName().equals(this.getName()) &&
p.getID().equals(this.getID()) &&
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/a_enterprise_business_rules/entities/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,9 @@ public String toString() {
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof Task)) {
if (!(o instanceof Task t)) {
return false;
}
Task t = (Task) o;
// Checking the equality of each of the attributes
boolean allAttributesAreEqual = t.getName().equals(this.getName()) &&
t.getID().equals(this.getID()) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@
import java.util.UUID;

public interface ProjectSelectionInputBoundary {
void setCurrentProject(Project project);

void setCurrentProject(ProjectModel project);

//void setCurrentProject(Project project);

void createProject(String name, String description);

void createProject();

void createProject(ProjectModel projectModel);

void deleteProject(UUID projectID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.UUID;

public interface ProjectViewingAndModificationInputBoundary {
public void removeCurrentProject();
void removeCurrentProject();

void addNewTask(UUID idOfColumn, String taskName, String taskDescription,
LocalDateTime dueDate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import a_enterprise_business_rules.entities.Column;
import a_enterprise_business_rules.entities.Project;
import a_enterprise_business_rules.entities.Task;
import b_application_business_rules.entity_models.ColumnModel;
import b_application_business_rules.entity_models.TaskModel;
import c_interface_adapters.view_models.ProjectViewModel;
import c_interface_adapters.view_models.ColumnViewModel;
Expand Down Expand Up @@ -33,6 +34,9 @@ public interface ProjectViewingAndModificationOutputBoundary {
void displayRenamedColumn(ColumnModel columnModel);

void displayDeletedColumn(ColumnModel columnModel);

//void displayRenamedColumn(ColumnModel column);

void dislayChangedTaskDetails(UUID taskID, TaskViewModel task);
void dislayChangedTaskDate(UUID taskID, TaskViewModel task);
void displayRenamedProject(ProjectViewModel project, UUID projectId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
import a_enterprise_business_rules.entities.Column;
import a_enterprise_business_rules.entities.Task;

import java.util.List;
import java.util.Collections;

import java.util.UUID;

import java.util.NoSuchElementException;
import java.util.*;

/**
* A column model within the productivity application.
Expand Down Expand Up @@ -237,6 +232,22 @@ public String toString() {
return columnModelStringRepresentation;
}

/**
* Returns a Column Entity from Column Model.
*
* {@inheritDoc}
*
* @return a Column Entity.
*/
public Column getColumnEntity() {
List<Task> taskEntities = new ArrayList<>();
for (TaskModel taskModel: taskModels) {
taskEntities.add(taskModel.getTaskEntity());
}

return new Column(name, taskEntities, ID);
}

// TODO:turn this into its own class
// private UUID getValidColumnID(){
// this.ID = UUID.randomUUID();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package b_application_business_rules.entity_models;

import a_enterprise_business_rules.entities.Project;
import a_enterprise_business_rules.entities.Column;

import java.util.List;
import java.util.Collections;

import java.util.UUID;

import java.util.NoSuchElementException;
import java.util.*;

/**
* A project model within the productivity application.
*
* A project model within the productivity application.*
* Each project model will have a name, unique identifier, a description, and a
* list
* of column models (which contain task modelss).
Expand Down Expand Up @@ -65,10 +58,10 @@ public ProjectModel(Project project) {
this.name = project.getName();

// Converting the List of Column objects to a List of ColumnModel objects
List<Column> columns = project.getColumns(); // Get the columns
List<ColumnModel> columns = project.getColumns(); // Get the columns
// Converts Columns to ColumnModels and puts it in the columnModels attribute
for (int i = 0; i < columns.size(); i++) {
this.addColumnModel(new ColumnModel(columns.get(i)));
for (ColumnModel cols : columns) {
this.addColumnModel(cols);
}

this.description = project.getDescription();
Expand Down Expand Up @@ -218,7 +211,7 @@ public void removeColumnModel(ColumnModel columnModelToRemove) throws NoSuchElem
// the java.util.List.remove method returns a bool,
// indicating whether the object was removed or not.
// If it wasn't removed, we want to throw an exception,
// saying that the column model isn't in the column model list, thus, it can't be
// saying that the task models isn't in the column model, thus, it can't be
// removed.
// If it was removed, we don't have to do anything extra.
throw new NoSuchElementException(
Expand Down Expand Up @@ -249,7 +242,7 @@ public void swapColumnModelOrder(ColumnModel col1, ColumnModel col2) {
exceptionMessage += col2.toString();
}

// Throws the exception if at least 1 of the column model are missing,
// Throws the exception if at least 1 of the task modelss are missing,
// using the exception message created above
if (!col1InColumnModel || !col2InColumnModel) {
throw new NoSuchElementException(exceptionMessage);
Expand All @@ -260,5 +253,20 @@ public void swapColumnModelOrder(ColumnModel col1, ColumnModel col2) {
this.columnModels, this.columnModels.indexOf(col1), this.columnModels.indexOf(col2));
}

/**
* Returns a Project Entity from Project Model.
*
* {@inheritDoc}
*
* @return a Project Entity.
*/
public Project getProjectEntity() {
List<ColumnModel> columnEntities = new ArrayList<>();
for (ColumnModel columnModel: columnModels) {
columnEntities.add(columnModel);
}

return new Project(name, ID, description, columnEntities);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,15 @@ public String toString() {
+ "Due Date: " + this.dueDateTime.toString() + "]";
}

/**
* Returns a Task Entity from Task Model.
*
* {@inheritDoc}
*
* @return a Task Entity.
*/
public Task getTaskEntity() {
return new Task(name, ID, description, isCompleted, dueDateTime);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package b_application_business_rules.use_cases;

import a_enterprise_business_rules.entities.Project;
import b_application_business_rules.entity_models.ProjectModel;

import java.util.UUID;
Expand Down Expand Up @@ -30,6 +31,7 @@ public void removeCurrentProject() {

public void deleteProject(UUID projectID) {}

public void getProjectByID(UUID projectID) {
public Project getProjectByID(UUID projectID) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import java.util.UUID;

public interface IDBInsert {
public void DBInsert(ProjectModel projectModel);
void DBInsert(ProjectModel projectModel);

public void DBInsert(ColumnModel columnModel);
void DBInsert(ColumnModel columnModel);

public void DBInsert(TaskModel taskModel);
void DBInsert(TaskModel taskModel);

public void DBInsert(UUID uuid);
void DBInsert(UUID uuid);

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.UUID;

public interface IDBRemove {
public void DBRemove(ProjectModel projectModel, UUID uuid);
public void DBRemove(TaskModel taskModel, UUID uuid);
public void DBRemove(ColumnModel columnModel, UUID uuid);
void DBRemove(ProjectModel projectModel, UUID uuid);
void DBRemove(TaskModel taskModel, UUID uuid);
void DBRemove(ColumnModel columnModel, UUID uuid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.*;
public interface IDBSearch {

public ArrayList<String> DBColumnSearch(String id);
ArrayList<String> DBColumnSearch(String id);

public ArrayList<String> DBTaskSearch(String id);
ArrayList<String> DBTaskSearch(String id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import b_application_business_rules.entity_models.*;

public interface IEntityIDsToList {
public String EntityIDsToList(ProjectModel projectModel);
public String EntityIDsToList(ColumnModel columnModel);
String EntityIDsToList(ProjectModel projectModel);
String EntityIDsToList(ColumnModel columnModel);
}
Loading

0 comments on commit 8a18207

Please sign in to comment.