Skip to content

Commit cd4769e

Browse files
Merge branch 'main' of https://github.com/CSC207-2022F-UofT/course-project-team-bbq into Anthony's_Branch
2 parents 6534ced + daec1a6 commit cd4769e

File tree

159 files changed

+1240
-1035
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+1240
-1035
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import com.formdev.flatlaf.FlatDarculaLaf;
22

3-
import login_and_signup_use_case.login_and_signup_use_case_screens.WelcomeScreen;
3+
import frameworks_and_drivers.screens.WelcomeScreen;
44

55
import java.io.IOException;
66

src/main/java/create_flashcard_set_use_case/FlashcardSetInputBoundary.java renamed to src/main/java/create_flashcard_set_use_case/CreateFlashcardSetInputBoundary.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@
22

33
// Use case (Red) layer
44

5+
import interface_adapters.presenters.exceptions.CreateFlashcardSetFailed;
6+
57
/**
68
* The input boundary interface for creating flashcard sets.
79
*
810
* @author Edward Ishii
911
*/
1012

11-
public interface FlashcardSetInputBoundary {
13+
public interface CreateFlashcardSetInputBoundary {
1214

1315
/**
1416
* Create a new flashcard set and store it into the database.
1517
*
1618
* @param requestModel the request model required for flashcard set creation.
1719
* @return the response model containing the newly created flashcard set data.
1820
*/
19-
FlashcardSetResponseModel create(FlashcardSetRequestModel requestModel) throws FlashcardSetCreationFailed;
21+
CreateFlashcardSetResponseModel create(CreateFlashcardSetRequestModel requestModel) throws CreateFlashcardSetFailed;
2022
}

src/main/java/create_flashcard_set_use_case/FlashcardSetInteractor.java renamed to src/main/java/create_flashcard_set_use_case/CreateFlashcardSetInteractor.java

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package create_flashcard_set_use_case;
22

3-
import data_access.DBGateway;
4-
import data_access.IFlashcardSetDataAccess;
5-
import data_access.entity_request_models.FlashcardSetDsRequestModel;
3+
import frameworks_and_drivers.database.DBGateway;
4+
import data_access_use_case.IFlashcardSetDataAccess;
5+
import data_access_use_case.entity_request_models.FlashcardSetDsRequestModel;
66
import entities.FlashcardSet;
77
import entities.FlashcardSetFactory;
8+
import interface_adapters.presenters.exceptions.CreateFlashcardSetFailed;
89

910
import java.util.ArrayList;
1011
import java.util.Objects;
@@ -25,38 +26,38 @@
2526
*
2627
* @author Edward Ishii
2728
*/
28-
public class FlashcardSetInteractor implements FlashcardSetInputBoundary {
29+
public class CreateFlashcardSetInteractor implements CreateFlashcardSetInputBoundary {
2930
DBGateway dbGateway;
3031
IFlashcardSetDataAccess flashcardSetDataAccess; // for testing
31-
FlashcardSetOutputBoundary flashcardSetOutputBoundary;
32+
CreateFlashcardSetOutputBoundary createFlashcardSetOutputBoundary;
3233
FlashcardSetFactory flashcardSetFactory;
3334

3435
/**
3536
* Constructs the use case interactor.
3637
*
3738
* @param dbGateway the database to store the flashcard set in.
38-
* @param flashcardSetOutputBoundary the output boundary for preparing success/fail view of saving flashcard sets.
39+
* @param createFlashcardSetOutputBoundary the output boundary for preparing success/fail view of saving flashcard sets.
3940
* @param flashcardSetFactory the factory that creates flashcard sets.
4041
*/
41-
public FlashcardSetInteractor(DBGateway dbGateway, FlashcardSetOutputBoundary flashcardSetOutputBoundary,
42-
FlashcardSetFactory flashcardSetFactory) {
42+
public CreateFlashcardSetInteractor(DBGateway dbGateway, CreateFlashcardSetOutputBoundary createFlashcardSetOutputBoundary,
43+
FlashcardSetFactory flashcardSetFactory) {
4344
this.dbGateway = dbGateway;
44-
this.flashcardSetOutputBoundary = flashcardSetOutputBoundary;
45+
this.createFlashcardSetOutputBoundary = createFlashcardSetOutputBoundary;
4546
this.flashcardSetFactory = flashcardSetFactory;
4647
}
4748

4849
/**
4950
* Alternative constructor for testing purposes.
5051
*
5152
* @param flashcardSetDataAccess the flashcard set database.
52-
* @param flashcardSetOutputBoundary the output boundary for preparing success/fail view.
53+
* @param createFlashcardSetOutputBoundary the output boundary for preparing success/fail view.
5354
* @param flashcardSetFactory the factory creating flashcard sets.
5455
*/
55-
public FlashcardSetInteractor(IFlashcardSetDataAccess flashcardSetDataAccess,
56-
FlashcardSetOutputBoundary flashcardSetOutputBoundary,
57-
FlashcardSetFactory flashcardSetFactory) {
56+
public CreateFlashcardSetInteractor(IFlashcardSetDataAccess flashcardSetDataAccess,
57+
CreateFlashcardSetOutputBoundary createFlashcardSetOutputBoundary,
58+
FlashcardSetFactory flashcardSetFactory) {
5859
this.flashcardSetDataAccess = flashcardSetDataAccess;
59-
this.flashcardSetOutputBoundary = flashcardSetOutputBoundary;
60+
this.createFlashcardSetOutputBoundary = createFlashcardSetOutputBoundary;
6061
this.flashcardSetFactory = flashcardSetFactory;
6162
}
6263

@@ -65,21 +66,21 @@ public FlashcardSetInteractor(IFlashcardSetDataAccess flashcardSetDataAccess,
6566
*
6667
* @param inputData the request model containing data required for creating flashcard sets.
6768
* @return the response model containing the newly created flashcard set data.
68-
* @throws FlashcardSetCreationFailed the error thrown if flashcard set creation fails.
69+
* @throws CreateFlashcardSetFailed the error thrown if flashcard set creation fails.
6970
*/
7071
@Override
71-
public FlashcardSetResponseModel create(FlashcardSetRequestModel inputData) throws FlashcardSetCreationFailed {
72+
public CreateFlashcardSetResponseModel create(CreateFlashcardSetRequestModel inputData) throws CreateFlashcardSetFailed {
7273

7374
// I chose to throw an exception when user gives invalid input so that the UI layer or any other caller
7475
// can use try-catch block to handle when to alert the user that something went wrong during creation.
7576

7677
// throw exception if title, description, or username is missing
7778
if (Objects.equals(inputData.getTitle(), "")) {
78-
return flashcardSetOutputBoundary.prepareFailView("Title is missing!");
79+
return createFlashcardSetOutputBoundary.prepareFailView("Title is missing!");
7980
} else if (Objects.equals(inputData.getDescription(), "")) {
80-
return flashcardSetOutputBoundary.prepareFailView("Description is missing!");
81+
return createFlashcardSetOutputBoundary.prepareFailView("Description is missing!");
8182
} else if (Objects.equals(inputData.getUsername(), "")) {
82-
return flashcardSetOutputBoundary.prepareFailView("Username is missing!");
83+
return createFlashcardSetOutputBoundary.prepareFailView("Username is missing!");
8384
}
8485

8586
int tempFlashcardSetId = -1; // placeholder id
@@ -101,9 +102,9 @@ public FlashcardSetResponseModel create(FlashcardSetRequestModel inputData) thro
101102
FlashcardSet savedFs = factory.create(inputData.getTitle(), inputData.getDescription(),
102103
inputData.isPrivate(), savedFlashcardSetId, inputData.getUsername());
103104

104-
FlashcardSetResponseModel responseModel = new FlashcardSetResponseModel(savedFs);
105+
CreateFlashcardSetResponseModel responseModel = new CreateFlashcardSetResponseModel(savedFs);
105106

106-
return flashcardSetOutputBoundary.prepareSuccessView(responseModel);
107+
return createFlashcardSetOutputBoundary.prepareSuccessView(responseModel);
107108
} catch (NullPointerException e) {
108109
return null;
109110
}

src/main/java/create_flashcard_set_use_case/FlashcardSetOutputBoundary.java renamed to src/main/java/create_flashcard_set_use_case/CreateFlashcardSetOutputBoundary.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,29 @@
22

33
// Use case (Red) layer
44

5+
import interface_adapters.presenters.exceptions.CreateFlashcardSetFailed;
6+
57
/**
68
* The output boundary interface that updates the view when creating a flashcard set succeeds or fails.
79
*
810
* @author Edward Ishii
911
*/
1012

11-
public interface FlashcardSetOutputBoundary {
13+
public interface CreateFlashcardSetOutputBoundary {
1214
/**
1315
* Prepares the success view when a flashcard set is created and saved.
1416
*
1517
* @param fs the flashcard set that has been created.
1618
* @return the response model containing the saved flashcard set data.
1719
*/
18-
FlashcardSetResponseModel prepareSuccessView(FlashcardSetResponseModel fs);
20+
CreateFlashcardSetResponseModel prepareSuccessView(CreateFlashcardSetResponseModel fs);
1921

2022
/**
2123
* Prepares the fail view when a flashcard set cannot be created or saved.
2224
*
2325
* @param error the failure message.
2426
* @return the response model containing the failure message.
25-
* @throws FlashcardSetCreationFailed the error thrown when flashcard set creation fails.
27+
* @throws CreateFlashcardSetFailed the error thrown when flashcard set creation fails.
2628
*/
27-
FlashcardSetResponseModel prepareFailView(String error) throws FlashcardSetCreationFailed;
29+
CreateFlashcardSetResponseModel prepareFailView(String error) throws CreateFlashcardSetFailed;
2830
}

src/main/java/create_flashcard_set_use_case/FlashcardSetRequestModel.java renamed to src/main/java/create_flashcard_set_use_case/CreateFlashcardSetRequestModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* @author Edward Ishii
99
*/
10-
public class FlashcardSetRequestModel {
10+
public class CreateFlashcardSetRequestModel {
1111
private String title;
1212
private String description;
1313
private boolean isPrivate;
@@ -21,7 +21,7 @@ public class FlashcardSetRequestModel {
2121
* @param isPrivate the privacy of the flashcard set.
2222
* @param username the owner's username of the flashcard set.
2323
*/
24-
public FlashcardSetRequestModel(String title, String description, boolean isPrivate, String username) {
24+
public CreateFlashcardSetRequestModel(String title, String description, boolean isPrivate, String username) {
2525
this.title = title;
2626
this.description = description;
2727
this.isPrivate = isPrivate;

src/main/java/create_flashcard_set_use_case/FlashcardSetResponseModel.java renamed to src/main/java/create_flashcard_set_use_case/CreateFlashcardSetResponseModel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
*
1010
* @author Edward Ishii
1111
*/
12-
public class FlashcardSetResponseModel {
12+
public class CreateFlashcardSetResponseModel {
1313
private final FlashcardSet fs;
1414

1515
/**
1616
* Constructs a FlashcardSetResponseModel.
1717
*
1818
* @param fs the flashcard set.
1919
*/
20-
public FlashcardSetResponseModel(FlashcardSet fs) {
20+
public CreateFlashcardSetResponseModel(FlashcardSet fs) {
2121
this.fs = fs;
2222
}
2323

src/main/java/create_flashcard_set_use_case/LabelTextPanel.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/main/java/create_flashcard_set_use_case/InMemoryFlashcardSet.java renamed to src/main/java/create_flashcard_set_use_case/function_testing/InMemoryFlashcardSet.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package create_flashcard_set_use_case;
1+
package create_flashcard_set_use_case.function_testing;
22

3-
import data_access.IFlashcardSetDataAccess;
4-
import data_access.entity_request_models.FlashcardSetDsRequestModel;
5-
import delete_flashcard_set_use_case.FlashcardSetNotFound;
3+
import data_access_use_case.IFlashcardSetDataAccess;
4+
import data_access_use_case.entity_request_models.FlashcardSetDsRequestModel;
5+
import interface_adapters.presenters.exceptions.DeleteFlashcardSetFailed;
66

77
import java.util.ArrayList;
88

@@ -26,7 +26,7 @@ private boolean checkIds(int id1, int id2) {
2626
* @return the flashcard set associated with the id.
2727
*/
2828
@Override
29-
public FlashcardSetDsRequestModel getFlashcardSet(int flashcardSetId) throws FlashcardSetNotFound {
29+
public FlashcardSetDsRequestModel getFlashcardSet(int flashcardSetId) throws DeleteFlashcardSetFailed {
3030

3131
for (FlashcardSetDsRequestModel fs : flashcardSets) {
3232
if (checkIds(fs.getFlashcardSetId(), flashcardSetId)) {
File renamed without changes.

0 commit comments

Comments
 (0)