Skip to content

Commit 3a68feb

Browse files
committed
work
1 parent fae7b7f commit 3a68feb

File tree

10 files changed

+80
-26
lines changed

10 files changed

+80
-26
lines changed

src/main/java/org/woehlke/java/simpleworklist/domain/db/data/Context.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
@NoArgsConstructor
3838
@EqualsAndHashCode(callSuper = true, exclude = "userAccount")
3939
@ToString(callSuper = true, exclude = "userAccount")
40-
public class Context extends AuditModel implements Serializable, ComparableById<Context> {
40+
public class Context extends AuditModel implements Serializable, ComparableById<Context>,Comparable<Context> {
4141

4242
private static final long serialVersionUID = -5035732370606951871L;
4343

@@ -102,4 +102,8 @@ public boolean equalsByUuid(Context otherObject) {
102102
return super.equalsByMyUuid(otherObject);
103103
}
104104

105+
@Override
106+
public int compareTo(Context o) {
107+
return this.nameDe.compareTo(o.nameDe);
108+
}
105109
}

src/main/java/org/woehlke/java/simpleworklist/domain/db/data/Project.java

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import javax.persistence.*;
1414
import javax.validation.constraints.NotBlank;
15+
import javax.validation.constraints.NotNull;
1516
import java.io.Serializable;
1617
import java.util.ArrayList;
1718
import java.util.List;
@@ -34,7 +35,7 @@
3435
@Getter
3536
@Setter
3637
@ToString(callSuper = true, exclude = {"children","parent","description"})
37-
public class Project extends AuditModel implements Serializable, ComparableById<Project> {
38+
public class Project extends AuditModel implements Serializable, ComparableById<Project>, Comparable<Project> {
3839

3940
private static final long serialVersionUID = 4566653175832872422L;
4041
public final static long rootProjectId = 0L;
@@ -84,10 +85,14 @@ public class Project extends AuditModel implements Serializable, ComparableById<
8485
@OneToMany(fetch = FetchType.LAZY, mappedBy = "parent", cascade = {CascadeType.ALL})
8586
private List<Project> children = new ArrayList<>();
8687

87-
@Transient
88-
public String getUrlRoot() {
89-
return "redirect:/project/root";
90-
}
88+
@NotNull
89+
@Column(name = "collapsed", nullable = false)
90+
private Boolean collapsed;
91+
92+
@Transient
93+
public String getUrlRoot() {
94+
return "redirect:/project/root";
95+
}
9196

9297
@Transient
9398
public String getUrl() {
@@ -165,18 +170,24 @@ public String out(){
165170
return "Project: "+name+" ("+id+")";
166171
}
167172

168-
@Override
169-
public boolean equals(Object o) {
170-
if (this == o) return true;
171-
if (!(o instanceof Project)) return false;
172-
if (!super.equals(o)) return false;
173-
Project project = (Project) o;
174-
return Objects.equals(getParent(), project.getParent()) && Objects.equals(getContext(), project.getContext()) && Objects.equals(getName(), project.getName()) && Objects.equals(getDescription(), project.getDescription());
175-
}
173+
@Override
174+
public boolean equals(Object o) {
175+
if (this == o) return true;
176+
if (!(o instanceof Project)) return false;
177+
if (!super.equals(o)) return false;
178+
Project project = (Project) o;
179+
return Objects.equals(getParent(), project.getParent()) && Objects.equals(getContext(), project.getContext()) && Objects.equals(getName(), project.getName()) && Objects.equals(getDescription(), project.getDescription());
180+
}
181+
182+
@Override
183+
public int hashCode() {
184+
return Objects.hash(super.hashCode(), getParent(), getContext(), getName(), getDescription());
185+
}
186+
187+
@Override
188+
public int compareTo(Project o) {
189+
return this.name.compareTo(o.name);
190+
}
176191

177-
@Override
178-
public int hashCode() {
179-
return Objects.hash(super.hashCode(), getParent(), getContext(), getName(), getDescription());
180-
}
181192
}
182193

src/main/java/org/woehlke/java/simpleworklist/domain/db/data/Task.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
@Setter
152152
@EqualsAndHashCode(callSuper = true)
153153
@ToString(callSuper = true, exclude="text")
154-
public class Task extends AuditModel implements Serializable, ComparableById<Task> {
154+
public class Task extends AuditModel implements Serializable, ComparableById<Task>, Comparable<Task> {
155155

156156
private static final long serialVersionUID = 5247710652586269801L;
157157

@@ -496,4 +496,9 @@ public void moveTaskToRootProject() {
496496
public void moveTaskToAnotherProject(Project project) {
497497
pushProject(project);
498498
}
499+
500+
@Override
501+
public int compareTo(Task o) {
502+
return this.rowCreatedAt.compareTo(o.rowCreatedAt);
503+
}
499504
}

src/main/java/org/woehlke/java/simpleworklist/domain/db/search/SearchRequest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@ToString(callSuper = true)
3232
@NoArgsConstructor
3333
@AllArgsConstructor
34-
public class SearchRequest extends AuditModel implements Serializable, ComparableById<SearchRequest> {
34+
public class SearchRequest extends AuditModel implements Serializable, ComparableById<SearchRequest>,Comparable<SearchRequest> {
3535

3636
private static final long serialVersionUID = 7860692526488291439L;
3737

@@ -77,4 +77,9 @@ public boolean equalsByUniqueConstraint(SearchRequest otherObject) {
7777
public boolean equalsByUuid(SearchRequest otherObject) {
7878
return super.equalsByMyUuid(otherObject);
7979
}
80+
81+
@Override
82+
public int compareTo(SearchRequest o) {
83+
return this.rowCreatedAt.compareTo(o.rowCreatedAt);
84+
}
8085
}

src/main/java/org/woehlke/java/simpleworklist/domain/db/search/SearchResult.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
@ToString(callSuper = true)
3737
@NoArgsConstructor
3838
@AllArgsConstructor
39-
public class SearchResult extends AuditModel implements Serializable, ComparableById<SearchResult> {
39+
public class SearchResult extends AuditModel implements Serializable, ComparableById<SearchResult>, Comparable<SearchResult> {
4040

4141
private static final long serialVersionUID = 1682809351146047764L;
4242

@@ -102,4 +102,10 @@ public boolean equalsByUniqueConstraint(SearchResult otherObject) {
102102
public boolean equalsByUuid(SearchResult otherObject) {
103103
return super.equalsByMyUuid(otherObject);
104104
}
105+
106+
107+
@Override
108+
public int compareTo(SearchResult o) {
109+
return this.rowCreatedAt.compareTo(o.rowCreatedAt);
110+
}
105111
}

src/main/java/org/woehlke/java/simpleworklist/domain/db/user/UserAccount.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
@Setter
3737
@EqualsAndHashCode(callSuper = true)
3838
@ToString(callSuper = true, exclude = {"userPassword","defaultLanguage","defaultContext","lastLoginTimestamp"})
39-
public class UserAccount extends AuditModel implements Serializable, ComparableById<UserAccount> {
39+
public class UserAccount extends AuditModel implements Serializable, ComparableById<UserAccount>,Comparable<UserAccount> {
4040

4141
private static final long serialVersionUID = 7860692526488291439L;
4242

@@ -141,4 +141,8 @@ public static UserAccount createUserAccount(
141141
return u;
142142
}
143143

144+
@Override
145+
public int compareTo(UserAccount o) {
146+
return this.userEmail.compareTo(o.userEmail);
147+
}
144148
}

src/main/java/org/woehlke/java/simpleworklist/domain/db/user/UserAccountChatMessage.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
@ToString(callSuper=true)
4141
@NoArgsConstructor
4242
@AllArgsConstructor
43-
public class UserAccountChatMessage extends AuditModel implements Serializable {
43+
public class UserAccountChatMessage extends AuditModel implements Serializable, Comparable<UserAccountChatMessage> {
4444

4545
private static final long serialVersionUID = 4263078228257938175L;
4646

@@ -72,4 +72,8 @@ public class UserAccountChatMessage extends AuditModel implements Serializable {
7272
@JoinColumn(name = "user_account_id_receiver", nullable = false)
7373
private UserAccount receiver;
7474

75+
@Override
76+
public int compareTo(UserAccountChatMessage o) {
77+
return this.rowCreatedAt.compareTo(o.rowCreatedAt);
78+
}
7579
}

src/main/java/org/woehlke/java/simpleworklist/domain/db/user/UserAccountPassword.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626
@Getter
2727
@Setter
28-
public class UserAccountPassword extends AuditModel implements Serializable, ComparableById<UserAccountPassword> {
28+
public class UserAccountPassword extends AuditModel implements Serializable, ComparableById<UserAccountPassword>, Comparable<UserAccountPassword> {
2929

3030
private static final long serialVersionUID = 7860692526488291439L;
3131

@@ -67,4 +67,9 @@ public boolean equalsByUniqueConstraint(UserAccountPassword otherObject) {
6767
public boolean equalsByUuid(UserAccountPassword otherObject) {
6868
return this.getUuid().compareTo(otherObject.getUuid())==0;
6969
}
70+
71+
@Override
72+
public int compareTo(UserAccountPassword o) {
73+
return this.rowCreatedAt.compareTo(o.rowCreatedAt);
74+
}
7075
}

src/main/java/org/woehlke/java/simpleworklist/domain/db/user/UserAccountPasswordRecovery.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
@Index(name = "ix_user_account_password_recovery_row_created_at", columnList = "row_created_at")
2929
}
3030
)
31-
public class UserAccountPasswordRecovery extends AuditModel implements Serializable {
31+
public class UserAccountPasswordRecovery extends AuditModel implements Serializable,Comparable<UserAccountPasswordRecovery> {
3232

3333
private static final long serialVersionUID = 6860716425733119940L;
3434

@@ -135,4 +135,9 @@ public String toString() {
135135
", rowUpdatedAt=" + rowUpdatedAt +
136136
'}';
137137
}
138+
139+
@Override
140+
public int compareTo(UserAccountPasswordRecovery o) {
141+
return this.rowCreatedAt.compareTo(o.rowCreatedAt);
142+
}
138143
}

src/main/java/org/woehlke/java/simpleworklist/domain/db/user/UserAccountRegistration.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
@Index(name = "ix_user_account_registration_row_created_at", columnList = "row_created_at")
3030
}
3131
)
32-
public class UserAccountRegistration extends AuditModel implements Serializable {
32+
public class UserAccountRegistration extends AuditModel implements Serializable,Comparable<UserAccountRegistration> {
3333

3434
private static final long serialVersionUID = -1955967514018161878L;
3535

@@ -136,4 +136,9 @@ public String toString() {
136136
", rowUpdatedAt=" + rowUpdatedAt +
137137
'}';
138138
}
139+
140+
@Override
141+
public int compareTo(UserAccountRegistration o) {
142+
return this.rowCreatedAt.compareTo(o.rowCreatedAt);
143+
}
139144
}

0 commit comments

Comments
 (0)