Skip to content

Commit 8e10eb6

Browse files
committed
Feature #3990
Take into account change in Silverpeas-Core.
1 parent 50c6a2b commit 8e10eb6

File tree

2 files changed

+68
-111
lines changed

2 files changed

+68
-111
lines changed

yellowpages/yellowpages-library/src/main/java/org/silverpeas/components/yellowpages/model/YellowPagesGroupDetail.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@
2929

3030
import java.util.ArrayList;
3131
import java.util.List;
32+
import java.util.Objects;
3233

3334
public class YellowPagesGroupDetail extends GroupDetail implements java.io.Serializable {
3435

3536
private static final long serialVersionUID = 1L;
3637

37-
private List<UserDetail> users = new ArrayList<>();
38-
private List<Group> subGroups = new ArrayList<>();
38+
private final List<UserDetail> users = new ArrayList<>();
39+
private final List<GroupDetail> subGroups = new ArrayList<>();
3940

4041
public YellowPagesGroupDetail(Group group) {
4142
super((GroupDetail) group);
@@ -50,35 +51,32 @@ public void addSubGroup(YellowPagesGroupDetail group) {
5051
}
5152

5253
@Override
53-
public List<Group> getSubGroups() {
54+
public List<GroupDetail> getSubGroups() {
5455
return subGroups;
5556
}
5657

58+
@Override
5759
public List<UserDetail> getUsers() {
5860
return users;
5961
}
6062

6163
@Override
6264
public boolean equals(Object o) {
65+
if (this == o) return true;
6366
if (o instanceof YellowPagesGroupDetail) {
6467
YellowPagesGroupDetail anotherGroup = (YellowPagesGroupDetail) o;
65-
if (this.getId() != null) {
66-
return this.getId().equals(anotherGroup.getId());
67-
}
68+
return getId() != null ? Objects.equals(getId(), anotherGroup.getId()) : super.equals(o);
6869
}
6970
return false;
7071
}
7172

7273
@Override
7374
public int hashCode() {
74-
int hash = super.hashCode();
75-
hash = 47 * hash + (this.users != null ? this.users.hashCode() : 0);
76-
hash = 47 * hash + (this.subGroups != null ? this.subGroups.hashCode() : 0);
77-
return hash;
75+
return getId() != null ? Objects.hash(getId()) : super.hashCode();
7876
}
7977

8078
public int getTotalUsers() {
81-
return super.getTotalNbUsers();
79+
return super.getTotalUsersCount();
8280
}
8381

8482
}

0 commit comments

Comments
 (0)