*/
public class Profile implements Fingerprintable {
- /** Whether the profile was modified. */
- private volatile boolean modified;
-
/** The first name. */
private volatile String firstName;
//
/**
- * 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
* @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;
}
* @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;
}
* @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;
}
* @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;
}
* @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;
}
* @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;
}
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);