Skip to content

Commit

Permalink
Pull request from team repo (#10)
Browse files Browse the repository at this point in the history
* Implement view schedule feature (AY1920S1-CS2103-F09-1#68)

* Pull request (#7)

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml to create a table (AY1920S1-CS2103-F09-1#54)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Add skeleton classes for generate interview timetable feature (AY1920S1-CS2103-F09-1#50)

* Add skeleton classes for generate interview timetable feature

* Fix errors with continous integration

* Add Unit Tests for Row, Column, and Schedule class

* Fix checkstyle issue

* Add skeleton Email feature (AY1920S1-CS2103-F09-1#51)

* Add new unimplemented email command

* Fix line endings

* Edit UserGuide.adoc to change UI display feature (AY1920S1-CS2103-F09-1#55)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Edit UserGuide to change the display feature

* Add skeleton Interviewee and Interviewer class (AY1920S1-CS2103-F09-1#46)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* [Partial] Implement import interviewer's availability from excel sheet feature (AY1920S1-CS2103-F09-1#57)

* Import from excel function

* Adds implementation for ExcelReader

* debug importExcel classes

* Check style for Import branch

* Add minimal functionality for Interviewee and Interviewer class (AY1920S1-CS2103-F09-1#60)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* Add minimal fields and logic for Interviewee and Interviewer

* Fix travis CI issues

* Update Interviewee, add Emails, Rework Faculty

* [Partial] Generate interview schedule timetable from interviewers' availability (AY1920S1-CS2103-F09-1#61)

* [Partial] Implement Schedule Class

* Modify Model Manager to adapt to list of schedules

* Fix travis build issue

* Fix checkstyle issue

* Edit fxml file to change UI

* Pull request from team repo (#8)

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml to create a table (AY1920S1-CS2103-F09-1#54)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Add skeleton classes for generate interview timetable feature (AY1920S1-CS2103-F09-1#50)

* Add skeleton classes for generate interview timetable feature

* Fix errors with continous integration

* Add Unit Tests for Row, Column, and Schedule class

* Fix checkstyle issue

* Add skeleton Email feature (AY1920S1-CS2103-F09-1#51)

* Add new unimplemented email command

* Fix line endings

* Edit UserGuide.adoc to change UI display feature (AY1920S1-CS2103-F09-1#55)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Edit UserGuide to change the display feature

* Add skeleton Interviewee and Interviewer class (AY1920S1-CS2103-F09-1#46)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* [Partial] Implement import interviewer's availability from excel sheet feature (AY1920S1-CS2103-F09-1#57)

* Import from excel function

* Adds implementation for ExcelReader

* debug importExcel classes

* Check style for Import branch

* Add minimal functionality for Interviewee and Interviewer class (AY1920S1-CS2103-F09-1#60)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* Add minimal fields and logic for Interviewee and Interviewer

* Fix travis CI issues

* Update Interviewee, add Emails, Rework Faculty

* [Partial] Generate interview schedule timetable from interviewers' availability (AY1920S1-CS2103-F09-1#61)

* [Partial] Implement Schedule Class

* Modify Model Manager to adapt to list of schedules

* Fix travis build issue

* Fix checkstyle issue

* Fix checkstyle issue (AY1920S1-CS2103-F09-1#62)

* Add ScheduleView.java to display timetable

* Resolve conflicts

* Resolve conflict

* Resolve Conflict

* Resolve Conflict

* Resolve Conflict

* Resolve Conflict

* Resolve Conflict

* Resolve Conflicts

* Pull Request (#9)

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml to create a table (AY1920S1-CS2103-F09-1#54)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Add skeleton classes for generate interview timetable feature (AY1920S1-CS2103-F09-1#50)

* Add skeleton classes for generate interview timetable feature

* Fix errors with continous integration

* Add Unit Tests for Row, Column, and Schedule class

* Fix checkstyle issue

* Add skeleton Email feature (AY1920S1-CS2103-F09-1#51)

* Add new unimplemented email command

* Fix line endings

* Edit UserGuide.adoc to change UI display feature (AY1920S1-CS2103-F09-1#55)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (AY1920S1-CS2103-F09-1#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (AY1920S1-CS2103-F09-1#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (AY1920S1-CS2103-F09-1#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Edit UserGuide to change the display feature

* Add skeleton Interviewee and Interviewer class (AY1920S1-CS2103-F09-1#46)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* [Partial] Implement import interviewer's availability from excel sheet feature (AY1920S1-CS2103-F09-1#57)

* Import from excel function

* Adds implementation for ExcelReader

* debug importExcel classes

* Check style for Import branch

* Add minimal functionality for Interviewee and Interviewer class (AY1920S1-CS2103-F09-1#60)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* Add minimal fields and logic for Interviewee and Interviewer

* Fix travis CI issues

* Update Interviewee, add Emails, Rework Faculty

* [Partial] Generate interview schedule timetable from interviewers' availability (AY1920S1-CS2103-F09-1#61)

* [Partial] Implement Schedule Class

* Modify Model Manager to adapt to list of schedules

* Fix travis build issue

* Fix checkstyle issue

* Fix checkstyle issue (AY1920S1-CS2103-F09-1#62)

* [Complete] Implement Schedule class (AY1920S1-CS2103-F09-1#63)

* Update Slot class and squash bug

* Add ScheduleView.java for viewing of timetable

* Edit ScheduleView.java to make it work

* Edit code to fulfil checkstyle

* Edit code to fulfil checkstyle

* Edit code to fulfil Checkstyle requirements

* Delete getSamplePersons from SampleDataUtil.java

* Edit code to fulfil Checkstyle Requirements

* Fix Checkstyle

* Implement timeslot sub-command (AY1920S1-CS2103-F09-1#65)

* Implement timeslot sub-command with basic error handling

* Fix checkstyle

* Specify Interviewee instead of Person

* Implement dummy code for opening user's mail client

* Remove unused import

* Implement functions for getting interviewee's email from name (AY1920S1-CS2103-F09-1#72)
  • Loading branch information
mrchensheng21 committed Oct 21, 2019
1 parent e54bce4 commit 60a2110
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/main/java/seedu/address/commons/core/Messages.java
Expand Up @@ -8,6 +8,7 @@ public class Messages {
public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
public static final String MESSAGE_INVALID_PERSON_NAME = "The person name provided does not exist";
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";

}
58 changes: 55 additions & 3 deletions src/main/java/seedu/address/logic/commands/EmailCommand.java
@@ -1,7 +1,16 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;

import java.io.IOException;
import java.util.List;

import seedu.address.commons.core.Messages;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.person.Interviewee;
import seedu.address.model.person.Name;
import seedu.address.model.person.Person;

/**
* Handles the sending of emails to interviewers/interviewees based on the email addresses associated with
Expand All @@ -10,17 +19,60 @@
public class EmailCommand extends Command {

public static final String COMMAND_WORD = "email";
public static final String TIMESLOT_COMMAND_WORD = "timeslot";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Handles the sending of emails to "
+ "interviewers/interviewees using their email addresses.\n\n"
+ COMMAND_WORD + " timeslots\n"
+ "Sends an email containing the interviewee's allocated interview time slot to every "
+ COMMAND_WORD + " " + TIMESLOT_COMMAND_WORD + " <interviewee-name> [email-address-type]\n"
+ "Sends an email containing the interviewee's allocated interview time slot to the specified "
+ "interviewee, including other details such as the interviewer, time, date and location.";

public static final String MESSAGE_NOT_IMPLEMENTED_YET = "Email command not implemented yet";
public static final String MESSAGE_EMAIL_INTERVIEWEE_SUCCESS = "Emailed interviewee: %1$s";

private final Name intervieweeName;

/**
* Constructor for the EmailCommand class where no email type is specified.
* @param intervieweeName The name of the {@code Interviewee}.
*/
public EmailCommand(Name intervieweeName) {
this.intervieweeName = intervieweeName;
}

@Override
public CommandResult execute(Model model) throws CommandException {
throw new CommandException(MESSAGE_NOT_IMPLEMENTED_YET);
requireNonNull(model);
// TODO: Need to filter for Interviewees only
List<Person> lastShownList = model.getFilteredPersonList();
// Interviewee intervieweeToEmail = new Interviewee.IntervieweeBuilder(lastShownList.get(1)).build();
Interviewee intervieweeToEmail = null;

for (Person person : lastShownList) {
if (person instanceof Interviewee && person.getName().equals(this.intervieweeName)) {
intervieweeToEmail = (Interviewee) person;
break;
}
}

if (intervieweeToEmail == null) {
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_NAME);
}

// TODO: Implement email feature
try {
model.emailInterviewee(intervieweeToEmail);
} catch (IOException ioe) {
// Happens when the mail client cannot be launched, should prompt the user to open a URL instead
throw new CommandException(MESSAGE_NOT_IMPLEMENTED_YET);
}
return new CommandResult(String.format(MESSAGE_EMAIL_INTERVIEWEE_SUCCESS, intervieweeToEmail));
}

@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof EmailCommand // instanceof handles nulls
&& intervieweeName.equals(((EmailCommand) other).intervieweeName)); // state check
}
}
Expand Up @@ -74,7 +74,7 @@ public Command parseCommand(String userInput) throws ParseException {
return new ImportCommandParser().parse(arguments);

case EmailCommand.COMMAND_WORD:
return new EmailCommand();
return new EmailCommandParser().parse(arguments);

default:
throw new ParseException(MESSAGE_UNKNOWN_COMMAND);
Expand Down
63 changes: 63 additions & 0 deletions src/main/java/seedu/address/logic/parser/EmailCommandParser.java
@@ -0,0 +1,63 @@
package seedu.address.logic.parser;

import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import seedu.address.logic.commands.EmailCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.Name;

/**
* Parses input arguments and creates a new EmailCommand object.
*/
public class EmailCommandParser implements Parser<EmailCommand> {

/**
* Parses the given {@code String} of arguments in the context of the EmailCommand
* and returns an EmailCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public EmailCommand parse(String args) throws ParseException {
String trimmedArgs = args.trim();
String[] splitArgs = trimmedArgs.split("\\s+");

if (trimmedArgs.isEmpty() || splitArgs.length < 2) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, EmailCommand.MESSAGE_USAGE));
}

boolean isTimeslotCommand = splitArgs[0].equals(EmailCommand.TIMESLOT_COMMAND_WORD);

if (isTimeslotCommand) {
return parseTimeslotCommand(trimmedArgs);
} else {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, EmailCommand.MESSAGE_USAGE));
}
}

/**
* Handles the "timeslot" sub-command in the context of the EmailCommand and returns
* an EmailCommand object for execution
* @param args The arguments of the command provided by the user
* @throws ParseException if the user input does not conform the expected format
*/
public EmailCommand parseTimeslotCommand(String args) throws ParseException {
String nameArg = args.substring(9).trim();
Name name;

if (nameArg.length() == 0) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, EmailCommand.MESSAGE_USAGE));
}

try {
name = ParserUtil.parseName(nameArg);
} catch (ParseException pe) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, EmailCommand.MESSAGE_USAGE));
}

return new EmailCommand(name);
}

}
12 changes: 12 additions & 0 deletions src/main/java/seedu/address/model/AddressBook.java
Expand Up @@ -3,6 +3,7 @@
import static java.util.Objects.requireNonNull;

import java.util.List;
import java.util.NoSuchElementException;

import javafx.collections.ObservableList;
import seedu.address.model.person.Person;
Expand Down Expand Up @@ -74,6 +75,17 @@ public void addPerson(Person p) {
persons.add(p);
}

/**
* Returns a person from the address book given the name
*/
public Person getPerson(String name) throws NoSuchElementException {
requireNonNull(name);
return persons.asUnmodifiableObservableList().stream()
.filter((x) -> x.getName().equals(name))
.findAny()
.get();
}

/**
* Replaces the given person {@code target} in the list with {@code editedPerson}.
* {@code target} must exist in the address book.
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/seedu/address/model/Model.java
@@ -1,11 +1,14 @@
package seedu.address.model;

import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.function.Predicate;

import javafx.collections.ObservableList;
import seedu.address.commons.core.GuiSettings;
import seedu.address.model.person.Interviewee;
import seedu.address.model.person.Interviewer;
import seedu.address.model.person.Person;
import seedu.address.model.person.Slot;
Expand Down Expand Up @@ -50,6 +53,19 @@ public interface Model {
*/
List<ObservableList<ObservableList<String>>> getObservableLists();

/**
* Returns an Interviewee given the intervieweeName.
* The Interviewee must exist in the database.
* @throws NoSuchElementException If the Interviewee does not exist in the database.
*/
Interviewee getInterviewee(String intervieweeName) throws NoSuchElementException;

/**
* Emails the given Interviewee.
* The Interviewee must exist in the database.
*/
void emailInterviewee(Interviewee interviewee) throws IOException;

/**
* Returns the interview slot assigned to the interviewee with the {@code intervieweeName}.
*/
Expand Down Expand Up @@ -101,6 +117,14 @@ public interface Model {
*/
void addPerson(Person person);

/**
* Returns the Person object given the name.
* The person must exist in the address book.
* @param name The name of the Person
* @throws NoSuchElementException If the person does not exist in the address book.
*/
Person getPerson(String name) throws NoSuchElementException;

/**
* Replaces the given person {@code target} with {@code editedPerson}.
* {@code target} must exist in the address book.
Expand Down
59 changes: 59 additions & 0 deletions src/main/java/seedu/address/model/ModelManager.java
Expand Up @@ -3,16 +3,23 @@
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;

import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.file.Path;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.function.Predicate;
import java.util.logging.Logger;

import javafx.collections.ObservableList;
import javafx.collections.transformation.FilteredList;
import seedu.address.commons.core.GuiSettings;
import seedu.address.commons.core.LogsCenter;
import seedu.address.commons.core.Messages;
import seedu.address.model.person.Interviewee;
import seedu.address.model.person.Interviewer;
import seedu.address.model.person.Person;
import seedu.address.model.person.Slot;
Expand Down Expand Up @@ -116,6 +123,53 @@ public List<ObservableList<ObservableList<String>>> getObservableLists() {
return observableLists;
}

@Override
public Interviewee getInterviewee(String intervieweeName) throws NoSuchElementException {
Person person = getPerson(intervieweeName);

if (person instanceof Interviewee) {
return (Interviewee) person;
} else {
throw new NoSuchElementException(Messages.MESSAGE_INVALID_PERSON_NAME);
}
}

/**
* Emails the given Interviewee.
* The Interviewee must exist in the database.
*/
@Override
public void emailInterviewee(Interviewee interviewee) throws IOException {
Desktop desktop = Desktop.getDesktop();
String intervieweeEmails = interviewee.getEmails().getAllEmails().values().stream()
.map((x) -> {
StringBuilder output = new StringBuilder();
for (int i = 0; i < x.size(); i++) {
output.append(x.get(i));
output.append("; ");
}

if (output.length() != 0) {
output.delete(output.length() - 2, output.length());
}

return output.toString();
})
.reduce((x, y) -> x + "; " + y).get();

String sb = "mailto:"
+ URLEncoder.encode(intervieweeEmails,
java.nio.charset.StandardCharsets.UTF_8.toString()).replace("+", "%20")
+ "?cc=" + "copied@example.com" + "&subject="
+ URLEncoder.encode("This is a test subject",
java.nio.charset.StandardCharsets.UTF_8.toString()).replace("+", "%20")
+ "&body="
+ URLEncoder.encode(intervieweeEmails,
java.nio.charset.StandardCharsets.UTF_8.toString()).replace("+", "%20");
URI uri = URI.create(sb);
desktop.mail(uri);
}

/**
* Returns a list of interview slots assigned to the interviewee with the {@code intervieweeName}.
*/
Expand Down Expand Up @@ -197,6 +251,11 @@ public void addPerson(Person person) {
updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
}

@Override
public Person getPerson(String name) throws NoSuchElementException {
return addressBook.getPerson(name);
}

@Override
public void setPerson(Person target, Person editedPerson) {
requireAllNonNull(target, editedPerson);
Expand Down

0 comments on commit 60a2110

Please sign in to comment.