Skip to content

Commit

Permalink
Resolve Merge Conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahidharah committed Nov 2, 2023
2 parents 4ce1ba8 + 8fbd769 commit 596a9c2
Show file tree
Hide file tree
Showing 43 changed files with 1,122 additions and 345 deletions.
271 changes: 147 additions & 124 deletions docs/UserGuide.md

Large diffs are not rendered by default.

40 changes: 25 additions & 15 deletions src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import seedu.address.logic.parser.Prefix;
import seedu.address.model.client.Client;
import seedu.address.model.developer.Developer;
import seedu.address.model.developer.DeveloperRoles;

/**
* Container for user visible messages.
Expand All @@ -23,6 +24,8 @@ public class Messages {
public static final String MESSAGE_INAPPLICABLE_PREFIX_USED = "You tried to edit an inapplicable field! Please check " +
"the prefixes used and try again. \n%1$s";
public static final String MESSAGE_NONEXISTENT_PROJECT = "There is no existing Project with the name: %1$s!";


public static String getMessageDevelopersListedOverview(int count) {
return count == 1
? "This is the 1 developer with matching information."
Expand Down Expand Up @@ -59,39 +62,39 @@ public static String getErrorMessageForDuplicatePrefixes(Prefix... duplicatePref
public static String format(Developer developer) {
final StringBuilder builder = new StringBuilder();
builder.append(developer.getName())
.append("; Phone: ")
.append("; \nPhone: ")
.append(developer.getPhone())
.append("; Email: ")
.append("; \nEmail: ")
.append(developer.getEmail())
.append("; Address: ")
.append("; \nAddress: ")
.append(developer.getAddress())
.append("; Date Joined: ")
.append("; \nDate Joined: ")
.append(developer.getDateJoined())
.append("; Role: ")
.append("; \nRole: ")
.append(developer.getRole())
.append("; Salary: ")
.append("; \nSalary: ")
.append(developer.getSalary())
.append("; Projects: ");
.append("; \nProjects: ");
developer.getProjects().forEach(builder::append);
return builder.toString();
}

public static String format(Client client) {
final StringBuilder builder = new StringBuilder();
builder.append(client.getName())
.append("; Phone: ")
.append("; \nPhone: ")
.append(client.getPhone())
.append("; Email: ")
.append("; \nEmail: ")
.append(client.getEmail())
.append("; Address: ")
.append("; \nAddress: ")
.append(client.getAddress())
.append("; Organisation: ")
.append("; \nOrganisation: ")
.append(client.getOrganisation())
.append("; Role: ")
.append("; \nRole: ")
.append(client.getRole())
.append("; Document: ")
.append("; \nDocument: ")
.append(client.getDocument())
.append("; Projects: ");
.append("; \nProjects: ");
client.getProjects().forEach(builder::append);
return builder.toString();
}
Expand All @@ -102,7 +105,14 @@ public static Object format(seedu.address.model.project.Project project) {
.append(";\nDescription: ")
.append(project.getProjectDescription())
.append(";\nDeadlines:\n");
project.getProjectDeadlines().forEach(t -> builder.append(t.getStringRepresentation()));
project.getProjectDeadlines().forEach(t -> builder.append(t.getPrintedStringRepresentation()).append("\n"));
return builder.toString();
}

public static String format(String role) {
final StringBuilder builder = new StringBuilder();
builder.append(role);
return builder.toString();
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package seedu.address.logic.commands;

import seedu.address.model.Model;
import seedu.address.model.client.ClientRoles;

/**
* Terminates the program.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ public class AddClientCommand extends Command {
// Name organisation, Document document

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a client to the address book. "
+ "Parameters: "
+ "\n Parameters: "
+ PREFIX_NAME + "NAME "
+ PREFIX_PHONE + "PHONE "
+ PREFIX_EMAIL + "EMAIL "
+ PREFIX_ADDRESS + "ADDRESS "
+ PREFIX_ROLE + "ROLE "
+ "[" + PREFIX_PROJECT + "PROJECT]...\n"
+ PREFIX_ORGANISATION + "ORGANISATION "
+ PREFIX_DOCUMENT + "DOCUMENT "
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_DOCUMENT + "DOCUMENT \n"
+ "Example: \n" + COMMAND_WORD + " "
+ PREFIX_NAME + "John Doe "
+ PREFIX_PHONE + "98765432 "
+ PREFIX_EMAIL + "johnd@example.com "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class AddDeveloperCommand extends Command {
public static final String COMMAND_WORD = "add-developer";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a developer to the address book. "
+ "Parameters: "
+ "\n Parameters: "
+ PREFIX_NAME + "NAME "
+ PREFIX_PHONE + "PHONE "
+ PREFIX_EMAIL + "EMAIL "
Expand All @@ -39,8 +39,8 @@ public class AddDeveloperCommand extends Command {
+ PREFIX_SALARY + "SALARY "
+ PREFIX_DATEJOINED + "DATE JOINED (Optional) "
+ PREFIX_GITHUBID + "GITHUBID "
+ PREFIX_RATING + "RATING "
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_RATING + "RATING \n"
+ "Example: \n" + COMMAND_WORD + " "
+ PREFIX_NAME + "John Doe "
+ PREFIX_PHONE + "98765432 "
+ PREFIX_EMAIL + "johnd@example.com "
Expand All @@ -49,7 +49,9 @@ public class AddDeveloperCommand extends Command {
+ PREFIX_PROJECT + "AndroidApp "
+ PREFIX_PROJECT + "CustomWebsite "
+ PREFIX_SALARY + "4500 "
+ PREFIX_DATEJOINED + "19-11-2023 ";
+ PREFIX_DATEJOINED + "19-11-2023 "
+ PREFIX_GITHUBID + "johng "
+ PREFIX_RATING + "3";

public static final String MESSAGE_SUCCESS = "New developer added: %1$s";
public static final String MESSAGE_DUPLICATE_DEVELOPER = "This developer already exists in the address book";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public CommandResult execute(Model model) throws CommandException {

model.addProject(toAdd);
model.commitAddressBook(model, successMessage, index);
Project.addProjectName(toAdd);
return new CommandResult(successMessage, index);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package seedu.address.logic.commands.addRoles;
import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ROLE;

import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.TabIndex;
import seedu.address.logic.commands.add.AddDeveloperCommand;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.client.ClientRoles;

public class AddClientRoleCommand extends Command {
public static final String COMMAND_WORD = "add-client-role";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a role for clients to the address book. "
+ "Parameters: " + PREFIX_ROLE + "ROLE "
+ "Example: " + PREFIX_ROLE + "Developer ";

public static final String MESSAGE_SUCCESS = "New role for client added: %1$s";
public static final String MESSAGE_DUPLICATE_DEVELOPER = "This client role already exists in the address book";
private final String toAdd;

/**
* Creates an AddDeveloperRoleCommand to add the specified {@code Developer}
*/
public AddClientRoleCommand(String role) {
requireNonNull(role);
toAdd = role;
}

@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

if (ClientRoles.isValidRole(toAdd)) {
throw new CommandException(MESSAGE_DUPLICATE_DEVELOPER);
}

String successMessage = String.format(MESSAGE_SUCCESS, Messages.format(toAdd));
TabIndex index = TabIndex.Client;

ClientRoles newRole = new ClientRoles(toAdd.toString());
ClientRoles.addClientRole(newRole);
return new CommandResult(successMessage, index);
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}

// instanceof handles nulls
if (!(other instanceof AddDeveloperCommand)) {
return false;
}

AddClientRoleCommand otherAddClientRoleCommand = (AddClientRoleCommand) other;
return toAdd.equals(otherAddClientRoleCommand.toAdd);
}

@Override
public String toString() {
return new ToStringBuilder(this)
.add("toAdd", toAdd)
.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package seedu.address.logic.commands.addRoles;
import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ROLE;

import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.TabIndex;
import seedu.address.logic.commands.add.AddDeveloperCommand;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.developer.DeveloperRoles;

public class AddDeveloperRoleCommand extends Command {
public static final String COMMAND_WORD = "add-developer-role";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a role for developers to the address book. "
+ "Parameters: " + PREFIX_ROLE + "ROLE "
+ "Example: " + PREFIX_ROLE + "Developer ";

public static final String MESSAGE_SUCCESS = "New role for developer added: %1$s";
public static final String MESSAGE_DUPLICATE_DEVELOPER = "This developer role already exists in the address book";
private final String toAdd;

/**
* Creates an AddDeveloperRoleCommand to add the specified {@code Developer}
*/
public AddDeveloperRoleCommand(String role) {
requireNonNull(role);
toAdd = role;
}

@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

if (DeveloperRoles.isValidRole(toAdd)) {
throw new CommandException(MESSAGE_DUPLICATE_DEVELOPER);
}

String successMessage = String.format(MESSAGE_SUCCESS, Messages.format(toAdd));
TabIndex index = TabIndex.Developer;

DeveloperRoles newRole = new DeveloperRoles(toAdd.toString());
DeveloperRoles.addDeveloperRole(newRole);
return new CommandResult(successMessage, index);
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}

// instanceof handles nulls
if (!(other instanceof AddDeveloperCommand)) {
return false;
}

AddDeveloperRoleCommand otherAddDeveloperRoleCommand = (AddDeveloperRoleCommand) other;
return toAdd.equals(otherAddDeveloperRoleCommand.toAdd);
}

@Override
public String toString() {
return new ToStringBuilder(this)
.add("toAdd", toAdd)
.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package seedu.address.logic.commands.deleteRoles;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ROLE;

import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.TabIndex;
import seedu.address.logic.commands.delete.DeleteClientCommand;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.client.ClientRoles;

public class DeleteClientRoleCommand extends Command {
public static final String COMMAND_WORD = "delete-client-role";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Delete a role for clients in the address book. "
+ "Parameters: " + PREFIX_ROLE + "ROLE "
+ "Example: " + PREFIX_ROLE + "Developer ";

public static final String MESSAGE_SUCCESS = "Role for client deleted: %1$s";
public static final String MESSAGE_CANNOT_DELETE_REPEAT = "This client role cannot be deleted "
+ "as there are clients of this role";
public static final String MESSAGE_CANNOT_DELETE_PREXISTS = "You are not allowed to delete this client role.";
public static final String MESSAGE_CANNOT_DELETE_NONEXISTING = "This client role does not exist. ";
public static final String MESSAGE_EXISTING_CLIENT_ROLES = "These are the existing client roles: \n"
+ ClientRoles.printRoles();

private final String toAdd;

/**
* Creates an AddDeveloperRoleCommand to add the specified {@code Developer}
*/
public DeleteClientRoleCommand(String role) {
requireNonNull(role);
toAdd = role;
}

@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

if (!ClientRoles.isRemovableRole(model, toAdd)) { //if when u search role result != 1
if (!ClientRoles.isNoRepeat()) {
throw new CommandException(MESSAGE_CANNOT_DELETE_REPEAT);
} else if (!ClientRoles.isNotDefault()) {
throw new CommandException(MESSAGE_CANNOT_DELETE_PREXISTS);
} else if (ClientRoles.isNotInList()) {
throw new CommandException(MESSAGE_CANNOT_DELETE_NONEXISTING + MESSAGE_EXISTING_CLIENT_ROLES);
}
}

String successMessage = String.format(MESSAGE_SUCCESS, Messages.format(toAdd));
TabIndex index = TabIndex.Client;

ClientRoles newRole = new ClientRoles(toAdd.toString());
ClientRoles.deleteClientRole(newRole);
return new CommandResult(successMessage, index);
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}

// instanceof handles nulls
if (!(other instanceof DeleteClientCommand)) {
return false;
}

DeleteClientRoleCommand otherDeleteClientRoleCommand = (DeleteClientRoleCommand) other;
return toAdd.equals(otherDeleteClientRoleCommand.toAdd);
}

@Override
public String toString() {
return new ToStringBuilder(this)
.add("toAdd", toAdd)
.toString();
}
}
Loading

0 comments on commit 596a9c2

Please sign in to comment.