Skip to content

Commit 65c3774

Browse files
authored
Merge pull request #51 from AY1920S2-CS2103T-F10-2/revert-49-master
Revert "Create New and Refactor Old UI classes "
2 parents 688c898 + fb666b0 commit 65c3774

File tree

87 files changed

+972
-3509
lines changed

Some content is hidden

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

87 files changed

+972
-3509
lines changed

docs/DeveloperGuide.adoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ endif::[]
1616

1717
By: `CS2103T-F10-2`      Since: `Feb 2020`      Licence: `MIT`
1818

19-
== Introduction
20-
21-
(to be inserted)
22-
2319
== Setting up
2420

2521
Refer to the guide <<SettingUp#, here>>.

docs/diagrams/tracing/LogicSequenceDiagram.puml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ create ecp
1313
abp -> ecp
1414
abp -> ecp ++: parse(arguments)
1515
create ec
16-
ecp -> ec ++: index, editInternshipDescriptor
16+
ecp -> ec ++: index, editPersonDescriptor
1717
ec --> ecp --
1818
ecp --> abp --: command
1919
abp --> logic --: command

docs/tutorials/TracingCode.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ image::LogicSequenceDiagram.png[]
180180
public CommandResult execute(Model model) throws CommandException {
181181
...
182182
Person personToEdit = lastShownList.get(index.getZeroBased());
183-
Person editedPerson = createEditedPerson(personToEdit, editInternshipDescriptor);
183+
Person editedPerson = createEditedPerson(personToEdit, editPersonDescriptor);
184184
if (!personToEdit.isSamePerson(editedPerson) && model.hasPerson(editedPerson)) {
185185
throw new CommandException(MESSAGE_DUPLICATE_PERSON);
186186
}

src/main/java/seedu/address/MainApp.java

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
import seedu.address.commons.util.StringUtil;
1616
import seedu.address.logic.Logic;
1717
import seedu.address.logic.LogicManager;
18-
import seedu.address.model.InternshipDiary;
18+
import seedu.address.model.AddressBook;
1919
import seedu.address.model.Model;
2020
import seedu.address.model.ModelManager;
21-
import seedu.address.model.ReadOnlyInternshipDiary;
21+
import seedu.address.model.ReadOnlyAddressBook;
2222
import seedu.address.model.ReadOnlyUserPrefs;
2323
import seedu.address.model.UserPrefs;
2424
import seedu.address.model.util.SampleDataUtil;
25-
import seedu.address.storage.InternshipDiaryStorage;
26-
import seedu.address.storage.JsonInternshipDiaryStorage;
25+
import seedu.address.storage.AddressBookStorage;
26+
import seedu.address.storage.JsonAddressBookStorage;
2727
import seedu.address.storage.JsonUserPrefsStorage;
2828
import seedu.address.storage.Storage;
2929
import seedu.address.storage.StorageManager;
@@ -48,17 +48,16 @@ public class MainApp extends Application {
4848

4949
@Override
5050
public void init() throws Exception {
51-
logger.info("=============================[ Initializing InternshipDiary ]===========================");
51+
logger.info("=============================[ Initializing AddressBook ]===========================");
5252
super.init();
5353

5454
AppParameters appParameters = AppParameters.parse(getParameters());
5555
config = initConfig(appParameters.getConfigPath());
5656

5757
UserPrefsStorage userPrefsStorage = new JsonUserPrefsStorage(config.getUserPrefsFilePath());
5858
UserPrefs userPrefs = initPrefs(userPrefsStorage);
59-
InternshipDiaryStorage internshipDiaryStorage =
60-
new JsonInternshipDiaryStorage(userPrefs.getInternshipDiaryFilePath());
61-
storage = new StorageManager(internshipDiaryStorage, userPrefsStorage);
59+
AddressBookStorage addressBookStorage = new JsonAddressBookStorage(userPrefs.getAddressBookFilePath());
60+
storage = new StorageManager(addressBookStorage, userPrefsStorage);
6261

6362
initLogging(config);
6463

@@ -75,20 +74,20 @@ public void init() throws Exception {
7574
* or an empty address book will be used instead if errors occur when reading {@code storage}'s address book.
7675
*/
7776
private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) {
78-
Optional<ReadOnlyInternshipDiary> internshipDiaryOptional;
79-
ReadOnlyInternshipDiary initialData;
77+
Optional<ReadOnlyAddressBook> addressBookOptional;
78+
ReadOnlyAddressBook initialData;
8079
try {
81-
internshipDiaryOptional = storage.readInternshipDiary();
82-
if (!internshipDiaryOptional.isPresent()) {
83-
logger.info("Data file not found. Will be starting with a sample InternshipDiary");
80+
addressBookOptional = storage.readAddressBook();
81+
if (!addressBookOptional.isPresent()) {
82+
logger.info("Data file not found. Will be starting with a sample AddressBook");
8483
}
85-
initialData = internshipDiaryOptional.orElseGet(SampleDataUtil::getSampleInternshipDiary);
84+
initialData = addressBookOptional.orElseGet(SampleDataUtil::getSampleAddressBook);
8685
} catch (DataConversionException e) {
87-
logger.warning("Data file not in the correct format. Will be starting with an empty InternshipDiary");
88-
initialData = new InternshipDiary();
86+
logger.warning("Data file not in the correct format. Will be starting with an empty AddressBook");
87+
initialData = new AddressBook();
8988
} catch (IOException e) {
90-
logger.warning("Problem while reading from the file. Will be starting with an empty InternshipDiary");
91-
initialData = new InternshipDiary();
89+
logger.warning("Problem while reading from the file. Will be starting with an empty AddressBook");
90+
initialData = new AddressBook();
9291
}
9392

9493
return new ModelManager(initialData, userPrefs);
@@ -152,7 +151,7 @@ protected UserPrefs initPrefs(UserPrefsStorage storage) {
152151
+ "Using default user prefs");
153152
initializedPrefs = new UserPrefs();
154153
} catch (IOException e) {
155-
logger.warning("Problem while reading from the file. Will be starting with an empty InternshipDiary");
154+
logger.warning("Problem while reading from the file. Will be starting with an empty AddressBook");
156155
initializedPrefs = new UserPrefs();
157156
}
158157

@@ -168,13 +167,13 @@ protected UserPrefs initPrefs(UserPrefsStorage storage) {
168167

169168
@Override
170169
public void start(Stage primaryStage) {
171-
logger.info("Starting InternshipDiary " + MainApp.VERSION);
170+
logger.info("Starting AddressBook " + MainApp.VERSION);
172171
ui.start(primaryStage);
173172
}
174173

175174
@Override
176175
public void stop() {
177-
logger.info("============================ [ Stopping InternshipDiary ] =============================");
176+
logger.info("============================ [ Stopping Address Book ] =============================");
178177
try {
179178
storage.saveUserPrefs(model.getUserPrefs());
180179
} catch (IOException e) {

src/main/java/seedu/address/commons/core/Messages.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ public class Messages {
77

88
public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
99
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
10-
public static final String MESSAGE_INVALID_INTERNSHIP_DISPLAYED_INDEX =
11-
"The internship application index provided is invalid";
12-
public static final String MESSAGE_INTERNSHIP_LISTED_OVERVIEW = "%1$d internship application listed!";
10+
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
11+
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";
1312

1413
}

src/main/java/seedu/address/logic/Logic.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import seedu.address.logic.commands.exceptions.CommandException;
99
import seedu.address.logic.parser.exceptions.ParseException;
1010
import seedu.address.model.ReadOnlyAddressBook;
11-
import seedu.address.model.ReadOnlyInternshipDiary;
12-
import seedu.address.model.internship.InternshipApplication;
1311
import seedu.address.model.person.Person;
1412

1513
/**
@@ -32,30 +30,14 @@ public interface Logic {
3230
*/
3331
ReadOnlyAddressBook getAddressBook();
3432

35-
/**
36-
* Returns the InternshipDiary.
37-
*
38-
* @see seedu.address.model.Model#getInternshipDiary()
39-
*/
40-
ReadOnlyInternshipDiary getInternshipDiary();
41-
42-
4333
/** Returns an unmodifiable view of the filtered list of persons */
4434
ObservableList<Person> getFilteredPersonList();
4535

46-
/** Returns an unmodifiable view of the filtered list of internship applications */
47-
ObservableList<InternshipApplication> getFilteredInternshipApplicationList();
48-
4936
/**
5037
* Returns the user prefs' address book file path.
5138
*/
5239
Path getAddressBookFilePath();
5340

54-
/**
55-
* Returns the user prefs' internship diary file path.
56-
*/
57-
Path getInternshipDiaryFilePath();
58-
5941
/**
6042
* Returns the user prefs' GUI settings.
6143
*/

src/main/java/seedu/address/logic/LogicManager.java

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
import seedu.address.logic.commands.Command;
1111
import seedu.address.logic.commands.CommandResult;
1212
import seedu.address.logic.commands.exceptions.CommandException;
13-
import seedu.address.logic.parser.InternshipDiaryParser;
13+
import seedu.address.logic.parser.AddressBookParser;
1414
import seedu.address.logic.parser.exceptions.ParseException;
1515
import seedu.address.model.Model;
1616
import seedu.address.model.ReadOnlyAddressBook;
17-
import seedu.address.model.ReadOnlyInternshipDiary;
18-
import seedu.address.model.internship.InternshipApplication;
1917
import seedu.address.model.person.Person;
2018
import seedu.address.storage.Storage;
2119

@@ -28,25 +26,24 @@ public class LogicManager implements Logic {
2826

2927
private final Model model;
3028
private final Storage storage;
31-
private final InternshipDiaryParser internshipDiaryParser;
29+
private final AddressBookParser addressBookParser;
3230

3331
public LogicManager(Model model, Storage storage) {
3432
this.model = model;
3533
this.storage = storage;
36-
internshipDiaryParser = new InternshipDiaryParser();
34+
addressBookParser = new AddressBookParser();
3735
}
3836

3937
@Override
4038
public CommandResult execute(String commandText) throws CommandException, ParseException {
4139
logger.info("----------------[USER COMMAND][" + commandText + "]");
4240

4341
CommandResult commandResult;
44-
Command command = internshipDiaryParser.parseCommand(commandText);
42+
Command command = addressBookParser.parseCommand(commandText);
4543
commandResult = command.execute(model);
4644

4745
try {
48-
//cf: Needs to be changed after storage is refactored.
49-
storage.saveInternshipDiary(model.getInternshipDiary());
46+
storage.saveAddressBook(model.getAddressBook());
5047
} catch (IOException ioe) {
5148
throw new CommandException(FILE_OPS_ERROR_MESSAGE + ioe, ioe);
5249
}
@@ -59,31 +56,16 @@ public ReadOnlyAddressBook getAddressBook() {
5956
return model.getAddressBook();
6057
}
6158

62-
@Override
63-
public ReadOnlyInternshipDiary getInternshipDiary() {
64-
return model.getInternshipDiary();
65-
}
66-
6759
@Override
6860
public ObservableList<Person> getFilteredPersonList() {
6961
return model.getFilteredPersonList();
7062
}
7163

72-
@Override
73-
public ObservableList<InternshipApplication> getFilteredInternshipApplicationList() {
74-
return model.getFilteredInternshipApplicationList();
75-
}
76-
7764
@Override
7865
public Path getAddressBookFilePath() {
7966
return model.getAddressBookFilePath();
8067
}
8168

82-
@Override
83-
public Path getInternshipDiaryFilePath() {
84-
return model.getInternshipDiaryFilePath();
85-
}
86-
8769
@Override
8870
public GuiSettings getGuiSettings() {
8971
return model.getGuiSettings();

src/main/java/seedu/address/logic/commands/AddCommand.java

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,69 +2,59 @@
22

33
import static java.util.Objects.requireNonNull;
44
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
5-
import static seedu.address.logic.parser.CliSyntax.PREFIX_COMPANY;
6-
import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE;
75
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
6+
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
87
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
9-
import static seedu.address.logic.parser.CliSyntax.PREFIX_PRIORITY;
10-
import static seedu.address.logic.parser.CliSyntax.PREFIX_ROLE;
11-
import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS;
8+
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
129

1310
import seedu.address.logic.commands.exceptions.CommandException;
1411
import seedu.address.model.Model;
15-
import seedu.address.model.internship.InternshipApplication;
12+
import seedu.address.model.person.Person;
1613

1714
/**
18-
* Adds a person to the internship diary.
15+
* Adds a person to the address book.
1916
*/
2017
public class AddCommand extends Command {
2118

2219
public static final String COMMAND_WORD = "add";
2320

24-
public static final String MESSAGE_USAGE = COMMAND_WORD
25-
+ ": Adds an internship application to the internship diary. "
21+
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book. "
2622
+ "Parameters: "
27-
+ PREFIX_COMPANY + "COMPANY "
28-
+ PREFIX_ROLE + "ROLE "
29-
+ PREFIX_ADDRESS + "ADDRESS "
23+
+ PREFIX_NAME + "NAME "
3024
+ PREFIX_PHONE + "PHONE "
3125
+ PREFIX_EMAIL + "EMAIL "
32-
+ PREFIX_DATE + "APPLICATION DATE "
33-
+ PREFIX_PRIORITY + "PRIORITY "
34-
+ PREFIX_STATUS + "STATUS "
26+
+ PREFIX_ADDRESS + "ADDRESS "
27+
+ "[" + PREFIX_TAG + "TAG]...\n"
3528
+ "Example: " + COMMAND_WORD + " "
36-
+ PREFIX_COMPANY + "Google "
37-
+ PREFIX_ROLE + "Software Engineer "
38-
+ PREFIX_ADDRESS + "123 Kent Ridge Road "
39-
+ PREFIX_PHONE + "67654321 "
40-
+ PREFIX_EMAIL + "[email protected] "
41-
+ PREFIX_DATE + "10 Feb 2020 "
42-
+ PREFIX_PRIORITY + "5 "
43-
+ PREFIX_STATUS + "Active ";
29+
+ PREFIX_NAME + "John Doe "
30+
+ PREFIX_PHONE + "98765432 "
31+
+ PREFIX_EMAIL + "[email protected] "
32+
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 "
33+
+ PREFIX_TAG + "friends "
34+
+ PREFIX_TAG + "owesMoney";
4435

45-
public static final String MESSAGE_SUCCESS = "New internship application added: %1$s";
46-
public static final String MESSAGE_DUPLICATE_INTERNSHIP =
47-
"This internship application already exists in the internship diary";
36+
public static final String MESSAGE_SUCCESS = "New person added: %1$s";
37+
public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book";
4838

49-
private final InternshipApplication toAdd;
39+
private final Person toAdd;
5040

5141
/**
52-
* Creates an AddCommand to add the specified {@code internshipApplication}
42+
* Creates an AddCommand to add the specified {@code Person}
5343
*/
54-
public AddCommand(InternshipApplication internshipApplication) {
55-
requireNonNull(internshipApplication);
56-
toAdd = internshipApplication;
44+
public AddCommand(Person person) {
45+
requireNonNull(person);
46+
toAdd = person;
5747
}
5848

5949
@Override
6050
public CommandResult execute(Model model) throws CommandException {
6151
requireNonNull(model);
6252

63-
if (model.hasInternshipApplication(toAdd)) {
64-
throw new CommandException(MESSAGE_DUPLICATE_INTERNSHIP);
53+
if (model.hasPerson(toAdd)) {
54+
throw new CommandException(MESSAGE_DUPLICATE_PERSON);
6555
}
6656

67-
model.addInternshipApplication(toAdd);
57+
model.addPerson(toAdd);
6858
return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd));
6959
}
7060

src/main/java/seedu/address/logic/commands/ClearCommand.java

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

33
import static java.util.Objects.requireNonNull;
44

5-
import seedu.address.model.InternshipDiary;
5+
import seedu.address.model.AddressBook;
66
import seedu.address.model.Model;
77

88
/**
9-
* Clears the internship diary.
9+
* Clears the address book.
1010
*/
1111
public class ClearCommand extends Command {
1212

1313
public static final String COMMAND_WORD = "clear";
14-
public static final String MESSAGE_SUCCESS = "Internship diary has been cleared!";
14+
public static final String MESSAGE_SUCCESS = "Address book has been cleared!";
1515

1616

1717
@Override
1818
public CommandResult execute(Model model) {
1919
requireNonNull(model);
20-
model.setInternshipDiary(new InternshipDiary());
20+
model.setAddressBook(new AddressBook());
2121
return new CommandResult(MESSAGE_SUCCESS);
2222
}
2323
}

0 commit comments

Comments
 (0)