+ /**
+ * Removes the parent album of this album.
+ *
+ * @return This album
+ */
+ protected Album removeParent() {
+ Validation.begin().isNotNull("Album Parent", parent).check();
+ this.parent = null;
+ return this;
+ }
+
+ /**
+ * Returns the title of this album.
+ *
+ * @return The title of this album
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Sets the title of this album.
+ *
+ * @param title
+ * The title of this album
+ * @return This album
+ */
+ public Album setTitle(String title) {
+ Validation.begin().isNotNull("Album Title", title).check();
+ this.title = title;
+ return this;
+ }
+
+ /**
+ * Returns the description of this album.
+ *
+ * @return The description of this album
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the description of this album.
+ *
+ * @param description
+ * The description of this album
+ * @return This album
+ */
+ public Album setDescription(String description) {
+ Validation.begin().isNotNull("Album Description", description).check();
+ this.description = description;
+ return this;
+ }
+
+ //
+ // FINGERPRINTABLE METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getFingerprint() {
+ StringBuilder fingerprint = new StringBuilder();
+ fingerprint.append("Album(");
+ fingerprint.append("ID(").append(id).append(')');
+ fingerprint.append("Title(").append(title).append(')');
+ fingerprint.append("Description(").append(description).append(')');
+
+ /* add nested albums. */
+ fingerprint.append("Albums(");
+ for (Album album : albums) {
+ fingerprint.append(album.getFingerprint());
+ }
+ fingerprint.append(')');
+
+ /* add images. */
+ fingerprint.append("Images(");
+ for (Image image : images) {
+ fingerprint.append(image.getFingerprint());
+ }
+ fingerprint.append(')');
+
+ fingerprint.append(')');
+ return fingerprint.toString();
+ }
+
+ //
+ // OBJECT METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof Album)) {
+ return false;
+ }
+ Album album = (Album) object;
+ return id.equals(album.id);
+ }
+