@Override public void setName(String name) { getDelegateForUpdate(); updated.setName(name); }
@Override public int hashCode() { return getId().hashCode(); }
public Set<RoleModel> getRealmScopeMappings() { Set<RoleModel> roleMappings = getScopeMappings(); Set<RoleModel> appRoles = new HashSet<RoleModel>(); for (RoleModel role : roleMappings) { RoleContainerModel container = role.getContainer(); if (container instanceof RealmModel) { if (((RealmModel) container).getId().equals(cachedRealm.getId())) { appRoles.add(role); } } } return appRoles; }
public Set<RoleModel> getScopeMappings() { if (updated != null) return updated.getScopeMappings(); Set<RoleModel> roles = new HashSet<RoleModel>(); for (String id : cached.getScope()) { roles.add(cacheSession.getRoleById(id, getRealm())); } return roles; }
@Override public ClientTemplateModel getClientTemplateById(String id, RealmModel realm) { if (!cache.isEnabled()) return getDelegate().getClientTemplateById(id, realm); CachedClientTemplate cached = cache.getClientTemplate(id); if (cached != null && !cached.getRealm().equals(realm.getId())) { cached = null; } if (cached == null) { ClientTemplateModel model = getDelegate().getClientTemplateById(id, realm); if (model == null) return null; if (clientTemplateInvalidations.contains(id)) return model; cached = new CachedClientTemplate(cache, getDelegate(), realm, model); cache.addCachedClientTemplate(cached); } else if (clientTemplateInvalidations.contains(id)) { return getDelegate().getClientTemplateById(id, realm); } else if (managedClientTemplates.containsKey(id)) { return managedClientTemplates.get(id); } ClientTemplateModel adapter = new ClientTemplateAdapter(realm, cached, this, cache); managedClientTemplates.put(id, adapter); return adapter; }
@Override public boolean hasScope(RoleModel role) { if (updated != null) return updated.hasScope(role); if (cached.isFullScopeAllowed() || cached.getScope().contains(role.getId())) return true; Set<RoleModel> roles = getScopeMappings(); for (RoleModel mapping : roles) { if (mapping.hasRole(role)) return true; } return false; }
@Override public void removeProtocolMapper(ProtocolMapperModel mapping) { getDelegateForUpdate(); updated.removeProtocolMapper(mapping); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || !(o instanceof ClientModel)) return false; ClientTemplateModel that = (ClientTemplateModel) o; return that.getId().equals(getId()); }
@Override public void updateProtocolMapper(ProtocolMapperModel mapping) { getDelegateForUpdate(); updated.updateProtocolMapper(mapping); }
@Override public void setDescription(String description) { getDelegateForUpdate(); updated.setDescription(description); }
@Override public void setProtocol(String protocol) { getDelegateForUpdate(); updated.setProtocol(protocol); }
@Override public void setFullScopeAllowed(boolean value) { getDelegateForUpdate(); updated.setFullScopeAllowed(value); }
@Override public void setStandardFlowEnabled(boolean standardFlowEnabled) { getDelegateForUpdate(); updated.setStandardFlowEnabled(standardFlowEnabled); }
@Override public void setDirectAccessGrantsEnabled(boolean directAccessGrantsEnabled) { getDelegateForUpdate(); updated.setDirectAccessGrantsEnabled(directAccessGrantsEnabled); }
@Override public void setImplicitFlowEnabled(boolean implicitFlowEnabled) { getDelegateForUpdate(); updated.setImplicitFlowEnabled(implicitFlowEnabled); }
@Override public void setServiceAccountsEnabled(boolean serviceAccountsEnabled) { getDelegateForUpdate(); updated.setServiceAccountsEnabled(serviceAccountsEnabled); }
@Override public ProtocolMapperModel addProtocolMapper(ProtocolMapperModel model) { getDelegateForUpdate(); return updated.addProtocolMapper(model); }
@Override public void setAttribute(String name, String value) { getDelegateForUpdate(); updated.setAttribute(name, value); }
@Override public void removeAttribute(String name) { getDelegateForUpdate(); updated.removeAttribute(name); }