forked from AY2324S1-CS2103T-T09-2/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added classes DeleteClientCommand and DeleteClientCommandParser
- Loading branch information
Showing
72 changed files
with
1,382 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/seedu/address/logic/commands/ChangePasswordCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import seedu.address.logic.parser.AddressBookParser; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.Password; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.model.Model.*; | ||
|
||
public class ChangePasswordCommand extends Command { | ||
public static final String COMMAND_WORD = "change-password"; | ||
public static final Object MESSAGE_USAGE = COMMAND_WORD + ": Please change password to correct format\n" | ||
+ Password.MESSAGE_CONSTRAINTS + "\n" | ||
+ "Example: " + COMMAND_WORD + " pw/Password123! npw/NewPass987!"; | ||
private String currentPw; | ||
private String newPw; | ||
|
||
public ChangePasswordCommand(String currentPw, String newPw) { | ||
this.currentPw = currentPw; | ||
this.newPw = newPw; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) { | ||
assert model != null : "Model cannot be null"; | ||
requireNonNull(model); | ||
String result = Password.changePassword(currentPw,newPw); | ||
return new CommandResult(result,TabIndex.Developer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/seedu/address/logic/commands/LockCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import seedu.address.logic.parser.AddressBookParser; | ||
import seedu.address.model.Model; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.model.Model.*; | ||
|
||
public class LockCommand extends Command{ | ||
public static final String COMMAND_WORD = "lock"; | ||
|
||
public static final String MESSAGE_SUCCESS = "Locked all data"; | ||
|
||
|
||
@Override | ||
public CommandResult execute(Model model) { | ||
assert model != null : "Model cannot be null"; | ||
requireNonNull(model); | ||
model.updateFilteredClientList(PREDICATE_SHOW_NO_CLIENT); | ||
model.updateFilteredDeveloperList(PREDICATE_SHOW_NO_DEVELOPER); | ||
model.updateFilteredProjectList(PREDICATE_SHOW_NO_PROJECT); | ||
AddressBookParser.lock(); | ||
return new CommandResult(MESSAGE_SUCCESS, TabIndex.Developer); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/seedu/address/logic/commands/RedoCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
|
||
public class RedoCommand extends Command { | ||
public static final String COMMAND_WORD = "redo"; | ||
public static final String MESSAGE_SUCCESS = "Redo successful!"; | ||
|
||
@Override | ||
public CommandResult execute(Model model) throws CommandException { | ||
requireNonNull(model); | ||
model.redoAddressBook(model); | ||
return new CommandResult(MESSAGE_SUCCESS, TabIndex.Developer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
public enum TabIndex { | ||
Developer, | ||
Client, | ||
Project | ||
developers, Project | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/seedu/address/logic/commands/UndoCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.AddressBook; | ||
import seedu.address.model.Model; | ||
|
||
public class UndoCommand extends Command { | ||
public static final String COMMAND_WORD = "undo"; | ||
public static final String MESSAGE_SUCCESS = "Undo successful!"; | ||
@Override | ||
public CommandResult execute(Model model) throws CommandException { | ||
requireNonNull(model); | ||
model.undoAddressBook(model); | ||
return new CommandResult(MESSAGE_SUCCESS, TabIndex.Developer); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/seedu/address/logic/commands/UnlockCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import seedu.address.logic.parser.AddressBookParser; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.Password; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.model.Model.*; | ||
|
||
public class UnlockCommand extends Command { | ||
public static final String COMMAND_WORD = "unlock"; | ||
|
||
public static final String MESSAGE_SUCCESS = "Unlocked all data"; | ||
public static final String MESSAGE_FAILURE = "Incorrect Password!\n"; | ||
public static final Object MESSAGE_USAGE = COMMAND_WORD + ": Please unlock using correct format\n" | ||
+ "Example: " + COMMAND_WORD + " pw/Password123!"; | ||
private String input; | ||
|
||
public UnlockCommand(String input) { | ||
this.input = input; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) { | ||
assert model != null : "Model cannot be null"; | ||
requireNonNull(model); | ||
if (Password.verifyPassword(input)) { | ||
model.updateFilteredClientList(PREDICATE_SHOW_ALL_CLIENTS); | ||
model.updateFilteredDeveloperList(PREDICATE_SHOW_ALL_DEVELOPERS); | ||
model.updateFilteredProjectList(PREDICATE_SHOW_ALL_PROJECTS); | ||
AddressBookParser.unlock(); | ||
return new CommandResult(MESSAGE_SUCCESS, TabIndex.Developer); | ||
} | ||
return new CommandResult(String.format(MESSAGE_FAILURE,Password.MESSAGE_CONSTRAINTS),TabIndex.Developer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.