KEYCLOAK-12088 Use diamond operator for collections in module "model/infinispan"
This commit is contained in:
parent
4117710379
commit
f0ac2ad3ce
11 changed files with 29 additions and 29 deletions
|
@ -238,7 +238,7 @@ public class ClientAdapter implements ClientModel, CachedObject {
|
|||
|
||||
public Set<RoleModel> getScopeMappings() {
|
||||
if (isUpdated()) return updated.getScopeMappings();
|
||||
Set<RoleModel> roles = new HashSet<RoleModel>();
|
||||
Set<RoleModel> roles = new HashSet<>();
|
||||
for (String id : cached.getScope()) {
|
||||
roles.add(cacheSession.getRoleById(id, getRealm()));
|
||||
|
||||
|
@ -259,7 +259,7 @@ public class ClientAdapter implements ClientModel, CachedObject {
|
|||
public Set<RoleModel> getRealmScopeMappings() {
|
||||
Set<RoleModel> roleMappings = getScopeMappings();
|
||||
|
||||
Set<RoleModel> appRoles = new HashSet<RoleModel>();
|
||||
Set<RoleModel> appRoles = new HashSet<>();
|
||||
for (RoleModel role : roleMappings) {
|
||||
RoleContainerModel container = role.getContainer();
|
||||
if (container instanceof RealmModel) {
|
||||
|
@ -321,7 +321,7 @@ public class ClientAdapter implements ClientModel, CachedObject {
|
|||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
if (isUpdated()) return updated.getAttributes();
|
||||
Map<String, String> copy = new HashMap<String, String>();
|
||||
Map<String, String> copy = new HashMap<>();
|
||||
copy.putAll(cached.getAttributes());
|
||||
return copy;
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ public class ClientAdapter implements ClientModel, CachedObject {
|
|||
@Override
|
||||
public Map<String, String> getAuthenticationFlowBindingOverrides() {
|
||||
if (isUpdated()) return updated.getAuthenticationFlowBindingOverrides();
|
||||
Map<String, String> copy = new HashMap<String, String>();
|
||||
Map<String, String> copy = new HashMap<>();
|
||||
copy.putAll(cached.getAuthFlowBindings());
|
||||
return copy;
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ public class ClientScopeAdapter implements ClientScopeModel {
|
|||
|
||||
public Set<RoleModel> getScopeMappings() {
|
||||
if (isUpdated()) return updated.getScopeMappings();
|
||||
Set<RoleModel> roles = new HashSet<RoleModel>();
|
||||
Set<RoleModel> roles = new HashSet<>();
|
||||
for (String id : cached.getScope()) {
|
||||
roles.add(cacheSession.getRoleById(id, getRealm()));
|
||||
|
||||
|
@ -180,7 +180,7 @@ public class ClientScopeAdapter implements ClientScopeModel {
|
|||
public Set<RoleModel> getRealmScopeMappings() {
|
||||
Set<RoleModel> roleMappings = getScopeMappings();
|
||||
|
||||
Set<RoleModel> appRoles = new HashSet<RoleModel>();
|
||||
Set<RoleModel> appRoles = new HashSet<>();
|
||||
for (RoleModel role : roleMappings) {
|
||||
RoleContainerModel container = role.getContainer();
|
||||
if (container instanceof RealmModel) {
|
||||
|
@ -230,7 +230,7 @@ public class ClientScopeAdapter implements ClientScopeModel {
|
|||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
if (isUpdated()) return updated.getAttributes();
|
||||
Map<String, String> copy = new HashMap<String, String>();
|
||||
Map<String, String> copy = new HashMap<>();
|
||||
copy.putAll(cached.getAttributes());
|
||||
return copy;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ public class GroupAdapter implements GroupModel {
|
|||
public Set<RoleModel> getRealmRoleMappings() {
|
||||
if (isUpdated()) return updated.getRealmRoleMappings();
|
||||
Set<RoleModel> roleMappings = getRoleMappings();
|
||||
Set<RoleModel> realmMappings = new HashSet<RoleModel>();
|
||||
Set<RoleModel> realmMappings = new HashSet<>();
|
||||
for (RoleModel role : roleMappings) {
|
||||
RoleContainerModel container = role.getContainer();
|
||||
if (container instanceof RealmModel) {
|
||||
|
@ -167,7 +167,7 @@ public class GroupAdapter implements GroupModel {
|
|||
public Set<RoleModel> getClientRoleMappings(ClientModel app) {
|
||||
if (isUpdated()) return updated.getClientRoleMappings(app);
|
||||
Set<RoleModel> roleMappings = getRoleMappings();
|
||||
Set<RoleModel> appMappings = new HashSet<RoleModel>();
|
||||
Set<RoleModel> appMappings = new HashSet<>();
|
||||
for (RoleModel role : roleMappings) {
|
||||
RoleContainerModel container = role.getContainer();
|
||||
if (container instanceof ClientModel) {
|
||||
|
@ -200,7 +200,7 @@ public class GroupAdapter implements GroupModel {
|
|||
@Override
|
||||
public Set<RoleModel> getRoleMappings() {
|
||||
if (isUpdated()) return updated.getRoleMappings();
|
||||
Set<RoleModel> roles = new HashSet<RoleModel>();
|
||||
Set<RoleModel> roles = new HashSet<>();
|
||||
for (String id : cached.getRoleMappings(modelSupplier)) {
|
||||
RoleModel roleById = keycloakSession.realms().getRoleById(id, realm);
|
||||
if (roleById == null) {
|
||||
|
|
|
@ -1370,7 +1370,7 @@ public class RealmAdapter implements CachedRealmModel {
|
|||
if (isUpdated()) return updated.getClientScopes();
|
||||
List<String> clientScopes = cached.getClientScopes();
|
||||
if (clientScopes.isEmpty()) return Collections.EMPTY_LIST;
|
||||
List<ClientScopeModel> apps = new LinkedList<ClientScopeModel>();
|
||||
List<ClientScopeModel> apps = new LinkedList<>();
|
||||
for (String id : clientScopes) {
|
||||
ClientScopeModel model = cacheSession.getClientScopeById(id, this);
|
||||
if (model == null) {
|
||||
|
|
|
@ -469,7 +469,7 @@ public class RealmCacheSession implements CacheRealmProvider {
|
|||
|
||||
private List<RealmModel> getRealms(List<RealmModel> backendRealms) {
|
||||
// Return cache delegates to ensure cache invalidated during write operations
|
||||
List<RealmModel> cachedRealms = new LinkedList<RealmModel>();
|
||||
List<RealmModel> cachedRealms = new LinkedList<>();
|
||||
for (RealmModel realm : backendRealms) {
|
||||
RealmModel cached = getRealm(realm.getId());
|
||||
cachedRealms.add(cached);
|
||||
|
|
|
@ -129,7 +129,7 @@ public class RoleAdapter implements RoleModel {
|
|||
if (isUpdated()) return updated.getComposites();
|
||||
|
||||
if (composites == null) {
|
||||
composites = new HashSet<RoleModel>();
|
||||
composites = new HashSet<>();
|
||||
for (String id : cached.getComposites()) {
|
||||
RoleModel role = realm.getRoleById(id);
|
||||
if (role == null) {
|
||||
|
|
|
@ -163,7 +163,7 @@ public class UserAdapter implements CachedUserModel {
|
|||
public List<String> getAttribute(String name) {
|
||||
if (updated != null) return updated.getAttribute(name);
|
||||
List<String> result = cached.getAttributes(modelSupplier).get(name);
|
||||
return (result == null) ? Collections.<String>emptyList() : result;
|
||||
return (result == null) ? Collections.emptyList() : result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -279,7 +279,7 @@ public class UserAdapter implements CachedUserModel {
|
|||
public Set<RoleModel> getRealmRoleMappings() {
|
||||
if (updated != null) return updated.getRealmRoleMappings();
|
||||
Set<RoleModel> roleMappings = getRoleMappings();
|
||||
Set<RoleModel> realmMappings = new HashSet<RoleModel>();
|
||||
Set<RoleModel> realmMappings = new HashSet<>();
|
||||
for (RoleModel role : roleMappings) {
|
||||
RoleContainerModel container = role.getContainer();
|
||||
if (container instanceof RealmModel) {
|
||||
|
@ -295,7 +295,7 @@ public class UserAdapter implements CachedUserModel {
|
|||
public Set<RoleModel> getClientRoleMappings(ClientModel app) {
|
||||
if (updated != null) return updated.getClientRoleMappings(app);
|
||||
Set<RoleModel> roleMappings = getRoleMappings();
|
||||
Set<RoleModel> appMappings = new HashSet<RoleModel>();
|
||||
Set<RoleModel> appMappings = new HashSet<>();
|
||||
for (RoleModel role : roleMappings) {
|
||||
RoleContainerModel container = role.getContainer();
|
||||
if (container instanceof ClientModel) {
|
||||
|
@ -328,7 +328,7 @@ public class UserAdapter implements CachedUserModel {
|
|||
@Override
|
||||
public Set<RoleModel> getRoleMappings() {
|
||||
if (updated != null) return updated.getRoleMappings();
|
||||
Set<RoleModel> roles = new HashSet<RoleModel>();
|
||||
Set<RoleModel> roles = new HashSet<>();
|
||||
for (String id : cached.getRoleMappings(modelSupplier)) {
|
||||
RoleModel roleById = keycloakSession.realms().getRoleById(id, realm);
|
||||
if (roleById == null) {
|
||||
|
|
|
@ -40,26 +40,26 @@ public class CachedClient extends AbstractRevisioned implements InRealm {
|
|||
protected String name;
|
||||
protected String description;
|
||||
protected String realm;
|
||||
protected Set<String> redirectUris = new HashSet<String>();
|
||||
protected Set<String> redirectUris = new HashSet<>();
|
||||
protected boolean enabled;
|
||||
protected String clientAuthenticatorType;
|
||||
protected String secret;
|
||||
protected String registrationToken;
|
||||
protected String protocol;
|
||||
protected Map<String, String> attributes = new HashMap<String, String>();
|
||||
protected Map<String, String> authFlowBindings = new HashMap<String, String>();
|
||||
protected Map<String, String> attributes = new HashMap<>();
|
||||
protected Map<String, String> authFlowBindings = new HashMap<>();
|
||||
protected boolean publicClient;
|
||||
protected boolean fullScopeAllowed;
|
||||
protected boolean frontchannelLogout;
|
||||
protected int notBefore;
|
||||
protected Set<String> scope = new HashSet<String>();
|
||||
protected Set<String> webOrigins = new HashSet<String>();
|
||||
protected Set<ProtocolMapperModel> protocolMappers = new HashSet<ProtocolMapperModel>();
|
||||
protected Set<String> scope = new HashSet<>();
|
||||
protected Set<String> webOrigins = new HashSet<>();
|
||||
protected Set<ProtocolMapperModel> protocolMappers = new HashSet<>();
|
||||
protected boolean surrogateAuthRequired;
|
||||
protected String managementUrl;
|
||||
protected String rootUrl;
|
||||
protected String baseUrl;
|
||||
protected List<String> defaultRoles = new LinkedList<String>();
|
||||
protected List<String> defaultRoles = new LinkedList<>();
|
||||
protected boolean bearerOnly;
|
||||
protected boolean consentRequired;
|
||||
protected boolean standardFlowEnabled;
|
||||
|
|
|
@ -38,7 +38,7 @@ public class CachedClientScope extends AbstractRevisioned implements InRealm {
|
|||
private String realm;
|
||||
private String protocol;
|
||||
private Set<String> scope = new HashSet<>();
|
||||
private Set<ProtocolMapperModel> protocolMappers = new HashSet<ProtocolMapperModel>();
|
||||
private Set<ProtocolMapperModel> protocolMappers = new HashSet<>();
|
||||
private Map<String, String> attributes = new HashMap<>();
|
||||
|
||||
public CachedClientScope(Long revision, RealmModel realm, ClientScopeModel model) {
|
||||
|
|
|
@ -133,7 +133,7 @@ public class CachedRealm extends AbstractExtendableRevisioned {
|
|||
protected Set<String> eventsListeners;
|
||||
protected Set<String> enabledEventTypes;
|
||||
protected boolean adminEventsEnabled;
|
||||
protected Set<String> adminEnabledEventOperations = new HashSet<String>();
|
||||
protected Set<String> adminEnabledEventOperations = new HashSet<>();
|
||||
protected boolean adminEventsDetailsEnabled;
|
||||
protected List<String> defaultRoles;
|
||||
private boolean allowUserManagedAccess;
|
||||
|
@ -142,7 +142,7 @@ public class CachedRealm extends AbstractExtendableRevisioned {
|
|||
return identityProviderMapperSet;
|
||||
}
|
||||
|
||||
protected List<String> defaultGroups = new LinkedList<String>();
|
||||
protected List<String> defaultGroups = new LinkedList<>();
|
||||
protected List<String> clientScopes = new LinkedList<>();
|
||||
protected List<String> defaultDefaultClientScopes = new LinkedList<>();
|
||||
protected List<String> optionalDefaultClientScopes = new LinkedList<>();
|
||||
|
@ -252,7 +252,7 @@ public class CachedRealm extends AbstractExtendableRevisioned {
|
|||
authenticationFlowList = model.getAuthenticationFlows();
|
||||
for (AuthenticationFlowModel flow : authenticationFlowList) {
|
||||
this.authenticationFlows.put(flow.getId(), flow);
|
||||
authenticationExecutions.put(flow.getId(), new LinkedList<AuthenticationExecutionModel>());
|
||||
authenticationExecutions.put(flow.getId(), new LinkedList<>());
|
||||
for (AuthenticationExecutionModel execution : model.getAuthenticationExecutions(flow.getId())) {
|
||||
authenticationExecutions.add(flow.getId(), execution);
|
||||
executionsById.put(execution.getId(), execution);
|
||||
|
|
|
@ -37,7 +37,7 @@ public class CachedRole extends AbstractRevisioned implements InRealm {
|
|||
final protected String realm;
|
||||
final protected String description;
|
||||
final protected boolean composite;
|
||||
final protected Set<String> composites = new HashSet<String>();
|
||||
final protected Set<String> composites = new HashSet<>();
|
||||
private final LazyLoader<RoleModel, MultivaluedHashMap<String, String>> attributes;
|
||||
|
||||
public CachedRole(Long revision, RoleModel model, RealmModel realm) {
|
||||
|
|
Loading…
Reference in a new issue