From a5d5fddfb29d2604a0746f147f45d9b57f9ef1d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 12 Jan 2011 10:00:33 +0100 Subject: [PATCH] Remove modified tracker from Profile. --- .../java/net/pterodactylus/sone/data/Profile.java | 21 --------------------- .../net/pterodactylus/sone/web/EditProfilePage.java | 4 +--- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/data/Profile.java b/src/main/java/net/pterodactylus/sone/data/Profile.java index 059c33e..8dec42a 100644 --- a/src/main/java/net/pterodactylus/sone/data/Profile.java +++ b/src/main/java/net/pterodactylus/sone/data/Profile.java @@ -33,9 +33,6 @@ import net.pterodactylus.util.validation.Validation; */ public class Profile implements Fingerprintable { - /** Whether the profile was modified. */ - private volatile boolean modified; - /** The first name. */ private volatile String firstName; @@ -91,18 +88,6 @@ public class Profile implements Fingerprintable { // /** - * Returns whether this profile was modified after creation. To clear the - * “is modified” flag you need to create a new profile from this one using - * the {@link #Profile(Profile)} constructor. - * - * @return {@code true} if this profile was modified after creation, - * {@code false} otherwise - */ - public boolean isModified() { - return modified; - } - - /** * Returns the first name. * * @return The first name @@ -119,7 +104,6 @@ public class Profile implements Fingerprintable { * @return This profile (for method chaining) */ public Profile setFirstName(String firstName) { - modified |= ((firstName != null) && (!firstName.equals(this.firstName))) || (this.firstName != null); this.firstName = firstName; return this; } @@ -141,7 +125,6 @@ public class Profile implements Fingerprintable { * @return This profile (for method chaining) */ public Profile setMiddleName(String middleName) { - modified |= ((middleName != null) && (!middleName.equals(this.middleName))) || (this.middleName != null); this.middleName = middleName; return this; } @@ -163,7 +146,6 @@ public class Profile implements Fingerprintable { * @return This profile (for method chaining) */ public Profile setLastName(String lastName) { - modified |= ((lastName != null) && (!lastName.equals(this.lastName))) || (this.lastName != null); this.lastName = lastName; return this; } @@ -185,7 +167,6 @@ public class Profile implements Fingerprintable { * @return This profile (for method chaining) */ public Profile setBirthDay(Integer birthDay) { - modified |= ((birthDay != null) && (!birthDay.equals(this.birthDay))) || (this.birthDay != null); this.birthDay = birthDay; return this; } @@ -207,7 +188,6 @@ public class Profile implements Fingerprintable { * @return This profile (for method chaining) */ public Profile setBirthMonth(Integer birthMonth) { - modified |= ((birthMonth != null) && (!birthMonth.equals(this.birthMonth))) || (this.birthMonth != null); this.birthMonth = birthMonth; return this; } @@ -229,7 +209,6 @@ public class Profile implements Fingerprintable { * @return This profile (for method chaining) */ public Profile setBirthYear(Integer birthYear) { - modified |= ((birthYear != null) && (!birthYear.equals(this.birthYear))) || (this.birthYear != null); this.birthYear = birthYear; return this; } diff --git a/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java b/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java index 965caf9..87f7aef 100644 --- a/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java +++ b/src/main/java/net/pterodactylus/sone/web/EditProfilePage.java @@ -73,9 +73,7 @@ public class EditProfilePage extends SoneTemplatePage { profile.setMiddleName(middleName.length() > 0 ? middleName : null); profile.setLastName(lastName.length() > 0 ? lastName : null); profile.setBirthDay(birthDay).setBirthMonth(birthMonth).setBirthYear(birthYear); - if (profile.isModified()) { - currentSone.setProfile(profile); - } + currentSone.setProfile(profile); throw new RedirectException("index.html"); } template.set("firstName", firstName); -- 2.7.4