mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-03 19:57:36 +08:00
Refs #1237 User: avoid LinkedHashSet usage, use List with @OrderBy
This commit is contained in:
parent
9b1f9006a0
commit
8dbb9e9003
@ -22,7 +22,7 @@ import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* User
|
||||
@ -75,16 +75,18 @@ public class User extends StandardEntity
|
||||
protected Group group;
|
||||
|
||||
@OneToMany(mappedBy = "user")
|
||||
@OrderBy("createTs")
|
||||
@Aggregation
|
||||
protected LinkedHashSet<UserRole> userRoles;
|
||||
protected List<UserRole> userRoles;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "DEFAULT_SUBSTITUTED_USER_ID")
|
||||
protected User defaultSubstitutedUser;
|
||||
|
||||
@OneToMany(mappedBy = "user")
|
||||
@OrderBy("createTs")
|
||||
@Aggregation
|
||||
protected LinkedHashSet<UserSubstitution> substitutions;
|
||||
protected List<UserSubstitution> substitutions;
|
||||
|
||||
@Column(name = "IP_MASK", length = 200)
|
||||
protected String ipMask;
|
||||
@ -129,11 +131,11 @@ public class User extends StandardEntity
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public LinkedHashSet<UserRole> getUserRoles() {
|
||||
public List<UserRole> getUserRoles() {
|
||||
return userRoles;
|
||||
}
|
||||
|
||||
public void setUserRoles(LinkedHashSet<UserRole> userRoles) {
|
||||
public void setUserRoles(List<UserRole> userRoles) {
|
||||
this.userRoles = userRoles;
|
||||
}
|
||||
|
||||
@ -189,11 +191,11 @@ public class User extends StandardEntity
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public LinkedHashSet<UserSubstitution> getSubstitutions() {
|
||||
public List<UserSubstitution> getSubstitutions() {
|
||||
return substitutions;
|
||||
}
|
||||
|
||||
public void setSubstitutions(LinkedHashSet<UserSubstitution> substitutions) {
|
||||
public void setSubstitutions(List<UserSubstitution> substitutions) {
|
||||
this.substitutions = substitutions;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,8 @@ import org.apache.commons.lang.BooleanUtils;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -76,7 +77,7 @@ public class UserBrowser extends AbstractLookup {
|
||||
selectedUser = dataService.reload(selectedUser, "user.edit");
|
||||
User newUser = metadata.create(User.class);
|
||||
if (selectedUser.getUserRoles() != null) {
|
||||
LinkedHashSet<UserRole> userRoles = new LinkedHashSet<UserRole>();
|
||||
List<UserRole> userRoles = new ArrayList<>();
|
||||
for (UserRole oldUserRole : selectedUser.getUserRoles()) {
|
||||
Role oldRole = dataService.reload(oldUserRole.getRole(), "_local");
|
||||
if (BooleanUtils.isTrue(oldRole.getDefaultRole()))
|
||||
|
@ -131,7 +131,7 @@ public class UserEditor extends AbstractEditor {
|
||||
ctx.setQueryString("select r from sec$Role r where r.defaultRole = true");
|
||||
List<Role> defaultRoles = dataService.loadList(ctx);
|
||||
|
||||
LinkedHashSet<UserRole> newRoles = new LinkedHashSet<UserRole>();
|
||||
List<UserRole> newRoles = new ArrayList<>();
|
||||
if (user.getUserRoles() != null)
|
||||
newRoles.addAll(user.getUserRoles());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user