diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2015-05-12 07:26:22 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2015-05-12 07:26:22 -0700 |
commit | b5ad47d5b77bfc023b9d3d466f9fd9ed2c29a452 (patch) | |
tree | f7409dd2e286bc5aac64b52d69cc1a11fb608e2a /src/com/p4square/grow/model/Chapter.java | |
parent | d4e0c770e3a79e5f36ce974f3ed4dd4834639f4f (diff) |
Adding tests for TrainingRecordResource.
Diffstat (limited to 'src/com/p4square/grow/model/Chapter.java')
-rw-r--r-- | src/com/p4square/grow/model/Chapter.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/com/p4square/grow/model/Chapter.java b/src/com/p4square/grow/model/Chapter.java index 7b6e27c..3a08e4c 100644 --- a/src/com/p4square/grow/model/Chapter.java +++ b/src/com/p4square/grow/model/Chapter.java @@ -17,13 +17,38 @@ import com.fasterxml.jackson.annotation.JsonIgnore; * @author Jesse Morgan <jesse@jesterpm.net> */ public class Chapter implements Cloneable { + private String mName; private Map<String, VideoRecord> mVideos; - public Chapter() { + public Chapter(String name) { + mName = name; mVideos = new HashMap<String, VideoRecord>(); } /** + * Private constructor for JSON decoding. + */ + private Chapter() { + this(null); + } + + /** + * @return The Chapter name. + */ + public String getName() { + return mName; + } + + /** + * Set the chapter name. + * + * @param name The name of the chapter. + */ + public void setName(final String name) { + mName = name; + } + + /** * @return The VideoRecord for videoid or null if videoid is not in the chapter. */ public VideoRecord getVideoRecord(String videoid) { @@ -78,7 +103,7 @@ public class Chapter implements Cloneable { * @return a new Chapter object identical but independent of this one. */ public Chapter clone() throws CloneNotSupportedException { - Chapter c = new Chapter(); + Chapter c = new Chapter(mName); for (Map.Entry<String, VideoRecord> videoEntry : mVideos.entrySet()) { c.setVideoRecord(videoEntry.getKey(), videoEntry.getValue().clone()); } |