forked from nus-cs2103-AY1718S2/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from nicholasangcx/cloudStorage
[v1.3] Logging in to Dropbox
- Loading branch information
Showing
19 changed files
with
464 additions
and
87 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/main/java/seedu/recipe/commons/events/ui/UploadRecipesEvent.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,26 @@ | ||
//@@author nicholasangcx | ||
package seedu.recipe.commons.events.ui; | ||
|
||
import seedu.recipe.commons.events.BaseEvent; | ||
|
||
/** | ||
* Indicates a request to upload recipes to Dropbox | ||
*/ | ||
public class UploadRecipesEvent extends BaseEvent { | ||
|
||
private String xmlExtensionFilename; | ||
|
||
public UploadRecipesEvent(String xmlExtensionFilename) { | ||
this.xmlExtensionFilename = xmlExtensionFilename; | ||
} | ||
|
||
public String getUploadFilename() { | ||
return this.xmlExtensionFilename; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.getClass().getSimpleName(); | ||
} | ||
} | ||
//@@author |
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
15 changes: 0 additions & 15 deletions
15
src/main/java/seedu/recipe/logic/commands/exceptions/UploadCommandException.java
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package seedu.recipe.storage.model; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.recipe.commons.util.AppUtil.checkArgument; | ||
|
||
/** | ||
* Represents a Filename used to upload to Dropbox | ||
* Guarantees: immutable; filename is valid as declared in {@link #isValidFilename(String)} | ||
*/ | ||
public class Filename { | ||
|
||
public static final String MESSAGE_FILENAME_CONSTRAINTS = "Filenames should not contain any" | ||
+ " incompatible characters"; | ||
public static final String FILENAME_VALIDATION_REGEX = "[^\\Q<>:/|.?\"\\*\\E\\s]+"; | ||
|
||
public final String filename; | ||
|
||
/** | ||
* Constructs a {@code Filename} | ||
* | ||
* @param filename a valid filename | ||
*/ | ||
public Filename(String filename) { | ||
requireNonNull(filename); | ||
checkArgument(isValidFilename(filename), MESSAGE_FILENAME_CONSTRAINTS); | ||
this.filename = filename; | ||
} | ||
|
||
/** | ||
* Returns true if a given string is a valid filename. | ||
*/ | ||
public static boolean isValidFilename(String test) { | ||
return test.matches(FILENAME_VALIDATION_REGEX); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return other == this // short circuit if same object | ||
|| (other instanceof Filename // instanceof handles nulls | ||
&& this.filename.equals(((Filename) other).filename)); // state check | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return filename.hashCode(); | ||
} | ||
} |
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.