diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 2dd47c680c5..59abada8afb 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -27,7 +27,7 @@ StaffConnect (SC) is a **desktop app for managing contacts of Professors and Tut * `list` : Lists all contacts. - * `add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01` : Adds a contact named `John Doe` to the contacts list. + * `add n/John Doe p/98765432 e/johnd@example.com v/John street, block 123, #01-01` : Adds a contact named `John Doe` to the contacts list. * `delete 3` : Deletes the 3rd contact shown in the current list. @@ -76,15 +76,15 @@ Format: `help` Adds a person to the contacts. -Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​` +Format: `add n/NAME p/PHONE_NUMBER e/EMAIL v/VENUE [t/TAG]…​`
:bulb: **Tip:** A person can have any number of tags (including 0)
Examples: -* `add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01` -* `add n/Betsy Crowe t/friend e/betsycrowe@example.com a/Newgate Prison p/1234567 t/criminal` +* `add n/John Doe p/98765432 e/johnd@example.com v/John street, block 123, #01-01` +* `add n/Betsy Crowe t/friend e/betsycrowe@example.com v/Newgate Prison p/1234567 t/criminal` ### Listing all persons : `list` @@ -96,7 +96,7 @@ Format: `list` Edits an existing person in the contacts. -Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]…​` +Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [v/VENUE] [t/TAG]…​` * Edits the person at the specified `INDEX`. The index refers to the index number shown in the displayed person list. The index **must be a positive integer** 1, 2, 3, …​ * At least one of the optional fields must be provided. @@ -189,10 +189,10 @@ _Details coming soon ..._ Action | Format, Examples --------|------------------ -**Add** | `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…​`
e.g., `add n/James Ho p/22224444 e/jamesho@example.com a/123, Clementi Rd, 1234665 t/friend t/colleague` +**Add** | `add n/NAME p/PHONE_NUMBER e/EMAIL v/VENUE [t/TAG]…​`
e.g., `add n/James Ho p/22224444 e/jamesho@example.com v/123, Clementi Rd, 1234665 t/friend t/colleague` **Clear** | `clear` **Delete** | `delete INDEX`
e.g., `delete 3` -**Edit** | `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [t/TAG]…​`
e.g.,`edit 2 n/James Lee e/jameslee@example.com` +**Edit** | `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [v/VENUE] [t/TAG]…​`
e.g.,`edit 2 n/James Lee e/jameslee@example.com` **Find** | `find KEYWORD [MORE_KEYWORDS]`
e.g., `find James Jake` **List** | `list` **Help** | `help` diff --git a/src/main/java/staffconnect/logic/Messages.java b/src/main/java/staffconnect/logic/Messages.java index 07598d04d10..210b43d43e8 100644 --- a/src/main/java/staffconnect/logic/Messages.java +++ b/src/main/java/staffconnect/logic/Messages.java @@ -41,8 +41,8 @@ public static String format(Person person) { .append(person.getPhone()) .append("; Email: ") .append(person.getEmail()) - .append("; Address: ") - .append(person.getAddress()) + .append("; Venue: ") + .append(person.getVenue()) .append("; Tags: "); person.getTags().forEach(builder::append); return builder.toString(); diff --git a/src/main/java/staffconnect/logic/commands/AddCommand.java b/src/main/java/staffconnect/logic/commands/AddCommand.java index 173b83d6d7d..577b0f67521 100644 --- a/src/main/java/staffconnect/logic/commands/AddCommand.java +++ b/src/main/java/staffconnect/logic/commands/AddCommand.java @@ -1,11 +1,11 @@ package staffconnect.logic.commands; import static java.util.Objects.requireNonNull; -import static staffconnect.logic.parser.CliSyntax.PREFIX_ADDRESS; import static staffconnect.logic.parser.CliSyntax.PREFIX_EMAIL; import static staffconnect.logic.parser.CliSyntax.PREFIX_NAME; import static staffconnect.logic.parser.CliSyntax.PREFIX_PHONE; import static staffconnect.logic.parser.CliSyntax.PREFIX_TAG; +import static staffconnect.logic.parser.CliSyntax.PREFIX_VENUE; import staffconnect.commons.util.ToStringBuilder; import staffconnect.logic.Messages; @@ -25,13 +25,13 @@ public class AddCommand extends Command { + PREFIX_NAME + "NAME " + PREFIX_PHONE + "PHONE " + PREFIX_EMAIL + "EMAIL " - + PREFIX_ADDRESS + "ADDRESS " + + PREFIX_VENUE + "VENUE " + "[" + PREFIX_TAG + "TAG]...\n" + "Example: " + COMMAND_WORD + " " + PREFIX_NAME + "John Doe " + PREFIX_PHONE + "98765432 " + PREFIX_EMAIL + "johnd@example.com " - + PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " + + PREFIX_VENUE + "311, Clementi Ave 2, #02-25 " + PREFIX_TAG + "friends " + PREFIX_TAG + "owesMoney"; diff --git a/src/main/java/staffconnect/logic/commands/EditCommand.java b/src/main/java/staffconnect/logic/commands/EditCommand.java index de8ece3efda..0b51e4aa99c 100644 --- a/src/main/java/staffconnect/logic/commands/EditCommand.java +++ b/src/main/java/staffconnect/logic/commands/EditCommand.java @@ -1,11 +1,11 @@ package staffconnect.logic.commands; import static java.util.Objects.requireNonNull; -import static staffconnect.logic.parser.CliSyntax.PREFIX_ADDRESS; import static staffconnect.logic.parser.CliSyntax.PREFIX_EMAIL; import static staffconnect.logic.parser.CliSyntax.PREFIX_NAME; import static staffconnect.logic.parser.CliSyntax.PREFIX_PHONE; import static staffconnect.logic.parser.CliSyntax.PREFIX_TAG; +import static staffconnect.logic.parser.CliSyntax.PREFIX_VENUE; import static staffconnect.model.Model.PREDICATE_SHOW_ALL_PERSONS; import java.util.Collections; @@ -21,11 +21,11 @@ import staffconnect.logic.Messages; import staffconnect.logic.commands.exceptions.CommandException; import staffconnect.model.Model; -import staffconnect.model.person.Address; import staffconnect.model.person.Email; import staffconnect.model.person.Name; import staffconnect.model.person.Person; import staffconnect.model.person.Phone; +import staffconnect.model.person.Venue; import staffconnect.model.tag.Tag; /** @@ -42,7 +42,7 @@ public class EditCommand extends Command { + "[" + PREFIX_NAME + "NAME] " + "[" + PREFIX_PHONE + "PHONE] " + "[" + PREFIX_EMAIL + "EMAIL] " - + "[" + PREFIX_ADDRESS + "ADDRESS] " + + "[" + PREFIX_VENUE + "VENUE] " + "[" + PREFIX_TAG + "TAG]...\n" + "Example: " + COMMAND_WORD + " 1 " + PREFIX_PHONE + "91234567 " @@ -98,10 +98,10 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript Name updatedName = editPersonDescriptor.getName().orElse(personToEdit.getName()); Phone updatedPhone = editPersonDescriptor.getPhone().orElse(personToEdit.getPhone()); Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail()); - Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); + Venue updatedVenue = editPersonDescriptor.getVenue().orElse(personToEdit.getVenue()); Set updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags()); - return new Person(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedTags); + return new Person(updatedName, updatedPhone, updatedEmail, updatedVenue, updatedTags); } @Override @@ -136,7 +136,7 @@ public static class EditPersonDescriptor { private Name name; private Phone phone; private Email email; - private Address address; + private Venue venue; private Set tags; public EditPersonDescriptor() {} @@ -149,7 +149,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { setName(toCopy.name); setPhone(toCopy.phone); setEmail(toCopy.email); - setAddress(toCopy.address); + setVenue(toCopy.venue); setTags(toCopy.tags); } @@ -157,7 +157,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { * Returns true if at least one field is edited. */ public boolean isAnyFieldEdited() { - return CollectionUtil.isAnyNonNull(name, phone, email, address, tags); + return CollectionUtil.isAnyNonNull(name, phone, email, venue, tags); } public void setName(Name name) { @@ -184,12 +184,12 @@ public Optional getEmail() { return Optional.ofNullable(email); } - public void setAddress(Address address) { - this.address = address; + public void setVenue(Venue venue) { + this.venue = venue; } - public Optional
getAddress() { - return Optional.ofNullable(address); + public Optional getVenue() { + return Optional.ofNullable(venue); } /** @@ -224,7 +224,7 @@ public boolean equals(Object other) { return Objects.equals(name, otherEditPersonDescriptor.name) && Objects.equals(phone, otherEditPersonDescriptor.phone) && Objects.equals(email, otherEditPersonDescriptor.email) - && Objects.equals(address, otherEditPersonDescriptor.address) + && Objects.equals(venue, otherEditPersonDescriptor.venue) && Objects.equals(tags, otherEditPersonDescriptor.tags); } @@ -234,7 +234,7 @@ public String toString() { .add("name", name) .add("phone", phone) .add("email", email) - .add("address", address) + .add("venue", venue) .add("tags", tags) .toString(); } diff --git a/src/main/java/staffconnect/logic/parser/AddCommandParser.java b/src/main/java/staffconnect/logic/parser/AddCommandParser.java index 4464682764b..19f8d8e203e 100644 --- a/src/main/java/staffconnect/logic/parser/AddCommandParser.java +++ b/src/main/java/staffconnect/logic/parser/AddCommandParser.java @@ -1,22 +1,22 @@ package staffconnect.logic.parser; import static staffconnect.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import static staffconnect.logic.parser.CliSyntax.PREFIX_ADDRESS; import static staffconnect.logic.parser.CliSyntax.PREFIX_EMAIL; import static staffconnect.logic.parser.CliSyntax.PREFIX_NAME; import static staffconnect.logic.parser.CliSyntax.PREFIX_PHONE; import static staffconnect.logic.parser.CliSyntax.PREFIX_TAG; +import static staffconnect.logic.parser.CliSyntax.PREFIX_VENUE; import java.util.Set; import java.util.stream.Stream; import staffconnect.logic.commands.AddCommand; import staffconnect.logic.parser.exceptions.ParseException; -import staffconnect.model.person.Address; import staffconnect.model.person.Email; import staffconnect.model.person.Name; import staffconnect.model.person.Person; import staffconnect.model.person.Phone; +import staffconnect.model.person.Venue; import staffconnect.model.tag.Tag; /** @@ -31,21 +31,21 @@ public class AddCommandParser implements Parser { */ public AddCommand parse(String args) throws ParseException { ArgumentMultimap argMultimap = - ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG); + ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_VENUE, PREFIX_TAG); - if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL) + if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_VENUE, PREFIX_PHONE, PREFIX_EMAIL) || !argMultimap.getPreamble().isEmpty()) { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE)); } - argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS); + argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_VENUE); Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get()); Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get()); Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get()); - Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get()); + Venue venue = ParserUtil.parseVenue(argMultimap.getValue(PREFIX_VENUE).get()); Set tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG)); - Person person = new Person(name, phone, email, address, tagList); + Person person = new Person(name, phone, email, venue, tagList); return new AddCommand(person); } diff --git a/src/main/java/staffconnect/logic/parser/CliSyntax.java b/src/main/java/staffconnect/logic/parser/CliSyntax.java index 4847f4b9ba6..110c2dd1386 100644 --- a/src/main/java/staffconnect/logic/parser/CliSyntax.java +++ b/src/main/java/staffconnect/logic/parser/CliSyntax.java @@ -9,7 +9,7 @@ public class CliSyntax { public static final Prefix PREFIX_NAME = new Prefix("n/"); public static final Prefix PREFIX_PHONE = new Prefix("p/"); public static final Prefix PREFIX_EMAIL = new Prefix("e/"); - public static final Prefix PREFIX_ADDRESS = new Prefix("a/"); + public static final Prefix PREFIX_VENUE = new Prefix("v/"); public static final Prefix PREFIX_TAG = new Prefix("t/"); } diff --git a/src/main/java/staffconnect/logic/parser/EditCommandParser.java b/src/main/java/staffconnect/logic/parser/EditCommandParser.java index 7281c65eacc..76ff492730f 100644 --- a/src/main/java/staffconnect/logic/parser/EditCommandParser.java +++ b/src/main/java/staffconnect/logic/parser/EditCommandParser.java @@ -2,11 +2,11 @@ import static java.util.Objects.requireNonNull; import static staffconnect.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; -import static staffconnect.logic.parser.CliSyntax.PREFIX_ADDRESS; import static staffconnect.logic.parser.CliSyntax.PREFIX_EMAIL; import static staffconnect.logic.parser.CliSyntax.PREFIX_NAME; import static staffconnect.logic.parser.CliSyntax.PREFIX_PHONE; import static staffconnect.logic.parser.CliSyntax.PREFIX_TAG; +import static staffconnect.logic.parser.CliSyntax.PREFIX_VENUE; import java.util.Collection; import java.util.Collections; @@ -32,7 +32,7 @@ public class EditCommandParser implements Parser { public EditCommand parse(String args) throws ParseException { requireNonNull(args); ArgumentMultimap argMultimap = - ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG); + ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_VENUE, PREFIX_TAG); Index index; @@ -42,7 +42,7 @@ public EditCommand parse(String args) throws ParseException { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE), pe); } - argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS); + argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_VENUE); EditPersonDescriptor editPersonDescriptor = new EditPersonDescriptor(); @@ -55,8 +55,8 @@ public EditCommand parse(String args) throws ParseException { if (argMultimap.getValue(PREFIX_EMAIL).isPresent()) { editPersonDescriptor.setEmail(ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get())); } - if (argMultimap.getValue(PREFIX_ADDRESS).isPresent()) { - editPersonDescriptor.setAddress(ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get())); + if (argMultimap.getValue(PREFIX_VENUE).isPresent()) { + editPersonDescriptor.setVenue(ParserUtil.parseVenue(argMultimap.getValue(PREFIX_VENUE).get())); } parseTagsForEdit(argMultimap.getAllValues(PREFIX_TAG)).ifPresent(editPersonDescriptor::setTags); diff --git a/src/main/java/staffconnect/logic/parser/ParserUtil.java b/src/main/java/staffconnect/logic/parser/ParserUtil.java index caa0239f860..182ab6e4755 100644 --- a/src/main/java/staffconnect/logic/parser/ParserUtil.java +++ b/src/main/java/staffconnect/logic/parser/ParserUtil.java @@ -9,10 +9,10 @@ import staffconnect.commons.core.index.Index; import staffconnect.commons.util.StringUtil; import staffconnect.logic.parser.exceptions.ParseException; -import staffconnect.model.person.Address; import staffconnect.model.person.Email; import staffconnect.model.person.Name; import staffconnect.model.person.Phone; +import staffconnect.model.person.Venue; import staffconnect.model.tag.Tag; /** @@ -66,18 +66,18 @@ public static Phone parsePhone(String phone) throws ParseException { } /** - * Parses a {@code String address} into an {@code Address}. + * Parses a {@code String venue} into an {@code Venue}. * Leading and trailing whitespaces will be trimmed. * - * @throws ParseException if the given {@code address} is invalid. + * @throws ParseException if the given {@code venue} is invalid. */ - public static Address parseAddress(String address) throws ParseException { - requireNonNull(address); - String trimmedAddress = address.trim(); - if (!Address.isValidAddress(trimmedAddress)) { - throw new ParseException(Address.MESSAGE_CONSTRAINTS); + public static Venue parseVenue(String venue) throws ParseException { + requireNonNull(venue); + String trimmedVenue = venue.trim(); + if (!Venue.isValidVenue(trimmedVenue)) { + throw new ParseException(Venue.MESSAGE_CONSTRAINTS); } - return new Address(trimmedAddress); + return new Venue(trimmedVenue); } /** diff --git a/src/main/java/staffconnect/model/person/Person.java b/src/main/java/staffconnect/model/person/Person.java index 2256a57b1d8..58424f05908 100644 --- a/src/main/java/staffconnect/model/person/Person.java +++ b/src/main/java/staffconnect/model/person/Person.java @@ -22,18 +22,18 @@ public class Person { private final Email email; // Data fields - private final Address address; + private final Venue venue; private final Set tags = new HashSet<>(); /** * Every field must be present and not null. */ - public Person(Name name, Phone phone, Email email, Address address, Set tags) { - requireAllNonNull(name, phone, email, address, tags); + public Person(Name name, Phone phone, Email email, Venue venue, Set tags) { + requireAllNonNull(name, phone, email, venue, tags); this.name = name; this.phone = phone; this.email = email; - this.address = address; + this.venue = venue; this.tags.addAll(tags); } @@ -49,8 +49,8 @@ public Email getEmail() { return email; } - public Address getAddress() { - return address; + public Venue getVenue() { + return venue; } /** @@ -93,14 +93,14 @@ public boolean equals(Object other) { return name.equals(otherPerson.name) && phone.equals(otherPerson.phone) && email.equals(otherPerson.email) - && address.equals(otherPerson.address) + && venue.equals(otherPerson.venue) && tags.equals(otherPerson.tags); } @Override public int hashCode() { // use this method for custom fields hashing instead of implementing your own - return Objects.hash(name, phone, email, address, tags); + return Objects.hash(name, phone, email, venue, tags); } @Override @@ -109,7 +109,7 @@ public String toString() { .add("name", name) .add("phone", phone) .add("email", email) - .add("address", address) + .add("venue", venue) .add("tags", tags) .toString(); } diff --git a/src/main/java/staffconnect/model/person/Address.java b/src/main/java/staffconnect/model/person/Venue.java similarity index 52% rename from src/main/java/staffconnect/model/person/Address.java rename to src/main/java/staffconnect/model/person/Venue.java index b4f9e0616b5..f411acf9bd0 100644 --- a/src/main/java/staffconnect/model/person/Address.java +++ b/src/main/java/staffconnect/model/person/Venue.java @@ -4,15 +4,16 @@ import static staffconnect.commons.util.AppUtil.checkArgument; /** - * Represents a Person's address in the staff book. - * Guarantees: immutable; is valid as declared in {@link #isValidAddress(String)} + * Represents a Person's venue in the staff book. + * Guarantees: immutable; is valid as declared in + * {@link #isValidVenue(String)} */ -public class Address { +public class Venue { - public static final String MESSAGE_CONSTRAINTS = "Addresses can take any values, and it should not be blank"; + public static final String MESSAGE_CONSTRAINTS = "Venues can take any values, and it should not be blank"; /* - * The first character of the address must not be a whitespace, + * The first character of the venue must not be a whitespace, * otherwise " " (a blank string) becomes a valid input. */ public static final String VALIDATION_REGEX = "[^\\s].*"; @@ -20,20 +21,20 @@ public class Address { public final String value; /** - * Constructs an {@code Address}. + * Constructs an {@code Venue}. * - * @param address A valid address. + * @param venue A valid venue. */ - public Address(String address) { - requireNonNull(address); - checkArgument(isValidAddress(address), MESSAGE_CONSTRAINTS); - value = address; + public Venue(String venue) { + requireNonNull(venue); + checkArgument(isValidVenue(venue), MESSAGE_CONSTRAINTS); + value = venue; } /** * Returns true if a given string is a valid email. */ - public static boolean isValidAddress(String test) { + public static boolean isValidVenue(String test) { return test.matches(VALIDATION_REGEX); } @@ -49,12 +50,12 @@ public boolean equals(Object other) { } // instanceof handles nulls - if (!(other instanceof Address)) { + if (!(other instanceof Venue)) { return false; } - Address otherAddress = (Address) other; - return value.equals(otherAddress.value); + Venue otherVenue = (Venue) other; + return value.equals(otherVenue.value); } @Override diff --git a/src/main/java/staffconnect/model/util/SampleDataUtil.java b/src/main/java/staffconnect/model/util/SampleDataUtil.java index df8f3de5d9a..b9704a48308 100644 --- a/src/main/java/staffconnect/model/util/SampleDataUtil.java +++ b/src/main/java/staffconnect/model/util/SampleDataUtil.java @@ -6,11 +6,11 @@ import staffconnect.model.ReadOnlyStaffBook; import staffconnect.model.StaffBook; -import staffconnect.model.person.Address; import staffconnect.model.person.Email; import staffconnect.model.person.Name; import staffconnect.model.person.Person; import staffconnect.model.person.Phone; +import staffconnect.model.person.Venue; import staffconnect.model.tag.Tag; /** @@ -20,22 +20,22 @@ public class SampleDataUtil { public static Person[] getSamplePersons() { return new Person[] { new Person(new Name("Alex Yeoh"), new Phone("87438807"), new Email("alexyeoh@example.com"), - new Address("Blk 30 Geylang Street 29, #06-40"), + new Venue("Blk 30 Geylang Street 29, #06-40"), getTagSet("friends")), new Person(new Name("Bernice Yu"), new Phone("99272758"), new Email("berniceyu@example.com"), - new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), + new Venue("Blk 30 Lorong 3 Serangoon Gardens, #07-18"), getTagSet("colleagues", "friends")), new Person(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("charlotte@example.com"), - new Address("Blk 11 Ang Mo Kio Street 74, #11-04"), + new Venue("Blk 11 Ang Mo Kio Street 74, #11-04"), getTagSet("neighbours")), new Person(new Name("David Li"), new Phone("91031282"), new Email("lidavid@example.com"), - new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), + new Venue("Blk 436 Serangoon Gardens Street 26, #16-43"), getTagSet("family")), new Person(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), - new Address("Blk 47 Tampines Street 20, #17-35"), + new Venue("Blk 47 Tampines Street 20, #17-35"), getTagSet("classmates")), new Person(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("royb@example.com"), - new Address("Blk 45 Aljunied Street 85, #11-31"), + new Venue("Blk 45 Aljunied Street 85, #11-31"), getTagSet("colleagues")) }; } diff --git a/src/main/java/staffconnect/storage/JsonAdaptedPerson.java b/src/main/java/staffconnect/storage/JsonAdaptedPerson.java index 0dde7c8df12..dd5958ff973 100644 --- a/src/main/java/staffconnect/storage/JsonAdaptedPerson.java +++ b/src/main/java/staffconnect/storage/JsonAdaptedPerson.java @@ -10,11 +10,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import staffconnect.commons.exceptions.IllegalValueException; -import staffconnect.model.person.Address; import staffconnect.model.person.Email; import staffconnect.model.person.Name; import staffconnect.model.person.Person; import staffconnect.model.person.Phone; +import staffconnect.model.person.Venue; import staffconnect.model.tag.Tag; /** @@ -27,7 +27,7 @@ class JsonAdaptedPerson { private final String name; private final String phone; private final String email; - private final String address; + private final String venue; private final List tags = new ArrayList<>(); /** @@ -35,12 +35,12 @@ class JsonAdaptedPerson { */ @JsonCreator public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone") String phone, - @JsonProperty("email") String email, @JsonProperty("address") String address, + @JsonProperty("email") String email, @JsonProperty("venue") String venue, @JsonProperty("tags") List tags) { this.name = name; this.phone = phone; this.email = email; - this.address = address; + this.venue = venue; if (tags != null) { this.tags.addAll(tags); } @@ -53,7 +53,7 @@ public JsonAdaptedPerson(Person source) { name = source.getName().fullName; phone = source.getPhone().value; email = source.getEmail().value; - address = source.getAddress().value; + venue = source.getVenue().value; tags.addAll(source.getTags().stream() .map(JsonAdaptedTag::new) .collect(Collectors.toList())); @@ -94,16 +94,16 @@ public Person toModelType() throws IllegalValueException { } final Email modelEmail = new Email(email); - if (address == null) { - throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Address.class.getSimpleName())); + if (venue == null) { + throw new IllegalValueException(String.format(MISSING_FIELD_MESSAGE_FORMAT, Venue.class.getSimpleName())); } - if (!Address.isValidAddress(address)) { - throw new IllegalValueException(Address.MESSAGE_CONSTRAINTS); + if (!Venue.isValidVenue(venue)) { + throw new IllegalValueException(Venue.MESSAGE_CONSTRAINTS); } - final Address modelAddress = new Address(address); + final Venue modelVenue = new Venue(venue); final Set modelTags = new HashSet<>(personTags); - return new Person(modelName, modelPhone, modelEmail, modelAddress, modelTags); + return new Person(modelName, modelPhone, modelEmail, modelVenue, modelTags); } } diff --git a/src/main/java/staffconnect/ui/PersonCard.java b/src/main/java/staffconnect/ui/PersonCard.java index 7e8360c4b8b..0abadaa1092 100644 --- a/src/main/java/staffconnect/ui/PersonCard.java +++ b/src/main/java/staffconnect/ui/PersonCard.java @@ -35,7 +35,7 @@ public class PersonCard extends UiPart { @FXML private Label phone; @FXML - private Label address; + private Label venue; @FXML private Label email; @FXML @@ -50,7 +50,7 @@ public PersonCard(Person person, int displayedIndex) { id.setText(displayedIndex + ". "); name.setText(person.getName().fullName); phone.setText(person.getPhone().value); - address.setText(person.getAddress().value); + venue.setText(person.getVenue().value); email.setText(person.getEmail().value); person.getTags().stream() .sorted(Comparator.comparing(tag -> tag.tagName)) diff --git a/src/main/resources/view/PersonListCard.fxml b/src/main/resources/view/PersonListCard.fxml index f5e812e25e6..c75735e6b23 100644 --- a/src/main/resources/view/PersonListCard.fxml +++ b/src/main/resources/view/PersonListCard.fxml @@ -29,7 +29,7 @@