@@ -22,6 +22,7 @@ connections with their peers during their time in University.
2222
2323System: BookFace
2424
25+ ```
2526Use case: UC1 - Add Contact
2627
2728Actor: User
@@ -37,7 +38,9 @@ Extensions:
37382a. BookFace detects incomplete/invalid details entered.
3839BookFace displays an example of valid details.
3940System repeats Step 1-2 until valid details are entered.
41+ ```
4042
43+ ```
4144Use case: UC2 - Delete Contact
4245
4346Actor: User
@@ -53,7 +56,9 @@ Extensions:
53562a. BookFace detects incomplete/invalid index entered.
5457BookFace displays an example of a valid index.
5558System repeats Step 1-2 until valid information is entered.
59+ ```
5660
61+ ```
5762Use case: UC3 - Edit Contact
5863
5964Actor: User
@@ -69,7 +74,9 @@ Extensions:
69742a. BookFace detects incomplete/invalid details entered.
7075BookFace displays an example of valid details.
7176System repeats Step 1-2 until valid details are entered.
77+ ```
7278
79+ ```
7380Use case: UC4 - Find Contact
7481
7582Actor: User
@@ -85,7 +92,9 @@ Extensions:
85922a. BookFace detects no name entered.
8693BookFace displays an example of a valid name.
8794System repeats Step 1-2 until a name is entered.
95+ ```
8896
97+ ```
8998Use case: UC5 - List Contacts
9099
91100Actor: User
941031. User chooses to view all contacts.
951042. BookFace displays all the user's contacts.
96105 Use case ends.
106+ ```
97107
108+ ```
98109Use case: UC6 - Get Help on Commands
99110
100111Actor: User
1031141. User chooses to view instructions on how to use BookFace.
1041152. BookFace displays a url to its User Guide.
105116 Use case ends.
117+ ```
106118
119+ ```
107120Use case: UC7 - Add Image for a Contact
108121Actor: User
109122MSS:
@@ -117,7 +130,9 @@ Extensions:
1171302a. BookFace detects invalid/incomplete filepath or index.
118131BookFace displays an example of a valid filepath and index.
119132System repeats Step 1-2 until valid information is entered.
133+ ```
120134
135+ ```
121136Use case: UC8 - Delete Image for a Contact
122137
123138Actor: User
@@ -136,7 +151,9 @@ System repeats Step 1-2 until valid information is entered.
136151
1371522b. BookFace detects that the contact does not have an image added.
138153Use case ends.
154+ ```
139155
156+ ```
140157Use case: UC9 - Import Contacts from a Faculty
141158
142159Actor: User
@@ -152,6 +169,7 @@ Extensions:
1521692a. BookFace detects incomplete/invalid details entered.
153170BookFace displays an example of valid details.
154171System repeats Step 1-2 until valid details are entered.
172+ ```
155173
156174** Glossary** :
157175* Student: A user who belongs to a faculty and attends one or more classes with other students
@@ -209,7 +227,7 @@ The following activity diagram summarizes what happens when a user executes add-
209227 - Path is easily invalidated (e.g. user moves/deletes/renames the image)
210228## Delete Image Feature
211229### Delete Image Implementation
212- The delete-image feature is facilitated by the classes ` DeleteImageCommand ` ,
230+ The delete-image feature is facilitated by the classes ` DeleteImageCommand ` ,
213231` DeleteImageCommandParser ` , ` ImageUtil ` , and ` ParserUtil ` .
214232The ` DeleteImageCommandParser ` first parses through the user command to obtain
215233the desired index through using ` ParserUtil#parseIndex ` . Following which an
@@ -225,7 +243,7 @@ which have already had an image added.
225243
226244Step 2: The user decides that the image given to the contact at index 4 is not
227245suitable, and wants to delete it. The user inputs ` delete-image 4 ` .
228- ` DeleteImageCommandParser#parse ` is then called to parse this input for the
246+ ` DeleteImageCommandParser#parse ` is then called to parse this input for the
229247desired index.
230248
231249> ** Note** : If the user inputs an index of a contact which currently does not have
@@ -258,10 +276,64 @@ directory.
258276 - Ensures application does not consume excess storage
259277 - Cons:
260278 - Extra complexity in requiring file i/o operations
261-
279+
262280- ** Alternative 2:** Disregard deleting the image file from program directory.
263281 - Pros:
264282 - Easier to implement
265283 - Cons:
266284 - Application will take up increasingly more unnecessary storage during
267285 its lifetime of usage
286+ ## Import Contacts Feature
287+ ### Import Contacts Implementation
288+ The import feature is facilitated by the classes ` ImportCommand ` , ` ImportCommandParser ` ,
289+ ` SocContacts ` and ` ChsContacts ` . The ` ImportCommandParser ` first parses through the user
290+ command to obtain the desired faculty to be imported. An instance of
291+ a ` ImportCommand ` containing the desired faculty from either ` SocContacts ` or
292+ ` ChsContacts ` is then returned. ` ImportCommand#execute ` is then called,
293+ which calls ` Model#addPerson ` to add the unique contacts into BookFace.
294+
295+ Given below is an example usage scenario for how the import mechanism behaves.
296+
297+ Step 1: User starts up the application and sees their list of contacts.
298+
299+ Step 2: User decides to import contacts from faculty SOC and input
300+ ` import soc ` . ` ImportCommandParser#parse ` is then called to parse
301+ this input for the desired faculty.
302+
303+ > ** Note** : If the user inputs a faculty that does not exist,
304+ > an error will be returned to the user
305+ >
306+
307+ Step 3: If the faculty was valid, ` ImportCommand#execute ` is called
308+ with the valid faculty that was parsed
309+
310+ Step 4: ` Model#addPerson ` is called for however
311+ many non-duplicate contacts are to be added.
312+
313+
314+ The following sequence diagram shows how the import command works.
315+
316+ ![ ImportSequenceDiagram] ( images/ImportSequenceDiagram.png )
317+
318+
319+ The following activity diagram summarizes what happens when a user executes an
320+ import command:
321+
322+ ![ ImportActivityDiagram] ( images/ImportActivityDiagram.png )
323+
324+ ### Design Considerations:
325+ - ** Alternative 1 (current choice):** ImportCommand#execute takes in a string to
326+ determine which faculty of in-built contacts to import
327+ - Pros:
328+ - User input is easily parsed (as it is just a string), faster to read and
329+ execute the command
330+ - Cons:
331+ - Possibly bad OOP design, ImportCommand#execute should take in a Faculty object
332+
333+ - ** Alternative 2:** ImportCommand#execute takes in a Faculty object instead of a string
334+ to determine which faculty of in-built contacts to import
335+ - Pros:
336+ - Better OOP design then simply taking in a string
337+ - Cons:
338+ - Input will take longer to parse as the string input has to be parsed into
339+ a faculty object to be used as input to ImportCommand#execute
0 commit comments