Skip to content
Snippets Groups Projects
Commit 653fbf69 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Add equals implementations for inner classes of Entities

parent 20060ccc
Branches
No related merge requests found
Pipeline #20626 passed with warnings with stages
in 1 minute and 54 seconds
...@@ -6,6 +6,7 @@ import org.springframework.core.style.ToStringCreator; ...@@ -6,6 +6,7 @@ import org.springframework.core.style.ToStringCreator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
public class ChoiceQuestionContent extends Content { public class ChoiceQuestionContent extends Content {
public static class AnswerOption { public static class AnswerOption {
...@@ -32,6 +33,25 @@ public class ChoiceQuestionContent extends Content { ...@@ -32,6 +33,25 @@ public class ChoiceQuestionContent extends Content {
this.points = points; this.points = points;
} }
@Override
public int hashCode() {
return Objects.hash(label, points);
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
final AnswerOption that = (AnswerOption) o;
return points == that.points &&
Objects.equals(label, that.label);
}
@Override @Override
public String toString() { public String toString() {
return new ToStringCreator(this) return new ToStringCreator(this)
......
...@@ -98,6 +98,29 @@ public class Content extends Entity { ...@@ -98,6 +98,29 @@ public class Content extends Entity {
this.responsesVisible = responsesVisible; this.responsesVisible = responsesVisible;
} }
@Override
public int hashCode() {
return Objects.hash(round, roundEndTimestamp, visible, solutionVisible, responsesEnabled, responsesVisible);
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
final State state = (State) o;
return round == state.round &&
visible == state.visible &&
solutionVisible == state.solutionVisible &&
responsesEnabled == state.responsesEnabled &&
responsesVisible == state.responsesVisible &&
Objects.equals(roundEndTimestamp, state.roundEndTimestamp);
}
@Override @Override
public String toString() { public String toString() {
return new ToStringCreator(this) return new ToStringCreator(this)
......
...@@ -49,6 +49,26 @@ public class Room extends Entity { ...@@ -49,6 +49,26 @@ public class Room extends Entity {
this.autoSort = autoSort; this.autoSort = autoSort;
} }
@Override
public int hashCode() {
return Objects.hash(name, contentIds, autoSort);
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ContentGroup that = (ContentGroup) o;
return autoSort == that.autoSort &&
Objects.equals(name, that.name) &&
Objects.equals(contentIds, that.contentIds);
}
@Override @Override
public String toString() { public String toString() {
return new ToStringCreator(this) return new ToStringCreator(this)
...@@ -171,6 +191,36 @@ public class Room extends Entity { ...@@ -171,6 +191,36 @@ public class Room extends Entity {
this.feedbackLocked = feedbackLocked; this.feedbackLocked = feedbackLocked;
} }
@Override
public int hashCode() {
return Objects.hash(
questionsEnabled, slidesEnabled, commentsEnabled, flashcardsEnabled,
quickSurveyEnabled, quickFeedbackEnabled, scoreEnabled, multipleRoundsEnabled,
timerEnabled, feedbackLocked);
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final Settings settings = (Settings) o;
return questionsEnabled == settings.questionsEnabled &&
slidesEnabled == settings.slidesEnabled &&
commentsEnabled == settings.commentsEnabled &&
flashcardsEnabled == settings.flashcardsEnabled &&
quickSurveyEnabled == settings.quickSurveyEnabled &&
quickFeedbackEnabled == settings.quickFeedbackEnabled &&
scoreEnabled == settings.scoreEnabled &&
multipleRoundsEnabled == settings.multipleRoundsEnabled &&
timerEnabled == settings.timerEnabled &&
feedbackLocked == settings.feedbackLocked;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringCreator(this) return new ToStringCreator(this)
...@@ -245,6 +295,28 @@ public class Room extends Entity { ...@@ -245,6 +295,28 @@ public class Room extends Entity {
this.organizationUnit = organizationUnit; this.organizationUnit = organizationUnit;
} }
@Override
public int hashCode() {
return Objects.hash(name, mail, organizationName, organizationLogo, organizationUnit);
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final Author author = (Author) o;
return Objects.equals(name, author.name) &&
Objects.equals(mail, author.mail) &&
Objects.equals(organizationName, author.organizationName) &&
Objects.equals(organizationLogo, author.organizationLogo) &&
Objects.equals(organizationUnit, author.organizationUnit);
}
@Override @Override
public String toString() { public String toString() {
return new ToStringCreator(this) return new ToStringCreator(this)
...@@ -292,6 +364,26 @@ public class Room extends Entity { ...@@ -292,6 +364,26 @@ public class Room extends Entity {
this.license = license; this.license = license;
} }
@Override
public int hashCode() {
return Objects.hash(category, level, license);
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final PoolProperties that = (PoolProperties) o;
return Objects.equals(category, that.category) &&
Objects.equals(level, that.level) &&
Objects.equals(license, that.license);
}
@Override @Override
public String toString() { public String toString() {
return new ToStringCreator(this) return new ToStringCreator(this)
......
...@@ -69,6 +69,27 @@ public class UserProfile extends Entity { ...@@ -69,6 +69,27 @@ public class UserProfile extends Entity {
this.passwordResetTime = passwordResetTime; this.passwordResetTime = passwordResetTime;
} }
@Override
public int hashCode() {
return Objects.hash(password, activationKey, passwordResetKey, passwordResetTime);
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!super.equals(o)) {
return false;
}
final Account account = (Account) o;
return Objects.equals(password, account.password) &&
Objects.equals(activationKey, account.activationKey) &&
Objects.equals(passwordResetKey, account.passwordResetKey) &&
Objects.equals(passwordResetTime, account.passwordResetTime);
}
@Override @Override
public String toString() { public String toString() {
return new ToStringCreator(this) return new ToStringCreator(this)
...@@ -113,6 +134,11 @@ public class UserProfile extends Entity { ...@@ -113,6 +134,11 @@ public class UserProfile extends Entity {
this.lastVisit = lastVisit; this.lastVisit = lastVisit;
} }
@Override
public int hashCode() {
return Objects.hash(roomId);
}
@Override @Override
public boolean equals(final Object o) { public boolean equals(final Object o) {
if (this == o) { if (this == o) {
...@@ -126,11 +152,6 @@ public class UserProfile extends Entity { ...@@ -126,11 +152,6 @@ public class UserProfile extends Entity {
return Objects.equals(roomId, that.roomId); return Objects.equals(roomId, that.roomId);
} }
@Override
public int hashCode() {
return Objects.hash(roomId);
}
@Override @Override
public String toString() { public String toString() {
return new ToStringCreator(this) return new ToStringCreator(this)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment